@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,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const GpuResources_vue_vue_type_script_lang = require("./GpuResources.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
|
-
const _component_dao_icon = vue.resolveComponent("dao-icon");
|
|
7
|
-
const _component_dao_input = vue.resolveComponent("dao-input");
|
|
8
|
-
const _component_dao_form_item_validate = vue.resolveComponent("dao-form-item-validate");
|
|
9
|
-
const _component_dao_form_item = vue.resolveComponent("dao-form-item");
|
|
10
|
-
return vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.resources, (res) => {
|
|
11
|
-
return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
|
|
12
|
-
key: res.key
|
|
13
|
-
}, [
|
|
14
|
-
!_ctx.isSide ? (vue.openBlock(), vue.createBlock(_component_dao_form_item_validate, {
|
|
15
|
-
key: 0,
|
|
16
|
-
label: _ctx.$i18n.locale.includes("zh") && res.aliasZh || res.alias,
|
|
17
|
-
class: vue.normalizeClass(res.unit ? "" : "input-without-append"),
|
|
18
|
-
name: `resources.${_ctx.sanitizeGPUKey(res.key)}`,
|
|
19
|
-
"control-props": {
|
|
20
|
-
type: "number",
|
|
21
|
-
append: res.unit,
|
|
22
|
-
placeholder: _ctx.resourcePlaceholder
|
|
23
|
-
},
|
|
24
|
-
helper: _ctx.getResHelper(res.available, res.key, res.alias),
|
|
25
|
-
"icon-message": _ctx.nvidiaVgpuResOrder.get(res.key ?? ""),
|
|
26
|
-
"yup-type": _ctx.yup.number(),
|
|
27
|
-
"yup-concat": _ctx.getIsNvidiaVgpuMemoryMb(res.alias) ? _ctx.getNvidiaVgpuMemoryResourceYup(res) : _ctx.getResourceYup(res),
|
|
28
|
-
required: _ctx.getResRequired(res)
|
|
29
|
-
}, vue.createSlots({ _: 2 }, [
|
|
30
|
-
_ctx.getIsIluvatarMemory(res.alias) ? {
|
|
31
|
-
name: "control-content",
|
|
32
|
-
fn: vue.withCtx(({ value, status }) => [
|
|
33
|
-
vue.createVNode(_component_dao_input, {
|
|
34
|
-
modelValue: value.value,
|
|
35
|
-
"onUpdate:modelValue": ($event) => value.value = $event,
|
|
36
|
-
modelModifiers: { number: true },
|
|
37
|
-
type: "number",
|
|
38
|
-
"root-attrs": {
|
|
39
|
-
class: "gpu-quotas-item__iluvatar-memory-input"
|
|
40
|
-
},
|
|
41
|
-
append: "MB",
|
|
42
|
-
status,
|
|
43
|
-
placeholder: _ctx.resourcePlaceholder
|
|
44
|
-
}, {
|
|
45
|
-
prefix: vue.withCtx(() => [
|
|
46
|
-
vue.createTextVNode(" 256 "),
|
|
47
|
-
vue.createVNode(_component_dao_icon, { name: "icon-asterisk" })
|
|
48
|
-
]),
|
|
49
|
-
_: 2
|
|
50
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "status", "placeholder"])
|
|
51
|
-
]),
|
|
52
|
-
key: "0"
|
|
53
|
-
} : _ctx.getIsNvidiaVgpuMemoryMb(res.alias) ? {
|
|
54
|
-
name: "control-content",
|
|
55
|
-
fn: vue.withCtx(({ status }) => [
|
|
56
|
-
vue.createVNode(_component_dao_input, {
|
|
57
|
-
modelValue: _ctx.nvidiaVgpuMemory,
|
|
58
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.nvidiaVgpuMemory = $event),
|
|
59
|
-
modelModifiers: { number: true },
|
|
60
|
-
type: "number",
|
|
61
|
-
append: _ctx.getResUnit(res),
|
|
62
|
-
status,
|
|
63
|
-
placeholder: _ctx.resourcePlaceholder
|
|
64
|
-
}, null, 8, ["modelValue", "append", "status", "placeholder"])
|
|
65
|
-
]),
|
|
66
|
-
key: "1"
|
|
67
|
-
} : void 0,
|
|
68
|
-
_ctx.$slots[`helper-${res.key}`] ? {
|
|
69
|
-
name: "helper",
|
|
70
|
-
fn: vue.withCtx(() => [
|
|
71
|
-
vue.renderSlot(_ctx.$slots, `helper-${res.key}`, {
|
|
72
|
-
resource: res,
|
|
73
|
-
quota: _ctx.quota,
|
|
74
|
-
isSide: _ctx.isSide,
|
|
75
|
-
gpuOptions: _ctx.resources
|
|
76
|
-
})
|
|
77
|
-
]),
|
|
78
|
-
key: "2"
|
|
79
|
-
} : void 0
|
|
80
|
-
]), 1032, ["label", "class", "name", "control-props", "helper", "icon-message", "yup-type", "yup-concat", "required"])) : (vue.openBlock(), vue.createBlock(_component_dao_form_item, {
|
|
81
|
-
key: 1,
|
|
82
|
-
label: _ctx.$i18n.locale.includes("zh") && res.aliasZh || res.alias,
|
|
83
|
-
class: vue.normalizeClass(res.unit ? "" : "input-without-append")
|
|
84
|
-
}, vue.createSlots({
|
|
85
|
-
default: vue.withCtx(() => [
|
|
86
|
-
vue.createVNode(_component_dao_input, {
|
|
87
|
-
"model-value": _ctx.getSideValue(res),
|
|
88
|
-
type: "number",
|
|
89
|
-
disabled: "",
|
|
90
|
-
"root-attrs": {
|
|
91
|
-
class: _ctx.getIsIluvatarMemory(res.alias) && "gpu-quotas-item__iluvatar-memory-input"
|
|
92
|
-
},
|
|
93
|
-
append: _ctx.getResUnit(res),
|
|
94
|
-
placeholder: _ctx.resourcePlaceholder
|
|
95
|
-
}, vue.createSlots({ _: 2 }, [
|
|
96
|
-
_ctx.getIsIluvatarMemory(res.alias) ? {
|
|
97
|
-
name: "prefix",
|
|
98
|
-
fn: vue.withCtx(() => [
|
|
99
|
-
vue.createTextVNode(" 256 "),
|
|
100
|
-
vue.createVNode(_component_dao_icon, { name: "icon-asterisk" })
|
|
101
|
-
]),
|
|
102
|
-
key: "0"
|
|
103
|
-
} : void 0
|
|
104
|
-
]), 1032, ["model-value", "root-attrs", "append", "placeholder"])
|
|
105
|
-
]),
|
|
106
|
-
_: 2
|
|
107
|
-
}, [
|
|
108
|
-
_ctx.$slots[`helper-${res.key}`] ? {
|
|
109
|
-
name: "helper",
|
|
110
|
-
fn: vue.withCtx(() => [
|
|
111
|
-
vue.renderSlot(_ctx.$slots, `helper-${res.key}`, {
|
|
112
|
-
resource: res,
|
|
113
|
-
quota: _ctx.quota,
|
|
114
|
-
isSide: _ctx.isSide,
|
|
115
|
-
gpuOptions: _ctx.resources
|
|
116
|
-
})
|
|
117
|
-
]),
|
|
118
|
-
key: "0"
|
|
119
|
-
} : void 0
|
|
120
|
-
]), 1032, ["label", "class"]))
|
|
121
|
-
], 64);
|
|
122
|
-
}), 128);
|
|
123
|
-
}
|
|
124
|
-
const GpuResources = /* @__PURE__ */ _pluginVue_exportHelper(GpuResources_vue_vue_type_script_lang, [["render", _sfc_render]]);
|
|
125
|
-
module.exports = GpuResources;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import _sfc_main from "./GpuResources.vue2.mjs";
|
|
2
|
-
import { resolveComponent, openBlock, createElementBlock, Fragment, renderList, createBlock, normalizeClass, createSlots, withCtx, createVNode, createTextVNode, renderSlot } from "vue";
|
|
3
|
-
import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5
|
-
const _component_dao_icon = resolveComponent("dao-icon");
|
|
6
|
-
const _component_dao_input = resolveComponent("dao-input");
|
|
7
|
-
const _component_dao_form_item_validate = resolveComponent("dao-form-item-validate");
|
|
8
|
-
const _component_dao_form_item = resolveComponent("dao-form-item");
|
|
9
|
-
return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.resources, (res) => {
|
|
10
|
-
return openBlock(), createElementBlock(Fragment, {
|
|
11
|
-
key: res.key
|
|
12
|
-
}, [
|
|
13
|
-
!_ctx.isSide ? (openBlock(), createBlock(_component_dao_form_item_validate, {
|
|
14
|
-
key: 0,
|
|
15
|
-
label: _ctx.$i18n.locale.includes("zh") && res.aliasZh || res.alias,
|
|
16
|
-
class: normalizeClass(res.unit ? "" : "input-without-append"),
|
|
17
|
-
name: `resources.${_ctx.sanitizeGPUKey(res.key)}`,
|
|
18
|
-
"control-props": {
|
|
19
|
-
type: "number",
|
|
20
|
-
append: res.unit,
|
|
21
|
-
placeholder: _ctx.resourcePlaceholder
|
|
22
|
-
},
|
|
23
|
-
helper: _ctx.getResHelper(res.available, res.key, res.alias),
|
|
24
|
-
"icon-message": _ctx.nvidiaVgpuResOrder.get(res.key ?? ""),
|
|
25
|
-
"yup-type": _ctx.yup.number(),
|
|
26
|
-
"yup-concat": _ctx.getIsNvidiaVgpuMemoryMb(res.alias) ? _ctx.getNvidiaVgpuMemoryResourceYup(res) : _ctx.getResourceYup(res),
|
|
27
|
-
required: _ctx.getResRequired(res)
|
|
28
|
-
}, createSlots({ _: 2 }, [
|
|
29
|
-
_ctx.getIsIluvatarMemory(res.alias) ? {
|
|
30
|
-
name: "control-content",
|
|
31
|
-
fn: withCtx(({ value, status }) => [
|
|
32
|
-
createVNode(_component_dao_input, {
|
|
33
|
-
modelValue: value.value,
|
|
34
|
-
"onUpdate:modelValue": ($event) => value.value = $event,
|
|
35
|
-
modelModifiers: { number: true },
|
|
36
|
-
type: "number",
|
|
37
|
-
"root-attrs": {
|
|
38
|
-
class: "gpu-quotas-item__iluvatar-memory-input"
|
|
39
|
-
},
|
|
40
|
-
append: "MB",
|
|
41
|
-
status,
|
|
42
|
-
placeholder: _ctx.resourcePlaceholder
|
|
43
|
-
}, {
|
|
44
|
-
prefix: withCtx(() => [
|
|
45
|
-
createTextVNode(" 256 "),
|
|
46
|
-
createVNode(_component_dao_icon, { name: "icon-asterisk" })
|
|
47
|
-
]),
|
|
48
|
-
_: 2
|
|
49
|
-
}, 1032, ["modelValue", "onUpdate:modelValue", "status", "placeholder"])
|
|
50
|
-
]),
|
|
51
|
-
key: "0"
|
|
52
|
-
} : _ctx.getIsNvidiaVgpuMemoryMb(res.alias) ? {
|
|
53
|
-
name: "control-content",
|
|
54
|
-
fn: withCtx(({ status }) => [
|
|
55
|
-
createVNode(_component_dao_input, {
|
|
56
|
-
modelValue: _ctx.nvidiaVgpuMemory,
|
|
57
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.nvidiaVgpuMemory = $event),
|
|
58
|
-
modelModifiers: { number: true },
|
|
59
|
-
type: "number",
|
|
60
|
-
append: _ctx.getResUnit(res),
|
|
61
|
-
status,
|
|
62
|
-
placeholder: _ctx.resourcePlaceholder
|
|
63
|
-
}, null, 8, ["modelValue", "append", "status", "placeholder"])
|
|
64
|
-
]),
|
|
65
|
-
key: "1"
|
|
66
|
-
} : void 0,
|
|
67
|
-
_ctx.$slots[`helper-${res.key}`] ? {
|
|
68
|
-
name: "helper",
|
|
69
|
-
fn: withCtx(() => [
|
|
70
|
-
renderSlot(_ctx.$slots, `helper-${res.key}`, {
|
|
71
|
-
resource: res,
|
|
72
|
-
quota: _ctx.quota,
|
|
73
|
-
isSide: _ctx.isSide,
|
|
74
|
-
gpuOptions: _ctx.resources
|
|
75
|
-
})
|
|
76
|
-
]),
|
|
77
|
-
key: "2"
|
|
78
|
-
} : void 0
|
|
79
|
-
]), 1032, ["label", "class", "name", "control-props", "helper", "icon-message", "yup-type", "yup-concat", "required"])) : (openBlock(), createBlock(_component_dao_form_item, {
|
|
80
|
-
key: 1,
|
|
81
|
-
label: _ctx.$i18n.locale.includes("zh") && res.aliasZh || res.alias,
|
|
82
|
-
class: normalizeClass(res.unit ? "" : "input-without-append")
|
|
83
|
-
}, createSlots({
|
|
84
|
-
default: withCtx(() => [
|
|
85
|
-
createVNode(_component_dao_input, {
|
|
86
|
-
"model-value": _ctx.getSideValue(res),
|
|
87
|
-
type: "number",
|
|
88
|
-
disabled: "",
|
|
89
|
-
"root-attrs": {
|
|
90
|
-
class: _ctx.getIsIluvatarMemory(res.alias) && "gpu-quotas-item__iluvatar-memory-input"
|
|
91
|
-
},
|
|
92
|
-
append: _ctx.getResUnit(res),
|
|
93
|
-
placeholder: _ctx.resourcePlaceholder
|
|
94
|
-
}, createSlots({ _: 2 }, [
|
|
95
|
-
_ctx.getIsIluvatarMemory(res.alias) ? {
|
|
96
|
-
name: "prefix",
|
|
97
|
-
fn: withCtx(() => [
|
|
98
|
-
createTextVNode(" 256 "),
|
|
99
|
-
createVNode(_component_dao_icon, { name: "icon-asterisk" })
|
|
100
|
-
]),
|
|
101
|
-
key: "0"
|
|
102
|
-
} : void 0
|
|
103
|
-
]), 1032, ["model-value", "root-attrs", "append", "placeholder"])
|
|
104
|
-
]),
|
|
105
|
-
_: 2
|
|
106
|
-
}, [
|
|
107
|
-
_ctx.$slots[`helper-${res.key}`] ? {
|
|
108
|
-
name: "helper",
|
|
109
|
-
fn: withCtx(() => [
|
|
110
|
-
renderSlot(_ctx.$slots, `helper-${res.key}`, {
|
|
111
|
-
resource: res,
|
|
112
|
-
quota: _ctx.quota,
|
|
113
|
-
isSide: _ctx.isSide,
|
|
114
|
-
gpuOptions: _ctx.resources
|
|
115
|
-
})
|
|
116
|
-
]),
|
|
117
|
-
key: "0"
|
|
118
|
-
} : void 0
|
|
119
|
-
]), 1032, ["label", "class"]))
|
|
120
|
-
], 64);
|
|
121
|
-
}), 128);
|
|
122
|
-
}
|
|
123
|
-
const GpuResources = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
124
|
-
export {
|
|
125
|
-
GpuResources as default
|
|
126
|
-
};
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const vue = require("vue");
|
|
3
|
-
const extend = require("@dao-style/extend");
|
|
4
|
-
const vueI18n = require("vue-i18n");
|
|
5
|
-
const yup = require("yup");
|
|
6
|
-
const veeValidate = require("vee-validate");
|
|
7
|
-
const props = require("../props.js");
|
|
8
|
-
const utils = require("../utils.js");
|
|
9
|
-
const nvidiaVgpuMemoryDecimal = require("./validations/nvidiaVgpuMemoryDecimal.js");
|
|
10
|
-
const useSetFieldValue = require("../../../utils/useSetFieldValue.js");
|
|
11
|
-
function _interopNamespaceDefault(e) {
|
|
12
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
13
|
-
if (e) {
|
|
14
|
-
for (const k in e) {
|
|
15
|
-
if (k !== "default") {
|
|
16
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: () => e[k]
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
n.default = e;
|
|
25
|
-
return Object.freeze(n);
|
|
26
|
-
}
|
|
27
|
-
const yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(yup);
|
|
28
|
-
const _sfc_main = vue.defineComponent({
|
|
29
|
-
name: "DaoGpuResources",
|
|
30
|
-
components: {
|
|
31
|
-
DaoFormItemValidate: extend.DaoFormItemValidate
|
|
32
|
-
},
|
|
33
|
-
props: props.gpuResourceItemProps,
|
|
34
|
-
setup(props$1) {
|
|
35
|
-
nvidiaVgpuMemoryDecimal(vueI18n.useI18n());
|
|
36
|
-
const isIluvatar = vue.computed(() => {
|
|
37
|
-
var _a, _b;
|
|
38
|
-
return (_b = (_a = props$1.quotaItem.type) == null ? void 0 : _a.toLocaleLowerCase) == null ? void 0 : _b.call(_a).includes("iluvatar");
|
|
39
|
-
});
|
|
40
|
-
const getIsIluvatarMemory = (alias) => isIluvatar.value && (alias == null ? void 0 : alias.includes("Memory"));
|
|
41
|
-
const getIsNvidiaVgpuMemoryMb = (alias) => props$1.quotaItem.type === props.nvidiaVgpuKey && (alias == null ? void 0 : alias.includes("Memory"));
|
|
42
|
-
const i18nInstance = vueI18n.useI18n();
|
|
43
|
-
const nvidiaVgpuResOrder = props.getNvidiaVgpuResOrder(i18nInstance);
|
|
44
|
-
const { t } = i18nInstance;
|
|
45
|
-
const resourcePlaceholder = vue.computed(() => !props$1.enableRangeValidate ? t("biz.components.Gpu.unlimited") : "");
|
|
46
|
-
const getResHelper = (available, key, alias) => {
|
|
47
|
-
const resHelperList = [];
|
|
48
|
-
if ((available == null ? void 0 : available.available) && Number(available.available) > -1) {
|
|
49
|
-
resHelperList.push(t("biz.components.Gpu.available", {
|
|
50
|
-
available: available == null ? void 0 : available.available
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
if (isIluvatar.value && (alias == null ? void 0 : alias.includes("Computing")) && alias.includes("Power")) {
|
|
54
|
-
resHelperList.push(t("biz.components.Gpu.iluvatar.computeTip"));
|
|
55
|
-
} else if (isIluvatar.value && (alias == null ? void 0 : alias.includes("Memory"))) {
|
|
56
|
-
resHelperList.push(t("biz.components.Gpu.iluvatar.memoryTip"));
|
|
57
|
-
}
|
|
58
|
-
return resHelperList.join(";");
|
|
59
|
-
};
|
|
60
|
-
const getResRequired = (resource) => {
|
|
61
|
-
var _a, _b;
|
|
62
|
-
if (props$1.availableQuotaItem) {
|
|
63
|
-
const available = (_a = props$1.availableQuotaItem.resources) == null ? void 0 : _a[utils.sanitizeGPUKey((resource == null ? void 0 : resource.key) ?? "") ?? ""];
|
|
64
|
-
if (available !== void 0) {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if (!props$1.enableRangeValidate) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
return (((_b = resource.range) == null ? void 0 : _b.min) ?? 0) > 0;
|
|
72
|
-
};
|
|
73
|
-
const getResUnit = (res) => {
|
|
74
|
-
if (getIsNvidiaVgpuMemoryMb(res.alias)) {
|
|
75
|
-
return "Gi";
|
|
76
|
-
}
|
|
77
|
-
return res.unit;
|
|
78
|
-
};
|
|
79
|
-
const getResourceYup = (resource) => {
|
|
80
|
-
var _a, _b;
|
|
81
|
-
if (!props$1.enableRangeValidate) {
|
|
82
|
-
const { key } = resource;
|
|
83
|
-
const parsedKey = utils.sanitizeGPUKey(key);
|
|
84
|
-
if (props$1.availableQuotaItem) {
|
|
85
|
-
const available = (_a = props$1.availableQuotaItem.resources) == null ? void 0 : _a[parsedKey ?? ""];
|
|
86
|
-
if (available) {
|
|
87
|
-
return yup__namespace.number().integer().max(Number(available)).min(1);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (props$1.usedQuotaItem) {
|
|
91
|
-
const used = (_b = props$1.usedQuotaItem.resources) == null ? void 0 : _b[parsedKey ?? ""];
|
|
92
|
-
if (used) {
|
|
93
|
-
return yup__namespace.number().integer().min(Number(used));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return yup__namespace.number().integer().min(1);
|
|
97
|
-
}
|
|
98
|
-
const { range } = resource;
|
|
99
|
-
if (range == null ? void 0 : range.max) {
|
|
100
|
-
return yup__namespace.number().integer().min((range == null ? void 0 : range.min) ?? 1).max(range.max);
|
|
101
|
-
}
|
|
102
|
-
return yup__namespace.number().integer().min((range == null ? void 0 : range.min) ?? 1);
|
|
103
|
-
};
|
|
104
|
-
const getNvidiaVgpuMemoryResourceYup = (resource) => {
|
|
105
|
-
var _a, _b;
|
|
106
|
-
const baseSchema = yup__namespace.number().transform((val) => {
|
|
107
|
-
if (val == null) {
|
|
108
|
-
return val;
|
|
109
|
-
}
|
|
110
|
-
return val / 1e3;
|
|
111
|
-
});
|
|
112
|
-
if (!props$1.enableRangeValidate) {
|
|
113
|
-
const { key } = resource;
|
|
114
|
-
const parsedKey = utils.sanitizeGPUKey(key);
|
|
115
|
-
if (props$1.availableQuotaItem) {
|
|
116
|
-
const available = (_a = props$1.availableQuotaItem.resources) == null ? void 0 : _a[parsedKey ?? ""];
|
|
117
|
-
if (available) {
|
|
118
|
-
const availableNum = Number(available);
|
|
119
|
-
return baseSchema.max(availableNum / 1e3).min(1 / 1e3).nvidiaVgpuMemoryDecimal();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (props$1.usedQuotaItem) {
|
|
123
|
-
const used = (_b = props$1.usedQuotaItem.resources) == null ? void 0 : _b[parsedKey ?? ""];
|
|
124
|
-
if (used) {
|
|
125
|
-
return baseSchema.min(Number(used) / 1e3).nvidiaVgpuMemoryDecimal();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return baseSchema.min(1 / 1e3).nvidiaVgpuMemoryDecimal();
|
|
129
|
-
}
|
|
130
|
-
const { range } = resource;
|
|
131
|
-
const rangeMin = ((range == null ? void 0 : range.min) ?? 1) / 1e3;
|
|
132
|
-
if (range == null ? void 0 : range.max) {
|
|
133
|
-
const rangeMax = ((range == null ? void 0 : range.max) ?? 1) / 1e3;
|
|
134
|
-
return baseSchema.min(rangeMin).max(rangeMax).nvidiaVgpuMemoryDecimal();
|
|
135
|
-
}
|
|
136
|
-
return baseSchema.min(rangeMin).nvidiaVgpuMemoryDecimal();
|
|
137
|
-
};
|
|
138
|
-
const nvidiaVgpuMemoryResource = vue.computed(() => {
|
|
139
|
-
var _a;
|
|
140
|
-
if (props$1.quotaItem.type !== props.nvidiaVgpuKey) {
|
|
141
|
-
return void 0;
|
|
142
|
-
}
|
|
143
|
-
return (_a = props$1.resources) == null ? void 0 : _a.find((res) => getIsNvidiaVgpuMemoryMb(res.alias));
|
|
144
|
-
});
|
|
145
|
-
const nvidiaVgpuMemoryField = vue.computed(() => {
|
|
146
|
-
var _a;
|
|
147
|
-
const key = (_a = nvidiaVgpuMemoryResource.value) == null ? void 0 : _a.key;
|
|
148
|
-
if (key) {
|
|
149
|
-
return `resources.${utils.sanitizeGPUKey(key)}`;
|
|
150
|
-
}
|
|
151
|
-
return "";
|
|
152
|
-
});
|
|
153
|
-
const nvidiaVgpuMemoryValue = veeValidate.useFieldValue(nvidiaVgpuMemoryField.value);
|
|
154
|
-
const setNvidiaVgpuMemoryValue = useSetFieldValue.useSetFieldValue(nvidiaVgpuMemoryField.value);
|
|
155
|
-
const nvidiaVgpuMemory = vue.computed({
|
|
156
|
-
get() {
|
|
157
|
-
if (nvidiaVgpuMemoryValue.value === void 0 || typeof nvidiaVgpuMemoryValue.value !== "number") {
|
|
158
|
-
return void 0;
|
|
159
|
-
}
|
|
160
|
-
return nvidiaVgpuMemoryValue.value / 1e3;
|
|
161
|
-
},
|
|
162
|
-
set(v) {
|
|
163
|
-
if (v === void 0 || typeof v !== "number") {
|
|
164
|
-
setNvidiaVgpuMemoryValue(void 0);
|
|
165
|
-
} else {
|
|
166
|
-
setNvidiaVgpuMemoryValue(v * 1e3);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
const getSideValue = (resource) => {
|
|
171
|
-
var _a, _b;
|
|
172
|
-
const val = (_b = (_a = props$1.quota) == null ? void 0 : _a.resources) == null ? void 0 : _b[utils.sanitizeGPUKey(resource.key) ?? ""];
|
|
173
|
-
if (getIsNvidiaVgpuMemoryMb(resource.alias) && val != null) {
|
|
174
|
-
return Number(val) / 1e3;
|
|
175
|
-
}
|
|
176
|
-
return val ?? "";
|
|
177
|
-
};
|
|
178
|
-
return {
|
|
179
|
-
getIsIluvatarMemory,
|
|
180
|
-
getIsNvidiaVgpuMemoryMb,
|
|
181
|
-
getResHelper,
|
|
182
|
-
getResUnit,
|
|
183
|
-
resourcePlaceholder,
|
|
184
|
-
getResRequired,
|
|
185
|
-
nvidiaVgpuResOrder,
|
|
186
|
-
nvidiaVgpuMemory,
|
|
187
|
-
sanitizeGPUKey: utils.sanitizeGPUKey,
|
|
188
|
-
yup: yup__namespace,
|
|
189
|
-
getResourceYup,
|
|
190
|
-
getNvidiaVgpuMemoryResourceYup,
|
|
191
|
-
nvidiaVgpuMemoryResource,
|
|
192
|
-
nvidiaVgpuMemoryField,
|
|
193
|
-
getSideValue
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
module.exports = _sfc_main;
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { defineComponent, computed } from "vue";
|
|
2
|
-
import { DaoFormItemValidate } from "@dao-style/extend";
|
|
3
|
-
import { useI18n } from "vue-i18n";
|
|
4
|
-
import * as yup from "yup";
|
|
5
|
-
import { useFieldValue } from "vee-validate";
|
|
6
|
-
import { gpuResourceItemProps, getNvidiaVgpuResOrder, nvidiaVgpuKey } from "../props.mjs";
|
|
7
|
-
import { sanitizeGPUKey } from "../utils.mjs";
|
|
8
|
-
import register from "./validations/nvidiaVgpuMemoryDecimal.mjs";
|
|
9
|
-
import { useSetFieldValue } from "../../../utils/useSetFieldValue.mjs";
|
|
10
|
-
const _sfc_main = defineComponent({
|
|
11
|
-
name: "DaoGpuResources",
|
|
12
|
-
components: {
|
|
13
|
-
DaoFormItemValidate
|
|
14
|
-
},
|
|
15
|
-
props: gpuResourceItemProps,
|
|
16
|
-
setup(props) {
|
|
17
|
-
register(useI18n());
|
|
18
|
-
const isIluvatar = computed(() => {
|
|
19
|
-
var _a, _b;
|
|
20
|
-
return (_b = (_a = props.quotaItem.type) == null ? void 0 : _a.toLocaleLowerCase) == null ? void 0 : _b.call(_a).includes("iluvatar");
|
|
21
|
-
});
|
|
22
|
-
const getIsIluvatarMemory = (alias) => isIluvatar.value && (alias == null ? void 0 : alias.includes("Memory"));
|
|
23
|
-
const getIsNvidiaVgpuMemoryMb = (alias) => props.quotaItem.type === nvidiaVgpuKey && (alias == null ? void 0 : alias.includes("Memory"));
|
|
24
|
-
const i18nInstance = useI18n();
|
|
25
|
-
const nvidiaVgpuResOrder = getNvidiaVgpuResOrder(i18nInstance);
|
|
26
|
-
const { t } = i18nInstance;
|
|
27
|
-
const resourcePlaceholder = computed(() => !props.enableRangeValidate ? t("biz.components.Gpu.unlimited") : "");
|
|
28
|
-
const getResHelper = (available, key, alias) => {
|
|
29
|
-
const resHelperList = [];
|
|
30
|
-
if ((available == null ? void 0 : available.available) && Number(available.available) > -1) {
|
|
31
|
-
resHelperList.push(t("biz.components.Gpu.available", {
|
|
32
|
-
available: available == null ? void 0 : available.available
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
if (isIluvatar.value && (alias == null ? void 0 : alias.includes("Computing")) && alias.includes("Power")) {
|
|
36
|
-
resHelperList.push(t("biz.components.Gpu.iluvatar.computeTip"));
|
|
37
|
-
} else if (isIluvatar.value && (alias == null ? void 0 : alias.includes("Memory"))) {
|
|
38
|
-
resHelperList.push(t("biz.components.Gpu.iluvatar.memoryTip"));
|
|
39
|
-
}
|
|
40
|
-
return resHelperList.join(";");
|
|
41
|
-
};
|
|
42
|
-
const getResRequired = (resource) => {
|
|
43
|
-
var _a, _b;
|
|
44
|
-
if (props.availableQuotaItem) {
|
|
45
|
-
const available = (_a = props.availableQuotaItem.resources) == null ? void 0 : _a[sanitizeGPUKey((resource == null ? void 0 : resource.key) ?? "") ?? ""];
|
|
46
|
-
if (available !== void 0) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (!props.enableRangeValidate) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
return (((_b = resource.range) == null ? void 0 : _b.min) ?? 0) > 0;
|
|
54
|
-
};
|
|
55
|
-
const getResUnit = (res) => {
|
|
56
|
-
if (getIsNvidiaVgpuMemoryMb(res.alias)) {
|
|
57
|
-
return "Gi";
|
|
58
|
-
}
|
|
59
|
-
return res.unit;
|
|
60
|
-
};
|
|
61
|
-
const getResourceYup = (resource) => {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
if (!props.enableRangeValidate) {
|
|
64
|
-
const { key } = resource;
|
|
65
|
-
const parsedKey = sanitizeGPUKey(key);
|
|
66
|
-
if (props.availableQuotaItem) {
|
|
67
|
-
const available = (_a = props.availableQuotaItem.resources) == null ? void 0 : _a[parsedKey ?? ""];
|
|
68
|
-
if (available) {
|
|
69
|
-
return yup.number().integer().max(Number(available)).min(1);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (props.usedQuotaItem) {
|
|
73
|
-
const used = (_b = props.usedQuotaItem.resources) == null ? void 0 : _b[parsedKey ?? ""];
|
|
74
|
-
if (used) {
|
|
75
|
-
return yup.number().integer().min(Number(used));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return yup.number().integer().min(1);
|
|
79
|
-
}
|
|
80
|
-
const { range } = resource;
|
|
81
|
-
if (range == null ? void 0 : range.max) {
|
|
82
|
-
return yup.number().integer().min((range == null ? void 0 : range.min) ?? 1).max(range.max);
|
|
83
|
-
}
|
|
84
|
-
return yup.number().integer().min((range == null ? void 0 : range.min) ?? 1);
|
|
85
|
-
};
|
|
86
|
-
const getNvidiaVgpuMemoryResourceYup = (resource) => {
|
|
87
|
-
var _a, _b;
|
|
88
|
-
const baseSchema = yup.number().transform((val) => {
|
|
89
|
-
if (val == null) {
|
|
90
|
-
return val;
|
|
91
|
-
}
|
|
92
|
-
return val / 1e3;
|
|
93
|
-
});
|
|
94
|
-
if (!props.enableRangeValidate) {
|
|
95
|
-
const { key } = resource;
|
|
96
|
-
const parsedKey = sanitizeGPUKey(key);
|
|
97
|
-
if (props.availableQuotaItem) {
|
|
98
|
-
const available = (_a = props.availableQuotaItem.resources) == null ? void 0 : _a[parsedKey ?? ""];
|
|
99
|
-
if (available) {
|
|
100
|
-
const availableNum = Number(available);
|
|
101
|
-
return baseSchema.max(availableNum / 1e3).min(1 / 1e3).nvidiaVgpuMemoryDecimal();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (props.usedQuotaItem) {
|
|
105
|
-
const used = (_b = props.usedQuotaItem.resources) == null ? void 0 : _b[parsedKey ?? ""];
|
|
106
|
-
if (used) {
|
|
107
|
-
return baseSchema.min(Number(used) / 1e3).nvidiaVgpuMemoryDecimal();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return baseSchema.min(1 / 1e3).nvidiaVgpuMemoryDecimal();
|
|
111
|
-
}
|
|
112
|
-
const { range } = resource;
|
|
113
|
-
const rangeMin = ((range == null ? void 0 : range.min) ?? 1) / 1e3;
|
|
114
|
-
if (range == null ? void 0 : range.max) {
|
|
115
|
-
const rangeMax = ((range == null ? void 0 : range.max) ?? 1) / 1e3;
|
|
116
|
-
return baseSchema.min(rangeMin).max(rangeMax).nvidiaVgpuMemoryDecimal();
|
|
117
|
-
}
|
|
118
|
-
return baseSchema.min(rangeMin).nvidiaVgpuMemoryDecimal();
|
|
119
|
-
};
|
|
120
|
-
const nvidiaVgpuMemoryResource = computed(() => {
|
|
121
|
-
var _a;
|
|
122
|
-
if (props.quotaItem.type !== nvidiaVgpuKey) {
|
|
123
|
-
return void 0;
|
|
124
|
-
}
|
|
125
|
-
return (_a = props.resources) == null ? void 0 : _a.find((res) => getIsNvidiaVgpuMemoryMb(res.alias));
|
|
126
|
-
});
|
|
127
|
-
const nvidiaVgpuMemoryField = computed(() => {
|
|
128
|
-
var _a;
|
|
129
|
-
const key = (_a = nvidiaVgpuMemoryResource.value) == null ? void 0 : _a.key;
|
|
130
|
-
if (key) {
|
|
131
|
-
return `resources.${sanitizeGPUKey(key)}`;
|
|
132
|
-
}
|
|
133
|
-
return "";
|
|
134
|
-
});
|
|
135
|
-
const nvidiaVgpuMemoryValue = useFieldValue(nvidiaVgpuMemoryField.value);
|
|
136
|
-
const setNvidiaVgpuMemoryValue = useSetFieldValue(nvidiaVgpuMemoryField.value);
|
|
137
|
-
const nvidiaVgpuMemory = computed({
|
|
138
|
-
get() {
|
|
139
|
-
if (nvidiaVgpuMemoryValue.value === void 0 || typeof nvidiaVgpuMemoryValue.value !== "number") {
|
|
140
|
-
return void 0;
|
|
141
|
-
}
|
|
142
|
-
return nvidiaVgpuMemoryValue.value / 1e3;
|
|
143
|
-
},
|
|
144
|
-
set(v) {
|
|
145
|
-
if (v === void 0 || typeof v !== "number") {
|
|
146
|
-
setNvidiaVgpuMemoryValue(void 0);
|
|
147
|
-
} else {
|
|
148
|
-
setNvidiaVgpuMemoryValue(v * 1e3);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
const getSideValue = (resource) => {
|
|
153
|
-
var _a, _b;
|
|
154
|
-
const val = (_b = (_a = props.quota) == null ? void 0 : _a.resources) == null ? void 0 : _b[sanitizeGPUKey(resource.key) ?? ""];
|
|
155
|
-
if (getIsNvidiaVgpuMemoryMb(resource.alias) && val != null) {
|
|
156
|
-
return Number(val) / 1e3;
|
|
157
|
-
}
|
|
158
|
-
return val ?? "";
|
|
159
|
-
};
|
|
160
|
-
return {
|
|
161
|
-
getIsIluvatarMemory,
|
|
162
|
-
getIsNvidiaVgpuMemoryMb,
|
|
163
|
-
getResHelper,
|
|
164
|
-
getResUnit,
|
|
165
|
-
resourcePlaceholder,
|
|
166
|
-
getResRequired,
|
|
167
|
-
nvidiaVgpuResOrder,
|
|
168
|
-
nvidiaVgpuMemory,
|
|
169
|
-
sanitizeGPUKey,
|
|
170
|
-
yup,
|
|
171
|
-
getResourceYup,
|
|
172
|
-
getNvidiaVgpuMemoryResourceYup,
|
|
173
|
-
nvidiaVgpuMemoryResource,
|
|
174
|
-
nvidiaVgpuMemoryField,
|
|
175
|
-
getSideValue
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
export {
|
|
180
|
-
_sfc_main as default
|
|
181
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const yup = require("yup");
|
|
3
|
-
const i18n = require("../../../../i18n.js");
|
|
4
|
-
function register(i18n$1 = i18n.getGlobalVueI18n()) {
|
|
5
|
-
yup.addMethod(yup.number, "nvidiaVgpuMemoryDecimal", function checkNvidiaVgpuMemoryDecimal(message = () => i18n$1 == null ? void 0 : i18n$1.t("biz.components.Gpu.errorDecimal")) {
|
|
6
|
-
return this.test({
|
|
7
|
-
name: "nvidiaVgpuMemoryDecimal",
|
|
8
|
-
message,
|
|
9
|
-
test(value) {
|
|
10
|
-
if (value == null) {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
const reg = /^\d+(\.\d{1,3})?$/;
|
|
14
|
-
return reg.test(String(value));
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
module.exports = register;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { addMethod, number } from "yup";
|
|
2
|
-
import { getGlobalVueI18n } from "../../../../i18n.mjs";
|
|
3
|
-
function register(i18n = getGlobalVueI18n()) {
|
|
4
|
-
addMethod(number, "nvidiaVgpuMemoryDecimal", function checkNvidiaVgpuMemoryDecimal(message = () => i18n == null ? void 0 : i18n.t("biz.components.Gpu.errorDecimal")) {
|
|
5
|
-
return this.test({
|
|
6
|
-
name: "nvidiaVgpuMemoryDecimal",
|
|
7
|
-
message,
|
|
8
|
-
test(value) {
|
|
9
|
-
if (value == null) {
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
const reg = /^\d+(\.\d{1,3})?$/;
|
|
13
|
-
return reg.test(String(value));
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
register as default
|
|
20
|
-
};
|