From f9fe74a6b4041c290424d468034da5cbcffbe773 Mon Sep 17 00:00:00 2001 From: tiny-craft <137850705+tiny-craft@users.noreply.github.com> Date: Sun, 22 Oct 2023 18:31:10 +0800 Subject: [PATCH] perf: move key view switch to connection preferences --- backend/services/connection_service.go | 3 +- backend/types/connection.go | 1 + .../components/dialogs/ConnectionDialog.vue | 99 +++++++++++-------- .../src/components/sidebar/BrowserPane.vue | 25 ++--- frontend/src/langs/en.json | 5 +- frontend/src/langs/zh-cn.json | 5 +- frontend/src/stores/connections.js | 4 +- 7 files changed, 85 insertions(+), 57 deletions(-) diff --git a/backend/services/connection_service.go b/backend/services/connection_service.go index bf40b02..fc61e2e 100644 --- a/backend/services/connection_service.go +++ b/backend/services/connection_service.go @@ -507,7 +507,8 @@ func (c *connectionService) OpenConnection(name string) (resp types.JSResp) { resp.Success = true resp.Data = map[string]any{ - "db": dbs, + "db": dbs, + "view": selConn.KeyView, } return } diff --git a/backend/types/connection.go b/backend/types/connection.go index f7ff5f4..ff5d5c5 100644 --- a/backend/types/connection.go +++ b/backend/types/connection.go @@ -15,6 +15,7 @@ type ConnectionConfig struct { ExecTimeout int `json:"execTimeout,omitempty" yaml:"exec_timeout,omitempty"` DBFilterType string `json:"dbFilterType" yaml:"db_filter_type,omitempty"` DBFilterList []int `json:"dbFilterList" yaml:"db_filter_list,omitempty"` + KeyView int `json:"keyView,omitempty" yaml:"key_view,omitempty"` LoadSize int `json:"loadSize,omitempty" yaml:"load_size,omitempty"` MarkColor string `json:"markColor,omitempty" yaml:"mark_color,omitempty"` SSL ConnectionSSL `json:"ssl,omitempty" yaml:"ssl,omitempty"` diff --git a/frontend/src/components/dialogs/ConnectionDialog.vue b/frontend/src/components/dialogs/ConnectionDialog.vue index d396b5b..9c67e20 100644 --- a/frontend/src/components/dialogs/ConnectionDialog.vue +++ b/frontend/src/components/dialogs/ConnectionDialog.vue @@ -7,6 +7,7 @@ import useDialog, { ConnDialogType } from 'stores/dialog' import Close from '@/components/icons/Close.vue' import useConnectionStore from 'stores/connections.js' import FileOpenInput from '@/components/common/FileOpenInput.vue' +import { KeyViewType } from '@/consts/key_view_type.js' /** * Dialog for new or edit connection @@ -258,37 +259,47 @@ const onClose = () => { :rules="generalFormRules()" :show-require-mark="false" label-placement="top"> - - - - - - - - - : - - - - - - - - + + + + + + + + + + : + + + + + + + + + @@ -337,6 +348,16 @@ const onClose = () => { + + + + + + @@ -403,20 +424,20 @@ const onClose = () => { + :disabled="!generalForm.ssl.enable" + :placeholder="$t('dialogue.connection.ssl.cert_file_tip')" /> + :disabled="!generalForm.ssl.enable" + :placeholder="$t('dialogue.connection.ssl.key_file_tip')" /> + :disabled="!generalForm.ssl.enable" + :placeholder="$t('dialogue.connection.ssl.ca_file_tip')" /> @@ -467,8 +488,8 @@ const onClose = () => { + :disabled="!generalForm.ssh.enable" + :placeholder="$t('dialogue.connection.ssh.pkfile_tip')" /> { return options }) -const viewType = ref(0) -const onSwitchView = (selectView) => { - const { server } = tabStore.currentTab - connectionStore.switchKeyView(server, selectView) -} +// forbid dynamic switch key view due to performance issues +// const viewType = ref(0) +// const onSwitchView = (selectView) => { +// const { server } = tabStore.currentTab +// connectionStore.switchKeyView(server, selectView) +// }