From 4ed677c6a48f649ba2f665e0ebe11eca1b9b7b92 Mon Sep 17 00:00:00 2001 From: chenwenchang <479999519@qq.com> Date: Thu, 28 Nov 2024 11:44:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E4=B8=B4=E6=97=B6=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E4=BF=AE=E6=94=B9=E4=BC=98=E5=8C=96=20#8250=20#=20Rev?= =?UTF-8?q?iewed,=20transaction=20id:=2026128?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbm-ui/frontend/src/locales/zh-cn.json | 2 + .../src/services/source/permission.ts | 17 +- dbm-ui/frontend/src/types/auto-imports.d.ts | 2 +- .../db-manage/common/password-input/Index.vue | 13 +- .../components/common/AccountCreate.vue | 22 +- .../views/db-manage/redis/apply-ha/Index.vue | 13 +- .../db-manage/redis/apply/ApplyRedis.vue | 13 +- .../temporary-paassword-modify/Index.vue | 225 +++++++++++- .../components/UpdateResult.vue | 330 +++++++++++++++++ .../components/form-item/InstanceList.vue | 0 .../components/form-item/PasswordInput.vue | 0 .../components/form-item/ValidDuration.vue | 0 .../render-passwrod-instance/Index.vue | 0 .../RenderInstance.vue | 0 .../index/Index.vue | 332 ------------------ .../index/components/UpdateResult.vue | 223 ------------ .../temporary-paassword-modify/routes.ts | 13 - 17 files changed, 618 insertions(+), 587 deletions(-) create mode 100644 dbm-ui/frontend/src/views/temporary-paassword-modify/components/UpdateResult.vue rename dbm-ui/frontend/src/views/temporary-paassword-modify/{index => }/components/form-item/InstanceList.vue (100%) rename dbm-ui/frontend/src/views/temporary-paassword-modify/{index => }/components/form-item/PasswordInput.vue (100%) rename dbm-ui/frontend/src/views/temporary-paassword-modify/{index => }/components/form-item/ValidDuration.vue (100%) rename dbm-ui/frontend/src/views/temporary-paassword-modify/{index => }/components/render-passwrod-instance/Index.vue (100%) rename dbm-ui/frontend/src/views/temporary-paassword-modify/{index => }/components/render-passwrod-instance/RenderInstance.vue (100%) delete mode 100644 dbm-ui/frontend/src/views/temporary-paassword-modify/index/Index.vue delete mode 100644 dbm-ui/frontend/src/views/temporary-paassword-modify/index/components/UpdateResult.vue diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json index c7cdcdfc9f..591a0cbc8e 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -3675,6 +3675,8 @@ "冷/热节点": "冷/热节点", "冷_热节点规格": "冷_热节点规格", "不允许使用特殊账号名称n": "不允许使用特殊账号名称 {n}", + "密码不符合要求": "密码不符合要求", + "错误日志": "错误日志", "这行勿动!新增翻译请在上一行添加!": "" } diff --git a/dbm-ui/frontend/src/services/source/permission.ts b/dbm-ui/frontend/src/services/source/permission.ts index c607d4a1ab..33cab05fb6 100644 --- a/dbm-ui/frontend/src/services/source/permission.ts +++ b/dbm-ui/frontend/src/services/source/permission.ts @@ -88,14 +88,7 @@ export const modifyAdminPassword = (params: { }[]; // 是否异步 is_async?: boolean; -}) => - http.post< - | { - success: AdminPasswordResultItem[] | null; - fail: AdminPasswordResultItem[] | null; - } - | string // 异步修改时返回root_id - >(`${path}/modify_admin_password/`, params); +}) => http.post(`${path}/modify_admin_password/`, params); /** * 查询生效实例密码(admin) @@ -118,11 +111,11 @@ export const queryAdminPassword = (params: { */ export const queryAsyncModifyResult = (params: { root_id: string }) => http.post<{ - data: { - success: AdminPasswordResultItem[] | null; - fail: AdminPasswordResultItem[] | null; - }; status: string; + error?: string; + success?: AdminPasswordResultItem[]; + fail?: AdminPasswordResultItem[]; + result?: boolean; }>(`${path}/query_async_modify_result/`, params); /** diff --git a/dbm-ui/frontend/src/types/auto-imports.d.ts b/dbm-ui/frontend/src/types/auto-imports.d.ts index d0c217f6f1..7021ac5101 100644 --- a/dbm-ui/frontend/src/types/auto-imports.d.ts +++ b/dbm-ui/frontend/src/types/auto-imports.d.ts @@ -71,6 +71,6 @@ declare global { // for type re-export declare global { // @ts-ignore - export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' + export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' import('vue') } diff --git a/dbm-ui/frontend/src/views/db-manage/common/password-input/Index.vue b/dbm-ui/frontend/src/views/db-manage/common/password-input/Index.vue index 2a42c3e580..3eab123785 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/password-input/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/password-input/Index.vue @@ -71,6 +71,10 @@ buttonDisabledTip?: string; } + interface Emits { + (e: 'verifyResult', isPass: boolean): void; + } + interface Exposes { getEncyptPassword: () => string; validate: () => Promise; @@ -82,12 +86,14 @@ buttonDisabledTip: '', }); - const { t } = useI18n(); + const emits = defineEmits(); const modelValue = defineModel('modelValue', { default: '', }); + const { t } = useI18n(); + let tippyInstance: Instance; let publicKey = ''; let passwordPolicyMemo = {} as PasswordPolicy['rule']; @@ -256,6 +262,7 @@ password: getEncyptPassword(), }); tippyInstance.show(); + emits('verifyResult', isStrength); return isStrength; }; const debounceVerifyPassword = _.debounce(verifyPassword, 300); @@ -294,6 +301,10 @@ tippyInstance.hide(); }; + watch(modelValue, () => { + debounceVerifyPassword(); + }); + onUnmounted(() => { tippyInstance.destroy(); }); diff --git a/dbm-ui/frontend/src/views/db-manage/common/permission/components/common/AccountCreate.vue b/dbm-ui/frontend/src/views/db-manage/common/permission/components/common/AccountCreate.vue index 4f6ebf0ada..c7408d71d2 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/permission/components/common/AccountCreate.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/permission/components/common/AccountCreate.vue @@ -54,7 +54,8 @@ + :db-type="dbTypeMap[accountType]" + @verify-result="verifyResult" />

{{ t('平台不会保存密码,请自行保管好。') }}