Dropdown settings support
Closes-Bug: #1393802 Change-Id: Iac0d7bf2318e5389c9d35823efa1c3f75de2489c
This commit is contained in:
parent
1b252e0338
commit
0213ca7af4
|
@ -51,8 +51,8 @@ structure includes the following attributes::
|
|||
* *restrictions*: see restrictions_.
|
||||
* *description* section should also contain information about setting
|
||||
restrictions (dependencies, conflicts)
|
||||
* *values* list is needed for settings of "radio" type to declare its
|
||||
possible values. Options from "values" list also support dependencies
|
||||
* *values* list is needed for settings of "radio" or "select" type to declare
|
||||
its possible values. Options from "values" list also support dependencies
|
||||
and conflcits declaration.
|
||||
|
||||
.. _restrictions:
|
||||
|
|
|
@ -303,7 +303,7 @@
|
|||
label: "NSX connector type"
|
||||
description: "Default network transport type to use"
|
||||
weight: 80
|
||||
type: "dropdown"
|
||||
type: "select"
|
||||
replication_mode:
|
||||
description: ""
|
||||
label: "NSX cluster has Service nodes"
|
||||
|
|
|
@ -240,6 +240,15 @@ function(React, utils, models, Expression, controls) {
|
|||
|
||||
var SettingGroup = React.createClass({
|
||||
mixins: [dependenciesMixin],
|
||||
composeOptions: function(values) {
|
||||
return _.map(values, function(value, index) {
|
||||
return (
|
||||
<option key={index} value={value.data} disabled={value.disabled}>
|
||||
{value.label}
|
||||
</option>
|
||||
);
|
||||
});
|
||||
},
|
||||
render: function() {
|
||||
var group = this.settings.get(this.props.groupName),
|
||||
metadata = group.metadata,
|
||||
|
@ -282,7 +291,7 @@ function(React, utils, models, Expression, controls) {
|
|||
}, this)
|
||||
.compact()
|
||||
.value();
|
||||
return this.transferPropsTo(
|
||||
if (setting.type == 'radio') return this.transferPropsTo(
|
||||
<controls.RadioGroup
|
||||
key={settingName}
|
||||
name={settingName}
|
||||
|
@ -301,6 +310,7 @@ function(React, utils, models, Expression, controls) {
|
|||
checked={_.isBoolean(setting.value) ? setting.value : false}
|
||||
label={setting.label}
|
||||
description={setting.description}
|
||||
children={setting.type == 'select' && this.composeOptions(setting.values)}
|
||||
toggleable={setting.type == 'password'}
|
||||
error={error}
|
||||
disabled={this.props.disabled || disabled}
|
||||
|
|
Loading…
Reference in New Issue