@dao-style/biz 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/gpu/style/assign-gpu-devices-list.js +1 -0
- package/dist/cjs/components/gpu/style/gpu-form.js +1 -0
- package/dist/components/form-block/FormBlock.d.ts +27 -1
- package/dist/components/form-block/props.d.ts +4 -0
- package/dist/components/form-block/props.js +4 -0
- package/dist/components/form-block/props.mjs +4 -0
- package/dist/components/form-block/src/FormBlock.vue.d.ts +11 -0
- package/dist/components/form-block/src/FormBlock.vue.js +4 -4
- package/dist/components/form-block/src/FormBlock.vue.mjs +4 -4
- package/dist/components/form-block/src/FormBlock.vue2.js +12 -1
- package/dist/components/form-block/src/FormBlock.vue2.mjs +12 -1
- package/dist/components/gpu/props.d.ts +121 -3
- package/dist/components/gpu/props.js +82 -9
- package/dist/components/gpu/props.mjs +82 -9
- package/dist/components/gpu/src/GpuForm.vue.d.ts +283 -50
- package/dist/components/gpu/src/GpuForm.vue.js +25 -24
- package/dist/components/gpu/src/GpuForm.vue.mjs +26 -25
- package/dist/components/gpu/src/GpuForm.vue2.js +115 -218
- package/dist/components/gpu/src/GpuForm.vue2.mjs +116 -219
- package/dist/components/gpu/src/components/AssignGpuDevicesList.vue.d.ts +77 -0
- package/dist/components/gpu/src/components/AssignGpuDevicesList.vue.js +40 -0
- package/dist/components/gpu/src/components/AssignGpuDevicesList.vue.mjs +41 -0
- package/dist/components/gpu/src/components/AssignGpuDevicesList.vue2.js +191 -0
- package/dist/components/gpu/src/components/AssignGpuDevicesList.vue2.mjs +192 -0
- package/dist/components/gpu/src/components/GpuAdvancedForm.vue.d.ts +180 -0
- package/dist/components/gpu/src/{GpuAdvancedForm.vue.js → components/GpuAdvancedForm.vue.js} +92 -37
- package/dist/components/gpu/src/{GpuAdvancedForm.vue.mjs → components/GpuAdvancedForm.vue.mjs} +93 -38
- package/dist/components/gpu/src/components/GpuAdvancedForm.vue2.js +169 -0
- package/dist/components/gpu/src/components/GpuAdvancedForm.vue2.mjs +153 -0
- package/dist/components/gpu/src/{GpuFormDynamicItem.vue.d.ts → components/GpuFormDynamicItem.vue.d.ts} +4 -4
- package/dist/components/gpu/src/{GpuFormDynamicItem.vue.js → components/GpuFormDynamicItem.vue.js} +1 -1
- package/dist/components/gpu/src/{GpuFormDynamicItem.vue.mjs → components/GpuFormDynamicItem.vue.mjs} +1 -1
- package/dist/components/gpu/src/{GpuFormDynamicItem.vue2.js → components/GpuFormDynamicItem.vue2.js} +1 -1
- package/dist/components/gpu/src/{GpuFormDynamicItem.vue2.mjs → components/GpuFormDynamicItem.vue2.mjs} +1 -1
- package/dist/components/gpu/src/components/GpuFormItem.vue.d.ts +310 -0
- package/dist/components/gpu/src/{GpuFormItem.vue.js → components/GpuFormItem.vue.js} +22 -26
- package/dist/components/gpu/src/{GpuFormItem.vue.mjs → components/GpuFormItem.vue.mjs} +23 -27
- package/dist/components/gpu/src/components/GpuFormItem.vue2.js +61 -0
- package/dist/components/gpu/src/components/GpuFormItem.vue2.mjs +45 -0
- package/dist/components/gpu/src/{GpuResources.vue.d.ts → components/GpuResources.vue.d.ts} +38 -18
- package/dist/components/gpu/src/components/GpuResources.vue.js +153 -0
- package/dist/components/gpu/src/components/GpuResources.vue.mjs +154 -0
- package/dist/components/gpu/src/components/GpuResources.vue2.js +278 -0
- package/dist/components/gpu/src/components/GpuResources.vue2.mjs +262 -0
- package/dist/components/gpu/src/gpuForm.constants.d.ts +3 -0
- package/dist/components/gpu/src/gpuForm.constants.js +10 -0
- package/dist/components/gpu/src/gpuForm.constants.mjs +10 -0
- package/dist/components/gpu/src/gpuForm.internal-types.d.ts +49 -0
- package/dist/components/gpu/src/gpuForm.mapper.d.ts +16 -0
- package/dist/components/gpu/src/gpuForm.mapper.js +199 -0
- package/dist/components/gpu/src/gpuForm.mapper.mjs +199 -0
- package/dist/components/gpu/src/gpuFormItem.mapper.d.ts +38 -0
- package/dist/components/gpu/src/gpuFormItem.mapper.js +153 -0
- package/dist/components/gpu/src/gpuFormItem.mapper.mjs +153 -0
- package/dist/components/gpu/src/useGPUOptions.d.ts +2 -2
- package/dist/components/gpu/src/useGPUOptions.js +15 -20
- package/dist/components/gpu/src/useGPUOptions.mjs +16 -21
- package/dist/components/gpu/src/useGpuFormItemState.d.ts +42 -0
- package/dist/components/gpu/src/useGpuFormItemState.js +178 -0
- package/dist/components/gpu/src/useGpuFormItemState.mjs +178 -0
- package/dist/components/gpu/src/useGpuFormSideState.d.ts +52 -0
- package/dist/components/gpu/src/useGpuFormSideState.js +71 -0
- package/dist/components/gpu/src/useGpuFormSideState.mjs +71 -0
- package/dist/components/gpu/src/useGpuFormState.d.ts +560 -0
- package/dist/components/gpu/src/useGpuFormState.js +52 -0
- package/dist/components/gpu/src/useGpuFormState.mjs +52 -0
- package/dist/components/gpu/src/validations/nvidiaVgpuMemoryDecimal.d.ts +5 -1
- package/dist/components/gpu/style/assign-gpu-devices-list.d.ts +1 -0
- package/dist/components/gpu/style/assign-gpu-devices-list.scss.js +3 -0
- package/dist/components/gpu/style/assign-gpu-devices-list.scss.mjs +4 -0
- package/dist/components/gpu/style/gpu-form.d.ts +1 -0
- package/dist/components/gpu/types.d.ts +6 -0
- package/dist/components/gpu/types.js +2 -0
- package/dist/components/gpu/types.mjs +2 -0
- package/dist/components/gpu/utils.d.ts +4 -0
- package/dist/components/gpu/utils.js +14 -0
- package/dist/components/gpu/utils.mjs +14 -0
- package/dist/components/instance-cluster/src/InstanceCluster.vue.d.ts +1 -1
- package/dist/components/instance-namespace/src/InstanceNamespace.vue.d.ts +1 -1
- package/dist/components/instance-storage-class/src/InstanceStorageClass.vue.d.ts +1 -1
- package/dist/components/network-config/src/NetworkConfig.vue.d.ts +1 -1
- package/dist/components/network-config/src/NetworkConfig.vue.js +13 -6
- package/dist/components/network-config/src/NetworkConfig.vue.mjs +14 -7
- package/dist/dialogs/create-network-config-dialog/src/CreateNetworkConfigDialog.vue.d.ts +1 -1
- package/dist/es/components/gpu/style/assign-gpu-devices-list.mjs +1 -0
- package/dist/es/components/gpu/style/gpu-form.mjs +1 -0
- package/dist/forms/import-parameter-template/props.d.ts +8 -8
- package/dist/forms/import-parameter-template/src/ImportParameterTemplate.vue.d.ts +24 -24
- package/dist/group-mapping.json +1 -1
- package/dist/index.js +34 -23
- package/dist/index.mjs +15 -4
- package/dist/locales/en-US/components/Gpu.json.js +36 -9
- package/dist/locales/en-US/components/Gpu.json.mjs +37 -10
- package/dist/locales/en-US/index.js +2 -0
- package/dist/locales/en-US/index.mjs +2 -0
- package/dist/locales/en-US/uses/UseCancelFormDialog.json.js +11 -0
- package/dist/locales/en-US/uses/UseCancelFormDialog.json.mjs +11 -0
- package/dist/locales/ja/components/Gpu.json.js +36 -9
- package/dist/locales/ja/components/Gpu.json.mjs +37 -10
- package/dist/locales/ja/components/InstancePassword.json.js +1 -1
- package/dist/locales/ja/components/InstancePassword.json.mjs +1 -1
- package/dist/locales/ja/components/MatchExpressionsEditor.json.js +1 -1
- package/dist/locales/ja/components/MatchExpressionsEditor.json.mjs +1 -1
- package/dist/locales/ja/components/NetworkConfig.json.js +1 -1
- package/dist/locales/ja/components/NetworkConfig.json.mjs +1 -1
- package/dist/locales/ja/index.js +2 -0
- package/dist/locales/ja/index.mjs +2 -0
- package/dist/locales/ja/uses/UseCancelFormDialog.json.js +11 -0
- package/dist/locales/ja/uses/UseCancelFormDialog.json.mjs +11 -0
- package/dist/locales/ja/workloads/DnsConfig.json.js +1 -1
- package/dist/locales/ja/workloads/DnsConfig.json.mjs +1 -1
- package/dist/locales/ja/workloads/workload-advanced/NetworkConfig.json.js +1 -1
- package/dist/locales/ja/workloads/workload-advanced/NetworkConfig.json.mjs +1 -1
- package/dist/locales/zh-CN/components/Gpu.json.js +36 -9
- package/dist/locales/zh-CN/components/Gpu.json.mjs +37 -10
- package/dist/locales/zh-CN/index.js +2 -0
- package/dist/locales/zh-CN/index.mjs +2 -0
- package/dist/locales/zh-CN/uses/UseCancelFormDialog.json.js +11 -0
- package/dist/locales/zh-CN/uses/UseCancelFormDialog.json.mjs +11 -0
- package/dist/style.css +692 -664
- package/dist/styles/components/gpu/assign-gpu-devices-list.css +10 -0
- package/dist/styles/components/gpu/gpu-form-item.css +16 -0
- package/dist/styles/components/gpu/gpu-form.css +4 -0
- package/dist/styles/components/network-config/network-config.css +3 -0
- package/dist/styles/components/resource-config/resource-config.css +0 -8
- package/dist/styles/styles/common.css +4 -0
- package/dist/uses/index.d.ts +1 -0
- package/dist/uses/useCancelFormDialog/index.d.ts +11 -0
- package/dist/uses/useCancelFormDialog/index.js +40 -0
- package/dist/uses/useCancelFormDialog/index.mjs +40 -0
- package/dist/uses/useCancelFormDialog/src/CancelFormDialog.vue.d.ts +8 -0
- package/dist/uses/useCancelFormDialog/src/CancelFormDialog.vue.js +25 -0
- package/dist/uses/useCancelFormDialog/src/CancelFormDialog.vue.mjs +26 -0
- package/dist/uses/useCancelFormDialog/src/CancelFormDialog.vue2.js +3 -0
- package/dist/uses/useCancelFormDialog/src/CancelFormDialog.vue2.mjs +4 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/injectWithSelf.d.ts +6 -0
- package/dist/utils/injectWithSelf.js +8 -0
- package/dist/utils/injectWithSelf.mjs +8 -0
- package/dist/utils/multiRowEditorValidate.d.ts +5 -5
- package/dist/utils/useResetFieldValue.d.ts +13 -0
- package/dist/utils/useResetFieldValue.js +28 -0
- package/dist/utils/useResetFieldValue.mjs +28 -0
- package/dist/utils/useSetFieldValue.d.ts +6 -0
- package/dist/utils/useSetFieldValue.js +2 -5
- package/dist/utils/useSetFieldValue.mjs +2 -5
- package/dist/workloads/container-basic-info/props.d.ts +13 -0
- package/dist/workloads/container-basic-info/props.js +4 -0
- package/dist/workloads/container-basic-info/props.mjs +4 -0
- package/dist/workloads/container-basic-info/src/ContainerBasicInfo.vue.d.ts +10 -0
- package/dist/workloads/container-basic-info/src/ContainerBasicInfo.vue.js +54 -29
- package/dist/workloads/container-basic-info/src/ContainerBasicInfo.vue.mjs +54 -29
- package/dist/workloads/container-basic-info/src/ContainerBasicInfo.vue2.js +18 -8
- package/dist/workloads/container-basic-info/src/ContainerBasicInfo.vue2.mjs +19 -9
- package/dist/workloads/container-image/src/dialogs/SelectImageDialog.vue.d.ts +1 -1
- package/dist/workloads/containers/demo/data.d.ts +8 -1
- package/dist/workloads/containers/src/ContainerItem.vue.d.ts +23 -0
- package/dist/workloads/containers/src/Containers.vue.d.ts +4 -0
- package/dist/workloads/containers/src/Containers.vue2.js +18 -1
- package/dist/workloads/containers/src/Containers.vue2.mjs +19 -2
- package/dist/workloads/health-check/props.d.ts +4 -0
- package/dist/workloads/health-check/props.js +4 -0
- package/dist/workloads/health-check/props.mjs +4 -0
- package/dist/workloads/health-check/src/HealthCheck.vue.d.ts +9 -0
- package/dist/workloads/health-check/src/HealthCheck.vue.js +6 -6
- package/dist/workloads/health-check/src/HealthCheck.vue.mjs +6 -6
- package/dist/workloads/health-check/src/HealthCheckHandler.vue.js +3 -1
- package/dist/workloads/health-check/src/HealthCheckHandler.vue.mjs +3 -1
- package/dist/workloads/http-get-action/src/HttpGetAction.vue.js +1 -1
- package/dist/workloads/http-get-action/src/HttpGetAction.vue.mjs +1 -1
- package/dist/workloads/workload-annotations/props.d.ts +1 -0
- package/dist/workloads/workload-annotations/props.js +1 -0
- package/dist/workloads/workload-annotations/props.mjs +2 -1
- package/package.json +12 -13
- package/dist/components/gpu/src/GpuAdvancedForm.vue.d.ts +0 -131
- package/dist/components/gpu/src/GpuAdvancedForm.vue2.js +0 -92
- package/dist/components/gpu/src/GpuAdvancedForm.vue2.mjs +0 -76
- package/dist/components/gpu/src/GpuFormItem.vue.d.ts +0 -232
- package/dist/components/gpu/src/GpuFormItem.vue2.js +0 -235
- package/dist/components/gpu/src/GpuFormItem.vue2.mjs +0 -219
- package/dist/components/gpu/src/GpuResources.vue.js +0 -125
- package/dist/components/gpu/src/GpuResources.vue.mjs +0 -126
- package/dist/components/gpu/src/GpuResources.vue2.js +0 -197
- package/dist/components/gpu/src/GpuResources.vue2.mjs +0 -181
- package/dist/components/gpu/src/validations/nvidiaVgpuMemoryDecimal.js +0 -19
- package/dist/components/gpu/src/validations/nvidiaVgpuMemoryDecimal.mjs +0 -20
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { defineComponent, computed, ref, watch } from "vue";
|
|
2
|
-
import { cloneDeep
|
|
2
|
+
import { cloneDeep } from "lodash-es";
|
|
3
|
+
import { DaoHistoryLink } from "@dao-style/extend";
|
|
3
4
|
import { gpuFormProps, nvidiaVgpuKey } from "../props.mjs";
|
|
4
|
-
import
|
|
5
|
-
import GpuFormItem from "./GpuFormItem.vue.mjs";
|
|
5
|
+
import GpuFormItem from "./components/GpuFormItem.vue.mjs";
|
|
6
6
|
import { useGPUOptions } from "./useGPUOptions.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { buildGpuFormInitialRows, buildGpuFormFormattedUpdate, buildGpuFormVgpuUpdateEmits } from "./gpuForm.mapper.mjs";
|
|
8
|
+
import { useGpuFormState } from "./useGpuFormState.mjs";
|
|
9
|
+
import { useGpuFormSideState } from "./useGpuFormSideState.mjs";
|
|
10
|
+
import "../style/assign-gpu-devices-list.scss.mjs";
|
|
8
11
|
import "../style/gpu-form-item.scss.mjs";
|
|
9
12
|
import "../style/gpu-form.scss.mjs";
|
|
10
|
-
import { randomStr } from "../../../utils/randomStr.mjs";
|
|
11
|
-
import { formatNumUnit } from "../../../utils/formatNumUnit.mjs";
|
|
12
13
|
const _sfc_main = defineComponent({
|
|
13
14
|
name: "DaoGpuForm",
|
|
14
15
|
components: {
|
|
16
|
+
DaoHistoryLink,
|
|
15
17
|
GpuFormItem
|
|
16
18
|
},
|
|
17
19
|
props: gpuFormProps,
|
|
@@ -20,11 +22,11 @@ const _sfc_main = defineComponent({
|
|
|
20
22
|
"update:nvidiaVgpuModel",
|
|
21
23
|
"update:nvidiaVgpuPriority",
|
|
22
24
|
"update:nvidiaVgpuGpuSchedule",
|
|
23
|
-
"update:nvidiaVgpuNodeSchedule"
|
|
25
|
+
"update:nvidiaVgpuNodeSchedule",
|
|
26
|
+
"update:nvidiaVgpuDevices"
|
|
24
27
|
],
|
|
25
28
|
setup(props, { emit }) {
|
|
26
29
|
const isLimitOne = computed(() => props.limit === 1);
|
|
27
|
-
const showSide = computed(() => !!props.usedQuota || !!props.availableQuota);
|
|
28
30
|
const {
|
|
29
31
|
gpuOptionsMap,
|
|
30
32
|
getDisplayResource,
|
|
@@ -44,114 +46,66 @@ const _sfc_main = defineComponent({
|
|
|
44
46
|
}, []);
|
|
45
47
|
nvidiaGpuModels.value = Array.from(new Set(modelsArray));
|
|
46
48
|
};
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
const {
|
|
50
|
+
rows,
|
|
51
|
+
rowsRef,
|
|
52
|
+
existTypes,
|
|
53
|
+
updateRow,
|
|
54
|
+
addRow,
|
|
55
|
+
removeRow,
|
|
56
|
+
filterRows,
|
|
57
|
+
validate
|
|
58
|
+
} = useGpuFormState();
|
|
59
|
+
const {
|
|
60
|
+
sideRows,
|
|
61
|
+
showSide,
|
|
62
|
+
sideQuota,
|
|
63
|
+
syncSideRowChange,
|
|
64
|
+
syncSideRowAdd,
|
|
65
|
+
syncSideRowDelete,
|
|
66
|
+
syncFilter,
|
|
67
|
+
initSideRows,
|
|
68
|
+
getUsedQuotaItem,
|
|
69
|
+
getAvailableQuotaItem
|
|
70
|
+
} = useGpuFormSideState({
|
|
71
|
+
usedQuota: computed(() => props.usedQuota),
|
|
72
|
+
availableQuota: computed(() => props.availableQuota),
|
|
73
|
+
gpuOptionsMap,
|
|
74
|
+
withPrefixRequest: computed(() => props.withPrefixRequest)
|
|
75
|
+
});
|
|
56
76
|
const formatToUpdate = () => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
type,
|
|
64
|
-
resources: rest,
|
|
65
|
-
[nvidiaVgpuModelKey]: nvidiaVgpuModel,
|
|
66
|
-
[nvidiaVgpuPriorityKey]: nvidiaVgpuPriority,
|
|
67
|
-
[nvidiaVgpuGpuScheduleKey]: nvidiaVgpuGpuSchedule,
|
|
68
|
-
[nvidiaVgpuNodeScheduleKey]: nvidiaVgpuNodeSchedule
|
|
69
|
-
} = row;
|
|
70
|
-
const vgpuResource = Object.entries(rest ?? {}).reduce((preRes, [key, val]) => {
|
|
71
|
-
const finalResourceKey = deSanitizeGPUKey(key) ?? "";
|
|
72
|
-
Object.assign(preRes, {
|
|
73
|
-
[props.withPrefixRequest ? `requests.${finalResourceKey}` : finalResourceKey]: val
|
|
74
|
-
});
|
|
75
|
-
return preRes;
|
|
76
|
-
}, {});
|
|
77
|
-
Object.assign(pre, vgpuResource);
|
|
78
|
-
if (type === nvidiaVgpuKey) {
|
|
79
|
-
currentNvidiaVgpuModel = nvidiaVgpuModel;
|
|
80
|
-
currentNvidiaVgpuPriority = nvidiaVgpuPriority;
|
|
81
|
-
currentNvidiaVgpuGpuSchedule = nvidiaVgpuGpuSchedule;
|
|
82
|
-
currentNvidiaVgpuNodeSchedule = nvidiaVgpuNodeSchedule;
|
|
83
|
-
} else {
|
|
84
|
-
currentNvidiaVgpuModel = void 0;
|
|
85
|
-
currentNvidiaVgpuPriority = void 0;
|
|
86
|
-
currentNvidiaVgpuGpuSchedule = void 0;
|
|
87
|
-
currentNvidiaVgpuNodeSchedule = void 0;
|
|
88
|
-
}
|
|
89
|
-
return pre;
|
|
90
|
-
}, {});
|
|
91
|
-
const res = {
|
|
92
|
-
types: existTypes.value,
|
|
93
|
-
resources
|
|
94
|
-
};
|
|
95
|
-
emit("change", res);
|
|
77
|
+
const formattedUpdate = buildGpuFormFormattedUpdate(
|
|
78
|
+
rows.value,
|
|
79
|
+
existTypes.value,
|
|
80
|
+
props.withPrefixRequest
|
|
81
|
+
);
|
|
82
|
+
emit("change", formattedUpdate.change);
|
|
96
83
|
const vgpuExist = existTypes.value.includes(nvidiaVgpuKey);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
emit("update:nvidiaVgpuGpuSchedule", currentNvidiaVgpuGpuSchedule);
|
|
109
|
-
emit("update:nvidiaVgpuNodeSchedule", currentNvidiaVgpuNodeSchedule);
|
|
110
|
-
} else if (props.nvidiaVgpuGpuSchedule || props.nvidiaVgpuNodeSchedule) {
|
|
111
|
-
emit("update:nvidiaVgpuGpuSchedule", void 0);
|
|
112
|
-
emit("update:nvidiaVgpuNodeSchedule", void 0);
|
|
113
|
-
}
|
|
84
|
+
buildGpuFormVgpuUpdateEmits(
|
|
85
|
+
formattedUpdate.vgpu,
|
|
86
|
+
props,
|
|
87
|
+
vgpuExist
|
|
88
|
+
).forEach(([event, value]) => {
|
|
89
|
+
if (event === "update:nvidiaVgpuDevices") {
|
|
90
|
+
emit(event, value);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
emit(event, value);
|
|
94
|
+
});
|
|
114
95
|
};
|
|
115
|
-
const sideQuota = computed(() => props.usedQuota ?? props.availableQuota);
|
|
116
96
|
const handleRowChange = (idx, newRow) => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (showSide.value) {
|
|
120
|
-
const sideNewRow = cloneDeep(newRow);
|
|
121
|
-
sideRows.value[idx] = sideNewRow;
|
|
122
|
-
const sideRow = sideRows.value[idx];
|
|
123
|
-
sideRow.type = (_a = sideNewRow.type) == null ? void 0 : _a.toString();
|
|
124
|
-
const currentGpuSettings = gpuOptionsMap.value.get(sideRow.type ?? "");
|
|
125
|
-
sideRow.resources = {};
|
|
126
|
-
(_b = currentGpuSettings == null ? void 0 : currentGpuSettings.resource) == null ? void 0 : _b.forEach(({ key }) => {
|
|
127
|
-
var _a2;
|
|
128
|
-
const actualKey = props.withPrefixRequest ? `requests.${key}` : key;
|
|
129
|
-
const val = (_a2 = sideQuota.value) == null ? void 0 : _a2.resources[actualKey ?? ""];
|
|
130
|
-
if (val !== void 0) {
|
|
131
|
-
set(sideRow, ["resources", sanitizeGPUKey(key) ?? ""], formatNumUnit(val));
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
}
|
|
97
|
+
updateRow(idx, newRow);
|
|
98
|
+
syncSideRowChange(idx, newRow);
|
|
135
99
|
formatToUpdate();
|
|
136
100
|
};
|
|
137
101
|
const handleAdd = () => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
type: ""
|
|
141
|
-
});
|
|
142
|
-
if (showSide.value) {
|
|
143
|
-
sideRows.value.push({
|
|
144
|
-
id: randomStr(3),
|
|
145
|
-
type: ""
|
|
146
|
-
});
|
|
147
|
-
}
|
|
102
|
+
addRow();
|
|
103
|
+
syncSideRowAdd();
|
|
148
104
|
formatToUpdate();
|
|
149
105
|
};
|
|
150
106
|
const handleDeleteRow = (idx) => {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
sideRows.value.splice(idx, 1);
|
|
154
|
-
}
|
|
107
|
+
removeRow(idx);
|
|
108
|
+
syncSideRowDelete(idx);
|
|
155
109
|
formatToUpdate();
|
|
156
110
|
};
|
|
157
111
|
const enableGpu = computed({
|
|
@@ -166,101 +120,32 @@ const _sfc_main = defineComponent({
|
|
|
166
120
|
}
|
|
167
121
|
}
|
|
168
122
|
});
|
|
169
|
-
const getUpdateRows = (items) => {
|
|
170
|
-
const diffRows = [];
|
|
171
|
-
items.forEach((v) => {
|
|
172
|
-
if (v.type && gpuOptionsMap.value.has(v.type)) {
|
|
173
|
-
diffRows.push(v);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
if (!diffRows.length) {
|
|
177
|
-
return [{
|
|
178
|
-
id: randomStr(3),
|
|
179
|
-
type: ""
|
|
180
|
-
}];
|
|
181
|
-
}
|
|
182
|
-
return diffRows;
|
|
183
|
-
};
|
|
184
123
|
const initValues = () => {
|
|
185
124
|
if (rows.value.length || sideRows.value.length) {
|
|
186
|
-
|
|
187
|
-
|
|
125
|
+
filterRows(gpuOptionsMap.value);
|
|
126
|
+
syncFilter();
|
|
188
127
|
formatToUpdate();
|
|
189
128
|
return;
|
|
190
129
|
}
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
};
|
|
207
|
-
const tempSideRow = {
|
|
208
|
-
type,
|
|
209
|
-
id: randomStr(3),
|
|
210
|
-
resources: {}
|
|
211
|
-
};
|
|
212
|
-
const displayResource = getDisplayResource(type);
|
|
213
|
-
if (displayResource.length) {
|
|
214
|
-
displayResource.forEach((rs) => {
|
|
215
|
-
var _a;
|
|
216
|
-
const key = props.withPrefixRequest ? `requests.${rs.key}` : rs.key;
|
|
217
|
-
const val = resources[key];
|
|
218
|
-
if (val !== void 0) {
|
|
219
|
-
set(row, ["resources", sanitizeGPUKey(rs.key) ?? ""], formatNumUnit(val));
|
|
220
|
-
}
|
|
221
|
-
if (showSide.value) {
|
|
222
|
-
const sideVal = (_a = sideQuota.value) == null ? void 0 : _a.resources[key];
|
|
223
|
-
if (sideVal !== void 0) {
|
|
224
|
-
set(tempSideRow, ["resources", sanitizeGPUKey(rs.key) ?? ""], formatNumUnit(sideVal));
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
if (type === nvidiaVgpuKey && isLimitOne.value) {
|
|
229
|
-
const vgpuModel = props.nvidiaVgpuModel;
|
|
230
|
-
if (vgpuModel) {
|
|
231
|
-
Object.assign(row, {
|
|
232
|
-
[nvidiaVgpuModelKey]: vgpuModel
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
const priority = props.nvidiaVgpuPriority;
|
|
236
|
-
if (priority) {
|
|
237
|
-
Object.assign(row, {
|
|
238
|
-
[nvidiaVgpuPriorityKey]: priority
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
const gpuSchedule = props.nvidiaVgpuGpuSchedule;
|
|
242
|
-
const nodeSchedule = props.nvidiaVgpuNodeSchedule;
|
|
243
|
-
if (gpuSchedule) {
|
|
244
|
-
Object.assign(row, {
|
|
245
|
-
[nvidiaVgpuGpuScheduleKey]: gpuSchedule
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
if (nodeSchedule) {
|
|
249
|
-
Object.assign(row, {
|
|
250
|
-
[nvidiaVgpuNodeScheduleKey]: nodeSchedule
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
if (showSide.value && !tempSideRows.includes(tempSideRow)) {
|
|
256
|
-
tempSideRows.push(tempSideRow);
|
|
257
|
-
}
|
|
258
|
-
if (!tempRows.includes(row)) {
|
|
259
|
-
tempRows.push(row);
|
|
130
|
+
const initialRows = buildGpuFormInitialRows({
|
|
131
|
+
quota: cloneDeep(props.quota),
|
|
132
|
+
availableQuota: props.availableQuota,
|
|
133
|
+
sideQuota: sideQuota.value,
|
|
134
|
+
gpuOptionsMap: gpuOptionsMap.value,
|
|
135
|
+
getDisplayResource,
|
|
136
|
+
withPrefixRequest: props.withPrefixRequest,
|
|
137
|
+
showSide: showSide.value,
|
|
138
|
+
isLimitOne: isLimitOne.value,
|
|
139
|
+
vgpu: {
|
|
140
|
+
nvidiaVgpuModel: props.nvidiaVgpuModel,
|
|
141
|
+
nvidiaVgpuDevices: props.nvidiaVgpuDevices,
|
|
142
|
+
nvidiaVgpuPriority: props.nvidiaVgpuPriority,
|
|
143
|
+
nvidiaVgpuGpuSchedule: props.nvidiaVgpuGpuSchedule,
|
|
144
|
+
nvidiaVgpuNodeSchedule: props.nvidiaVgpuNodeSchedule
|
|
260
145
|
}
|
|
261
146
|
});
|
|
262
|
-
sideRows
|
|
263
|
-
rows.value =
|
|
147
|
+
initSideRows(initialRows.sideRows);
|
|
148
|
+
rows.value = initialRows.rows;
|
|
264
149
|
formatToUpdate();
|
|
265
150
|
};
|
|
266
151
|
watch([
|
|
@@ -272,35 +157,45 @@ const _sfc_main = defineComponent({
|
|
|
272
157
|
if (!fetchingGpuOptions.value) {
|
|
273
158
|
initValues();
|
|
274
159
|
}
|
|
275
|
-
|
|
276
|
-
|
|
160
|
+
const selectedModelMissing = Boolean(props.nvidiaVgpuModel) && !nvidiaGpuModels.value.includes(props.nvidiaVgpuModel);
|
|
161
|
+
const shouldFetchNvidiaVgpuModels = props.enableNvidiaVgpuModel && gpuOptionsMap.value.has(nvidiaVgpuKey) && (!nvidiaGpuModels.value.length || props.assignGpuDisabled && selectedModelMissing);
|
|
162
|
+
if (shouldFetchNvidiaVgpuModels) {
|
|
163
|
+
await fetchNvidiaVgpuModels();
|
|
277
164
|
}
|
|
278
165
|
}, {
|
|
279
166
|
immediate: true
|
|
280
167
|
});
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
168
|
+
const gpuFormItemBaseProps = computed(() => ({
|
|
169
|
+
targetType: props.targetType,
|
|
170
|
+
enableRangeValidate: props.enableRangeValidate,
|
|
171
|
+
gpuOptionsMap: gpuOptionsMap.value,
|
|
172
|
+
getDisplayResource,
|
|
173
|
+
gpuUsage: props.gpuUsage,
|
|
174
|
+
gpuSettingsAdaptor: props.gpuSettingsAdaptor
|
|
175
|
+
}));
|
|
176
|
+
const sharedGpuFormItemAdvancedProps = computed(() => ({
|
|
177
|
+
enableRemoteCall: props.enableRemoteCall,
|
|
178
|
+
enableNvidiaVgpuModel: props.enableNvidiaVgpuModel,
|
|
179
|
+
enableNvidiaVgpuDevices: props.enableNvidiaVgpuDevices,
|
|
180
|
+
assignGpuDisabled: props.assignGpuDisabled,
|
|
181
|
+
enableNvidiaVgpuPriority: props.enableNvidiaVgpuPriority,
|
|
182
|
+
nvidiaGpuModels: nvidiaGpuModels.value,
|
|
183
|
+
nvidiaVgpuModelsAdaptor: props.nvidiaVgpuModelsAdaptor,
|
|
184
|
+
nvidiaVgpuDevicesAdaptor: props.nvidiaVgpuDevicesAdaptor
|
|
185
|
+
}));
|
|
186
|
+
const gpuFormItemAdvancedProps = computed(() => ({
|
|
187
|
+
...sharedGpuFormItemAdvancedProps.value,
|
|
188
|
+
enableNvidiaVgpuSchedulePolicy: props.enableNvidiaVgpuSchedulePolicy
|
|
189
|
+
}));
|
|
190
|
+
const gpuFormItemProps = computed(() => ({
|
|
191
|
+
...gpuFormItemBaseProps.value,
|
|
192
|
+
...gpuFormItemAdvancedProps.value,
|
|
193
|
+
dynamicLimitOne: props.dynamicLimitOne
|
|
194
|
+
}));
|
|
195
|
+
const sideGpuFormItemProps = computed(() => ({
|
|
196
|
+
...gpuFormItemBaseProps.value,
|
|
197
|
+
...sharedGpuFormItemAdvancedProps.value
|
|
198
|
+
}));
|
|
304
199
|
return {
|
|
305
200
|
isLimitOne,
|
|
306
201
|
rows,
|
|
@@ -314,6 +209,8 @@ const _sfc_main = defineComponent({
|
|
|
314
209
|
fetchGpuOptions,
|
|
315
210
|
getDisplayResource,
|
|
316
211
|
nvidiaGpuModels,
|
|
212
|
+
gpuFormItemProps,
|
|
213
|
+
sideGpuFormItemProps,
|
|
317
214
|
showSide,
|
|
318
215
|
sideRows,
|
|
319
216
|
validate,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import '../../style/assign-gpu-devices-list';
|
|
2
|
+
import { GpuDevice } from '../../props';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
modelValue: {
|
|
5
|
+
type: import("vue").PropType<string[]>;
|
|
6
|
+
default: () => never[];
|
|
7
|
+
};
|
|
8
|
+
disabled: {
|
|
9
|
+
type: BooleanConstructor;
|
|
10
|
+
default: boolean;
|
|
11
|
+
};
|
|
12
|
+
id: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
nvidiaVgpuDevicesAdaptor: {
|
|
17
|
+
type: import("vue").PropType<import("../../props").GpuDevicesAdaptor>;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
}, {
|
|
21
|
+
columns: import("vue").ComputedRef<({
|
|
22
|
+
header: string;
|
|
23
|
+
id: string;
|
|
24
|
+
defaultWidth?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
header: string;
|
|
27
|
+
id: string;
|
|
28
|
+
defaultWidth: string;
|
|
29
|
+
})[]>;
|
|
30
|
+
selectedDevices: import("vue").ComputedRef<GpuDevice[]>;
|
|
31
|
+
displayDevices: import("vue").ComputedRef<GpuDevice[]>;
|
|
32
|
+
onSelect: (selected: GpuDevice[]) => void;
|
|
33
|
+
getRowCheckable: (row: GpuDevice) => boolean;
|
|
34
|
+
displayComputePower: (row: GpuDevice) => string;
|
|
35
|
+
displayMemory: (row: GpuDevice) => string;
|
|
36
|
+
searchOptions: import("vue").ComputedRef<{
|
|
37
|
+
key: string;
|
|
38
|
+
label: string;
|
|
39
|
+
single: boolean;
|
|
40
|
+
}[]>;
|
|
41
|
+
fuzzySearch: {
|
|
42
|
+
key: string;
|
|
43
|
+
single: boolean;
|
|
44
|
+
};
|
|
45
|
+
filterData: import("vue").Ref<{
|
|
46
|
+
searchDeviceUUID?: string[] | undefined;
|
|
47
|
+
searchNodeName?: string[] | undefined;
|
|
48
|
+
searchGPUModel?: string[] | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
handleSearch: () => void;
|
|
51
|
+
handleRefresh: () => void;
|
|
52
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
53
|
+
modelValue: {
|
|
54
|
+
type: import("vue").PropType<string[]>;
|
|
55
|
+
default: () => never[];
|
|
56
|
+
};
|
|
57
|
+
disabled: {
|
|
58
|
+
type: BooleanConstructor;
|
|
59
|
+
default: boolean;
|
|
60
|
+
};
|
|
61
|
+
id: {
|
|
62
|
+
type: StringConstructor;
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
65
|
+
nvidiaVgpuDevicesAdaptor: {
|
|
66
|
+
type: import("vue").PropType<import("../../props").GpuDevicesAdaptor>;
|
|
67
|
+
default: undefined;
|
|
68
|
+
};
|
|
69
|
+
}>> & {
|
|
70
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
modelValue: string[];
|
|
73
|
+
id: string;
|
|
74
|
+
disabled: boolean;
|
|
75
|
+
nvidiaVgpuDevicesAdaptor: import("../../props").GpuDevicesAdaptor;
|
|
76
|
+
}>;
|
|
77
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const AssignGpuDevicesList_vue_vue_type_script_lang = require("./AssignGpuDevicesList.vue2.js");
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const _pluginVue_exportHelper = require("../../../../_virtual/_plugin-vue_export-helper.js");
|
|
5
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const _component_dao_table = vue.resolveComponent("dao-table");
|
|
8
|
+
return vue.openBlock(), vue.createBlock(_component_dao_table, {
|
|
9
|
+
id: _ctx.id,
|
|
10
|
+
search: _ctx.filterData,
|
|
11
|
+
"onUpdate:search": _cache[0] || (_cache[0] = ($event) => _ctx.filterData = $event),
|
|
12
|
+
class: "dao-assign-gpu-devices-list",
|
|
13
|
+
"selected-rows": _ctx.selectedDevices,
|
|
14
|
+
loading: (_a = _ctx.nvidiaVgpuDevicesAdaptor) == null ? void 0 : _a.loading,
|
|
15
|
+
columns: _ctx.columns,
|
|
16
|
+
data: _ctx.displayDevices,
|
|
17
|
+
selectable: _ctx.getRowCheckable,
|
|
18
|
+
"page-layout": [],
|
|
19
|
+
compact: "",
|
|
20
|
+
"hide-batch-bar": "",
|
|
21
|
+
multiple: "",
|
|
22
|
+
"no-shadow": "",
|
|
23
|
+
"hide-search": _ctx.disabled || !((_b = _ctx.nvidiaVgpuDevicesAdaptor) == null ? void 0 : _b.search),
|
|
24
|
+
"search-options": _ctx.searchOptions,
|
|
25
|
+
fuzzy: _ctx.fuzzySearch,
|
|
26
|
+
onSelect: _ctx.onSelect,
|
|
27
|
+
onRefresh: _ctx.handleRefresh,
|
|
28
|
+
onSearch: _ctx.handleSearch
|
|
29
|
+
}, {
|
|
30
|
+
"td-memory": vue.withCtx(({ row }) => [
|
|
31
|
+
vue.createTextVNode(vue.toDisplayString(_ctx.displayMemory(row)), 1)
|
|
32
|
+
]),
|
|
33
|
+
"td-computePower": vue.withCtx(({ row }) => [
|
|
34
|
+
vue.createTextVNode(vue.toDisplayString(_ctx.displayComputePower(row)), 1)
|
|
35
|
+
]),
|
|
36
|
+
_: 1
|
|
37
|
+
}, 8, ["id", "search", "selected-rows", "loading", "columns", "data", "selectable", "hide-search", "search-options", "fuzzy", "onSelect", "onRefresh", "onSearch"]);
|
|
38
|
+
}
|
|
39
|
+
const DaoAssignGpuDevicesList = /* @__PURE__ */ _pluginVue_exportHelper(AssignGpuDevicesList_vue_vue_type_script_lang, [["render", _sfc_render]]);
|
|
40
|
+
module.exports = DaoAssignGpuDevicesList;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _sfc_main from "./AssignGpuDevicesList.vue2.mjs";
|
|
2
|
+
import { resolveComponent, openBlock, createBlock, withCtx, createTextVNode, toDisplayString } from "vue";
|
|
3
|
+
import _export_sfc from "../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
const _component_dao_table = resolveComponent("dao-table");
|
|
7
|
+
return openBlock(), createBlock(_component_dao_table, {
|
|
8
|
+
id: _ctx.id,
|
|
9
|
+
search: _ctx.filterData,
|
|
10
|
+
"onUpdate:search": _cache[0] || (_cache[0] = ($event) => _ctx.filterData = $event),
|
|
11
|
+
class: "dao-assign-gpu-devices-list",
|
|
12
|
+
"selected-rows": _ctx.selectedDevices,
|
|
13
|
+
loading: (_a = _ctx.nvidiaVgpuDevicesAdaptor) == null ? void 0 : _a.loading,
|
|
14
|
+
columns: _ctx.columns,
|
|
15
|
+
data: _ctx.displayDevices,
|
|
16
|
+
selectable: _ctx.getRowCheckable,
|
|
17
|
+
"page-layout": [],
|
|
18
|
+
compact: "",
|
|
19
|
+
"hide-batch-bar": "",
|
|
20
|
+
multiple: "",
|
|
21
|
+
"no-shadow": "",
|
|
22
|
+
"hide-search": _ctx.disabled || !((_b = _ctx.nvidiaVgpuDevicesAdaptor) == null ? void 0 : _b.search),
|
|
23
|
+
"search-options": _ctx.searchOptions,
|
|
24
|
+
fuzzy: _ctx.fuzzySearch,
|
|
25
|
+
onSelect: _ctx.onSelect,
|
|
26
|
+
onRefresh: _ctx.handleRefresh,
|
|
27
|
+
onSearch: _ctx.handleSearch
|
|
28
|
+
}, {
|
|
29
|
+
"td-memory": withCtx(({ row }) => [
|
|
30
|
+
createTextVNode(toDisplayString(_ctx.displayMemory(row)), 1)
|
|
31
|
+
]),
|
|
32
|
+
"td-computePower": withCtx(({ row }) => [
|
|
33
|
+
createTextVNode(toDisplayString(_ctx.displayComputePower(row)), 1)
|
|
34
|
+
]),
|
|
35
|
+
_: 1
|
|
36
|
+
}, 8, ["id", "search", "selected-rows", "loading", "columns", "data", "selectable", "hide-search", "search-options", "fuzzy", "onSelect", "onRefresh", "onSearch"]);
|
|
37
|
+
}
|
|
38
|
+
const DaoAssignGpuDevicesList = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
39
|
+
export {
|
|
40
|
+
DaoAssignGpuDevicesList as default
|
|
41
|
+
};
|