From e048671bfde6cc449ec8ce9fdbc5ae7a3a918125 Mon Sep 17 00:00:00 2001 From: NI Date: Tue, 22 Oct 2019 08:38:31 +0800 Subject: [PATCH] Session data can be cleared without reloading the page --- ui/commands/history.js | 17 +++++++++++++++++ ui/home.vue | 6 ++++++ ui/widgets/connect.vue | 8 ++++++++ ui/widgets/connect_known.css | 5 +++++ ui/widgets/connect_known.vue | 19 +++++++++++++++++++ 5 files changed, 55 insertions(+) diff --git a/ui/commands/history.js b/ui/commands/history.js index 025cc21..6d9b4ef 100644 --- a/ui/commands/history.js +++ b/ui/commands/history.js @@ -113,6 +113,23 @@ export class History { this.saver(this, this.records); } + /** + * Clear session data + * + * @param {string} uid unique name + * + */ + clearSession(uid) { + for (let i in this.records) { + if (this.records[i].uname !== uid) { + continue; + } + + this.records[i].session = null; + break; + } + } + /** * Return all history records * diff --git a/ui/home.vue b/ui/home.vue index d768044..b50f237 100644 --- a/ui/home.vue +++ b/ui/home.vue @@ -115,6 +115,7 @@ @connector-select="connectNew" @known-select="connectKnown" @known-remove="removeKnown" + @known-clear-session="clearSessionKnown" >
@@ -148,6 +149,13 @@ export default { } this.$emit("known-remove", uid); + }, + clearSessionKnown(uid) { + if (this.inputting) { + return; + } + + this.$emit("known-clear-session", uid); } } }; diff --git a/ui/widgets/connect_known.css b/ui/widgets/connect_known.css index d2ce966..9c8cc62 100644 --- a/ui/widgets/connect_known.css +++ b/ui/widgets/connect_known.css @@ -90,6 +90,11 @@ color: #fff; } +#connect-known-list li .labels > .opt.clr { + background: #b71; + color: #fff; +} + #connect-known-list li:hover .labels > .opt, #connect-known-list li:focus .labels > .opt { display: inline-block; diff --git a/ui/widgets/connect_known.vue b/ui/widgets/connect_known.vue index 3b17f34..2ac7604 100644 --- a/ui/widgets/connect_known.vue +++ b/ui/widgets/connect_known.vue @@ -25,6 +25,7 @@ {{ known.data.type }} + {{ known.copyStatus }} + Remove + + Clear +