PLT-3237 Update displayed config values in admin console after saving (#3506)

* Reloaded admin console data when settings are saved

* Fixed attempting to save an invalid config setting overwriting the stored config
Этот коммит содержится в:
Harrison Healey
2016-07-06 16:07:56 -04:00
коммит произвёл GitHub
родитель b1520d0b94
Коммит b114062c1b
30 изменённых файлов: 327 добавлений и 256 удалений

Просмотреть файл

@@ -24,11 +24,11 @@ export default class AdminSettings extends React.Component {
this.handleSubmit = this.handleSubmit.bind(this);
this.onKeyDown = this.onKeyDown.bind(this);
this.state = {
this.state = Object.assign(this.getStateFromConfig(props.config), {
saveNeeded: false,
saving: false,
serverError: null
};
});
}
handleChange(id, value) {
@@ -60,12 +60,17 @@ export default class AdminSettings extends React.Component {
serverError: null
});
const config = this.getConfigFromState(this.props.config);
// clone config so that we aren't modifying data in the stores
let config = JSON.parse(JSON.stringify(this.props.config));
config = this.getConfigFromState(config);
Client.saveConfig(
config,
() => {
AsyncClient.getConfig();
AsyncClient.getConfig((savedConfig) => {
this.setState(this.getStateFromConfig(savedConfig));
});
this.setState({
saveNeeded: false,
saving: false