mirror of https://github.com/status-im/consul.git
ui: Only save the setting that you've changed (#7918)
Originally we assumed all settings would be editable in the settings page, but over time we've added thigns to localStorage that aren't user settable settings. This means we shouldn't save all you localStorage settings everything time only a single setting has been saved. This change only changes the setting you've changed via the settings page, meaning it will never update non-user-settable settings.
This commit is contained in:
parent
2a41708fb1
commit
3be1237e42
|
@ -35,14 +35,14 @@ export default Controller.extend({
|
|||
switch (target.name) {
|
||||
case 'client[blocking]':
|
||||
set(this, 'item.client.blocking', !blocking);
|
||||
this.send('update', this.item);
|
||||
this.send('update', 'client', this.item.client);
|
||||
break;
|
||||
case 'urls[service]':
|
||||
if (typeof get(this, 'item.urls') === 'undefined') {
|
||||
set(this, 'item.urls', {});
|
||||
}
|
||||
set(this, 'item.urls.service', target.value);
|
||||
this.send('update', this.item);
|
||||
this.send('update', 'urls', this.item.urls);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -25,11 +25,17 @@ export default Route.extend({
|
|||
controller.setProperties(model);
|
||||
},
|
||||
actions: {
|
||||
update: function(item) {
|
||||
update: function(slug, item) {
|
||||
switch (slug) {
|
||||
case 'client':
|
||||
if (!get(item, 'client.blocking')) {
|
||||
this.client.abort();
|
||||
}
|
||||
this.repo.persist(item);
|
||||
break;
|
||||
}
|
||||
this.repo.persist({
|
||||
[slug]: item,
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue