From 21d2a44090d1be2421bce2d88403884ef8d7606e Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud <79562285+wangdan-fit2cloud@users.noreply.github.com> Date: Wed, 2 Apr 2025 18:09:47 +0800 Subject: [PATCH] perf: Optimize application setting switch button control --- ui/src/locales/lang/en-US/views/document.ts | 2 +- .../component/APIKeyDialog.vue | 26 +++++++++++++------ ui/src/views/application-overview/index.vue | 21 +++++++++++---- .../views/dataset/ImportDocumentDataset.vue | 4 +-- .../component/FunctionFormDrawer.vue | 3 --- 5 files changed, 37 insertions(+), 19 deletions(-) diff --git a/ui/src/locales/lang/en-US/views/document.ts b/ui/src/locales/lang/en-US/views/document.ts index e314fbcd4..9a3f1da73 100644 --- a/ui/src/locales/lang/en-US/views/document.ts +++ b/ui/src/locales/lang/en-US/views/document.ts @@ -172,7 +172,7 @@ export default { feishu: { selectDocument: 'Select Document', tip1: 'Supports document and table types, including TXT, Markdown, PDF, DOCX, HTML, XLS, XLSX, CSV, and ZIP formats;', - tip2: 'The system does not store the original documents. Before importing a document, it is recommended to standardize the paragraph segmentation markings of the document.', + tip2: 'The system does not store original documents. Before importing, Please ensure the document follows standardized paragraph markers', allCheck: 'Select All', errorMessage1: 'Please select a document' } diff --git a/ui/src/views/application-overview/component/APIKeyDialog.vue b/ui/src/views/application-overview/component/APIKeyDialog.vue index 4ff20eb4a..dc8c9aa37 100644 --- a/ui/src/views/application-overview/component/APIKeyDialog.vue +++ b/ui/src/views/application-overview/component/APIKeyDialog.vue @@ -24,7 +24,11 @@ @@ -104,17 +108,23 @@ function deleteApiKey(row: any) { .catch(() => {}) } -function changeState(bool: Boolean, row: any) { +function changeState(row: any) { const obj = { - is_active: bool + is_active: !row.is_active } - const str = bool + const str = obj.is_active ? t('views.applicationOverview.appInfo.APIKeyDialog.enabledSuccess') : t('views.applicationOverview.appInfo.APIKeyDialog.disabledSuccess') - overviewApi.putAPIKey(id as string, row.id, obj, loading).then((res) => { - MsgSuccess(str) - getApiKeyList() - }) + overviewApi + .putAPIKey(id as string, row.id, obj, loading) + .then((res) => { + MsgSuccess(str) + getApiKeyList() + return true + }) + .catch(() => { + return false + }) } function createApiKey() { diff --git a/ui/src/views/application-overview/index.vue b/ui/src/views/application-overview/index.vue index 1316041c9..121292b39 100644 --- a/ui/src/views/application-overview/index.vue +++ b/ui/src/views/application-overview/index.vue @@ -54,7 +54,7 @@ inline-prompt :active-text="$t('views.applicationOverview.appInfo.openText')" :inactive-text="$t('views.applicationOverview.appInfo.closeText')" - @change="changeState($event)" + :before-change="() => changeState(accessToken.is_active)" /> @@ -148,7 +148,12 @@ {{ $t('views.applicationOverview.monitor.monitoringStatistics') }}
- + { + return true + }) + .catch(() => { + return false + }) } -function updateAccessToken(obj: any, str: string) { +async function updateAccessToken(obj: any, str: string) { applicationApi.putAccessToken(id as string, obj, loading).then((res) => { accessToken.value = res?.data MsgSuccess(str) diff --git a/ui/src/views/dataset/ImportDocumentDataset.vue b/ui/src/views/dataset/ImportDocumentDataset.vue index d512fd55b..d3ab2ac5f 100644 --- a/ui/src/views/dataset/ImportDocumentDataset.vue +++ b/ui/src/views/dataset/ImportDocumentDataset.vue @@ -5,7 +5,7 @@
-
+

{{ $t('views.document.feishu.selectDocument') }}

@@ -41,7 +41,7 @@ @change="handleAllCheckChange" />
-
+
{ visible.value = true setTimeout(() => { showEditor.value = true - nextTick(() => { - onDragHandle() - }) }, 100) }