Activate edit mode after taking control (#2486)

* Activate edit mode after taking control

* Move to take-control
This commit is contained in:
Bram Kragten 2019-01-16 22:57:54 +01:00 committed by Paulus Schoutsen
parent 427f0f5e66
commit 1b2e052f05
2 changed files with 9 additions and 2 deletions

View File

@ -112,6 +112,7 @@ export class HuiSaveConfig extends hassLocalizeLitMixin(LitElement) {
try { try {
const lovelace = this._params!.lovelace; const lovelace = this._params!.lovelace;
await lovelace.saveConfig(lovelace.config); await lovelace.saveConfig(lovelace.config);
lovelace.setEditMode(true);
this._saving = false; this._saving = false;
this._closeDialog(); this._closeDialog();
} catch (err) { } catch (err) {

View File

@ -184,13 +184,19 @@ class LovelacePanel extends hassLocalizeLitMixin(LitElement) {
const { config, mode } = this.lovelace!; const { config, mode } = this.lovelace!;
try { try {
// Optimistic update // Optimistic update
this._updateLovelace({ config: newConfig, mode: "storage" }); this._updateLovelace({
config: newConfig,
mode: "storage",
});
await saveConfig(this.hass!, newConfig); await saveConfig(this.hass!, newConfig);
} catch (err) { } catch (err) {
// tslint:disable-next-line // tslint:disable-next-line
console.error(err); console.error(err);
// Rollback the optimistic update // Rollback the optimistic update
this._updateLovelace({ config, mode }); this._updateLovelace({
config,
mode,
});
throw err; throw err;
} }
}, },