GenericField
Extends:
GenericField is a generic component which can be used as different input fields in Form component
It is used widely in widget configuration modal. Constant values used for defining field type are described below.
Access
Stage.Basic.Form.GenericField
Usage
String input field
<GenericField name="stringTest" type={GenericField.STRING_TYPE}
label="STRING_TYPE" icon="rocket" placeholder="Write text..." />
Password input field
<GenericField name="passwordTest" type={GenericField.PASSWORD_TYPE}
label="PASSWORD_TYPE" icon="key" value="" />
Number input field
<GenericField name="numberTest" type={GenericField.NUMBER_TYPE}
label="NUMBER_TYPE" value="5" min={1} max={10} />
Boolean input field
<GenericField name="booleanTest" type={GenericField.BOOLEAN_TYPE}
label="BOOLEAN_TYPE" value="true" />
List input field
<GenericField name="listTest" type={GenericField.LIST_TYPE}
label="LIST_TYPE" items={['a','b','c']} value='b' />
Number list input field
<GenericField name="numberListTest" type={GenericField.NUMBER_LIST_TYPE}
label="NUMBER_LIST_TYPE" items={[1,2,3]} value={2} />
Multi select list input field
<GenericField name="multiSelectListTest" type={GenericField.MULTI_SELECT_LIST_TYPE}
label="MULTI_SELECT_LIST_TYPE" value={[2,3,4]} items={[1,2,3,{value:4, name:'four'}, {value:5, name:'five'}]} />
Editable list input field
<GenericField name="editableListTest" type={GenericField.EDITABLE_LIST_TYPE}
label="EDITABLE_LIST_TYPE" value='b' items={['a','b','c']}/>
Editable number list input field
<GenericField name="numberEditableListTest" type={GenericField.NUMBER_EDITABLE_LIST_TYPE}
label="NUMBER_EDITABLE_LIST_TYPE" items={[1,2,3]} value={2}/>
Custom field - Editable table
<GenericField name="editableTable" type={GenericField.CUSTOM_TYPE} component={Stage.Basic.Form.Table}
label="EDITABLE_TABLE_TYPE"
columns={[
{name: "metric", label: 'Metric', default: "", type: Stage.Basic.GenericField.EDITABLE_LIST_TYPE, description: "Name of the metric to be presented on the graph",
items: ["", "cpu_total_system", "cpu_total_user", "memory_MemFree", "memory_SwapFree", "loadavg_processes_running"]},
{name: 'label', label: 'Label', default: "", type: Stage.Basic.GenericField.STRING_TYPE, description: "Chart label"},
{name: 'unit', label: 'Unit', default: "", type: Stage.Basic.GenericField.STRING_TYPE, description: "Chart data unit"}
]}
rows={3} />
Custom filed - Time filter
<GenericField name="timeFilterTest" type={GenericField.CUSTOM_TYPE} component={Stage.Basic.TimeFilter}
label="TIME_FILTER_TYPE" value={Stage.Basic.TimeFilter.DEFAULT_VALUE} />
Static Member Summary
Static Public Members | ||
public static |
boolean with no default |
|
public static |
BOOLEAN_TYPE: * two-state input field |
|
public static |
CUSTOM_TYPE: * custom input field |
|
public static |
dropdown editable list |
|
public static |
LIST_TYPE: * dropdown alphanumeric list field |
|
public static |
dropdown multiselection list |
|
public static |
dropdown editable numeric list |
|
public static |
dropdown numeric list field |
|
public static |
NUMBER_TYPE: * numeric input field |
|
public static |
password input field |
|
public static |
STRING_TYPE: * alphanumeric input field |
|
public static |
propTypes: * propTypes |
Static Public Members
public static propTypes: * source
propTypes
Properties:
Name | Type | Attribute | Description |
label | string | field's label to show above the field |
|
name | string | name of the input field |
|
placeholder | string |
|
specifies a short hint that describes the expected value of an input field |
error | string |
|
specifies if a field should be marked as field with error |
type | string |
|
specifies type of the field |
icon | string |
|
additional icon in right side of the input field |
description | string | element |
|
fields description showed in popup when user hovers field |
value | object |
|
specifies the value of an <input> element |
required | boolean |
|
define if a field is required adding a red star icon to label |
items | object[] |
|
list of items (for list types) |
onChange | Function |
|
function called on input value change |
max | number |
|
maximal value (only for GenericField.NUMBER_TYPE type) |
min | number |
|
minimal value (only for GenericField.NUMBER_TYPE type) |