@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
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { ref, computed, watch } from "vue";
|
|
2
|
+
import { useForm } from "vee-validate";
|
|
3
|
+
import { getPriorityOpts } from "../props.mjs";
|
|
4
|
+
import { nvidiaVgpuPriorityKey } from "../types.mjs";
|
|
5
|
+
import { isNvidiaVgpu, isHamiGpu, deSanitizeGPUObjectKey } from "../utils.mjs";
|
|
6
|
+
import { buildGpuFormItemChangePayload, filterGpuFormItemOptions, buildGpuFormItemInitialState, buildGpuFormItemDefaultResources } from "./gpuFormItem.mapper.mjs";
|
|
7
|
+
function useGpuFormItemState(props, emits, slots, i18nInstance) {
|
|
8
|
+
const {
|
|
9
|
+
values: quota,
|
|
10
|
+
setValues,
|
|
11
|
+
validate
|
|
12
|
+
} = useForm({
|
|
13
|
+
initialValues: {}
|
|
14
|
+
});
|
|
15
|
+
const dynamicQuota = ref({});
|
|
16
|
+
const currentDisplayResource = computed(() => {
|
|
17
|
+
var _a;
|
|
18
|
+
return (_a = props.getDisplayResource) == null ? void 0 : _a.call(props, quota.type ?? "");
|
|
19
|
+
});
|
|
20
|
+
const currentGpuProvider = computed(() => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
return ((_b = (_a = props.gpuOptionsMap) == null ? void 0 : _a.get(quota.type ?? "")) == null ? void 0 : _b.provider) ?? "";
|
|
23
|
+
});
|
|
24
|
+
const openNvidiaAssignGpu = ref(false);
|
|
25
|
+
const openNvidiaVgpuModel = ref(false);
|
|
26
|
+
const openNvidiaVgpuSchedulePolicy = ref(false);
|
|
27
|
+
const showDynamicForm = computed(() => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
return (_b = (_a = props.gpuOptionsMap) == null ? void 0 : _a.get(quota.type ?? "")) == null ? void 0 : _b.isDynamic;
|
|
30
|
+
});
|
|
31
|
+
const gpuAdvancedFeatures = computed(() => ({
|
|
32
|
+
enableNvidiaVgpuModel: props.enableNvidiaVgpuModel,
|
|
33
|
+
enableNvidiaVgpuDevices: props.enableNvidiaVgpuDevices,
|
|
34
|
+
enableNvidiaVgpuPriority: props.enableNvidiaVgpuPriority,
|
|
35
|
+
enableNvidiaVgpuSchedulePolicy: props.enableNvidiaVgpuSchedulePolicy
|
|
36
|
+
}));
|
|
37
|
+
const initValues = () => {
|
|
38
|
+
var _a;
|
|
39
|
+
const initialState = buildGpuFormItemInitialState({
|
|
40
|
+
quotaItem: props.quotaItem,
|
|
41
|
+
gpuOptionsMap: props.gpuOptionsMap ?? /* @__PURE__ */ new Map(),
|
|
42
|
+
advanced: gpuAdvancedFeatures.value
|
|
43
|
+
});
|
|
44
|
+
if (!initialState) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (initialState.dynamicQuota) {
|
|
48
|
+
dynamicQuota.value = initialState.dynamicQuota;
|
|
49
|
+
}
|
|
50
|
+
openNvidiaAssignGpu.value = initialState.openNvidiaAssignGpu;
|
|
51
|
+
openNvidiaVgpuSchedulePolicy.value = initialState.openNvidiaVgpuSchedulePolicy;
|
|
52
|
+
if (!props.isSide) {
|
|
53
|
+
initialState.values.resources = {
|
|
54
|
+
...buildGpuFormItemDefaultResources(
|
|
55
|
+
(_a = props.gpuOptionsMap) == null ? void 0 : _a.get(initialState.values.type ?? ""),
|
|
56
|
+
props.gpuUsage
|
|
57
|
+
),
|
|
58
|
+
...initialState.values.resources
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
setValues(initialState.values);
|
|
62
|
+
};
|
|
63
|
+
if (isNvidiaVgpu(props.quotaItem.type ?? "")) {
|
|
64
|
+
initValues();
|
|
65
|
+
} else {
|
|
66
|
+
const unwatchInit = watch(() => props.gpuOptionsMap, (newGpuOptions) => {
|
|
67
|
+
if (newGpuOptions == null ? void 0 : newGpuOptions.size) {
|
|
68
|
+
initValues();
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
unwatchInit == null ? void 0 : unwatchInit();
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
immediate: true
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (props.isSide) {
|
|
78
|
+
watch(() => props.quotaItem, () => {
|
|
79
|
+
initValues();
|
|
80
|
+
}, {
|
|
81
|
+
deep: true
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
watch([() => quota, dynamicQuota], () => {
|
|
85
|
+
emits("change", buildGpuFormItemChangePayload({
|
|
86
|
+
quota,
|
|
87
|
+
dynamicQuota: dynamicQuota.value,
|
|
88
|
+
quotaItem: props.quotaItem,
|
|
89
|
+
showDynamicForm: showDynamicForm.value,
|
|
90
|
+
advanced: gpuAdvancedFeatures.value,
|
|
91
|
+
openNvidiaAssignGpu: openNvidiaAssignGpu.value,
|
|
92
|
+
openNvidiaVgpuSchedulePolicy: openNvidiaVgpuSchedulePolicy.value
|
|
93
|
+
}));
|
|
94
|
+
}, {
|
|
95
|
+
deep: true
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
const filteredGpuOptionsMap = computed(() => filterGpuFormItemOptions({
|
|
99
|
+
gpuOptionsMap: props.gpuOptionsMap ?? /* @__PURE__ */ new Map(),
|
|
100
|
+
quotaType: quota.type,
|
|
101
|
+
existTypes: props.existTypes,
|
|
102
|
+
targetType: props.targetType
|
|
103
|
+
}));
|
|
104
|
+
const priorityOpts = getPriorityOpts(i18nInstance);
|
|
105
|
+
const gpuAdvancedFormProps = computed(() => ({
|
|
106
|
+
enableRemoteCall: props.enableRemoteCall,
|
|
107
|
+
enableNvidiaVgpuModel: props.enableNvidiaVgpuModel,
|
|
108
|
+
enableNvidiaVgpuDevices: props.enableNvidiaVgpuDevices,
|
|
109
|
+
assignGpuDisabled: props.assignGpuDisabled,
|
|
110
|
+
enableNvidiaVgpuPriority: props.enableNvidiaVgpuPriority,
|
|
111
|
+
enableNvidiaVgpuSchedulePolicy: props.enableNvidiaVgpuSchedulePolicy,
|
|
112
|
+
nvidiaGpuModels: props.nvidiaGpuModels,
|
|
113
|
+
nvidiaVgpuModelsAdaptor: props.nvidiaVgpuModelsAdaptor,
|
|
114
|
+
nvidiaVgpuDevicesAdaptor: props.nvidiaVgpuDevicesAdaptor,
|
|
115
|
+
isSide: props.isSide
|
|
116
|
+
}));
|
|
117
|
+
const isShowHamiGpuHelper = computed(() => isHamiGpu(currentGpuProvider.value) && props.gpuUsage === "workload" && !props.isSide);
|
|
118
|
+
const handleTypeChange = (val) => {
|
|
119
|
+
var _a;
|
|
120
|
+
quota.resources = buildGpuFormItemDefaultResources(
|
|
121
|
+
(_a = props.gpuOptionsMap) == null ? void 0 : _a.get(val),
|
|
122
|
+
props.gpuUsage
|
|
123
|
+
);
|
|
124
|
+
const isNextNvidiaVgpu = isNvidiaVgpu(val);
|
|
125
|
+
if (gpuAdvancedFeatures.value.enableNvidiaVgpuPriority && isNextNvidiaVgpu) {
|
|
126
|
+
quota[nvidiaVgpuPriorityKey] = priorityOpts[0].value;
|
|
127
|
+
}
|
|
128
|
+
if (!isNextNvidiaVgpu && gpuAdvancedFeatures.value.enableNvidiaVgpuSchedulePolicy) {
|
|
129
|
+
openNvidiaVgpuSchedulePolicy.value = false;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const validateWrapper = () => {
|
|
133
|
+
if (props.isSide) {
|
|
134
|
+
return {
|
|
135
|
+
valid: true
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return validate();
|
|
139
|
+
};
|
|
140
|
+
const gpuResourceHelperSlot = () => {
|
|
141
|
+
var _a;
|
|
142
|
+
return (_a = currentDisplayResource.value) == null ? void 0 : _a.reduce((acc, res) => {
|
|
143
|
+
const helperKey = `helper-${res.key}`;
|
|
144
|
+
if (slots[helperKey]) {
|
|
145
|
+
acc.push(helperKey);
|
|
146
|
+
}
|
|
147
|
+
return acc;
|
|
148
|
+
}, []);
|
|
149
|
+
};
|
|
150
|
+
const getGPUTypeInSide = (quotaType) => {
|
|
151
|
+
var _a;
|
|
152
|
+
if (!quotaType) {
|
|
153
|
+
return "";
|
|
154
|
+
}
|
|
155
|
+
return ((_a = filteredGpuOptionsMap.value.get(quotaType)) == null ? void 0 : _a.alias) ?? quotaType;
|
|
156
|
+
};
|
|
157
|
+
return {
|
|
158
|
+
quota,
|
|
159
|
+
dynamicQuota,
|
|
160
|
+
currentDisplayResource,
|
|
161
|
+
currentGpuProvider,
|
|
162
|
+
isShowHamiGpuHelper,
|
|
163
|
+
filteredGpuOptionsMap,
|
|
164
|
+
getGPUTypeInSide,
|
|
165
|
+
handleTypeChange,
|
|
166
|
+
validate: validateWrapper,
|
|
167
|
+
deSanitizeGPUObjectKey,
|
|
168
|
+
gpuResourceHelperSlot,
|
|
169
|
+
openNvidiaVgpuModel,
|
|
170
|
+
openNvidiaAssignGpu,
|
|
171
|
+
openNvidiaVgpuSchedulePolicy,
|
|
172
|
+
gpuAdvancedFormProps,
|
|
173
|
+
showDynamicForm
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
export {
|
|
177
|
+
useGpuFormItemState
|
|
178
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import type { GpuQuota, GpuQuotaItem } from '../types';
|
|
3
|
+
import type { GpuFormOptionsMap, GpuFormRows } from './gpuForm.internal-types';
|
|
4
|
+
interface UseGpuFormSideStateParams {
|
|
5
|
+
usedQuota: ComputedRef<GpuQuota | undefined>;
|
|
6
|
+
availableQuota: ComputedRef<GpuQuota | undefined>;
|
|
7
|
+
gpuOptionsMap: ComputedRef<GpuFormOptionsMap> | Ref<GpuFormOptionsMap>;
|
|
8
|
+
withPrefixRequest: ComputedRef<boolean | undefined>;
|
|
9
|
+
}
|
|
10
|
+
export declare function useGpuFormSideState({ usedQuota, availableQuota, gpuOptionsMap, withPrefixRequest, }: UseGpuFormSideStateParams): {
|
|
11
|
+
sideRows: Ref<{
|
|
12
|
+
type?: string | undefined;
|
|
13
|
+
id?: string | undefined;
|
|
14
|
+
removable?: boolean | undefined;
|
|
15
|
+
resources?: Record<string, string | number | undefined> | undefined;
|
|
16
|
+
nvidiaVgpuModel?: string | undefined;
|
|
17
|
+
nvidiaVgpuDevices?: string[] | undefined;
|
|
18
|
+
nvidiaVgpPriority?: string | undefined;
|
|
19
|
+
nvidiaVgpuGpuSchedule?: import("../types").VgpuSchedulePolicy | undefined;
|
|
20
|
+
nvidiaVgpuNodeSchedule?: import("../types").VgpuSchedulePolicy | undefined;
|
|
21
|
+
}[]>;
|
|
22
|
+
showSide: ComputedRef<boolean>;
|
|
23
|
+
sideQuota: ComputedRef<GpuQuota | undefined>;
|
|
24
|
+
syncSideRowChange: (idx: number, newRow: GpuQuotaItem) => void;
|
|
25
|
+
syncSideRowAdd: () => void;
|
|
26
|
+
syncSideRowDelete: (idx: number) => void;
|
|
27
|
+
syncFilter: () => void;
|
|
28
|
+
initSideRows: (rows: GpuFormRows) => void;
|
|
29
|
+
getUsedQuotaItem: (index: number) => {
|
|
30
|
+
type?: string | undefined;
|
|
31
|
+
id?: string | undefined;
|
|
32
|
+
removable?: boolean | undefined;
|
|
33
|
+
resources?: Record<string, string | number | undefined> | undefined;
|
|
34
|
+
nvidiaVgpuModel?: string | undefined;
|
|
35
|
+
nvidiaVgpuDevices?: string[] | undefined;
|
|
36
|
+
nvidiaVgpPriority?: string | undefined;
|
|
37
|
+
nvidiaVgpuGpuSchedule?: import("../types").VgpuSchedulePolicy | undefined;
|
|
38
|
+
nvidiaVgpuNodeSchedule?: import("../types").VgpuSchedulePolicy | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
getAvailableQuotaItem: (index: number) => {
|
|
41
|
+
type?: string | undefined;
|
|
42
|
+
id?: string | undefined;
|
|
43
|
+
removable?: boolean | undefined;
|
|
44
|
+
resources?: Record<string, string | number | undefined> | undefined;
|
|
45
|
+
nvidiaVgpuModel?: string | undefined;
|
|
46
|
+
nvidiaVgpuDevices?: string[] | undefined;
|
|
47
|
+
nvidiaVgpPriority?: string | undefined;
|
|
48
|
+
nvidiaVgpuGpuSchedule?: import("../types").VgpuSchedulePolicy | undefined;
|
|
49
|
+
nvidiaVgpuNodeSchedule?: import("../types").VgpuSchedulePolicy | undefined;
|
|
50
|
+
} | undefined;
|
|
51
|
+
};
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const lodashEs = require("lodash-es");
|
|
5
|
+
const gpuForm_mapper = require("./gpuForm.mapper.js");
|
|
6
|
+
const gpuForm_constants = require("./gpuForm.constants.js");
|
|
7
|
+
function useGpuFormSideState({
|
|
8
|
+
usedQuota,
|
|
9
|
+
availableQuota,
|
|
10
|
+
gpuOptionsMap,
|
|
11
|
+
withPrefixRequest
|
|
12
|
+
}) {
|
|
13
|
+
const sideRows = vue.ref([]);
|
|
14
|
+
const sideQuota = vue.computed(() => usedQuota.value ?? availableQuota.value);
|
|
15
|
+
const showSide = vue.computed(() => !!sideQuota.value);
|
|
16
|
+
const syncSideRowChange = (idx, newRow) => {
|
|
17
|
+
if (!showSide.value) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
sideRows.value[idx] = gpuForm_mapper.buildGpuFormSideRow({
|
|
21
|
+
row: lodashEs.cloneDeep(newRow),
|
|
22
|
+
gpuOptionsMap: gpuOptionsMap.value,
|
|
23
|
+
sideQuota: sideQuota.value,
|
|
24
|
+
withPrefixRequest: withPrefixRequest.value
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const syncSideRowAdd = () => {
|
|
28
|
+
if (!showSide.value) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
sideRows.value.push(gpuForm_constants.createEmptyRow());
|
|
32
|
+
};
|
|
33
|
+
const syncSideRowDelete = (idx) => {
|
|
34
|
+
if (sideRows.value.length) {
|
|
35
|
+
sideRows.value.splice(idx, 1);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const syncFilter = () => {
|
|
39
|
+
sideRows.value = gpuForm_mapper.filterGpuFormRows(sideRows.value, gpuOptionsMap.value);
|
|
40
|
+
};
|
|
41
|
+
const initSideRows = (rows) => {
|
|
42
|
+
sideRows.value = rows;
|
|
43
|
+
};
|
|
44
|
+
const getUsedQuotaItem = (index) => {
|
|
45
|
+
var _a;
|
|
46
|
+
if (usedQuota.value) {
|
|
47
|
+
return (_a = sideRows.value) == null ? void 0 : _a[index];
|
|
48
|
+
}
|
|
49
|
+
return void 0;
|
|
50
|
+
};
|
|
51
|
+
const getAvailableQuotaItem = (index) => {
|
|
52
|
+
var _a;
|
|
53
|
+
if (availableQuota.value) {
|
|
54
|
+
return (_a = sideRows.value) == null ? void 0 : _a[index];
|
|
55
|
+
}
|
|
56
|
+
return void 0;
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
sideRows,
|
|
60
|
+
showSide,
|
|
61
|
+
sideQuota,
|
|
62
|
+
syncSideRowChange,
|
|
63
|
+
syncSideRowAdd,
|
|
64
|
+
syncSideRowDelete,
|
|
65
|
+
syncFilter,
|
|
66
|
+
initSideRows,
|
|
67
|
+
getUsedQuotaItem,
|
|
68
|
+
getAvailableQuotaItem
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
exports.useGpuFormSideState = useGpuFormSideState;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
import { cloneDeep } from "lodash-es";
|
|
3
|
+
import { buildGpuFormSideRow, filterGpuFormRows } from "./gpuForm.mapper.mjs";
|
|
4
|
+
import { createEmptyRow } from "./gpuForm.constants.mjs";
|
|
5
|
+
function useGpuFormSideState({
|
|
6
|
+
usedQuota,
|
|
7
|
+
availableQuota,
|
|
8
|
+
gpuOptionsMap,
|
|
9
|
+
withPrefixRequest
|
|
10
|
+
}) {
|
|
11
|
+
const sideRows = ref([]);
|
|
12
|
+
const sideQuota = computed(() => usedQuota.value ?? availableQuota.value);
|
|
13
|
+
const showSide = computed(() => !!sideQuota.value);
|
|
14
|
+
const syncSideRowChange = (idx, newRow) => {
|
|
15
|
+
if (!showSide.value) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
sideRows.value[idx] = buildGpuFormSideRow({
|
|
19
|
+
row: cloneDeep(newRow),
|
|
20
|
+
gpuOptionsMap: gpuOptionsMap.value,
|
|
21
|
+
sideQuota: sideQuota.value,
|
|
22
|
+
withPrefixRequest: withPrefixRequest.value
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const syncSideRowAdd = () => {
|
|
26
|
+
if (!showSide.value) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
sideRows.value.push(createEmptyRow());
|
|
30
|
+
};
|
|
31
|
+
const syncSideRowDelete = (idx) => {
|
|
32
|
+
if (sideRows.value.length) {
|
|
33
|
+
sideRows.value.splice(idx, 1);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const syncFilter = () => {
|
|
37
|
+
sideRows.value = filterGpuFormRows(sideRows.value, gpuOptionsMap.value);
|
|
38
|
+
};
|
|
39
|
+
const initSideRows = (rows) => {
|
|
40
|
+
sideRows.value = rows;
|
|
41
|
+
};
|
|
42
|
+
const getUsedQuotaItem = (index) => {
|
|
43
|
+
var _a;
|
|
44
|
+
if (usedQuota.value) {
|
|
45
|
+
return (_a = sideRows.value) == null ? void 0 : _a[index];
|
|
46
|
+
}
|
|
47
|
+
return void 0;
|
|
48
|
+
};
|
|
49
|
+
const getAvailableQuotaItem = (index) => {
|
|
50
|
+
var _a;
|
|
51
|
+
if (availableQuota.value) {
|
|
52
|
+
return (_a = sideRows.value) == null ? void 0 : _a[index];
|
|
53
|
+
}
|
|
54
|
+
return void 0;
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
sideRows,
|
|
58
|
+
showSide,
|
|
59
|
+
sideQuota,
|
|
60
|
+
syncSideRowChange,
|
|
61
|
+
syncSideRowAdd,
|
|
62
|
+
syncSideRowDelete,
|
|
63
|
+
syncFilter,
|
|
64
|
+
initSideRows,
|
|
65
|
+
getUsedQuotaItem,
|
|
66
|
+
getAvailableQuotaItem
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
useGpuFormSideState
|
|
71
|
+
};
|