From a669f3dfcb77a3fff31a099f6d7beb72c23578dd Mon Sep 17 00:00:00 2001 From: tiny-craft <137850705+tiny-craft@users.noreply.github.com> Date: Sun, 22 Oct 2023 00:57:36 +0800 Subject: [PATCH] feat: add "tree view" and "list view" switch for keys browser --- .../src/components/common/SwitchButton.vue | 42 +-- frontend/src/components/icons/ListView.vue | 48 ++++ frontend/src/components/icons/TreeView.vue | 57 ++++ .../src/components/sidebar/BrowserPane.vue | 20 +- .../src/components/sidebar/BrowserTree.vue | 11 +- .../src/components/sidebar/ConnectionTree.vue | 2 +- frontend/src/consts/key_view_type.js | 8 + frontend/src/langs/en.json | 2 + frontend/src/langs/zh-cn.json | 2 + frontend/src/stores/connections.js | 248 +++++++++++++----- 10 files changed, 339 insertions(+), 101 deletions(-) create mode 100644 frontend/src/components/icons/ListView.vue create mode 100644 frontend/src/components/icons/TreeView.vue create mode 100644 frontend/src/consts/key_view_type.js diff --git a/frontend/src/components/common/SwitchButton.vue b/frontend/src/components/common/SwitchButton.vue index 3dd33be..ea8433c 100644 --- a/frontend/src/components/common/SwitchButton.vue +++ b/frontend/src/components/common/SwitchButton.vue @@ -24,6 +24,10 @@ const props = defineProps({ type: [Number, String], default: 3, }, + unselectStrokeWidth: { + type: [Number, String], + default: 3, + }, }) const emit = defineEmits(['update:value']) @@ -36,24 +40,26 @@ const handleSwitch = (idx) => { diff --git a/frontend/src/components/icons/ListView.vue b/frontend/src/components/icons/ListView.vue new file mode 100644 index 0000000..94e7190 --- /dev/null +++ b/frontend/src/components/icons/ListView.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/frontend/src/components/icons/TreeView.vue b/frontend/src/components/icons/TreeView.vue new file mode 100644 index 0000000..23a27f1 --- /dev/null +++ b/frontend/src/components/icons/TreeView.vue @@ -0,0 +1,57 @@ + + + + + diff --git a/frontend/src/components/sidebar/BrowserPane.vue b/frontend/src/components/sidebar/BrowserPane.vue index 506a8ac..3a3ce5e 100644 --- a/frontend/src/components/sidebar/BrowserPane.vue +++ b/frontend/src/components/sidebar/BrowserPane.vue @@ -1,5 +1,5 @@