From 75258bb465abc096e35d3b53f949eca39327858a Mon Sep 17 00:00:00 2001 From: ssongliu Date: Wed, 13 May 2026 13:45:50 +0800 Subject: [PATCH] fix: tighten frontend RBAC permission guards (#12717) * fix: tighten frontend RBAC permission guards * feat: add permission directive coverage * refactor frontend global store usage --- frontend/src/App.vue | 24 ++-- frontend/src/api/helper/check-status.ts | 8 +- frontend/src/api/index.ts | 34 ++--- frontend/src/api/modules/backup.ts | 11 +- .../src/components/complex-table/index.vue | 9 +- frontend/src/components/drawer-pro/index.vue | 17 ++- frontend/src/components/fu/FuDropdownItem.vue | 38 +++++ .../src/components/fu/FuInputRwSwitch.vue | 20 ++- .../src/components/fu/FuReadWriteSwitch.vue | 15 +- .../src/components/fu/FuSelectRwSwitch.vue | 18 ++- .../src/components/fu/FuTableOperations.vue | 6 +- frontend/src/components/fu/index.ts | 2 + frontend/src/components/fu/shared.ts | 2 + .../src/components/license-import/index.vue | 20 +-- frontend/src/components/log/compose/index.vue | 12 +- .../components/log/container-drawer/index.vue | 14 +- .../src/components/log/container/index.vue | 8 +- .../src/components/log/file-drawer/index.vue | 12 +- frontend/src/components/log/file/index.vue | 8 +- frontend/src/components/port-jump/index.vue | 8 +- frontend/src/components/status/index.vue | 17 ++- .../src/components/system-upgrade/index.vue | 26 ++-- .../system-upgrade/upgrade/index.vue | 8 +- frontend/src/components/task-list/index.vue | 6 +- frontend/src/components/terminal/index.vue | 7 +- .../components/v-charts/components/Line.vue | 8 +- .../components/v-charts/components/Pie.vue | 8 +- frontend/src/components/vscode-open/index.vue | 12 +- .../composables/useMenuManagePermission.ts | 53 +++++++ frontend/src/directives/index.ts | 2 + frontend/src/directives/modules/permission.ts | 134 ++++++++++++++++++ frontend/src/edition/community/index.ts | 9 -- frontend/src/edition/load.ts | 17 --- frontend/src/edition/provider.ts | 7 - frontend/src/global/use-logo.ts | 28 ++-- frontend/src/global/use-theme.ts | 18 +-- frontend/src/layout/components/AppFooter.vue | 7 +- .../Sidebar/components/Collapse.vue | 35 +++-- .../components/Sidebar/components/Logo.vue | 8 +- .../Sidebar/components/user-info/index.vue | 14 +- .../src/layout/components/Sidebar/index.vue | 55 ++++--- frontend/src/layout/hooks/useResize.ts | 4 +- frontend/src/layout/index.vue | 67 +++++---- frontend/src/main.ts | 2 +- frontend/src/routers/index.ts | 31 ++-- frontend/src/routers/modules/container.ts | 1 + frontend/src/routers/modules/cronjob.ts | 1 + frontend/src/routers/modules/database.ts | 1 + frontend/src/routers/modules/website.ts | 1 + frontend/src/store/modules/global.ts | 18 +-- frontend/src/utils/app.ts | 3 +- frontend/src/utils/auth-response.ts | 8 +- frontend/src/utils/node.ts | 26 ++-- frontend/src/utils/permission.ts | 67 +++++++++ frontend/src/utils/rbac.ts | 19 +-- frontend/src/utils/stream-auth.ts | 8 +- frontend/src/utils/xpack.ts | 112 +++++++-------- .../src/views/ai/agents/agent/add/index.vue | 6 +- .../agents/agent/components/hermes-chat.vue | 3 + .../ai/agents/agent/components/terminal.vue | 4 +- .../config/tabs/agents/binding/index.vue | 5 +- .../agent/config/tabs/agents/create/index.vue | 6 +- .../agent/config/tabs/agents/detail/index.vue | 2 +- .../agents/agent/config/tabs/agents/index.vue | 14 +- .../tabs/channels/components/channel-bots.vue | 35 +++-- .../channels/components/plugin-install.vue | 6 +- .../config/tabs/channels/hermes/dingtalk.vue | 6 +- .../config/tabs/channels/hermes/discord.vue | 6 +- .../config/tabs/channels/hermes/feishu.vue | 6 +- .../agent/config/tabs/channels/hermes/qq.vue | 6 +- .../config/tabs/channels/hermes/telegram.vue | 6 +- .../config/tabs/channels/hermes/wecom.vue | 6 +- .../config/tabs/channels/hermes/weixin.vue | 4 +- .../tabs/channels/openclaw/dingtalk.vue | 2 +- .../config/tabs/channels/openclaw/discord.vue | 3 +- .../config/tabs/channels/openclaw/feishu.vue | 2 +- .../config/tabs/channels/openclaw/qq.vue | 2 +- .../tabs/channels/openclaw/telegram.vue | 3 +- .../config/tabs/channels/openclaw/wecom.vue | 10 +- .../config/tabs/channels/openclaw/weixin.vue | 8 +- .../ai/agents/agent/config/tabs/model.vue | 6 +- .../config/tabs/settings/config-file.vue | 2 +- .../agent/config/tabs/settings/other.vue | 2 +- .../agent/config/tabs/settings/security.vue | 2 +- .../agent/config/tabs/skills/hermes.vue | 3 + .../agent/config/tabs/skills/openclaw.vue | 3 + .../views/ai/agents/agent/delete/index.vue | 2 +- frontend/src/views/ai/agents/agent/index.vue | 50 +++++-- .../views/ai/agents/agent/website/index.vue | 2 +- .../src/views/ai/agents/model/add/index.vue | 2 +- frontend/src/views/ai/agents/model/index.vue | 6 +- .../src/views/ai/agents/model/pool/index.vue | 6 +- .../src/views/ai/mcp/server/bind/index.vue | 2 +- .../src/views/ai/mcp/server/import/index.vue | 2 +- frontend/src/views/ai/mcp/server/index.vue | 10 +- .../src/views/ai/mcp/server/operate/index.vue | 10 +- .../src/views/ai/mcp/server/volume/index.vue | 6 +- .../src/views/ai/model/ollama/add/index.vue | 2 +- .../src/views/ai/model/ollama/conn/index.vue | 8 +- .../src/views/ai/model/ollama/del/index.vue | 7 +- .../views/ai/model/ollama/domain/index.vue | 2 +- frontend/src/views/ai/model/ollama/index.vue | 22 ++- .../src/views/ai/model/tensorrt/index.vue | 7 +- .../views/ai/model/tensorrt/operate/index.vue | 2 +- .../src/views/app-store/apps/app/index.vue | 1 + frontend/src/views/app-store/apps/index.vue | 4 +- .../src/views/app-store/detail/form/index.vue | 8 +- frontend/src/views/app-store/detail/index.vue | 1 + .../views/app-store/installed/app/header.vue | 19 ++- .../src/views/app-store/installed/index.vue | 5 + .../src/views/app-store/setting/index.vue | 12 +- .../src/views/container/compose/index.vue | 46 ++++-- .../src/views/container/container/index.vue | 81 +++++++---- .../container/container/operate/index.vue | 12 +- .../src/views/container/dashboard/index.vue | 4 + frontend/src/views/container/image/index.vue | 18 ++- .../src/views/container/network/index.vue | 7 +- frontend/src/views/container/repo/index.vue | 5 +- .../src/views/container/setting/index.vue | 47 +++--- .../views/container/setting/ipv6/index.vue | 8 +- .../src/views/container/template/index.vue | 16 ++- frontend/src/views/container/volume/index.vue | 8 +- .../views/cronjob/cronjob/backup/index.vue | 6 +- frontend/src/views/cronjob/cronjob/index.vue | 39 +++-- .../views/cronjob/cronjob/operate/index.vue | 16 +-- .../views/cronjob/cronjob/record/index.vue | 5 +- frontend/src/views/cronjob/library/index.vue | 30 ++-- .../src/views/cronjob/library/run/index.vue | 6 +- .../src/views/database/mongodb/conn/index.vue | 13 +- frontend/src/views/database/mongodb/index.vue | 29 ++-- .../views/database/mongodb/remote/index.vue | 4 +- .../src/views/database/mysql/conn/index.vue | 20 ++- frontend/src/views/database/mysql/index.vue | 31 ++-- .../src/views/database/mysql/remote/index.vue | 4 +- .../views/database/mysql/setting/index.vue | 9 +- .../database/mysql/setting/slow-log/index.vue | 1 + .../mysql/setting/variables/index.vue | 2 +- .../views/database/postgresql/conn/index.vue | 13 +- .../src/views/database/postgresql/index.vue | 31 ++-- .../database/postgresql/remote/index.vue | 4 +- .../database/postgresql/setting/index.vue | 9 +- .../views/database/redis/command/index.vue | 7 +- .../src/views/database/redis/conn/index.vue | 13 +- frontend/src/views/database/redis/index.vue | 18 +-- .../src/views/database/redis/remote/index.vue | 4 +- .../views/database/redis/setting/index.vue | 6 +- .../redis/setting/persistence/index.vue | 30 +++- frontend/src/views/home/app/index.vue | 14 +- frontend/src/views/home/index.vue | 112 +++++++++++---- .../disk-management/components/disk-card.vue | 26 +++- .../host/disk-management/partition/index.vue | 8 +- .../ai-search/file-ai-search-drawer.vue | 4 +- .../host/file-management/compress/index.vue | 8 +- .../host/file-management/convert/index.vue | 6 +- .../host/file-management/decompress/index.vue | 8 +- .../host/file-management/favorite/index.vue | 1 + .../src/views/host/file-management/index.vue | 130 ++++++++++++----- .../host/file-management/process/index.vue | 6 +- .../file-management/recycle-bin/index.vue | 16 ++- .../host/file-management/share-list/index.vue | 1 + .../host/file-management/share/index.vue | 12 +- .../file-management/text-preview/index.vue | 6 +- .../src/views/host/firewall/advance/index.vue | 10 +- .../src/views/host/firewall/forward/index.vue | 10 +- frontend/src/views/host/firewall/ip/index.vue | 20 ++- .../src/views/host/firewall/port/index.vue | 20 ++- .../src/views/host/firewall/status/index.vue | 25 +++- .../src/views/host/monitor/monitor/index.vue | 11 +- .../host/monitor/setting/default-io/index.vue | 6 +- .../monitor/setting/default-network/index.vue | 6 +- .../src/views/host/monitor/setting/index.vue | 13 +- .../src/views/host/process/network/index.vue | 7 +- .../src/views/host/process/process/index.vue | 28 ++-- frontend/src/views/host/ssh/log/log.vue | 10 +- frontend/src/views/host/ssh/session/index.vue | 7 +- .../host/ssh/ssh/certification/index.vue | 8 +- frontend/src/views/host/ssh/ssh/index.vue | 22 +-- frontend/src/views/log/login/index.vue | 2 +- frontend/src/views/log/operation/index.vue | 20 +-- frontend/src/views/log/system/index.vue | 11 +- frontend/src/views/log/website/index.vue | 4 +- .../src/views/login/components/login-form.vue | 94 ++++++------ frontend/src/views/login/index.vue | 16 +-- frontend/src/views/setting/about/index.vue | 10 +- .../src/views/setting/alert/dash/index.vue | 9 +- .../src/views/setting/alert/setting/index.vue | 10 +- .../setting/backup-account/operate/index.vue | 15 +- .../views/setting/license-required/index.vue | 56 +++++--- .../src/views/setting/license/bind/xpack.vue | 6 +- frontend/src/views/setting/license/index.vue | 4 +- .../src/views/setting/panel/edition/index.vue | 8 +- .../views/setting/panel/hidemenu/index.vue | 6 +- frontend/src/views/setting/panel/index.vue | 69 ++++----- .../src/views/setting/panel/name/index.vue | 9 +- .../src/views/setting/panel/proxy/index.vue | 8 +- .../views/setting/panel/theme-color/index.vue | 16 +-- .../views/setting/panel/watermark/index.vue | 14 +- .../src/views/setting/safe/bind/index.vue | 10 +- .../src/views/setting/safe/entrance/index.vue | 10 +- frontend/src/views/setting/safe/index.vue | 10 +- .../src/views/setting/safe/port/index.vue | 13 +- frontend/src/views/setting/safe/ssl/index.vue | 10 +- .../views/setting/snapshot/import/index.vue | 6 +- .../src/views/terminal/terminal/index.vue | 23 ++- frontend/src/views/toolbox/clam/index.vue | 23 +-- .../src/views/toolbox/clam/operate/index.vue | 28 ++-- .../src/views/toolbox/clam/record/index.vue | 4 +- .../src/views/toolbox/clam/setting/index.vue | 2 +- .../src/views/toolbox/clam/status/index.vue | 24 +++- frontend/src/views/toolbox/clean/index.vue | 3 +- .../src/views/toolbox/device/dns/index.vue | 2 +- .../views/toolbox/device/hostname/index.vue | 2 +- .../src/views/toolbox/device/hosts/index.vue | 4 +- frontend/src/views/toolbox/device/index.vue | 16 +-- .../src/views/toolbox/device/ntp/index.vue | 8 +- .../src/views/toolbox/device/passwd/index.vue | 2 +- .../src/views/toolbox/device/swap/index.vue | 2 +- .../views/toolbox/device/time-zone/index.vue | 8 +- .../toolbox/fail2ban/ban-action/index.vue | 2 +- .../views/toolbox/fail2ban/ban-time/index.vue | 2 +- .../toolbox/fail2ban/find-time/index.vue | 2 +- frontend/src/views/toolbox/fail2ban/index.vue | 45 +++--- .../src/views/toolbox/fail2ban/ips/index.vue | 2 +- .../views/toolbox/fail2ban/log-path/index.vue | 4 +- .../toolbox/fail2ban/max-retry/index.vue | 2 +- .../src/views/toolbox/fail2ban/port/index.vue | 2 +- frontend/src/views/toolbox/ftp/index.vue | 23 +-- .../src/views/toolbox/ftp/operate/index.vue | 8 +- frontend/src/views/toolbox/index.vue | 12 +- .../toolbox/supervisor/config/basic/index.vue | 2 +- .../supervisor/config/source/index.vue | 2 +- .../views/toolbox/supervisor/create/index.vue | 4 +- .../views/toolbox/supervisor/file/index.vue | 8 +- .../src/views/toolbox/supervisor/index.vue | 20 +-- .../views/toolbox/supervisor/log/index.vue | 8 +- .../views/toolbox/supervisor/status/index.vue | 34 +++-- .../toolbox/supervisor/status/init/index.vue | 2 +- .../website/runtime/components/terminal.vue | 6 +- .../views/website/runtime/dotnet/index.vue | 11 +- .../src/views/website/runtime/go/index.vue | 4 +- .../src/views/website/runtime/java/index.vue | 11 +- .../src/views/website/runtime/node/index.vue | 11 +- .../website/runtime/php/create/index.vue | 14 +- .../runtime/php/extension-template/index.vue | 5 +- .../php/extension-template/operate/index.vue | 8 +- .../src/views/website/runtime/php/index.vue | 11 +- .../website/runtime/php/supervisor/index.vue | 3 +- .../views/website/runtime/python/index.vue | 11 +- .../views/website/ssl/acme-account/index.vue | 4 +- frontend/src/views/website/ssl/ca/index.vue | 4 +- .../src/views/website/ssl/create/index.vue | 6 +- .../views/website/ssl/dns-account/index.vue | 3 +- frontend/src/views/website/ssl/index.vue | 19 ++- .../website/config/basic/auth-basic/index.vue | 6 +- .../config/basic/load-balance/index.vue | 3 +- .../website/config/basic/proxy/index.vue | 23 ++- .../website/config/basic/redirect/index.vue | 9 +- frontend/src/views/website/website/index.vue | 20 ++- .../website/website/nginx/module/index.vue | 12 +- 259 files changed, 2309 insertions(+), 1340 deletions(-) create mode 100644 frontend/src/components/fu/FuDropdownItem.vue create mode 100644 frontend/src/composables/useMenuManagePermission.ts create mode 100644 frontend/src/directives/modules/permission.ts delete mode 100644 frontend/src/edition/community/index.ts delete mode 100644 frontend/src/edition/load.ts delete mode 100644 frontend/src/edition/provider.ts create mode 100644 frontend/src/utils/permission.ts diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 7abba6f42..7316b9586 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -6,7 +6,7 @@ diff --git a/frontend/src/components/fu/FuDropdownItem.vue b/frontend/src/components/fu/FuDropdownItem.vue new file mode 100644 index 000000000..a7c7cd7a8 --- /dev/null +++ b/frontend/src/components/fu/FuDropdownItem.vue @@ -0,0 +1,38 @@ + + + diff --git a/frontend/src/components/fu/FuInputRwSwitch.vue b/frontend/src/components/fu/FuInputRwSwitch.vue index d33226355..fcdf8e675 100644 --- a/frontend/src/components/fu/FuInputRwSwitch.vue +++ b/frontend/src/components/fu/FuInputRwSwitch.vue @@ -42,6 +42,11 @@ const emit = defineEmits(['update:modelValue', 'input', 'blur', 'enter']); const inputRef = ref(); const isWrite = ref(false); +const permissionDisabled = ref(false); + +const effectiveWriteTrigger = computed(() => { + return permissionDisabled.value ? 'disabled' : props.writeTrigger; +}); const displayValue = computed(() => { return props.modelValue === '' || props.modelValue === undefined || props.modelValue === null @@ -61,13 +66,13 @@ const closeWrite = () => { }; const handleReadClick = () => { - if (props.writeTrigger === 'onClick') { + if (effectiveWriteTrigger.value === 'onClick') { openWrite(); } }; const handleReadDblClick = () => { - if (props.writeTrigger === 'onDblclick') { + if (effectiveWriteTrigger.value === 'onDblclick') { openWrite(); } }; @@ -89,4 +94,15 @@ const handleEnter = (event: KeyboardEvent) => { emit('enter', event); closeWrite(); }; + +defineExpose({ + setPermissionDisabled: (disabled: boolean) => { + permissionDisabled.value = disabled; + if (disabled) { + isWrite.value = false; + } + }, + write: openWrite, + read: closeWrite, +}); diff --git a/frontend/src/components/fu/FuReadWriteSwitch.vue b/frontend/src/components/fu/FuReadWriteSwitch.vue index e10293514..b03f90dbe 100644 --- a/frontend/src/components/fu/FuReadWriteSwitch.vue +++ b/frontend/src/components/fu/FuReadWriteSwitch.vue @@ -39,6 +39,11 @@ const props = defineProps({ const emit = defineEmits(['update:modelValue', 'change']); const isWrite = ref(false); +const permissionDisabled = ref(false); + +const effectiveWriteTrigger = computed(() => { + return permissionDisabled.value ? 'disabled' : props.writeTrigger; +}); const displayValue = computed(() => { const value = props.modelValue !== '' && props.modelValue !== undefined ? props.modelValue : props.data; @@ -58,18 +63,24 @@ const closeWrite = (value?: any) => { }; const handleReadClick = () => { - if (props.writeTrigger === 'onClick') { + if (effectiveWriteTrigger.value === 'onClick') { openWrite(); } }; const handleReadDblClick = () => { - if (props.writeTrigger === 'onDblclick') { + if (effectiveWriteTrigger.value === 'onDblclick') { openWrite(); } }; defineExpose({ + setPermissionDisabled: (disabled: boolean) => { + permissionDisabled.value = disabled; + if (disabled) { + isWrite.value = false; + } + }, write: openWrite, read: closeWrite, }); diff --git a/frontend/src/components/fu/FuSelectRwSwitch.vue b/frontend/src/components/fu/FuSelectRwSwitch.vue index 8ac5a94e6..b7a280df7 100644 --- a/frontend/src/components/fu/FuSelectRwSwitch.vue +++ b/frontend/src/components/fu/FuSelectRwSwitch.vue @@ -50,6 +50,20 @@ const emit = defineEmits(['update:modelValue', 'input', 'blur', 'change']); const selectRef = ref(); const isWrite = ref(false); +const permissionDisabled = ref(false); + +defineExpose({ + setPermissionDisabled: (disabled: boolean) => { + permissionDisabled.value = disabled; + if (disabled) { + isWrite.value = false; + } + }, +}); + +const effectiveWriteTrigger = computed(() => { + return permissionDisabled.value ? 'disabled' : props.writeTrigger; +}); const displayValue = computed(() => { return props.modelValue === '' || props.modelValue === undefined || props.modelValue === null @@ -70,13 +84,13 @@ const closeWrite = () => { }; const handleReadClick = () => { - if (props.writeTrigger === 'onClick') { + if (effectiveWriteTrigger.value === 'onClick') { openWrite(); } }; const handleReadDblClick = () => { - if (props.writeTrigger === 'onDblclick') { + if (effectiveWriteTrigger.value === 'onDblclick') { openWrite(); } }; diff --git a/frontend/src/components/fu/FuTableOperations.vue b/frontend/src/components/fu/FuTableOperations.vue index 55c9e598e..0dbe06f8a 100644 --- a/frontend/src/components/fu/FuTableOperations.vue +++ b/frontend/src/components/fu/FuTableOperations.vue @@ -59,6 +59,7 @@ import { computed, type PropType } from 'vue'; import { useI18n } from 'vue-i18n'; import { resolveMaybeFn, type FuTableOperationButton } from './shared'; +import { hasManagePermissionAccess } from '@/utils/permission'; defineOptions({ name: 'FuTableOperations' }); @@ -204,7 +205,10 @@ const getMoreButtons = (row: any) => { }; const isButtonDisabled = (button: FuTableOperationButton, row: any) => { - return Boolean(resolveMaybeFn(button.disabled ?? false, row)); + const permissionDisabled = + button.permission !== undefined && + !hasManagePermissionAccess(button.permission === true ? undefined : button.permission); + return permissionDisabled || Boolean(resolveMaybeFn(button.disabled ?? false, row)); }; const handleButtonClick = (button: FuTableOperationButton, row: any) => { diff --git a/frontend/src/components/fu/index.ts b/frontend/src/components/fu/index.ts index e2ab9f74c..0a1ebe0cc 100644 --- a/frontend/src/components/fu/index.ts +++ b/frontend/src/components/fu/index.ts @@ -1,6 +1,7 @@ import { type App } from 'vue'; import FuInputRwSwitch from './FuInputRwSwitch.vue'; +import FuDropdownItem from './FuDropdownItem.vue'; import FuReadWriteSwitch from './FuReadWriteSwitch.vue'; import FuSelectRwSwitch from './FuSelectRwSwitch.vue'; import FuStep from './FuStep'; @@ -14,6 +15,7 @@ const components = [ FuTable, FuTableOperations, FuTablePagination, + FuDropdownItem, FuInputRwSwitch, FuReadWriteSwitch, FuSelectRwSwitch, diff --git a/frontend/src/components/fu/shared.ts b/frontend/src/components/fu/shared.ts index e612a3065..c063d3ec0 100644 --- a/frontend/src/components/fu/shared.ts +++ b/frontend/src/components/fu/shared.ts @@ -1,4 +1,5 @@ import { Comment, Fragment, Text, type VNode } from 'vue'; +import type { PermissionBindingValue } from '@/utils/permission'; export interface FuTableColumnConfig { key: string; @@ -12,6 +13,7 @@ export interface FuTableOperationButton { label?: string | number; click?: (row: any) => void; disabled?: boolean | ((row: any) => boolean); + permission?: true | PermissionBindingValue; show?: boolean | ((row: any) => boolean); type?: string; icon?: any; diff --git a/frontend/src/components/license-import/index.vue b/frontend/src/components/license-import/index.vue index c8656f130..f50def483 100644 --- a/frontend/src/components/license-import/index.vue +++ b/frontend/src/components/license-import/index.vue @@ -61,10 +61,10 @@ import { ref } from 'vue'; import { MsgSuccess } from '@/utils/message'; import { uploadLicense, uploadEnterpriseLicense } from '@/api/modules/setting'; import DockerProxy from '@/components/docker-proxy/index.vue'; -import { GlobalStore } from '@/store'; import { UploadFile, UploadFiles, UploadInstance, UploadProps, UploadRawFile, genFileId } from 'element-plus'; import { getXpackSettingForTheme, loadMasterProductProFromDB, loadProductProFromDB } from '@/utils/xpack'; -const globalStore = GlobalStore(); +import { useGlobalStore } from '@/composables/useGlobalStore'; +const { isIntl, isEnterprise, currentNode, isProductPro, isMasterProductPro, isEnterpriseLicensed } = useGlobalStore(); const em = defineEmits(['search']); @@ -111,9 +111,9 @@ const handleExceed: UploadProps['onExceed'] = (files) => { uploadRef.value!.handleStart(file); }; -const toEdition = () => { - if (!globalStore.isIntl) { - window.open('https://1panel.cn/versions.html' + '', '_blank', 'noopener,noreferrer'); +const toLxware = () => { + if (!isIntl.value) { + window.open('https://www.lxware.cn/1panel' + '', '_blank', 'noopener,noreferrer'); } else { window.open('https://1panel.pro/pricing' + '', '_blank', 'noopener,noreferrer'); } @@ -126,7 +126,7 @@ const submit = async () => { const file = uploaderFiles.value[0]; const formData = new FormData(); formData.append('file', file.raw); - if (globalStore.isEnterprise) { + if (isEnterprise.value) { loading.value = true; await uploadEnterpriseLicense(formData) .then(async () => { @@ -143,7 +143,7 @@ const submit = async () => { formData.append('oldLicenseName', oldLicense.value); } if (!isImport.value) { - formData.append('currentNode', globalStore.currentNode); + formData.append('currentNode', currentNode.value); formData.append('withDockerRestart', withDockerRestart.value); } formData.append('isForce', isForce.value); @@ -166,10 +166,10 @@ const handleAfterSubmit = () => { open.value = false; MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); if (!isImport.value) { - if (!globalStore.isEnterprise) globalStore.isProductPro = true; - globalStore.isMasterProductPro = true; + if (!isEnterprise.value) isProductPro.value = true; + isMasterProductPro.value = true; } else { - globalStore.isEnterpriseLicensed = true; + isEnterpriseLicensed.value = true; } if (!withoutReload.value) { loadMasterProductProFromDB(); diff --git a/frontend/src/components/log/compose/index.vue b/frontend/src/components/log/compose/index.vue index 0af49a0eb..90ee7cf18 100644 --- a/frontend/src/components/log/compose/index.vue +++ b/frontend/src/components/log/compose/index.vue @@ -3,7 +3,7 @@ v-model="open" :header="resource" @close="handleClose" - :size="globalStore.isFullScreen ? 'full' : '60%'" + :size="isFullScreen ? 'full' : '60%'" :resource="container" > diff --git a/frontend/src/views/log/system/index.vue b/frontend/src/views/log/system/index.vue index afcec6f81..41face13f 100644 --- a/frontend/src/views/log/system/index.vue +++ b/frontend/src/views/log/system/index.vue @@ -14,12 +14,7 @@ {{ $t('commons.button.watch') }} - + @@ -44,8 +39,8 @@ import LogFile from '@/components/log/file/index.vue'; import LogRouter from '@/views/log/router/index.vue'; import { nextTick, onMounted, reactive, ref } from 'vue'; import { getSystemFiles } from '@/api/modules/log'; -import { GlobalStore } from '@/store'; -const globalStore = GlobalStore(); +import { useGlobalStore } from '@/composables/useGlobalStore'; +const { currentNode } = useGlobalStore(); const loading = ref(); const isWatch = ref(); diff --git a/frontend/src/views/log/website/index.vue b/frontend/src/views/log/website/index.vue index d50afa247..d992ef979 100644 --- a/frontend/src/views/log/website/index.vue +++ b/frontend/src/views/log/website/index.vue @@ -34,10 +34,10 @@ {{ $t('commons.button.watch') }} - + {{ $t('commons.button.download') }} - + {{ $t('logs.deleteLogs') }} diff --git a/frontend/src/views/login/components/login-form.vue b/frontend/src/views/login/components/login-form.vue index 5c189d30d..4f5cf9353 100644 --- a/frontend/src/views/login/components/login-form.vue +++ b/frontend/src/views/login/components/login-form.vue @@ -52,10 +52,10 @@