Skip to content

Commit 21d2a44

Browse files
perf: Optimize application setting switch button control
1 parent e364d6e commit 21d2a44

File tree

5 files changed

+37
-19
lines changed

5 files changed

+37
-19
lines changed

ui/src/locales/lang/en-US/views/document.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export default {
172172
feishu: {
173173
selectDocument: 'Select Document',
174174
tip1: 'Supports document and table types, including TXT, Markdown, PDF, DOCX, HTML, XLS, XLSX, CSV, and ZIP formats;',
175-
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.',
175+
tip2: 'The system does not store original documents. Before importing, Please ensure the document follows standardized paragraph markers',
176176
allCheck: 'Select All',
177177
errorMessage1: 'Please select a document'
178178
}

ui/src/views/application-overview/component/APIKeyDialog.vue

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
<el-table-column :label="$t('common.status.label')" width="70">
2525
<template #default="{ row }">
2626
<div @click.stop>
27-
<el-switch size="small" v-model="row.is_active" @change="changeState($event, row)" />
27+
<el-switch
28+
size="small"
29+
v-model="row.is_active"
30+
:before-change="() => changeState(row)"
31+
/>
2832
</div>
2933
</template>
3034
</el-table-column>
@@ -104,17 +108,23 @@ function deleteApiKey(row: any) {
104108
.catch(() => {})
105109
}
106110
107-
function changeState(bool: Boolean, row: any) {
111+
function changeState(row: any) {
108112
const obj = {
109-
is_active: bool
113+
is_active: !row.is_active
110114
}
111-
const str = bool
115+
const str = obj.is_active
112116
? t('views.applicationOverview.appInfo.APIKeyDialog.enabledSuccess')
113117
: t('views.applicationOverview.appInfo.APIKeyDialog.disabledSuccess')
114-
overviewApi.putAPIKey(id as string, row.id, obj, loading).then((res) => {
115-
MsgSuccess(str)
116-
getApiKeyList()
117-
})
118+
overviewApi
119+
.putAPIKey(id as string, row.id, obj, loading)
120+
.then((res) => {
121+
MsgSuccess(str)
122+
getApiKeyList()
123+
return true
124+
})
125+
.catch(() => {
126+
return false
127+
})
118128
}
119129
120130
function createApiKey() {

ui/src/views/application-overview/index.vue

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
inline-prompt
5555
:active-text="$t('views.applicationOverview.appInfo.openText')"
5656
:inactive-text="$t('views.applicationOverview.appInfo.closeText')"
57-
@change="changeState($event)"
57+
:before-change="() => changeState(accessToken.is_active)"
5858
/>
5959
</div>
6060

@@ -148,7 +148,12 @@
148148
{{ $t('views.applicationOverview.monitor.monitoringStatistics') }}
149149
</h4>
150150
<div class="mb-16">
151-
<el-select v-model="history_day" class="mr-12" @change="changeDayHandle" style="width:180px">
151+
<el-select
152+
v-model="history_day"
153+
class="mr-12"
154+
@change="changeDayHandle"
155+
style="width: 180px"
156+
>
152157
<el-option
153158
v-for="item in dayOptions"
154159
:key="item.value"
@@ -331,13 +336,19 @@ function refreshAccessToken() {
331336
}
332337
function changeState(bool: Boolean) {
333338
const obj = {
334-
is_active: bool
339+
is_active: !bool
335340
}
336-
const str = bool ? t('common.status.enableSuccess') : t('common.status.disableSuccess')
341+
const str = obj.is_active ? t('common.status.enableSuccess') : t('common.status.disableSuccess')
337342
updateAccessToken(obj, str)
343+
.then(() => {
344+
return true
345+
})
346+
.catch(() => {
347+
return false
348+
})
338349
}
339350
340-
function updateAccessToken(obj: any, str: string) {
351+
async function updateAccessToken(obj: any, str: string) {
341352
applicationApi.putAccessToken(id as string, obj, loading).then((res) => {
342353
accessToken.value = res?.data
343354
MsgSuccess(str)

ui/src/views/dataset/ImportDocumentDataset.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</template>
66
<div class="create-dataset__main flex" v-loading="loading">
77
<div class="create-dataset__component main-calc-height">
8-
<div class="upload-document p-24">
8+
<div class="upload-document p-24" style="min-width: 850px">
99
<h4 class="title-decoration-1 mb-8">
1010
{{ $t('views.document.feishu.selectDocument') }}
1111
</h4>
@@ -41,7 +41,7 @@
4141
@change="handleAllCheckChange"
4242
/>
4343
</div>
44-
<div style="height: calc(100vh - 430px)">
44+
<div style="height: calc(100vh - 450px)">
4545
<el-scrollbar>
4646
<el-tree
4747
:props="props"

ui/src/views/function-lib/component/FunctionFormDrawer.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,6 @@ const open = (data: any) => {
508508
visible.value = true
509509
setTimeout(() => {
510510
showEditor.value = true
511-
nextTick(() => {
512-
onDragHandle()
513-
})
514511
}, 100)
515512
}
516513

0 commit comments

Comments
 (0)