Skip to content

Commit dff3857

Browse files
author
NI
committed
Clean up some code
1 parent f190cef commit dff3857

1 file changed

Lines changed: 7 additions & 19 deletions

File tree

ui/home.vue

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -532,11 +532,11 @@ export default {
532532
this.tab.tabs[index].indicator.level = "";
533533
}
534534
},
535-
tabWarning(index, msg) {
535+
tabMessage(index, msg, type) {
536536
if (msg.toDismiss) {
537537
if (
538538
this.tab.tabs[index].indicator.message !== msg.text ||
539-
this.tab.tabs[index].indicator.level !== "warning"
539+
this.tab.tabs[index].indicator.level !== type
540540
) {
541541
return;
542542
}
@@ -548,25 +548,13 @@ export default {
548548
}
549549
550550
this.tab.tabs[index].indicator.message = msg.text;
551-
this.tab.tabs[index].indicator.level = "warning";
551+
this.tab.tabs[index].indicator.level = type;
552+
},
553+
tabWarning(index, msg) {
554+
this.tabMessage(index, msg, "warning");
552555
},
553556
tabInfo(index, msg) {
554-
if (msg.toDismiss) {
555-
if (
556-
this.tab.tabs[index].indicator.message !== msg.text ||
557-
this.tab.tabs[index].indicator.level !== "info"
558-
) {
559-
return;
560-
}
561-
562-
this.tab.tabs[index].indicator.message = "";
563-
this.tab.tabs[index].indicator.level = "";
564-
565-
return;
566-
}
567-
568-
this.tab.tabs[index].indicator.message = msg.text;
569-
this.tab.tabs[index].indicator.level = "info";
557+
this.tabMessage(index, msg, "info");
570558
},
571559
tabUpdated(index) {
572560
this.$emit("tab-updated", this.tab.tabs);

0 commit comments

Comments
 (0)