From d26872aefb4b095f8d79b5f049e9e96500b0cb89 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 10 Jul 2025 14:31:51 +0800 Subject: [PATCH] refactor: clean up access token retrieval logic and remove unused authentication watcher --- ui/src/stores/modules/application.ts | 22 ++++++++-------- .../xpack-component/XPackLimitDrawer.vue | 25 ++++++++++--------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/ui/src/stores/modules/application.ts b/ui/src/stores/modules/application.ts index f87630154..f2c1e515f 100644 --- a/ui/src/stores/modules/application.ts +++ b/ui/src/stores/modules/application.ts @@ -25,16 +25,16 @@ const useApplicationStore = defineStore('application', { async asyncGetAccessToken(id: string, loading?: Ref) { return new Promise((resolve, reject) => { const user = useUserStore() - if (user.isEE() || user.isPE()) { - applicationXpackApi - .getAccessToken(id, loading) - .then((data) => { - resolve(data) - }) - .catch((error) => { - reject(error) - }) - } else { + // if (user.isEE() || user.isPE()) { + // applicationXpackApi + // .getAccessToken(id, loading) + // .then((data) => { + // resolve(data) + // }) + // .catch((error) => { + // reject(error) + // }) + // } else { applicationApi .getAccessToken(id, loading) .then((data) => { @@ -43,7 +43,7 @@ const useApplicationStore = defineStore('application', { .catch((error) => { reject(error) }) - } + // } }) }, diff --git a/ui/src/views/application-overview/xpack-component/XPackLimitDrawer.vue b/ui/src/views/application-overview/xpack-component/XPackLimitDrawer.vue index f3c0692c3..e5e46c9f1 100644 --- a/ui/src/views/application-overview/xpack-component/XPackLimitDrawer.vue +++ b/ui/src/views/application-overview/xpack-component/XPackLimitDrawer.vue @@ -34,7 +34,7 @@ v-if="form.authentication" v-model="form.authentication_value.type" class="card__radio" - @change="(val: string) => val === 'password' && refreshAuthentication()" + @change="(val: string) => val === 'password'" > { } } }) -watch( - () => form.value.authentication, - (b) => { - if (b) { - applicationApi.getChatUserAuthType().then((ok) => { - auth_list.value = ok.data - }) - } - }, -) +// watch( +// () => form.value.authentication, +// (b) => { +// if (b) { +// applicationApi.getChatUserAuthType().then((ok) => { +// auth_list.value = ok.data +// }) +// } +// }, +// ) const open = (data: any) => { form.value.access_num = data.access_num form.value.white_active = data.white_active @@ -196,7 +196,7 @@ const open = (data: any) => { form.value.authentication_value = data.authentication_value || { type: 'password', } - if (form.value.authentication_value.type === 'password') { + if (form.value.authentication_value.type === 'password' && !form.value.authentication_value.password_value) { refreshAuthentication() } form.value.authentication = data.authentication @@ -239,6 +239,7 @@ function refreshAuthentication() { } function firstGeneration() { + console.log('firstGeneration') if (form.value.authentication && !form.value.authentication_value) { form.value.authentication_value = generateAuthenticationValue() }