From 4ebc36d5a91ac8cdc8afdd0291e831533716f152 Mon Sep 17 00:00:00 2001 From: baiqi Date: Mon, 24 Jul 2023 17:46:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B5=84=E6=BA=90=E6=B1=A0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=81=94=E8=B0=83&=E9=83=A8=E5=88=86=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/modules/setting/resourcePool.ts | 30 ++- .../src/api/requrls/setting/resourcePool.ts | 1 + .../src/components/pure/ms-card/index.vue | 36 ++-- .../components/pure/ms-code-editor/types.ts | 4 + .../pure/ms-code-editor/userWorker.ts | 3 +- .../src/components/pure/ms-upload/index.vue | 31 ++- .../components/pure/ms-upload/locale/en-US.ts | 3 + .../components/pure/ms-upload/locale/zh-CN.ts | 3 + frontend/src/enums/tableEnum.ts | 2 + frontend/src/layout/default-layout.vue | 2 +- frontend/src/models/setting/resourcePool.ts | 18 ++ .../components/jobTemplateDrawer.vue | 37 +++- .../setting/system/resourcePool/detail.vue | 49 +++-- .../setting/system/resourcePool/index.vue | 187 ++++++++++++------ 14 files changed, 297 insertions(+), 109 deletions(-) diff --git a/frontend/src/api/modules/setting/resourcePool.ts b/frontend/src/api/modules/setting/resourcePool.ts index 66096889eb..47381d0819 100644 --- a/frontend/src/api/modules/setting/resourcePool.ts +++ b/frontend/src/api/modules/setting/resourcePool.ts @@ -1,8 +1,20 @@ import MSR from '@/api/http/index'; -import { PoolListUrl, UpdatePoolUrl, AddPoolUrl, DetailPoolUrl } from '@/api/requrls/setting/resourcePool'; +import { + PoolListUrl, + UpdatePoolUrl, + AddPoolUrl, + DetailPoolUrl, + DeletePoolUrl, + EnablePoolUrl, +} from '@/api/requrls/setting/resourcePool'; import type { LocationQueryValue } from 'vue-router'; -import type { ResourcePoolItem, AddResourcePoolParams } from '@/models/setting/resourcePool'; +import type { + ResourcePoolItem, + AddResourcePoolParams, + UpdateResourcePoolParams, + ResourcePoolDetail, +} from '@/models/setting/resourcePool'; import type { TableQueryParams } from '@/models/common'; // 获取资源池列表 @@ -11,7 +23,7 @@ export function getPoolList(data: TableQueryParams) { } // 更新资源池信息 -export function updatePoolInfo(data: ResourcePoolItem) { +export function updatePoolInfo(data: UpdateResourcePoolParams) { return MSR.post({ url: UpdatePoolUrl, data }); } @@ -22,5 +34,15 @@ export function addPool(data: AddResourcePoolParams) { // 获取资源池详情 export function getPoolInfo(poolId: LocationQueryValue | LocationQueryValue[]) { - return MSR.get({ url: DetailPoolUrl, params: poolId }); + return MSR.get({ url: DetailPoolUrl, params: poolId }); +} + +// 删除资源池 +export function delPoolInfo(poolId: string) { + return MSR.get({ url: DeletePoolUrl, params: poolId }); +} + +// 启用/禁用资源池 +export function togglePoolStatus(poolId: string) { + return MSR.post({ url: EnablePoolUrl, params: poolId }); } diff --git a/frontend/src/api/requrls/setting/resourcePool.ts b/frontend/src/api/requrls/setting/resourcePool.ts index 72d0fd0a89..586de7e7ef 100644 --- a/frontend/src/api/requrls/setting/resourcePool.ts +++ b/frontend/src/api/requrls/setting/resourcePool.ts @@ -3,3 +3,4 @@ export const UpdatePoolUrl = '/test/resource/pool/update'; export const AddPoolUrl = '/test/resource/pool/add'; export const DeletePoolUrl = '/test/resource/pool/delete'; export const DetailPoolUrl = '/test/resource/pool/detail'; +export const EnablePoolUrl = '/test/resource/pool/set/enable/'; diff --git a/frontend/src/components/pure/ms-card/index.vue b/frontend/src/components/pure/ms-card/index.vue index f3cf2ec93f..e5b63f0d81 100644 --- a/frontend/src/components/pure/ms-card/index.vue +++ b/frontend/src/components/pure/ms-card/index.vue @@ -7,7 +7,13 @@
- +
@@ -20,11 +26,11 @@ {{ t('mscard.defaultCancelText') }} - + {{ t('mscard.defaultSaveAndContinueText') }} - {{ t(idEdit ? 'mscard.defaultConfirm' : 'mscard.defaultUpdate') }} + {{ t(props.isEdit ? 'mscard.defaultUpdate' : 'mscard.defaultConfirm') }} @@ -37,20 +43,24 @@ import { useRouter } from 'vue-router'; const props = withDefaults( - defineProps<{ - simple?: boolean; - title?: string; - hideContinue?: boolean; - handleBack?: () => void; - hideFooter?: boolean; - loading?: boolean; - idEdit?: boolean; - }>(), + defineProps< + Partial<{ + simple: boolean; + title: string; + hideContinue: boolean; + hideFooter: boolean; + loading: boolean; + isEdit: boolean; + specialHeight: number; // 特殊高度,例如某些页面有面包屑 + handleBack: () => void; + }> + >(), { simple: false, hideContinue: false, hideFooter: false, - idEdit: false, + isEdit: false, + specialHeight: 0, } ); diff --git a/frontend/src/components/pure/ms-code-editor/types.ts b/frontend/src/components/pure/ms-code-editor/types.ts index 2e8bc67fc0..a788a71d0b 100644 --- a/frontend/src/components/pure/ms-code-editor/types.ts +++ b/frontend/src/components/pure/ms-code-editor/types.ts @@ -58,6 +58,10 @@ export const editorProps = { }, default: 'vs-dark', }, + readOnly: { + type: Boolean as PropType, + default: false, + }, options: { type: Object as PropType, default() { diff --git a/frontend/src/components/pure/ms-code-editor/userWorker.ts b/frontend/src/components/pure/ms-code-editor/userWorker.ts index 20715cc429..53d634f91b 100644 --- a/frontend/src/components/pure/ms-code-editor/userWorker.ts +++ b/frontend/src/components/pure/ms-code-editor/userWorker.ts @@ -1,5 +1,5 @@ import * as monaco from 'monaco-editor'; -import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; +// import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; // import JsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'; // import CssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker'; // import HtmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'; @@ -26,6 +26,7 @@ self.MonacoEnvironment = { return new TsWorker(); } + const EditorWorker = ((await import('monaco-editor/esm/vs/editor/editor.worker?worker')) as any).default; return new EditorWorker(); }, }; diff --git a/frontend/src/components/pure/ms-upload/index.vue b/frontend/src/components/pure/ms-upload/index.vue index faefa39e11..feb4ad16f1 100644 --- a/frontend/src/components/pure/ms-upload/index.vue +++ b/frontend/src/components/pure/ms-upload/index.vue @@ -13,8 +13,17 @@