From 72dcdbad1e721212b9e78c0f6ae15d7fdde3dcd8 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Tue, 4 Jul 2023 10:46:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BA=94=E7=94=A8=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=8A=9F=E8=83=BD=20(#1520)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/modules/en.ts | 1 + frontend/src/lang/modules/tw.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + frontend/src/utils/util.ts | 15 +++++++++++++++ frontend/src/views/app-store/installed/index.vue | 12 ++++++++++-- frontend/src/views/container/container/index.vue | 12 +++--------- frontend/src/views/database/mysql/index.vue | 11 +++-------- 7 files changed, 34 insertions(+), 19 deletions(-) diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 9a45d07e6..18c62cfeb 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -114,6 +114,7 @@ const message = { fileNameErr: 'You can upload only files whose name contains 1 to 256 characters, including English, Chinese, digits, or periods (.-_)', confirmNoNull: 'Make sure the value {0} is not empty', + errPort: 'Incorrect port information, please confirm!', }, login: { username: 'UserName', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index e01073129..ecfcb1d5f 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -115,6 +115,7 @@ const message = { fileExist: '當前文件夾已存在該文件,不支持重復上傳!', fileNameErr: '僅支持上傳名稱包含英文、中文、數字或者 .-_ ,長度 1-256 位的文件', confirmNoNull: '請確認 {0} 值不為空', + errPort: '錯誤的端口信息,請確認!', }, login: { username: '用戶名', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 34a2cabf9..e10d7669d 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -115,6 +115,7 @@ const message = { fileExist: '当前文件夹已存在该文件,不支持重复上传!', fileNameErr: '仅支持上传名称包含英文、中文、数字或者 .-_ ,长度 1-256 位的文件', confirmNoNull: '请确认 {0} 值不为空', + errPort: '错误的端口信息,请确认!', }, login: { username: '用户名', diff --git a/frontend/src/utils/util.ts b/frontend/src/utils/util.ts index 432a88a2b..9d4d64adc 100644 --- a/frontend/src/utils/util.ts +++ b/frontend/src/utils/util.ts @@ -1,4 +1,6 @@ +import { getSettingInfo } from '@/api/modules/setting'; import i18n from '@/lang'; +import { MsgError } from './message'; export function deepCopy(obj: any): T { let newObj: any; @@ -256,3 +258,16 @@ export function downloadFile(filePath: string) { let url = `${import.meta.env.VITE_API_URL as string}/files/download?`; window.open(url + 'path=' + filePath, '_blank'); } + +export async function JumpDashboard(port: any) { + if (Number(port) === 0) { + MsgError(i18n.global.t('setting.errPort')); + return; + } + const res = await getSettingInfo(); + if (!res.data.systemIP) { + MsgError(i18n.global.t('setting.systemIPWarning')); + return; + } + window.open(`http://${res.data.systemIP}:${port}`, '_blank'); +} diff --git a/frontend/src/views/app-store/installed/index.vue b/frontend/src/views/app-store/installed/index.vue index a08386d5e..3b2aab73b 100644 --- a/frontend/src/views/app-store/installed/index.vue +++ b/frontend/src/views/app-store/installed/index.vue @@ -187,8 +187,15 @@
- {{ $t('app.version') }}:{{ installed.version }} - + + {{ $t('app.version') }}:{{ installed.version }} + + + {{ $t('app.busPort') }}:{{ installed.httpPort }}
@@ -257,6 +264,7 @@ import { getAge } from '@/utils/util'; import { useRouter } from 'vue-router'; import { MsgSuccess } from '@/utils/message'; import { toFolder } from '@/global/business'; +import { JumpDashboard } from '@/utils/util'; const data = ref(); const loading = ref(false); diff --git a/frontend/src/views/container/container/index.vue b/frontend/src/views/container/container/index.vue index 5a46ec675..09ba4dca7 100644 --- a/frontend/src/views/container/container/index.vue +++ b/frontend/src/views/container/container/index.vue @@ -164,9 +164,8 @@ import { Container } from '@/api/interface/container'; import { ElMessageBox } from 'element-plus'; import i18n from '@/lang'; import router from '@/routers'; -import { MsgError, MsgSuccess } from '@/utils/message'; -import { computeSize } from '@/utils/util'; -import { getSettingInfo } from '@/api/modules/setting'; +import { MsgSuccess } from '@/utils/message'; +import { JumpDashboard, computeSize } from '@/utils/util'; const loading = ref(); const data = ref(); @@ -201,12 +200,7 @@ const goDashboard = async (port: any) => { return; } let portEx = port.split(':')[0]; - const res = await getSettingInfo(); - if (!res.data.systemIP) { - MsgError(i18n.global.t('setting.systemIPWarning')); - return; - } - window.open(`http://${res.data.systemIP}:${portEx}`, '_blank'); + JumpDashboard(portEx); }; const goSetting = async () => { diff --git a/frontend/src/views/database/mysql/index.vue b/frontend/src/views/database/mysql/index.vue index 789a9a6f0..f81b33fca 100644 --- a/frontend/src/views/database/mysql/index.vue +++ b/frontend/src/views/database/mysql/index.vue @@ -155,7 +155,7 @@ import Setting from '@/views/database/mysql/setting/index.vue'; import AppStatus from '@/components/app-status/index.vue'; import Backups from '@/components/backup/index.vue'; import UploadDialog from '@/components/upload/index.vue'; -import { dateFormat } from '@/utils/util'; +import { JumpDashboard, dateFormat } from '@/utils/util'; import { reactive, ref } from 'vue'; import { deleteCheckMysqlDB, loadRemoteAccess, searchMysqlDBs, updateMysqlDescription } from '@/api/modules/database'; import i18n from '@/lang'; @@ -165,7 +165,6 @@ import { GetAppPort } from '@/api/modules/app'; import router from '@/routers'; import { MsgError, MsgSuccess } from '@/utils/message'; import useClipboard from 'vue-clipboard3'; -import { getSettingInfo } from '@/api/modules/setting'; const { toClipboard } = useClipboard(); const loading = ref(false); @@ -265,13 +264,9 @@ const goDashboard = async () => { phpVisiable.value = true; return; } - const res = await getSettingInfo(); - if (!res.data.systemIP) { - MsgError(i18n.global.t('setting.systemIPWarning')); - return; - } - window.open(`http://${res.data.systemIP}:${phpadminPort.value}`, '_blank'); + JumpDashboard(phpadminPort.value); }; + const getAppDetail = (key: string) => { router.push({ name: 'AppDetail', params: { appKey: key } }); };