From dff38573064123823121e40838b6239259c7cced Mon Sep 17 00:00:00 2001 From: NI Date: Sun, 15 Dec 2019 14:59:35 +0800 Subject: [PATCH] Clean up some code --- ui/home.vue | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/ui/home.vue b/ui/home.vue index 9b185b2..acc78cb 100644 --- a/ui/home.vue +++ b/ui/home.vue @@ -532,11 +532,11 @@ export default { this.tab.tabs[index].indicator.level = ""; } }, - tabWarning(index, msg) { + tabMessage(index, msg, type) { if (msg.toDismiss) { if ( this.tab.tabs[index].indicator.message !== msg.text || - this.tab.tabs[index].indicator.level !== "warning" + this.tab.tabs[index].indicator.level !== type ) { return; } @@ -548,25 +548,13 @@ export default { } this.tab.tabs[index].indicator.message = msg.text; - this.tab.tabs[index].indicator.level = "warning"; + this.tab.tabs[index].indicator.level = type; + }, + tabWarning(index, msg) { + this.tabMessage(index, msg, "warning"); }, tabInfo(index, msg) { - if (msg.toDismiss) { - if ( - this.tab.tabs[index].indicator.message !== msg.text || - this.tab.tabs[index].indicator.level !== "info" - ) { - return; - } - - this.tab.tabs[index].indicator.message = ""; - this.tab.tabs[index].indicator.level = ""; - - return; - } - - this.tab.tabs[index].indicator.message = msg.text; - this.tab.tabs[index].indicator.level = "info"; + this.tabMessage(index, msg, "info"); }, tabUpdated(index) { this.$emit("tab-updated", this.tab.tabs);