Dropdown settings support

Closes-Bug: #1393802

Change-Id: Iac0d7bf2318e5389c9d35823efa1c3f75de2489c
This commit is contained in:
Julia Aranovich 2014-11-18 16:12:44 +03:00
parent 1b252e0338
commit 0213ca7af4
3 changed files with 14 additions and 4 deletions

View File

@ -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:

View File

@ -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"

View File

@ -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}