Table of Contents
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:
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.
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:
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:
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:
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.
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.
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:
'Text' configuration parameters accept one more piece of information:
'Dropdown' configuration parameters require additional information. To add an option for a dropdown, click + add option, then supply the option value(s):
Repeat these steps as desired.
The configuration parameters that were defined are implemented when adding a Widget Definition to the Dashboard.
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.
© 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.