From e919a3e2300c7bcada13caea11cf26a4a69c2763 Mon Sep 17 00:00:00 2001 From: Yannick Schaus Date: Sun, 11 Apr 2021 19:43:37 +0200 Subject: [PATCH 1/2] Fix rule creation Fixes #998. Signed-off-by: Yannick Schaus --- .../org.openhab.ui/web/src/pages/settings/rules/rule-edit.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.ui/web/src/pages/settings/rules/rule-edit.vue b/bundles/org.openhab.ui/web/src/pages/settings/rules/rule-edit.vue index 5641c2f562..a76b79eb7e 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/rules/rule-edit.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/rules/rule-edit.vue @@ -327,7 +327,8 @@ export default { destroyOnClose: true, closeTimeout: 2000 }).open() - this.$f7router.navigate(this.$f7route.url.replace('/add', '/' + this.rule.uid), { reloadCurrent: true }) + this.dirty = false + this.$f7router.navigate(this.$f7route.url.replace('/add', '/' + this.rule.uid).replace('/schedule/', '/rules/'), { reloadCurrent: true }) this.load() } else { this.$f7.toast.create({ From 637129e07b8af5f395890f685423374ea486e763 Mon Sep 17 00:00:00 2001 From: Yannick Schaus Date: Sun, 11 Apr 2021 20:03:16 +0200 Subject: [PATCH 2/2] Reset dirty flag earlier Signed-off-by: Yannick Schaus --- .../org.openhab.ui/web/src/pages/settings/rules/rule-edit.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/pages/settings/rules/rule-edit.vue b/bundles/org.openhab.ui/web/src/pages/settings/rules/rule-edit.vue index a76b79eb7e..7b4ccfcbed 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/rules/rule-edit.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/rules/rule-edit.vue @@ -321,13 +321,13 @@ export default { ? this.$oh.api.postPlain('/rest/rules', JSON.stringify(this.rule), 'text/plain', 'application/json') : this.$oh.api.put('/rest/rules/' + this.rule.uid, this.rule) return promise.then((data) => { + this.dirty = false if (this.createMode) { this.$f7.toast.create({ text: 'Rule created', destroyOnClose: true, closeTimeout: 2000 }).open() - this.dirty = false this.$f7router.navigate(this.$f7route.url.replace('/add', '/' + this.rule.uid).replace('/schedule/', '/rules/'), { reloadCurrent: true }) this.load() } else { @@ -338,7 +338,6 @@ export default { }).open() this.savedRule = cloneDeep(this.rule) } - this.dirty = false // if (!stay) this.$f7router.back() }).catch((err) => { this.$f7.toast.create({