From 8e651f1c6066b7895e6e53635e1bdc32148d7e48 Mon Sep 17 00:00:00 2001 From: Lazy <2211717435@qq.com> Date: Mon, 16 Oct 2023 12:38:04 +0800 Subject: [PATCH 1/6] Optimize: user list --- frontend/src/widgets/UserList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/widgets/UserList.vue b/frontend/src/widgets/UserList.vue index 200a56fc..7a89f28c 100644 --- a/frontend/src/widgets/UserList.vue +++ b/frontend/src/widgets/UserList.vue @@ -346,7 +346,7 @@ onMounted(async () => { --> - + {{ t("TXT_CODE_fe731dfc") }} From 7942f310f756cbd2a3d40836b41d8a0230ab7e99 Mon Sep 17 00:00:00 2001 From: Lazy <2211717435@qq.com> Date: Mon, 16 Oct 2023 12:38:24 +0800 Subject: [PATCH 2/6] Feat: select instances --- frontend/components.d.ts | 1 + frontend/src/components/SelectInstances.vue | 226 ++++++++++++++++++ frontend/src/types/index.ts | 12 +- frontend/src/widgets/user/AccessSettings.vue | 98 +++++--- .../src/widgets/user/dialog/UserResources.vue | 54 +++++ 5 files changed, 348 insertions(+), 43 deletions(-) create mode 100644 frontend/src/components/SelectInstances.vue create mode 100644 frontend/src/widgets/user/dialog/UserResources.vue diff --git a/frontend/components.d.ts b/frontend/components.d.ts index 11b05744..9d406d14 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -69,5 +69,6 @@ declare module 'vue' { PlaceHolderCard: typeof import('./src/components/PlaceHolderCard.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] + SelectInstances: typeof import('./src/components/SelectInstances.vue')['default'] } } diff --git a/frontend/src/components/SelectInstances.vue b/frontend/src/components/SelectInstances.vue new file mode 100644 index 00000000..ebfba39a --- /dev/null +++ b/frontend/src/components/SelectInstances.vue @@ -0,0 +1,226 @@ + + + + + diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index 62dee759..3235c6c8 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -99,17 +99,17 @@ export interface UserInfo { } export interface UserInstance { - endTime: string; + // endTime: string; hostIp: string; - ie: string; + // ie: string; instanceUuid: string; - lastDatetime: string; + // lastDatetime: string; nickname: string; - oe: string; - remarks: string; + // oe: string; + // remarks: string; serviceUuid: string; status: number; - stopCommand: string; + // stopCommand: string; } export interface ImageInfo { diff --git a/frontend/src/widgets/user/AccessSettings.vue b/frontend/src/widgets/user/AccessSettings.vue index 2e0cad4e..cf8f3c23 100644 --- a/frontend/src/widgets/user/AccessSettings.vue +++ b/frontend/src/widgets/user/AccessSettings.vue @@ -10,12 +10,15 @@ import { arrayFilter } from "@/tools/array"; import { userInfoApiAdvanced } from "@/services/apis"; import { useLayoutCardTools } from "@/hooks/useCardTools"; import { updateUserInstance } from "@/services/apis"; +import UserResources from "./dialog/UserResources.vue"; +import { message } from "ant-design-vue"; const props = defineProps<{ card: LayoutCard; uuid: string; }>(); +const userResourcesDialog = ref>(); const screen = useScreen(); let dataSource: Ref = ref([]); @@ -30,19 +33,32 @@ const handleDelete = async (deletedInstance: UserInstance) => { deletedInstance.instanceUuid == instance.instanceUuid ) { dataSource.value.splice(valueKey, 1); - await updateUserInstance().execute({ - data: { - config: { - instances: dataSource.value - }, - uuid: userUuid - } - }); break; } } }; +const addAnotherInstances = (array: UserInstance) => { + dataSource.value = dataSource.value.concat(array); +}; + +const saveData = async () => { + try { + await updateUserInstance().execute({ + data: { + config: { + instances: dataSource.value + }, + uuid: userUuid + } + }); + return message.success(t("更新成功")); + } catch (err: any) { + console.error(err); + return message.error(err.message); + } +}; + async function refreshChart() { if (userUuid == null) { return; @@ -112,39 +128,47 @@ const columns = computed(() => {