bfg-common 1.5.300 → 1.5.302

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.
Files changed (122) hide show
  1. package/CODE_STYLE.md +109 -109
  2. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  3. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  4. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  5. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  6. package/components/atoms/TheIcon3.vue +50 -50
  7. package/components/atoms/perPage/PerPage.vue +58 -58
  8. package/components/atoms/table/dataGrid/DataGrid.vue +1717 -1717
  9. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  10. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  11. package/components/atoms/tabs/VerticalTabs.vue +105 -105
  12. package/components/common/backup/storage/actions/add/lib/config/steps.ts +168 -168
  13. package/components/common/backup/storage/actions/add/steps/hostAccessibility/HostAccessibility.vue +52 -52
  14. package/components/common/backup/storage/actions/add/steps/nameAndConfigure/NameAndConfigure.vue +42 -42
  15. package/components/common/backup/storage/actions/add/steps/readyComplete/ReadyComplete.vue +45 -45
  16. package/components/common/backup/storage/actions/add/steps/readyComplete/lib/config/propertiesDetails.ts +243 -243
  17. package/components/common/backup/storage/actions/delete/Delete.vue +65 -65
  18. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  19. package/components/common/context/lib/models/interfaces.ts +33 -31
  20. package/components/common/context/recursion/RecursionNew.vue +3 -2
  21. package/components/common/context/recursion/RecursionOld.vue +3 -2
  22. package/components/common/diagramMain/DiagramMain.vue +897 -897
  23. package/components/common/layout/theHeader/helpMenu/About.vue +82 -82
  24. package/components/common/layout/theHeader/userMenu/modals/preferences/view/ViewOld.vue +112 -112
  25. package/components/common/monitor/overview/OverviewOld.vue +139 -139
  26. package/components/common/pages/home/headline/Headline.vue +45 -45
  27. package/components/common/pages/home/headline/HeadlineOld.vue +42 -42
  28. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  29. package/components/common/pages/home/widgets/Widgets.vue +49 -49
  30. package/components/common/pages/home/widgets/WidgetsNew.vue +86 -86
  31. package/components/common/pages/home/widgets/WidgetsOld.vue +34 -34
  32. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  33. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  34. package/components/common/pages/home/widgets/vms/Vms.vue +26 -26
  35. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  36. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  37. package/components/common/pages/packages/Packages.vue +208 -208
  38. package/components/common/pages/shortcuts/block/BlockOld.vue +68 -68
  39. package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
  40. package/components/common/recursionTree/RecursionTree.vue +223 -223
  41. package/components/common/select/button/ButtonDropdown.vue +108 -108
  42. package/components/common/spiceConsole/Drawer.vue +377 -377
  43. package/components/common/spiceConsole/SpiceConsole.vue +127 -127
  44. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  45. package/components/common/vm/actions/add/folderTreeView/FolderTreeView.vue +72 -72
  46. package/components/common/vm/actions/add/folderTreeView/New.vue +40 -40
  47. package/components/common/vm/actions/add/folderTreeView/Old.vue +50 -50
  48. package/components/common/vm/actions/clone/lib/config/steps.ts +291 -291
  49. package/components/common/vm/actions/clone/toTemplate/lib/config/steps.ts +116 -116
  50. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardwareOld.vue +321 -321
  51. package/components/common/vm/actions/common/customizeHardware/virtualHardware/browseView/BrowseView.vue +227 -227
  52. package/components/common/vm/actions/common/customizeHardware/virtualHardware/bus/Bus.vue +100 -100
  53. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +232 -232
  54. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDriveOld.vue +168 -168
  55. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +25 -25
  56. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaNew.vue +78 -78
  57. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaOld.vue +50 -50
  58. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/Shares.vue +140 -140
  59. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
  60. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/tooltip/TooltipNew.vue +154 -154
  61. package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/Limit.vue +220 -220
  62. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +307 -307
  63. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +385 -385
  64. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/Location.vue +154 -154
  65. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/LocationOld.vue +85 -85
  66. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +288 -288
  67. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/lib/config/config.ts +94 -94
  68. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +119 -119
  69. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +205 -205
  70. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoNew.vue +66 -66
  71. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/directPathIo/DirectPathIoOld.vue +62 -62
  72. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIo.vue +31 -31
  73. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIoOld.vue +76 -76
  74. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/Note.vue +15 -15
  75. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteNew.vue +42 -42
  76. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/note/NoteOld.vue +30 -30
  77. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/nvidiaGrid/NvidiaGridOld.vue +84 -84
  78. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +16 -16
  79. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +154 -154
  80. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/numberDisplays/NumberDisplays.vue +53 -53
  81. package/components/common/vm/actions/common/customizeHardware/vmoptions/Vmoptions.vue +152 -152
  82. package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsNew.vue +128 -128
  83. package/components/common/vm/actions/common/customizeHardware/vmoptions/VmoptionsOld.vue +111 -111
  84. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +32 -32
  85. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +60 -60
  86. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +174 -174
  87. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +83 -83
  88. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptionsOld.vue +154 -154
  89. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +32 -32
  90. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/KeymapOld.vue +44 -44
  91. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +103 -103
  92. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirection.vue +28 -28
  93. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirectionOld.vue +44 -44
  94. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
  95. package/components/common/vm/actions/common/select/computeResource/treeView/TreeView.vue +118 -118
  96. package/components/common/vm/actions/common/select/createType/CreateType.vue +38 -38
  97. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
  98. package/components/common/vm/actions/common/select/name/Name.vue +174 -174
  99. package/components/common/vm/actions/common/select/os/Old.vue +152 -152
  100. package/components/common/vm/actions/common/select/os/Os.vue +139 -139
  101. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
  102. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
  103. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  104. package/components/common/vmt/actions/add/Add.vue +641 -641
  105. package/components/common/vmt/actions/add/lib/config/steps.ts +107 -107
  106. package/components/common/vmt/actions/add/lib/models/interfaces.ts +23 -23
  107. package/components/common/wizards/vm/migrate/lib/config/constructDataReady.ts +220 -220
  108. package/components/common/wizards/vm/migrate/lib/config/steps.ts +157 -157
  109. package/components/common/wizards/vm/migrate/lib/validations.ts +68 -68
  110. package/components/common/wizards/vm/migrate/select/network/Network.vue +103 -103
  111. package/components/common/wizards/vm/migrate/select/network/table/network/lib/config/advancedTable.ts +91 -91
  112. package/composables/productNameLocal.ts +30 -30
  113. package/composables/useAppVersion.ts +21 -21
  114. package/package.json +1 -1
  115. package/plugins/date.ts +233 -233
  116. package/plugins/panelStates.ts +70 -70
  117. package/plugins/text.ts +59 -59
  118. package/public/spice-console/lib/images/bitmap.js +203 -203
  119. package/public/spice-console/network/spicechannel.js +387 -387
  120. package/store/main/mutations.ts +7 -7
  121. package/store/main/state.ts +7 -7
  122. package/store/tasks/mappers/recentTasks.ts +64 -64
@@ -1,641 +1,641 @@
1
- <template>
2
- <div class="add-template">
3
- <atoms-wizard
4
- show
5
- :wizard="wizard"
6
- :selected-scheme="selectedScheme"
7
- :title="title"
8
- :localization="localization"
9
- @change-steps="onChangeSteps"
10
- @hide="onHideModal"
11
- @submit="onFinish"
12
- >
13
- <template #modalBody="{ selectedStep }">
14
- <atoms-loader
15
- v-show="isLoading"
16
- id="loader"
17
- test-id="add-template-loader"
18
- />
19
- <div class="vmt-context">
20
- <common-pages-scheduled-tasks-modals-common-new-task-form
21
- v-show="selectedStep.id === dynamicSteps.scheduledTasks"
22
- v-model="newTaskForm"
23
- target="0"
24
- class="new-task-form"
25
- />
26
- <common-vm-actions-common-select-name
27
- v-show="selectedStep.id === dynamicSteps.selectName"
28
- :show="selectedStep.id === dynamicSteps.selectName"
29
- :name-form-submit="nameFormSubmit"
30
- :project="props.project"
31
- @submit="onChangeName(...$event)"
32
- @check-name="emits('check-name', $event)"
33
- />
34
- <common-vm-actions-common-select-storage
35
- v-show="selectedStep.id === dynamicSteps.selectStorage"
36
- :storage-submit="storageSubmit"
37
- :datastore="props.datastore"
38
- :is-datastore-loading="props.isDatastoreLoading"
39
- :get-datastore-table-func="props.getDatastoreTableFunc"
40
- @submit="onChangeStorage"
41
- />
42
- <common-vm-actions-common-select-os
43
- v-show="selectedStep.id === dynamicSteps.selectGuestOSMachineType"
44
- v-model:machine-type="vmtForm.guestMachineType"
45
- v-model:guest-os-family="vmtForm.guestOsFamily"
46
- v-model:guest-os-version="vmtForm.guestOsVersion"
47
- :families-options="guestOsFamilies"
48
- :versions-options="guestOsVersions"
49
- :machine-types-options="machineTypes"
50
- :error-validation-fields="props.errorValidationFields"
51
- @remove-error-by-title="emits('remove-error-by-title', $event)"
52
- />
53
- <common-vm-actions-common-customize-hardware
54
- v-show="selectedStep.id === dynamicSteps.customizeHardware"
55
- v-model:vm-name="vmtForm.name"
56
- v-model:guest-machine-type="vmtForm.guestMachineType"
57
- v-model:guest-os-family="vmtForm.guestOsFamily"
58
- v-model:guest-os-version="vmtForm.guestOsVersion"
59
- :storage="vmtForm.storage"
60
- :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
61
- :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
62
- :networks-for-boot-options="virtualHardwareNetworksLocal"
63
- :customize-hardware-submit="customizeHardwareSubmit"
64
- :max-cpus="maxCpus"
65
- :max-memory="maxMemory"
66
- :cpu-models="cpuModels"
67
- :selected-nav-item="selectedNavItem"
68
- :nodes="props.nodes"
69
- :files="props.files"
70
- :networks-table="props.networksTable"
71
- :error-validation-fields="props.errorValidationFields"
72
- :get-datastore-table-func="props.getDatastoreTableFunc"
73
- :datastore="props.datastore"
74
- :is-datastore-loading="props.isDatastoreLoading"
75
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
76
- :passthrough-devices="props.passthroughDevices"
77
- :mediated-devices="props.mediatedDevices"
78
- :compute-resource="vmtForm.computeResource"
79
- :project="props.project"
80
- @change-boot-order="onChangeBootOrder"
81
- @send-data="onChangeCustomizeHardware"
82
- @get-storage="emits('get-storage', $event)"
83
- @get-folders-or-files="emits('get-folders-or-files', $event)"
84
- @get-active-device-child="emits('get-active-device-child', $event)"
85
- @show-datastore-child="emits('show-datastore-child', $event)"
86
- @get-networks-table="emits('get-networks-table', $event)"
87
- @get-pci-devices="emits('get-pci-devices')"
88
- />
89
- <common-ready-to-complete
90
- v-show="selectedStep.id === dynamicSteps.readyComplete"
91
- :data="props.readyCompleteTableInfo"
92
- />
93
- </div>
94
- </template>
95
- </atoms-wizard>
96
- </div>
97
- </template>
98
-
99
- <script setup lang="ts">
100
- import type {
101
- UI_I_DatastoreTableItem,
102
- UI_I_FolderOrFileTreePayload,
103
- } from '~/lib/models/store/storage/interfaces'
104
- import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
105
- import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
106
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
107
- import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
108
- import type {
109
- UI_I_ArbitraryObject,
110
- UI_I_Localization,
111
- } from '~/lib/models/interfaces'
112
- import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
113
- import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
114
- import type {
115
- UI_I_SendDataCpu,
116
- UI_I_SendDataMemory,
117
- UI_I_SendDataNewCdDvdDrive,
118
- UI_I_SendDataNewHardDisk,
119
- UI_I_SendDataNewNetwork,
120
- } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
121
- import type { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
122
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
123
- import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
124
- import type { UI_T_Project } from '~/lib/models/types'
125
- import type {
126
- UI_I_MediatedDevice,
127
- UI_I_PciDevice,
128
- } from '~/lib/models/store/vm/interfaces'
129
- // import type {
130
- // I_DynamicSteps,
131
- // // UI_I_VmForm,
132
- // } from '~/components/common/vmt/actions/add/lib/models/interfaces'
133
- import type {
134
- UI_I_ValidationReturn,
135
- UI_I_WizardStep,
136
- } from '~/components/atoms/wizard/lib/models/interfaces'
137
- import type { UI_I_Capabilities } from '~/components/common/vm/actions/common/lib/models/interfaces'
138
- import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
139
- import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
140
- import {
141
- dynamicSteps,
142
- stepsSchemeInitial,
143
- stepsFunc,
144
- } from '~/components/common/vmt/actions/add/lib/config/steps'
145
- import Wizard from '~/components/atoms/wizard/lib/utils/utils'
146
- import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
147
- import { scheduledTaskDefaultFormFunc } from '~/components/common/pages/scheduledTasks/modals/lib/config/createScheduledTask'
148
- import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
149
- import type {UI_I_VmtForm} from "~/components/common/vmt/actions/add/lib/models/interfaces";
150
-
151
- const props = defineProps<{
152
- project: UI_T_Project
153
- nodes: UI_I_FileTreeNode[]
154
- files: UI_I_FileTreeNode[]
155
- networksTable: UI_I_NetworkTableItem[]
156
- datastore: UI_I_DatastoreTableItem[]
157
- isDatastoreLoading: boolean
158
- errorValidationFields: UI_I_ErrorValidationField[]
159
- readyCompleteTableInfo: UI_I_TableInfoItem[]
160
- vmCpuHelpTextSecond: string
161
- finishFunc: any
162
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
163
- validateSendDataFunc: any
164
- passthroughDevices: UI_I_PciDevice[]
165
- mediatedDevices: UI_I_MediatedDevice[]
166
- vmNameInWizard: string
167
- capabilities?: UI_I_Capabilities
168
- schedulerTask?: any // TODO надо interface переместить глобално
169
- }>()
170
-
171
- const emits = defineEmits<{
172
- (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
173
- (event: 'get-storage', value: UI_I_TablePayload): void
174
- (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
175
- (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
176
- (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
177
- (event: 'remove-error-by-title', value: string): void
178
- (event: 'get-networks-table', value: UI_I_TablePayload): void
179
- (event: 'get-pci-devices'): void
180
- (event: 'hide'): void
181
- }>()
182
-
183
- const localization = computed<UI_I_Localization>(() => useLocal())
184
-
185
- const isScheduledTasks = computed<boolean>(
186
- () => props.schedulerTask.isSchedulerTask
187
- )
188
-
189
- const title = computed<string>(() => {
190
- const { scheduleNewTasks, scheduleTaskEdit } = localization.value.common
191
-
192
- let result = localization.value.vmt.newTemplate
193
- if (isScheduledTasks.value) {
194
- const schedulerMode = props.schedulerTask.editTask
195
- ? scheduleTaskEdit
196
- : scheduleNewTasks
197
-
198
- result = `${schedulerMode} (${localization.value.vmt.newTemplate})`
199
- }
200
-
201
- return result
202
- })
203
-
204
- // const dynamicSteps = ref<I_DynamicSteps>(
205
- // getDynamicSteps(isScheduledTasks.value)
206
- // )
207
-
208
- watch(
209
- () => props.capabilities,
210
- () => {
211
- if (props.capabilities) mapCapabilities(props.capabilities)
212
- },
213
- { deep: true, immediate: true }
214
- )
215
-
216
- const guestOsFamilies = ref<UI_I_OptionItem[]>(
217
- capabilities.value.guestOsFamilies
218
- )
219
- const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
220
- capabilities.value.guestOsVersions
221
- )
222
- const machineTypes = ref<UI_I_OptionItem[]>(capabilities.value.machineTypes)
223
- const cpuModels = ref<UI_I_OptionItem[]>(capabilities.value.cpuModels)
224
- const maxCpus = ref<number>(capabilities.value.maxCpus)
225
- const maxMemory = ref<number>(capabilities.value.maxMemory)
226
-
227
- const wizard: Wizard = new Wizard(
228
- stepsFunc(localization.value, isScheduledTasks.value),
229
- stepsSchemeInitial
230
- )
231
- // TODO move to common
232
- const newTaskForm = ref<UI_I_ScheduleNewTasksForm>(
233
- useDeepCopy(scheduledTaskDefaultFormFunc())
234
- )
235
- watch(
236
- newTaskForm,
237
- (newValue: UI_I_ScheduleNewTasksForm) => {
238
- if (isScheduledTasks.value) wizard.setDisabledNextButton(newValue.isValid)
239
- },
240
- { immediate: true, deep: true }
241
- )
242
-
243
- const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
244
-
245
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
246
- wizard.changeSteps(value, validationFunc, validateSendData)
247
- }
248
-
249
- const validationFunc = async (
250
- value: UI_I_WizardStep[],
251
- currentStep: UI_I_WizardStep,
252
- nextStep: UI_I_WizardStep
253
- ): Promise<UI_I_ValidationReturn> => {
254
- let stepHasError = false
255
- let stepShouldStop = {
256
- ifOnCurrentStep: false,
257
- ifFromAnyStep: false,
258
- stoppageStepId: -1,
259
- }
260
-
261
- wizard.setLoader(true)
262
- if (
263
- wizard.isValidateForStep(
264
- dynamicSteps.selectName,
265
- currentStep.id,
266
- nextStep.id
267
- )
268
- ) {
269
- const nameValidation = await checkName(value)
270
-
271
- value = nameValidation.newValue
272
- stepHasError = stepHasError || nameValidation.stepHasError
273
- } else if (
274
- wizard.isValidateForStep(
275
- dynamicSteps.selectStorage,
276
- currentStep.id,
277
- nextStep.id
278
- )
279
- ) {
280
- const storageValidation = await checkStorage(value)
281
-
282
- value = storageValidation.newValue
283
-
284
- stepHasError = stepHasError || storageValidation.stepHasError
285
- } else if (
286
- wizard.isValidateForStep(
287
- dynamicSteps.selectOptions,
288
- currentStep.id,
289
- nextStep.id
290
- )
291
- ) {
292
- selectOptionsSubmit.value++
293
- } else if (
294
- wizard.isValidateForStep(
295
- dynamicSteps.customizeHardware,
296
- currentStep.id,
297
- nextStep.id
298
- )
299
- ) {
300
- const customizeHardwareValidation = await checkCustomizeHardware(value)
301
-
302
- value = customizeHardwareValidation.newValue
303
-
304
- stepHasError = stepHasError || customizeHardwareValidation.stepHasError
305
- }
306
- wizard.setLoader(false)
307
-
308
- return {
309
- newValue: value,
310
- stepHasError,
311
- stepShouldStop,
312
- }
313
- }
314
- const checkName = async (
315
- value: UI_I_WizardStep[]
316
- ): Promise<UI_I_ValidationReturn> => {
317
- let stepHasError = false
318
-
319
- return new Promise((resolve) => {
320
- nameFormSubmit.value = (isValid: boolean) => {
321
- if (!isValid) {
322
- stepHasError = wizard.setValidation(dynamicSteps.selectName, 'name', {
323
- fieldMessage: 'aaa',
324
- alertMessage: 'aaa',
325
- })
326
- } else if (wizard.hasMessage(dynamicSteps.selectName, 'name')) {
327
- value = wizard.removeValidation(dynamicSteps.selectName, 'name', value)
328
- }
329
-
330
- resolve({
331
- stepHasError,
332
- newValue: value,
333
- })
334
- nameFormSubmit.value = null
335
- }
336
- })
337
- }
338
- const checkStorage = async (
339
- value: UI_I_WizardStep[]
340
- ): Promise<UI_I_ValidationReturn> => {
341
- let stepHasError = false
342
-
343
- return new Promise((resolve) => {
344
- storageSubmit.value = (isValid: boolean) => {
345
- if (!isValid) {
346
- stepHasError = wizard.setValidation(
347
- dynamicSteps.selectStorage,
348
- 'storage',
349
- {
350
- fieldMessage: 'aaa',
351
- alertMessage: 'aaa',
352
- }
353
- )
354
- } else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
355
- value = wizard.removeValidation(
356
- dynamicSteps.selectStorage,
357
- 'storage',
358
- value
359
- )
360
- }
361
-
362
- resolve({
363
- stepHasError,
364
- newValue: value,
365
- })
366
- storageSubmit.value = null
367
- }
368
- })
369
- }
370
- const checkCustomizeHardware = async (
371
- value: UI_I_WizardStep[]
372
- ): Promise<UI_I_ValidationReturn> => {
373
- let stepHasError = false
374
-
375
- return new Promise((resolve) => {
376
- customizeHardwareSubmit.value = (isValid: boolean) => {
377
- if (!isValid) {
378
- stepHasError = wizard.setValidation(
379
- dynamicSteps.customizeHardware,
380
- 'customizeHardware',
381
- {
382
- fieldMessage: 'aaa',
383
- alertMessage: 'aaa',
384
- }
385
- )
386
- } else if (
387
- wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
388
- ) {
389
- value = wizard.removeValidation(
390
- dynamicSteps.customizeHardware,
391
- 'customizeHardware',
392
- value
393
- )
394
- }
395
-
396
- resolve({
397
- stepHasError,
398
- newValue: value,
399
- })
400
- storageSubmit.value = null
401
- }
402
- })
403
- }
404
-
405
- const vmtForm = ref<UI_I_VmtForm>({
406
- name: '',
407
- compatibility: '',
408
- guestMachineType: null,
409
- guestOsFamily: null,
410
- guestOsVersion: null,
411
- computeResource: null,
412
- storage: null,
413
- locationPath: '',
414
- // dataCenter: null,
415
- })
416
- const storageIdCash = ref<string | null>(null)
417
- const onChangeName = (name: string): void => {
418
- vmtForm.value.name = name
419
- }
420
- const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
421
- if (!storage) return
422
-
423
- vmtForm.value.storage = storage
424
- storageIdCash.value = storage.id
425
- }
426
- const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
427
- const onChangeCustomizeHardware = (
428
- data: UI_I_SendDataCustomizeHardware
429
- ): void => {
430
- customizeHardware.value = data
431
- }
432
-
433
- const virtualHardwareHardDisksLocal = computed<
434
- UI_I_SendDataNewHardDisk[] | null
435
- >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
436
- const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
437
- () => customizeHardware.value?.virtualHardware?.networks || null
438
- )
439
- const virtualHardwareCdDvdDrivesLocal = computed<
440
- UI_I_SendDataNewCdDvdDrive[] | null
441
- >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
442
-
443
- const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
444
- () => customizeHardware.value?.virtualHardware?.cpu || null
445
- )
446
- const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
447
- () => customizeHardware.value?.virtualHardware?.memory || null
448
- )
449
- const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
450
- const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
451
- null
452
- )
453
- const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
454
- const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
455
- virtualHardwareHardDisks.value = data[0]
456
- virtualHardwareCdDvdDrives.value = data[1]
457
- virtualHardwareNetworks.value = data[2]
458
- }
459
-
460
- const isPowerOnByDefault = ref<boolean>(true)
461
-
462
- watch(
463
- () => props.vmNameInWizard,
464
- (newValue) => {
465
- vmtForm.value.name = newValue
466
- }
467
- )
468
-
469
- const validateSendData = async (
470
- value: UI_I_WizardStep[]
471
- ): Promise<UI_I_ValidationReturn> => {
472
- wizard.setLoader(true)
473
- let stepHasError = false
474
-
475
- const data = await props.validateSendDataFunc(
476
- vmtForm.value,
477
- virtualHardwareCpu.value,
478
- virtualHardwareMemory.value,
479
- customizeHardware.value,
480
- virtualHardwareNetworks.value,
481
- virtualHardwareHardDisks.value,
482
- virtualHardwareCdDvdDrives.value,
483
- isPowerOnByDefault.value,
484
- localization.value
485
- )
486
-
487
- wizard.setLoader(false)
488
- if (data) {
489
- stepHasError = true
490
- selectedNavItem.value = data[0]
491
- }
492
-
493
- return {
494
- stepHasError,
495
- newValue: value,
496
- }
497
- }
498
-
499
- const isLoading = ref<boolean>(false)
500
- const onFinish = (): void => {
501
- isLoading.value = true
502
- wizard.setLoader(false)
503
- props
504
- .finishFunc(
505
- vmtForm.value,
506
- virtualHardwareCpu.value,
507
- virtualHardwareMemory.value,
508
- customizeHardware.value,
509
- virtualHardwareNetworks.value,
510
- virtualHardwareHardDisks.value,
511
- virtualHardwareCdDvdDrives.value,
512
- isPowerOnByDefault.value,
513
- localization.value,
514
- false,
515
- newTaskForm.value,
516
- props.schedulerTask
517
- )
518
- .then(() => {
519
- isLoading.value = false
520
- onHideModal()
521
- wizard.setLoader(false)
522
- })
523
- }
524
-
525
- const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
526
-
527
- const nameFormSubmit = ref<null | Function>(null)
528
- const storageSubmit = ref<null | Function>(null)
529
- const selectOptionsSubmit = ref<number>(0)
530
- const customizeHardwareSubmit = ref<null | Function>(null)
531
-
532
- const onHideModal = (): void => {
533
- emits('hide')
534
- }
535
- </script>
536
-
537
- <style>
538
- :root {
539
- --vmt-context-title: #333;
540
- --vmt-context-sub-title: #000;
541
- }
542
- :root.dark-theme {
543
- --vmt-context-title: #adbbc4;
544
- --vmt-context-sub-title: #adbbc4;
545
- }
546
- </style>
547
- <style scoped lang="scss">
548
- :deep(.has-solid.close-icon.clr-icon) {
549
- width: 20px;
550
- top: 0;
551
- }
552
- .vmt-context {
553
- padding: 16px 15px 10px 10px;
554
- height: 100%;
555
- display: flex;
556
- flex-direction: column;
557
-
558
- .context-title-wrap {
559
- padding-bottom: 3px;
560
- border-bottom: 1px solid #a6a6a6;
561
-
562
- h4 {
563
- font-weight: 700;
564
- font-size: 13px;
565
- color: var(--vmt-context-title);
566
- }
567
- p {
568
- font-weight: 400;
569
- font-size: 13px;
570
- color: var(--vmt-context-sub-title);
571
- }
572
- }
573
-
574
- .finish-block {
575
- padding: 18px 24px 24px 24px;
576
-
577
- .add-hosts-ready-to-complete-mt-12 {
578
- margin-top: 12px;
579
-
580
- .add-hosts-ready-to-complete-bold {
581
- line-height: 18px;
582
- font-weight: 700;
583
- }
584
- }
585
- }
586
-
587
- .vm-hardware-version {
588
- align-self: flex-end;
589
- margin-top: auto;
590
- }
591
- }
592
-
593
- :deep(.modal .modal-dialog .modal-content .modal-footer) {
594
- flex: unset;
595
- height: unset;
596
- min-height: unset;
597
- }
598
- :deep(.wizard-modal-titlebar h3) {
599
- color: #000;
600
- font-size: 24px;
601
- font-weight: 200;
602
- line-height: 27px;
603
- margin: 0;
604
- padding: 0;
605
- }
606
- :deep(.clr-wizard-stepnav-item) {
607
- padding-left: 0;
608
- }
609
- :deep(.clr-wizard-stepnav
610
- .clr-wizard-stepnav-item
611
- button
612
- .clr-wizard-stepnav-link-title) {
613
- width: 189px;
614
- font-weight: 700;
615
- font-size: 13px;
616
- }
617
-
618
- #vm-wizard-notification {
619
- h3 {
620
- color: var(--global-font-color7);
621
- margin-top: 6px;
622
- }
623
- p {
624
- color: var(--global-font-color6);
625
- line-height: 16px;
626
- }
627
- }
628
-
629
- .power-on-by-default-wrap {
630
- display: flex;
631
- align-items: center;
632
-
633
- input {
634
- margin-right: 6px;
635
- }
636
- }
637
-
638
- .new-task-form {
639
- padding: 0 25px 0 5px;
640
- }
641
- </style>
1
+ <template>
2
+ <div class="add-template">
3
+ <atoms-wizard
4
+ show
5
+ :wizard="wizard"
6
+ :selected-scheme="selectedScheme"
7
+ :title="title"
8
+ :localization="localization"
9
+ @change-steps="onChangeSteps"
10
+ @hide="onHideModal"
11
+ @submit="onFinish"
12
+ >
13
+ <template #modalBody="{ selectedStep }">
14
+ <atoms-loader
15
+ v-show="isLoading"
16
+ id="loader"
17
+ test-id="add-template-loader"
18
+ />
19
+ <div class="vmt-context">
20
+ <common-pages-scheduled-tasks-modals-common-new-task-form
21
+ v-show="selectedStep.id === dynamicSteps.scheduledTasks"
22
+ v-model="newTaskForm"
23
+ target="0"
24
+ class="new-task-form"
25
+ />
26
+ <common-vm-actions-common-select-name
27
+ v-show="selectedStep.id === dynamicSteps.selectName"
28
+ :show="selectedStep.id === dynamicSteps.selectName"
29
+ :name-form-submit="nameFormSubmit"
30
+ :project="props.project"
31
+ @submit="onChangeName(...$event)"
32
+ @check-name="emits('check-name', $event)"
33
+ />
34
+ <common-vm-actions-common-select-storage
35
+ v-show="selectedStep.id === dynamicSteps.selectStorage"
36
+ :storage-submit="storageSubmit"
37
+ :datastore="props.datastore"
38
+ :is-datastore-loading="props.isDatastoreLoading"
39
+ :get-datastore-table-func="props.getDatastoreTableFunc"
40
+ @submit="onChangeStorage"
41
+ />
42
+ <common-vm-actions-common-select-os
43
+ v-show="selectedStep.id === dynamicSteps.selectGuestOSMachineType"
44
+ v-model:machine-type="vmtForm.guestMachineType"
45
+ v-model:guest-os-family="vmtForm.guestOsFamily"
46
+ v-model:guest-os-version="vmtForm.guestOsVersion"
47
+ :families-options="guestOsFamilies"
48
+ :versions-options="guestOsVersions"
49
+ :machine-types-options="machineTypes"
50
+ :error-validation-fields="props.errorValidationFields"
51
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
52
+ />
53
+ <common-vm-actions-common-customize-hardware
54
+ v-show="selectedStep.id === dynamicSteps.customizeHardware"
55
+ v-model:vm-name="vmtForm.name"
56
+ v-model:guest-machine-type="vmtForm.guestMachineType"
57
+ v-model:guest-os-family="vmtForm.guestOsFamily"
58
+ v-model:guest-os-version="vmtForm.guestOsVersion"
59
+ :storage="vmtForm.storage"
60
+ :hard-disks-for-boot-options="virtualHardwareHardDisksLocal"
61
+ :cd-dvd-drives-for-boot-options="virtualHardwareCdDvdDrivesLocal"
62
+ :networks-for-boot-options="virtualHardwareNetworksLocal"
63
+ :customize-hardware-submit="customizeHardwareSubmit"
64
+ :max-cpus="maxCpus"
65
+ :max-memory="maxMemory"
66
+ :cpu-models="cpuModels"
67
+ :selected-nav-item="selectedNavItem"
68
+ :nodes="props.nodes"
69
+ :files="props.files"
70
+ :networks-table="props.networksTable"
71
+ :error-validation-fields="props.errorValidationFields"
72
+ :get-datastore-table-func="props.getDatastoreTableFunc"
73
+ :datastore="props.datastore"
74
+ :is-datastore-loading="props.isDatastoreLoading"
75
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
76
+ :passthrough-devices="props.passthroughDevices"
77
+ :mediated-devices="props.mediatedDevices"
78
+ :compute-resource="vmtForm.computeResource"
79
+ :project="props.project"
80
+ @change-boot-order="onChangeBootOrder"
81
+ @send-data="onChangeCustomizeHardware"
82
+ @get-storage="emits('get-storage', $event)"
83
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
84
+ @get-active-device-child="emits('get-active-device-child', $event)"
85
+ @show-datastore-child="emits('show-datastore-child', $event)"
86
+ @get-networks-table="emits('get-networks-table', $event)"
87
+ @get-pci-devices="emits('get-pci-devices')"
88
+ />
89
+ <common-ready-to-complete
90
+ v-show="selectedStep.id === dynamicSteps.readyComplete"
91
+ :data="props.readyCompleteTableInfo"
92
+ />
93
+ </div>
94
+ </template>
95
+ </atoms-wizard>
96
+ </div>
97
+ </template>
98
+
99
+ <script setup lang="ts">
100
+ import type {
101
+ UI_I_DatastoreTableItem,
102
+ UI_I_FolderOrFileTreePayload,
103
+ } from '~/lib/models/store/storage/interfaces'
104
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
105
+ import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
106
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
107
+ import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
108
+ import type {
109
+ UI_I_ArbitraryObject,
110
+ UI_I_Localization,
111
+ } from '~/lib/models/interfaces'
112
+ import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
113
+ import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
114
+ import type {
115
+ UI_I_SendDataCpu,
116
+ UI_I_SendDataMemory,
117
+ UI_I_SendDataNewCdDvdDrive,
118
+ UI_I_SendDataNewHardDisk,
119
+ UI_I_SendDataNewNetwork,
120
+ } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
121
+ import type { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
122
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
123
+ import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
124
+ import type { UI_T_Project } from '~/lib/models/types'
125
+ import type {
126
+ UI_I_MediatedDevice,
127
+ UI_I_PciDevice,
128
+ } from '~/lib/models/store/vm/interfaces'
129
+ // import type {
130
+ // I_DynamicSteps,
131
+ // // UI_I_VmForm,
132
+ // } from '~/components/common/vmt/actions/add/lib/models/interfaces'
133
+ import type {
134
+ UI_I_ValidationReturn,
135
+ UI_I_WizardStep,
136
+ } from '~/components/atoms/wizard/lib/models/interfaces'
137
+ import type { UI_I_Capabilities } from '~/components/common/vm/actions/common/lib/models/interfaces'
138
+ import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
139
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
140
+ import {
141
+ dynamicSteps,
142
+ stepsSchemeInitial,
143
+ stepsFunc,
144
+ } from '~/components/common/vmt/actions/add/lib/config/steps'
145
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
146
+ import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
147
+ import { scheduledTaskDefaultFormFunc } from '~/components/common/pages/scheduledTasks/modals/lib/config/createScheduledTask'
148
+ import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
149
+ import type {UI_I_VmtForm} from "~/components/common/vmt/actions/add/lib/models/interfaces";
150
+
151
+ const props = defineProps<{
152
+ project: UI_T_Project
153
+ nodes: UI_I_FileTreeNode[]
154
+ files: UI_I_FileTreeNode[]
155
+ networksTable: UI_I_NetworkTableItem[]
156
+ datastore: UI_I_DatastoreTableItem[]
157
+ isDatastoreLoading: boolean
158
+ errorValidationFields: UI_I_ErrorValidationField[]
159
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
160
+ vmCpuHelpTextSecond: string
161
+ finishFunc: any
162
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
163
+ validateSendDataFunc: any
164
+ passthroughDevices: UI_I_PciDevice[]
165
+ mediatedDevices: UI_I_MediatedDevice[]
166
+ vmNameInWizard: string
167
+ capabilities?: UI_I_Capabilities
168
+ schedulerTask?: any // TODO надо interface переместить глобално
169
+ }>()
170
+
171
+ const emits = defineEmits<{
172
+ (event: 'check-name', value: [string, (error: API_UI_I_Error) => void]): void
173
+ (event: 'get-storage', value: UI_I_TablePayload): void
174
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
175
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
176
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
177
+ (event: 'remove-error-by-title', value: string): void
178
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
179
+ (event: 'get-pci-devices'): void
180
+ (event: 'hide'): void
181
+ }>()
182
+
183
+ const localization = computed<UI_I_Localization>(() => useLocal())
184
+
185
+ const isScheduledTasks = computed<boolean>(
186
+ () => props.schedulerTask.isSchedulerTask
187
+ )
188
+
189
+ const title = computed<string>(() => {
190
+ const { scheduleNewTasks, scheduleTaskEdit } = localization.value.common
191
+
192
+ let result = localization.value.vmt.newTemplate
193
+ if (isScheduledTasks.value) {
194
+ const schedulerMode = props.schedulerTask.editTask
195
+ ? scheduleTaskEdit
196
+ : scheduleNewTasks
197
+
198
+ result = `${schedulerMode} (${localization.value.vmt.newTemplate})`
199
+ }
200
+
201
+ return result
202
+ })
203
+
204
+ // const dynamicSteps = ref<I_DynamicSteps>(
205
+ // getDynamicSteps(isScheduledTasks.value)
206
+ // )
207
+
208
+ watch(
209
+ () => props.capabilities,
210
+ () => {
211
+ if (props.capabilities) mapCapabilities(props.capabilities)
212
+ },
213
+ { deep: true, immediate: true }
214
+ )
215
+
216
+ const guestOsFamilies = ref<UI_I_OptionItem[]>(
217
+ capabilities.value.guestOsFamilies
218
+ )
219
+ const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
220
+ capabilities.value.guestOsVersions
221
+ )
222
+ const machineTypes = ref<UI_I_OptionItem[]>(capabilities.value.machineTypes)
223
+ const cpuModels = ref<UI_I_OptionItem[]>(capabilities.value.cpuModels)
224
+ const maxCpus = ref<number>(capabilities.value.maxCpus)
225
+ const maxMemory = ref<number>(capabilities.value.maxMemory)
226
+
227
+ const wizard: Wizard = new Wizard(
228
+ stepsFunc(localization.value, isScheduledTasks.value),
229
+ stepsSchemeInitial
230
+ )
231
+ // TODO move to common
232
+ const newTaskForm = ref<UI_I_ScheduleNewTasksForm>(
233
+ useDeepCopy(scheduledTaskDefaultFormFunc())
234
+ )
235
+ watch(
236
+ newTaskForm,
237
+ (newValue: UI_I_ScheduleNewTasksForm) => {
238
+ if (isScheduledTasks.value) wizard.setDisabledNextButton(newValue.isValid)
239
+ },
240
+ { immediate: true, deep: true }
241
+ )
242
+
243
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
244
+
245
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
246
+ wizard.changeSteps(value, validationFunc, validateSendData)
247
+ }
248
+
249
+ const validationFunc = async (
250
+ value: UI_I_WizardStep[],
251
+ currentStep: UI_I_WizardStep,
252
+ nextStep: UI_I_WizardStep
253
+ ): Promise<UI_I_ValidationReturn> => {
254
+ let stepHasError = false
255
+ let stepShouldStop = {
256
+ ifOnCurrentStep: false,
257
+ ifFromAnyStep: false,
258
+ stoppageStepId: -1,
259
+ }
260
+
261
+ wizard.setLoader(true)
262
+ if (
263
+ wizard.isValidateForStep(
264
+ dynamicSteps.selectName,
265
+ currentStep.id,
266
+ nextStep.id
267
+ )
268
+ ) {
269
+ const nameValidation = await checkName(value)
270
+
271
+ value = nameValidation.newValue
272
+ stepHasError = stepHasError || nameValidation.stepHasError
273
+ } else if (
274
+ wizard.isValidateForStep(
275
+ dynamicSteps.selectStorage,
276
+ currentStep.id,
277
+ nextStep.id
278
+ )
279
+ ) {
280
+ const storageValidation = await checkStorage(value)
281
+
282
+ value = storageValidation.newValue
283
+
284
+ stepHasError = stepHasError || storageValidation.stepHasError
285
+ } else if (
286
+ wizard.isValidateForStep(
287
+ dynamicSteps.selectOptions,
288
+ currentStep.id,
289
+ nextStep.id
290
+ )
291
+ ) {
292
+ selectOptionsSubmit.value++
293
+ } else if (
294
+ wizard.isValidateForStep(
295
+ dynamicSteps.customizeHardware,
296
+ currentStep.id,
297
+ nextStep.id
298
+ )
299
+ ) {
300
+ const customizeHardwareValidation = await checkCustomizeHardware(value)
301
+
302
+ value = customizeHardwareValidation.newValue
303
+
304
+ stepHasError = stepHasError || customizeHardwareValidation.stepHasError
305
+ }
306
+ wizard.setLoader(false)
307
+
308
+ return {
309
+ newValue: value,
310
+ stepHasError,
311
+ stepShouldStop,
312
+ }
313
+ }
314
+ const checkName = async (
315
+ value: UI_I_WizardStep[]
316
+ ): Promise<UI_I_ValidationReturn> => {
317
+ let stepHasError = false
318
+
319
+ return new Promise((resolve) => {
320
+ nameFormSubmit.value = (isValid: boolean) => {
321
+ if (!isValid) {
322
+ stepHasError = wizard.setValidation(dynamicSteps.selectName, 'name', {
323
+ fieldMessage: 'aaa',
324
+ alertMessage: 'aaa',
325
+ })
326
+ } else if (wizard.hasMessage(dynamicSteps.selectName, 'name')) {
327
+ value = wizard.removeValidation(dynamicSteps.selectName, 'name', value)
328
+ }
329
+
330
+ resolve({
331
+ stepHasError,
332
+ newValue: value,
333
+ })
334
+ nameFormSubmit.value = null
335
+ }
336
+ })
337
+ }
338
+ const checkStorage = async (
339
+ value: UI_I_WizardStep[]
340
+ ): Promise<UI_I_ValidationReturn> => {
341
+ let stepHasError = false
342
+
343
+ return new Promise((resolve) => {
344
+ storageSubmit.value = (isValid: boolean) => {
345
+ if (!isValid) {
346
+ stepHasError = wizard.setValidation(
347
+ dynamicSteps.selectStorage,
348
+ 'storage',
349
+ {
350
+ fieldMessage: 'aaa',
351
+ alertMessage: 'aaa',
352
+ }
353
+ )
354
+ } else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
355
+ value = wizard.removeValidation(
356
+ dynamicSteps.selectStorage,
357
+ 'storage',
358
+ value
359
+ )
360
+ }
361
+
362
+ resolve({
363
+ stepHasError,
364
+ newValue: value,
365
+ })
366
+ storageSubmit.value = null
367
+ }
368
+ })
369
+ }
370
+ const checkCustomizeHardware = async (
371
+ value: UI_I_WizardStep[]
372
+ ): Promise<UI_I_ValidationReturn> => {
373
+ let stepHasError = false
374
+
375
+ return new Promise((resolve) => {
376
+ customizeHardwareSubmit.value = (isValid: boolean) => {
377
+ if (!isValid) {
378
+ stepHasError = wizard.setValidation(
379
+ dynamicSteps.customizeHardware,
380
+ 'customizeHardware',
381
+ {
382
+ fieldMessage: 'aaa',
383
+ alertMessage: 'aaa',
384
+ }
385
+ )
386
+ } else if (
387
+ wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
388
+ ) {
389
+ value = wizard.removeValidation(
390
+ dynamicSteps.customizeHardware,
391
+ 'customizeHardware',
392
+ value
393
+ )
394
+ }
395
+
396
+ resolve({
397
+ stepHasError,
398
+ newValue: value,
399
+ })
400
+ storageSubmit.value = null
401
+ }
402
+ })
403
+ }
404
+
405
+ const vmtForm = ref<UI_I_VmtForm>({
406
+ name: '',
407
+ compatibility: '',
408
+ guestMachineType: null,
409
+ guestOsFamily: null,
410
+ guestOsVersion: null,
411
+ computeResource: null,
412
+ storage: null,
413
+ locationPath: '',
414
+ // dataCenter: null,
415
+ })
416
+ const storageIdCash = ref<string | null>(null)
417
+ const onChangeName = (name: string): void => {
418
+ vmtForm.value.name = name
419
+ }
420
+ const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
421
+ if (!storage) return
422
+
423
+ vmtForm.value.storage = storage
424
+ storageIdCash.value = storage.id
425
+ }
426
+ const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
427
+ const onChangeCustomizeHardware = (
428
+ data: UI_I_SendDataCustomizeHardware
429
+ ): void => {
430
+ customizeHardware.value = data
431
+ }
432
+
433
+ const virtualHardwareHardDisksLocal = computed<
434
+ UI_I_SendDataNewHardDisk[] | null
435
+ >(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
436
+ const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
437
+ () => customizeHardware.value?.virtualHardware?.networks || null
438
+ )
439
+ const virtualHardwareCdDvdDrivesLocal = computed<
440
+ UI_I_SendDataNewCdDvdDrive[] | null
441
+ >(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
442
+
443
+ const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
444
+ () => customizeHardware.value?.virtualHardware?.cpu || null
445
+ )
446
+ const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
447
+ () => customizeHardware.value?.virtualHardware?.memory || null
448
+ )
449
+ const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
450
+ const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
451
+ null
452
+ )
453
+ const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
454
+ const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
455
+ virtualHardwareHardDisks.value = data[0]
456
+ virtualHardwareCdDvdDrives.value = data[1]
457
+ virtualHardwareNetworks.value = data[2]
458
+ }
459
+
460
+ const isPowerOnByDefault = ref<boolean>(true)
461
+
462
+ watch(
463
+ () => props.vmNameInWizard,
464
+ (newValue) => {
465
+ vmtForm.value.name = newValue
466
+ }
467
+ )
468
+
469
+ const validateSendData = async (
470
+ value: UI_I_WizardStep[]
471
+ ): Promise<UI_I_ValidationReturn> => {
472
+ wizard.setLoader(true)
473
+ let stepHasError = false
474
+
475
+ const data = await props.validateSendDataFunc(
476
+ vmtForm.value,
477
+ virtualHardwareCpu.value,
478
+ virtualHardwareMemory.value,
479
+ customizeHardware.value,
480
+ virtualHardwareNetworks.value,
481
+ virtualHardwareHardDisks.value,
482
+ virtualHardwareCdDvdDrives.value,
483
+ isPowerOnByDefault.value,
484
+ localization.value
485
+ )
486
+
487
+ wizard.setLoader(false)
488
+ if (data) {
489
+ stepHasError = true
490
+ selectedNavItem.value = data[0]
491
+ }
492
+
493
+ return {
494
+ stepHasError,
495
+ newValue: value,
496
+ }
497
+ }
498
+
499
+ const isLoading = ref<boolean>(false)
500
+ const onFinish = (): void => {
501
+ isLoading.value = true
502
+ wizard.setLoader(false)
503
+ props
504
+ .finishFunc(
505
+ vmtForm.value,
506
+ virtualHardwareCpu.value,
507
+ virtualHardwareMemory.value,
508
+ customizeHardware.value,
509
+ virtualHardwareNetworks.value,
510
+ virtualHardwareHardDisks.value,
511
+ virtualHardwareCdDvdDrives.value,
512
+ isPowerOnByDefault.value,
513
+ localization.value,
514
+ false,
515
+ newTaskForm.value,
516
+ props.schedulerTask
517
+ )
518
+ .then(() => {
519
+ isLoading.value = false
520
+ onHideModal()
521
+ wizard.setLoader(false)
522
+ })
523
+ }
524
+
525
+ const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
526
+
527
+ const nameFormSubmit = ref<null | Function>(null)
528
+ const storageSubmit = ref<null | Function>(null)
529
+ const selectOptionsSubmit = ref<number>(0)
530
+ const customizeHardwareSubmit = ref<null | Function>(null)
531
+
532
+ const onHideModal = (): void => {
533
+ emits('hide')
534
+ }
535
+ </script>
536
+
537
+ <style>
538
+ :root {
539
+ --vmt-context-title: #333;
540
+ --vmt-context-sub-title: #000;
541
+ }
542
+ :root.dark-theme {
543
+ --vmt-context-title: #adbbc4;
544
+ --vmt-context-sub-title: #adbbc4;
545
+ }
546
+ </style>
547
+ <style scoped lang="scss">
548
+ :deep(.has-solid.close-icon.clr-icon) {
549
+ width: 20px;
550
+ top: 0;
551
+ }
552
+ .vmt-context {
553
+ padding: 16px 15px 10px 10px;
554
+ height: 100%;
555
+ display: flex;
556
+ flex-direction: column;
557
+
558
+ .context-title-wrap {
559
+ padding-bottom: 3px;
560
+ border-bottom: 1px solid #a6a6a6;
561
+
562
+ h4 {
563
+ font-weight: 700;
564
+ font-size: 13px;
565
+ color: var(--vmt-context-title);
566
+ }
567
+ p {
568
+ font-weight: 400;
569
+ font-size: 13px;
570
+ color: var(--vmt-context-sub-title);
571
+ }
572
+ }
573
+
574
+ .finish-block {
575
+ padding: 18px 24px 24px 24px;
576
+
577
+ .add-hosts-ready-to-complete-mt-12 {
578
+ margin-top: 12px;
579
+
580
+ .add-hosts-ready-to-complete-bold {
581
+ line-height: 18px;
582
+ font-weight: 700;
583
+ }
584
+ }
585
+ }
586
+
587
+ .vm-hardware-version {
588
+ align-self: flex-end;
589
+ margin-top: auto;
590
+ }
591
+ }
592
+
593
+ :deep(.modal .modal-dialog .modal-content .modal-footer) {
594
+ flex: unset;
595
+ height: unset;
596
+ min-height: unset;
597
+ }
598
+ :deep(.wizard-modal-titlebar h3) {
599
+ color: #000;
600
+ font-size: 24px;
601
+ font-weight: 200;
602
+ line-height: 27px;
603
+ margin: 0;
604
+ padding: 0;
605
+ }
606
+ :deep(.clr-wizard-stepnav-item) {
607
+ padding-left: 0;
608
+ }
609
+ :deep(.clr-wizard-stepnav
610
+ .clr-wizard-stepnav-item
611
+ button
612
+ .clr-wizard-stepnav-link-title) {
613
+ width: 189px;
614
+ font-weight: 700;
615
+ font-size: 13px;
616
+ }
617
+
618
+ #vm-wizard-notification {
619
+ h3 {
620
+ color: var(--global-font-color7);
621
+ margin-top: 6px;
622
+ }
623
+ p {
624
+ color: var(--global-font-color6);
625
+ line-height: 16px;
626
+ }
627
+ }
628
+
629
+ .power-on-by-default-wrap {
630
+ display: flex;
631
+ align-items: center;
632
+
633
+ input {
634
+ margin-right: 6px;
635
+ }
636
+ }
637
+
638
+ .new-task-form {
639
+ padding: 0 25px 0 5px;
640
+ }
641
+ </style>