From a8ca0b7575aafb901b9de52a38e13936687c0c97 Mon Sep 17 00:00:00 2001 From: Safirex Date: Sat, 29 Apr 2023 16:47:21 +0200 Subject: [PATCH 1/2] add abort connection button --- src/renderer/components/Icon.vue | 1 + src/renderer/components/MainWindow/ConnectionItem.vue | 6 +++++- src/renderer/components/MainWindow/index.vue | 9 ++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/Icon.vue b/src/renderer/components/Icon.vue index 59bc4b5..ca87d31 100644 --- a/src/renderer/components/Icon.vue +++ b/src/renderer/components/Icon.vue @@ -18,6 +18,7 @@ const icons = { unavailable: 'M 16 3 C 8.832031 3 3 8.832031 3 16 C 3 23.167969 8.832031 29 16 29 C 23.167969 29 29 23.167969 29 16 C 29 8.832031 23.167969 3 16 3 Z M 16 5 C 22.085938 5 27 9.914063 27 16 C 27 18.726563 26.011719 21.207031 24.375 23.125 L 9.03125 7.46875 C 10.925781 5.917969 13.351563 5 16 5 Z M 7.625 8.875 L 22.96875 24.53125 C 21.074219 26.082031 18.648438 27 16 27 C 9.914063 27 5 22.085938 5 16 C 5 13.273438 5.988281 10.792969 7.625 8.875 Z ', duplicate: 'M 4 4 L 4 24 L 11 24 L 11 22 L 6 22 L 6 6 L 18 6 L 18 7 L 20 7 L 20 4 Z M 12 8 L 12 28 L 28 28 L 28 8 Z M 14 10 L 26 10 L 26 26 L 14 26 Z ', info: 'M 16 3 C 8.832031 3 3 8.832031 3 16 C 3 23.167969 8.832031 29 16 29 C 23.167969 29 29 23.167969 29 16 C 29 8.832031 23.167969 3 16 3 Z M 16 5 C 22.085938 5 27 9.914063 27 16 C 27 22.085938 22.085938 27 16 27 C 9.914063 27 5 22.085938 5 16 C 5 9.914063 9.914063 5 16 5 Z M 15 10 L 15 12 L 17 12 L 17 10 Z M 15 14 L 15 22 L 17 22 L 17 14 Z ', + cancel: 'M12,2c-5.511,0 -10,4.489 -10,10c0,5.511 4.489,10 10,10c5.511,0 10,-4.489 10,-10c0,-5.511 -4.489,-10 -10,-10zM12,4c4.43012,0 8,3.56988 8,8c0,4.43012 -3.56988,8 -8,8c-4.43012,0 -8,-3.56988 -8,-8c0,-4.43012 3.56988,-8 8,-8zM8.70703,7.29297l-1.41406,1.41406l3.29297,3.29297l-3.29297,3.29297l1.41406,1.41406l3.29297,-3.29297l3.29297,3.29297l1.41406,-1.41406l-3.29297,-3.29297l3.29297,-3.29297l-1.41406,-1.41406l-3.29297,3.29297z ', grip: 'M 3 11 L 3 13 L 29 13 L 29 11 L 3 11 z M 3 19 L 3 21 L 29 21 L 29 19 L 3 19 z' } diff --git a/src/renderer/components/MainWindow/ConnectionItem.vue b/src/renderer/components/MainWindow/ConnectionItem.vue index 09f2579..c6cb12a 100644 --- a/src/renderer/components/MainWindow/ConnectionItem.vue +++ b/src/renderer/components/MainWindow/ConnectionItem.vue @@ -30,13 +30,17 @@ + + diff --git a/src/renderer/components/MainWindow/index.vue b/src/renderer/components/MainWindow/index.vue index 0b412f0..f754a67 100644 --- a/src/renderer/components/MainWindow/index.vue +++ b/src/renderer/components/MainWindow/index.vue @@ -9,7 +9,9 @@ - + @@ -92,6 +94,11 @@ export default { }, methods: { + abortConnection (pid) { + ProcessManager.terminate(pid) + this.updateConnectionList() + }, + toggleDeleteMode () { this.listMode = this.listMode === 'delete' ? 'none' : 'delete' }, From c5c1cd80dfc6139435eb39044ad0f101a3eaf283 Mon Sep 17 00:00:00 2001 From: Safirex Date: Sat, 29 Apr 2023 17:11:28 +0200 Subject: [PATCH 2/2] reuse defined func --- .../components/MainWindow/ConnectionItem.vue | 2 +- src/renderer/components/MainWindow/index.vue | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/renderer/components/MainWindow/ConnectionItem.vue b/src/renderer/components/MainWindow/ConnectionItem.vue index c6cb12a..451f9e2 100644 --- a/src/renderer/components/MainWindow/ConnectionItem.vue +++ b/src/renderer/components/MainWindow/ConnectionItem.vue @@ -30,7 +30,7 @@ - diff --git a/src/renderer/components/MainWindow/index.vue b/src/renderer/components/MainWindow/index.vue index f754a67..2b23056 100644 --- a/src/renderer/components/MainWindow/index.vue +++ b/src/renderer/components/MainWindow/index.vue @@ -11,7 +11,7 @@ + @delete="deleteConnection" @clone="cloneConnection" @abort="disconnect"/> @@ -94,11 +94,6 @@ export default { }, methods: { - abortConnection (pid) { - ProcessManager.terminate(pid) - this.updateConnectionList() - }, - toggleDeleteMode () { this.listMode = this.listMode === 'delete' ? 'none' : 'delete' }, @@ -114,14 +109,11 @@ export default { ProcessManager.create(c).then(pid => { conn.pid = pid conn.status = 'connected' - - this.updateConnectionList() }).catch(error => { conn.status = 'disconnected' - - this.updateConnectionList() - this.notify(`Can't connect to '${conn.name}': ${error}`, 'error-icon') + }).finally(() => { + this.updateConnectionList() }) }