From 0c83303953b8cae68f77148d7f3c004ef7799094 Mon Sep 17 00:00:00 2001 From: 0xJacky Date: Sat, 6 Sep 2025 03:46:32 +0000 Subject: [PATCH] feat: add useGlobalApp composable and integrate it into various components for improved message handling --- app/.eslint-auto-import.mjs | 1 + app/auto-imports.d.ts | 2 ++ app/src/components/ConfigHistory/ConfigHistory.vue | 2 +- app/src/components/NamespaceTabs/NamespaceTabs.vue | 2 +- .../NgxConfigEditor/directive/DirectiveEditorItem.vue | 2 +- app/src/components/PortScanner/PortScannerCompact.vue | 3 ++- app/src/components/SystemRestore/SystemRestoreContent.vue | 2 +- app/src/components/TwoFA/use2FAModal.ts | 1 - app/src/layouts/HeaderLayout.vue | 2 +- app/src/lib/http/error.ts | 1 - .../backup/AutoBackup/components/StorageConfigEditor.vue | 2 +- app/src/views/backup/components/BackupCreator.vue | 1 - app/src/views/backup/components/SystemRestore.vue | 3 ++- app/src/views/config/components/ConfigLeftPanel.vue | 2 +- app/src/views/config/components/ConfigName.vue | 2 +- app/src/views/config/components/Delete.vue | 2 +- app/src/views/config/components/Mkdir.vue | 2 +- app/src/views/config/components/Rename.vue | 2 +- app/src/views/dashboard/SiteNavigation.vue | 2 +- app/src/views/dashboard/components/ParamsOptimization.vue | 2 +- app/src/views/dashboard/components/SiteHealthCheckModal.vue | 2 +- app/src/views/install/components/InstallForm.vue | 3 ++- app/src/views/install/components/InstallView.vue | 2 +- app/src/views/node/Node.vue | 2 +- app/src/views/notification/Notification.vue | 2 +- app/src/views/other/Login.vue | 3 ++- app/src/views/site/components/SiteStatusSelect.vue | 3 ++- app/src/views/site/site_add/SiteAdd.vue | 2 +- app/src/views/site/site_edit/components/Cert/ObtainCert.vue | 3 ++- .../views/site/site_edit/components/ConfigName/ConfigName.vue | 2 +- app/src/views/site/site_list/SiteDuplicate.vue | 4 ++-- app/src/views/stream/StreamList.vue | 2 +- app/src/views/stream/components/ConfigName.vue | 2 +- app/src/views/stream/components/StreamDuplicate.vue | 4 ++-- app/src/views/stream/components/StreamStatusSelect.vue | 3 ++- app/src/views/user/UserProfile.vue | 2 +- app/vite.config.ts | 3 +++ 37 files changed, 46 insertions(+), 36 deletions(-) diff --git a/app/.eslint-auto-import.mjs b/app/.eslint-auto-import.mjs index 4d0cb2a4..46293319 100644 --- a/app/.eslint-auto-import.mjs +++ b/app/.eslint-auto-import.mjs @@ -87,6 +87,7 @@ export default { "useAttrs": true, "useCssModule": true, "useCssVars": true, + "useGlobalApp": true, "useId": true, "useLink": true, "useModel": true, diff --git a/app/auto-imports.d.ts b/app/auto-imports.d.ts index ca080ff2..4c301081 100644 --- a/app/auto-imports.d.ts +++ b/app/auto-imports.d.ts @@ -82,6 +82,7 @@ declare global { const useAttrs: typeof import('vue')['useAttrs'] const useCssModule: typeof import('vue')['useCssModule'] const useCssVars: typeof import('vue')['useCssVars'] + const useGlobalApp: typeof import('@/composables/useGlobalApp')['useGlobalApp'] const useId: typeof import('vue')['useId'] const useLink: typeof import('vue-router')['useLink'] const useModel: typeof import('vue')['useModel'] @@ -176,6 +177,7 @@ declare module 'vue' { readonly useAttrs: UnwrapRef readonly useCssModule: UnwrapRef readonly useCssVars: UnwrapRef + readonly useGlobalApp: UnwrapRef readonly useId: UnwrapRef readonly useLink: UnwrapRef readonly useModel: UnwrapRef diff --git a/app/src/components/ConfigHistory/ConfigHistory.vue b/app/src/components/ConfigHistory/ConfigHistory.vue index 9687a507..b45d907c 100644 --- a/app/src/components/ConfigHistory/ConfigHistory.vue +++ b/app/src/components/ConfigHistory/ConfigHistory.vue @@ -3,7 +3,6 @@ import type { Key } from 'ant-design-vue/es/_util/type' import type { ConfigBackup } from '@/api/config' import type { GetListResponse } from '@/api/curd' import { datetimeRender, StdPagination } from '@uozi-admin/curd' -import { message } from 'ant-design-vue' import config from '@/api/config' // Define props for the component @@ -14,6 +13,7 @@ const props = defineProps<{ // Define modal props using defineModel with boolean type const visible = defineModel('visible') const currentContent = defineModel('currentContent') +const { message } = useGlobalApp() // Import DiffViewer asynchronously with loading options const DiffViewer = defineAsyncComponent({ diff --git a/app/src/components/NamespaceTabs/NamespaceTabs.vue b/app/src/components/NamespaceTabs/NamespaceTabs.vue index 65be7bd5..cda4c393 100644 --- a/app/src/components/NamespaceTabs/NamespaceTabs.vue +++ b/app/src/components/NamespaceTabs/NamespaceTabs.vue @@ -1,6 +1,5 @@