Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > Dashboard Users Guide > Design > Widgets > Concepts > Widget Inputs

Widget Inputs

Table of Contents

Overview

Inputs are generic, user specified, user configurable parameters that are available for use within the Liquid body rendered within a Widget. For example, rather than hard coding the color yellow to highlight a stranded server (see the Liquid body syntax for the "Servers Example" below) simply specify a configuration parameter in the Liquid body syntax that dynamically gets replaced with a color value when you add the Widget Definition. Below is a Widget Definition added to the Dashboard that contains a stranded server, highlighted in yellow:

screen-WidgetsInputs1.png

Benefits of Using Inputs

One of the benefits of having user configurable parameters is that you can customize each individual use of a Widget Definition differently than another. Looking at the Widget Definition for the following "Servers Example", the background-color as yellow has been hard coded into the Liquid body syntax. This means that each use of this particular Widget Definition displays the background-color as yellow for the specified condition.  

screen-WidgetsInputs2.png

 

However, what if you wanted yellow in one Widget Definition use, but red in another? Without using configuration parameters, this would require two separate Widget Definitions, identical in syntax, with the exception that the background-color is specified as yellow in one and red in the other. This is a perfect example of when using a configuration parameter can be extremely beneficial. Rather than hard coding the desired background-color value directly into the Liquid body syntax, a configuration parameter can be used instead.


The following example uses a configuration parameter (rather than a hard coded value) to specify the background-color of an object. Note the definition of the configuration parameter color in the Inputs area, and the usage of the config.color configuration parameter in the body syntax:

screen-WidgetsInputs3.png

Configuration Parameters

Configuration parameters, defined in the Inputs for a Widget Definition, are available for use within the Liquid body syntax as config.<name>. In the Widget Definition, the parameters can be defined with default values. You can override these default values when the Widget Definition is added to the Dashboard or to a deployment. Here is an example of overriding the default value yellow with red (for the color configuration parameter) when adding a Widget Definition:

screen-WidgetsInputs4.png

Using configuration parameters allows for different customized uses of the same Widget Definition. For example, two "Server Example" Widgets can use the same Widget Definition, but with different values for the color configuration parameter:

Creating Inputs

The following examples use an existing Widget Definition, but you can apply the same steps when creating a new Widget Definition. To add a configuration parameter, click on the Add Input button in the Inputs area of the edit page.

screen-WidgetsInputs5.png


Each time that you clicke Add Input, you see a set of objects that you can use to define the desired configuration parameter. When you change the Type from 'Text' to 'Dropdown' you see a different set of options.

Adding multiple configuration parameters 

You can add multiple configuration parameters to a Widget Definition, one 'Text' and one 'Dropdown,' by clicking the Add Input button and selecting the 'Type'. Both 'Text' and 'Dropdown' configuration parameters require the following basic pieces of information:

  • Name - The name of the configuration parameter
  • Type - Representation type of the configuration parameter: 'Text' or 'Dropdown'
  • Description - A text description explaining the purpose of the configuration parameter

 

'Text' configuration parameters accept one more piece of information:

  • Default Value - The default value for the named configuration parameter

 

'Dropdown' configuration parameters require additional information. To add an option for a dropdown, click + add option, then supply the option value(s):

  • Option - One of the values to be displayed in the dropdown (for example, if the configuration parameter is named 'color,' then its values might be 'red,' 'yellow' and 'green'). The first option is used as the default value.

 

Repeat these steps as desired.

screen-WidgetsInputs6.png

The configuration parameters that were defined are implemented when adding a Widget Definition to the Dashboard.

Using Inputs

You can see each configuration parameter as available for configuration when adding a Widget Definition and you can can also modify them after adding them to the Dashboard. Change the configuration parameters by entering or selecting a new value for the desired parameter.

You must to post a comment.
Last modified
22:41, 16 May 2013

Tags

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.