Fix Load Defaults button for node attributes

Closes-Bug: #1645725

Change-Id: I3327751ddc8bf9326a47148b31f335b8edf3c1a5
This commit is contained in:
Julia Aranovich 2016-11-29 16:30:03 +03:00
parent 66fa719534
commit 5054225617
1 changed files with 21 additions and 19 deletions

View File

@ -1446,25 +1446,27 @@ export var ShowNodeInfoDialog = React.createClass({
.fetch({
url: _.result(this.props.node, 'url') + '/attributes/defaults'
})
.done(() => {
nodeAttributes.set(defaultNodeAttributes.attributes);
nodeAttributes.isValid({models: configModels});
this.setState({
nodeAttributes,
nodeAttributesError: nodeAttributes.validationError,
actionInProgress: false,
loadDefaultsError: null,
savingError: null,
key: _.now()
});
})
.fail((response) => {
this.setState({
actionInProgress: false,
savingError: null,
loadDefaultsError: utils.getResponseText(response)
});
});
.then(
() => {
nodeAttributes.set(defaultNodeAttributes.attributes);
nodeAttributes.isValid({models: configModels});
this.setState({
nodeAttributes,
nodeAttributesError: nodeAttributes.validationError,
actionInProgress: false,
loadDefaultsError: null,
savingError: null,
key: _.now()
});
},
(response) => {
this.setState({
actionInProgress: false,
savingError: null,
loadDefaultsError: utils.getResponseText(response)
});
}
);
},
cancelNodeAttributesChange() {
var {nodeAttributes, initialNodeAttributes, configModels} = this.state;