From 797f4fd89c4571adb59e216d243d60b6b987d687 Mon Sep 17 00:00:00 2001 From: NI Date: Mon, 9 Sep 2019 22:52:06 +0800 Subject: [PATCH] Add `retap` triggers, which is currently no use --- ui/control/ssh.js | 2 ++ ui/control/telnet.js | 2 ++ ui/home.vue | 5 +++++ ui/widgets/tab_list.vue | 25 +++++++++++++++++++------ ui/widgets/tab_window.vue | 3 ++- ui/widgets/tabs.vue | 3 ++- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/ui/control/ssh.js b/ui/control/ssh.js index bc42055..d9e268a 100644 --- a/ui/control/ssh.js +++ b/ui/control/ssh.js @@ -80,6 +80,8 @@ class Control { this.enable = false; } + retap() {} + receive() { return this.subs.subscribe(); } diff --git a/ui/control/telnet.js b/ui/control/telnet.js index e7d3c9b..d961ac4 100644 --- a/ui/control/telnet.js +++ b/ui/control/telnet.js @@ -399,6 +399,8 @@ class Control { this.enable = false; } + retap() {} + receive() { return this.subs.subscribe(); } diff --git a/ui/home.vue b/ui/home.vue index ceb8e94..9636e51 100644 --- a/ui/home.vue +++ b/ui/home.vue @@ -51,6 +51,7 @@ tabs-class="tab1" list-trigger-class="icon icon-more1" @current="switchTab" + @retap="retapTab" @list="showTabsWindow" @close="closeTab" > @@ -135,6 +136,7 @@ tabs-class="tab1 tab1-list" @display="windows.tabs = $event" @current="switchTab" + @retap="retapTab" @close="closeTab" > @@ -472,6 +474,9 @@ export default { this.tab.tabs[this.tab.current].indicator.updated = false; await this.tab.tabs[this.tab.current].control.enabled(); }, + async retapTab(tab) { + await this.tab.tabs[tab].control.retap(); + }, async closeTab(index) { if (this.tab.tabs[index].status.closing) { return; diff --git a/ui/widgets/tab_list.vue b/ui/widgets/tab_list.vue index a3e4b1d..8918412 100644 --- a/ui/widgets/tab_list.vue +++ b/ui/widgets/tab_list.vue @@ -33,9 +33,9 @@ ? tabInfo.control.activeColor() : tabInfo.control.color()) " - @click="switchTo(idx)" + @click.self="switchTab(idx)" > - + this.tab) { return; } - this.switchTo(newVal.length - 1); + this.switchTabTo(newVal.length - 1); } }, methods: { - switchTo(index) { + switchTabTo(index) { if (index < 0 || index >= this.tabs.length) { return; } @@ -95,6 +95,19 @@ export default { this.$emit("current", index); }, + switchTab(index) { + if (index < 0 || index >= this.tabs.length) { + return; + } + + if (this.tab === index) { + this.$emit("retap", index); + + return; + } + + return this.switchTabTo(index); + }, closeAt(index) { this.$emit("close", index); } diff --git a/ui/widgets/tab_window.vue b/ui/widgets/tab_window.vue index e4a466d..5b64752 100644 --- a/ui/widgets/tab_window.vue +++ b/ui/widgets/tab_window.vue @@ -32,6 +32,7 @@ :tabs="tabs" :tabs-class="tabsClass" @current="$emit('current', $event)" + @retap="$emit('retap', $event)" @close="$emit('close', $event)" > @@ -55,7 +56,7 @@ export default { }, tab: { type: Number, - default: 0 + default: -1 }, tabs: { type: Array, diff --git a/ui/widgets/tabs.vue b/ui/widgets/tabs.vue index 79ec2d3..6977029 100644 --- a/ui/widgets/tabs.vue +++ b/ui/widgets/tabs.vue @@ -25,6 +25,7 @@ :tabs="tabs" :tabs-class="tabsClass" @current="$emit('current', $event)" + @retap="$emit('retap', $event)" @close="$emit('close', $event)" > @@ -52,7 +53,7 @@ export default { }, tab: { type: Number, - default: 0 + default: -1 }, tabs: { type: Array,