bfg-common 1.5.600 → 1.5.601

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.
@@ -1,431 +1,437 @@
1
- <template>
2
- <ui-wizard
3
- :steps="props.wizard.steps"
4
- :selected-scheme="props.selectedScheme"
5
- :is-loading="props.wizard.wizardLoader.status"
6
- :title="props.title"
7
- :texts="texts"
8
- test-id="clone-exist-vm"
9
- show
10
- @change-steps="onChangeSteps"
11
- @hide="onHideModal"
12
- @submit="onClone"
13
- >
14
- <template #content="{ selectedStep }">
15
- <ui-wizard-block
16
- v-if="selectedStep.id === props.dynamicSteps.scheduledTasks"
17
- :sub-title-height="height0"
18
- >
19
- <template #subTitle>
20
- <div ref="subTitleBlock0">
21
- <div class="subtitle-block flex flex-col">
22
- <ui-wizard-subtitle :sub-title="selectedStep.subTitle" />
23
- </div>
24
- </div>
25
- </template>
26
- <template #content>
27
- <common-pages-scheduled-tasks-modals-common-new-task-form
28
- v-model="schedulerTaskForm"
29
- :target="props.selectedVirtualMachine"
30
- class="new-task-form"
31
- />
32
- </template>
33
- </ui-wizard-block>
34
-
35
- <ui-wizard-block
36
- v-if="
37
- selectedStep.id === props.dynamicSteps.selectName ||
38
- selectedStep.id === props.dynamicSteps.selectNameFolder
39
- "
40
- :sub-title-height="height1"
41
- >
42
- <template #subTitle>
43
- <div ref="subTitleBlock1">
44
- <div class="subtitle-block flex flex-col">
45
- <div
46
- id="name-alert-wrapper"
47
- :class="[{ 'mb-4': !isNameAlertWrapperEmpty }]"
48
- ></div>
49
- <ui-wizard-subtitle
50
- :sub-title="localization.common.specifyUniqueNameForVm"
51
- />
52
- </div>
53
- </div>
54
- </template>
55
- <template #content>
56
- <common-wizards-common-steps-name
57
- v-model:name="model.name"
58
- v-model:location="location"
59
- :show="
60
- selectedStep.id === props.dynamicSteps.selectName ||
61
- selectedStep.id === props.dynamicSteps.selectNameFolder
62
- "
63
- :name-form-submit="props.nameFormSubmit"
64
- :name-request-url="props.nameRequestUrl"
65
- :has-location="props.project === 'sphere'"
66
- :location-nodes="props.locationNodes"
67
- :allowed-location-kinds="props.allowedLocationKinds"
68
- :location-description="props.locationDescription"
69
- :validation-description="
70
- localization.common.enterValidLocationVirtualMachine
71
- "
72
- :name-exist-validation-description="
73
- localization.common.vmNameExistInSelectedLocation
74
- "
75
- :test-ids="props.nameTestIds"
76
- @submit="emits('change-name', $event)"
77
- @has-errors="isNameAlertWrapperEmpty = $event"
78
- />
79
- </template>
80
- </ui-wizard-block>
81
-
82
- <ui-wizard-block
83
- v-if="selectedStep.id === props.dynamicSteps.selectStorage"
84
- :sub-title-height="height2"
85
- >
86
- <template #subTitle>
87
- <div ref="subTitleBlock2">
88
- <div class="subtitle-block flex flex-col">
89
- <ui-wizard-subtitle
90
- :sub-title="
91
- localization.common.selectStorageConfigurationDiskFiles2
92
- "
93
- />
94
- </div>
95
- </div>
96
- </template>
97
- <template #content>
98
- <common-vm-actions-common-select-storage
99
- :storage-submit="props.storageSubmit"
100
- :datastore="props.datastore"
101
- :is-datastore-loading="props.isDatastoreLoading"
102
- :storage="model.storage"
103
- :get-datastore-table-func="props.getDatastoreTableFunc"
104
- hide-alert
105
- @change-storage="emits('change-storage', $event)"
106
- />
107
- </template>
108
- </ui-wizard-block>
109
-
110
- <ui-wizard-block
111
- v-if="selectedStep.id === props.dynamicSteps.selectOptions"
112
- :sub-title-height="height3"
113
- >
114
- <template #subTitle>
115
- <div ref="subTitleBlock3">
116
- <div class="subtitle-block flex flex-col">
117
- <ui-wizard-subtitle
118
- :sub-title="localization.vmWizard.selectAdvancedOptionsCloning"
119
- />
120
- </div>
121
- </div>
122
- </template>
123
- <template #content>
124
- <common-vm-actions-common-select-options
125
- :is-create-template="props.isNewVmFromTemplate"
126
- @change="emits('change-select-options', $event)"
127
- @change-count="emits('change-clone-count', $event)"
128
- />
129
- </template>
130
- </ui-wizard-block>
131
-
132
- <ui-wizard-block
133
- v-if="selectedStep.id === props.dynamicSteps.selectGuestOSMachineType"
134
- :sub-title-height="height4"
135
- >
136
- <template #subTitle>
137
- <div ref="subTitleBlock4">
138
- <div class="subtitle-block flex flex-col">
139
- <ui-wizard-subtitle
140
- :sub-title="
141
- localization.common
142
- .chooseGuestOSInstalledVmAndMachineTypeUsedCreateVm
143
- "
144
- />
145
- </div>
146
- </div>
147
- </template>
148
- <template #content>
149
- <common-vm-actions-common-select-os
150
- v-model:guest-os-family="model.guest_os_family"
151
- v-model:guest-os-version="model.guest_os_version"
152
- v-model:machine-type="model.machine_type"
153
- :families-options="props.guestOsFamilies"
154
- :versions-options="props.guestOsVersions"
155
- :machine-types-options="props.machineTypes"
156
- :error-validation-fields="props.errorValidationFields"
157
- @remove-error-by-title="emits('remove-error-by-title', $event)"
158
- />
159
- </template>
160
- </ui-wizard-block>
161
-
162
- <ui-wizard-block
163
- v-if="selectedStep.id === props.dynamicSteps.customizeHardware"
164
- >
165
- <template #content>
166
- <common-vm-actions-common-customize-hardware
167
- v-model="model"
168
- :storage="model.storage"
169
- :customize-hardware-submit="props.customizeHardwareSubmit"
170
- :max-memory="props.maxMemory"
171
- :cpu-models="props.cpuModels"
172
- :selected-nav-item="props.selectedNavItem"
173
- :nodes="props.nodes"
174
- :files="props.files"
175
- :networks-table="props.networksTable"
176
- :error-validation-fields="props.errorValidationFields"
177
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
178
- :passthrough-devices="props.passthroughDevices"
179
- :mediated-devices="props.mediatedDevices"
180
- :get-datastore-table-func="props.getDatastoreTableFunc"
181
- :datastore="props.datastore"
182
- :is-datastore-loading="props.isDatastoreLoading"
183
- :project="props.project"
184
- is-clone
185
- @get-storage="emits('get-storage', $event)"
186
- @get-folders-or-files="emits('get-folders-or-files', $event)"
187
- @get-active-device-child="emits('get-active-device-child', $event)"
188
- @show-datastore-child="emits('show-datastore-child', $event)"
189
- @get-networks-table="emits('get-networks-table', $event)"
190
- @get-pci-devices="emits('get-pci-devices')"
191
- />
192
- </template>
193
- </ui-wizard-block>
194
-
195
- <ui-wizard-block
196
- v-if="selectedStep.id === props.dynamicSteps.selectComputeResource"
197
- :sub-title-height="height5"
198
- >
199
- <template #subTitle>
200
- <div ref="subTitleBlock5">
201
- <div class="subtitle-block">
202
- <ui-alert
203
- v-if="props.computeResourceAlert.length"
204
- :messages="props.computeResourceAlert"
205
- test-id="computed-resource-alert"
206
- type="error"
207
- size="md"
208
- class="subtitle-block__alert"
209
- />
210
- <ui-wizard-subtitle
211
- :sub-title="
212
- localization.vmWizard
213
- .selectDestinationComputeResourceForThisOperation
214
- "
215
- />
216
- </div>
217
- </div>
218
- </template>
219
- <template #content>
220
- <common-wizards-common-steps-compute-resource
221
- v-if="props.isSphere"
222
- v-show="
223
- selectedStep.id === props.dynamicSteps.selectComputeResource
224
- "
225
- v-model="computeResource"
226
- :node="computeResourceTreeLocal"
227
- :alert-messages="props.computeResourceAlert"
228
- :is-loading="props.isLoadingComputeTree"
229
- :compatibility-text="props.compatibilityText"
230
- />
231
- </template>
232
- </ui-wizard-block>
233
-
234
- <ui-wizard-block
235
- v-if="selectedStep.id === props.dynamicSteps.readyComplete"
236
- :sub-title-height="heightReadyComplete"
237
- >
238
- <template #subTitle>
239
- <div ref="subTitleBlockReadyComplete">
240
- <div class="subtitle-block">
241
- <ui-wizard-subtitle
242
- :sub-title="localization.vmWizard.lastCreateSubtitle"
243
- />
244
- </div>
245
- </div>
246
- </template>
247
- <template #content>
248
- <div class="select-block-wrap h-full flex flex-col mt-3">
249
- <common-ready-to-complete :data="props.readyCompleteTableInfo" />
250
- <div
251
- class="vm-hardware-version-wrap justify-end flex flex-1 mt-4 pb-4"
252
- >
253
- <span class="vm-hardware-version">{{
254
- props.compatibilityInfo
255
- }}</span>
256
- </div>
257
- </div>
258
- </template>
259
- </ui-wizard-block>
260
- </template>
261
- </ui-wizard>
262
- </template>
263
-
264
- <script setup lang="ts">
265
- import { useElementSize } from '@vueuse/core'
266
- import type {
267
- UI_I_WizardStep,
268
- UI_I_WizardTexts,
269
- } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
270
- import type Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
271
- import type {
272
- UI_I_ArbitraryObject,
273
- UI_I_Localization,
274
- } from '~/lib/models/interfaces'
275
- import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
276
- import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
277
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
278
- import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
279
- import type { UI_T_Project } from '~/lib/models/types'
280
- import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
281
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
282
- import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
283
- import type { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
284
- import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
285
- import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
286
- import type {
287
- UI_I_MediatedDevice,
288
- UI_I_PciDevice,
289
- } from '~/lib/models/store/vm/interfaces'
290
- import type {
291
- UI_I_DatastoreTableItem,
292
- UI_I_FolderOrFileTreePayload,
293
- } from '~/lib/models/store/storage/interfaces'
294
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
295
- import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
296
-
297
- const model = defineModel<UI_I_CreateVmData>({ required: true })
298
-
299
- const schedulerTaskForm = defineModel<UI_I_ScheduleNewTasksForm>(
300
- 'scheduler-task-form'
301
- )
302
- const computeResource = defineModel<UI_I_TreeNode | undefined>(
303
- 'compute-resource'
304
- )
305
- const location = defineModel<UI_I_TreeNode | null>('location')
306
- const props = withDefaults(
307
- defineProps<{
308
- project: UI_T_Project
309
- nodes: UI_I_FileTreeNode[]
310
- files: UI_I_FileTreeNode[]
311
- networksTable: UI_I_NetworkTableItem[]
312
- datastore: UI_I_DatastoreTableItem[]
313
- isDatastoreLoading: boolean
314
- errorValidationFields: UI_I_ErrorValidationField[]
315
- readyCompleteTableInfo: UI_I_TableInfoItem[]
316
- vmCpuHelpTextSecond: string
317
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
318
- passthroughDevices: UI_I_PciDevice[]
319
- mediatedDevices: UI_I_MediatedDevice[]
320
- nameRequestUrl: string
321
- wizard: Wizard
322
- selectedScheme: number[]
323
- selectedVirtualMachine: string
324
- isNewVmFromTemplate: boolean | undefined
325
- computeResourceTree: UI_I_TreeNode[] | undefined // для сферы
326
- locationNodes: UI_I_TreeNode[] | undefined // для сферы
327
- title: string
328
- nameFormSubmit: null | Function
329
- storageSubmit: null | Function
330
- customizeHardwareSubmit: null | Function
331
- selectedNavItem: UI_T_SelectedNavItem
332
- allowedLocationKinds: number[]
333
- isSphere: boolean
334
- locationDescription: string
335
- nameTestIds: UI_I_NameTestIds
336
- guestOsFamilies: UI_I_OptionItem[]
337
- guestOsVersions: UI_I_ArbitraryObject<UI_I_OptionItem[]>
338
- machineTypes: UI_I_OptionItem[]
339
- maxMemory: number
340
- cpuModels: UI_I_OptionItem[]
341
- dynamicSteps: UI_I_ArbitraryObject<number>
342
- isLoadingComputeTree?: boolean // для сферы
343
- computeResourceAlert?: string[] // для сферы
344
- compatibilityText?: [UI_T_CompatibilityStatus, string] // для сферы
345
- }>(),
346
- {
347
- isLoadingComputeTree: false,
348
- computeResourceAlert: () => [],
349
- compatibilityText: () => ['none', ''],
350
- }
351
- )
352
-
353
- const emits = defineEmits<{
354
- (event: 'get-storage', value: UI_I_TablePayload): void
355
- (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
356
- (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
357
- (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
358
- (event: 'remove-error-by-title', value: string): void
359
- (event: 'get-networks-table', value: UI_I_TablePayload): void
360
- (event: 'get-pci-devices'): void
361
- (event: 'change-steps', value: UI_I_WizardStep[]): void
362
- (event: 'change-name', value: [string, UI_I_TreeNode | null]): void
363
- (event: 'change-storage', value: UI_I_DatastoreTableItem | null): void
364
- (event: 'change-select-options', value: string[]): void
365
- (event: 'change-clone-count', value: number): void
366
- (event: 'hide'): void
367
- (event: 'finish'): void
368
- }>()
369
-
370
- const localization = computed<UI_I_Localization>(() => useLocal())
371
-
372
- const computeResourceTreeLocal = computed<UI_I_TreeNode | null>(() => {
373
- // для сферы
374
- return props.computeResourceTree?.[0] || null
375
- })
376
-
377
- const texts = computed<UI_I_WizardTexts>(() => ({
378
- cancel: localization.value.common.cancel,
379
- back: localization.value.common.backCap,
380
- processing: localization.value.common.processing,
381
- next: localization.value.common.next,
382
- finish: localization.value.common.clone,
383
- incompleteTitle: localization.value.common.incompleteProcess,
384
- incompleteMessage: localization.value.common.incompleteProcessMessage,
385
- incompleteCancel: localization.value.common.cancel,
386
- incompleteLeave: localization.value.common.leave,
387
- step: localization.value.common.step,
388
- of: localization.value.common.of2,
389
- }))
390
-
391
- const subTitleBlock0 = ref<HTMLElement | null>(null)
392
- const { height: height0 } = useElementSize(subTitleBlock0)
393
-
394
- const subTitleBlock1 = ref<HTMLElement | null>(null)
395
- const { height: height1 } = useElementSize(subTitleBlock1)
396
-
397
- const subTitleBlock2 = ref<HTMLElement | null>(null)
398
- const { height: height2 } = useElementSize(subTitleBlock2)
399
-
400
- const subTitleBlock3 = ref<HTMLElement | null>(null)
401
- const { height: height3 } = useElementSize(subTitleBlock3)
402
-
403
- const subTitleBlock4 = ref<HTMLElement | null>(null)
404
- const { height: height4 } = useElementSize(subTitleBlock4)
405
-
406
- const subTitleBlock5 = ref<HTMLElement | null>(null)
407
- const { height: height5 } = useElementSize(subTitleBlock5)
408
-
409
- const subTitleBlockReadyComplete = ref<HTMLElement | null>(null)
410
- const { height: heightReadyComplete } = useElementSize(
411
- subTitleBlockReadyComplete
412
- )
413
-
414
- const isNameAlertWrapperEmpty = ref<boolean>(false)
415
-
416
- const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
417
- emits('change-steps', value)
418
-
419
- const onHideModal = (): void => emits('hide')
420
- const onClone = (): void => emits('finish')
421
- </script>
422
-
423
- <style scoped lang="scss">
424
- .subtitle-block {
425
- display: flex;
426
- flex-direction: column;
427
- row-gap: 16px;
428
- border-bottom: 1px solid var(--wizard-line);
429
- padding-bottom: 12px;
430
- }
431
- </style>
1
+ <template>
2
+ <ui-wizard
3
+ :steps="props.wizard.steps"
4
+ :selected-scheme="props.selectedScheme"
5
+ :is-loading="props.wizard.wizardLoader.status"
6
+ :title="props.title"
7
+ :texts="texts"
8
+ test-id="clone-exist-vm"
9
+ show
10
+ @change-steps="onChangeSteps"
11
+ @hide="onHideModal"
12
+ @submit="onClone"
13
+ >
14
+ <template #content="{ selectedStep }">
15
+ <ui-wizard-block
16
+ v-if="selectedStep.id === props.dynamicSteps.scheduledTasks"
17
+ :sub-title-height="height0"
18
+ >
19
+ <template #subTitle>
20
+ <div ref="subTitleBlock0">
21
+ <div class="subtitle-block flex flex-col">
22
+ <ui-wizard-subtitle :sub-title="selectedStep.subTitle" />
23
+ </div>
24
+ </div>
25
+ </template>
26
+ <template #content>
27
+ <common-pages-scheduled-tasks-modals-common-new-task-form
28
+ v-model="schedulerTaskForm"
29
+ :target="props.selectedVirtualMachine"
30
+ class="new-task-form"
31
+ />
32
+ </template>
33
+ </ui-wizard-block>
34
+
35
+ <ui-wizard-block
36
+ v-if="
37
+ selectedStep.id === props.dynamicSteps.selectName ||
38
+ selectedStep.id === props.dynamicSteps.selectNameFolder
39
+ "
40
+ :sub-title-height="height1"
41
+ >
42
+ <template #subTitle>
43
+ <div ref="subTitleBlock1">
44
+ <div class="subtitle-block flex flex-col">
45
+ <div
46
+ id="name-alert-wrapper"
47
+ :class="[{ 'mb-4': !isNameAlertWrapperEmpty }]"
48
+ ></div>
49
+ <ui-wizard-subtitle
50
+ :sub-title="selectNameStepSubtitle"
51
+ />
52
+ </div>
53
+ </div>
54
+ </template>
55
+ <template #content>
56
+ <common-wizards-common-steps-name
57
+ v-model:name="model.name"
58
+ v-model:location="location"
59
+ :show="
60
+ selectedStep.id === props.dynamicSteps.selectName ||
61
+ selectedStep.id === props.dynamicSteps.selectNameFolder
62
+ "
63
+ :name-form-submit="props.nameFormSubmit"
64
+ :name-request-url="props.nameRequestUrl"
65
+ :has-location="props.project === 'sphere'"
66
+ :location-nodes="props.locationNodes"
67
+ :allowed-location-kinds="props.allowedLocationKinds"
68
+ :location-description="props.locationDescription"
69
+ :validation-description="
70
+ localization.common.enterValidLocationVirtualMachine
71
+ "
72
+ :name-exist-validation-description="
73
+ localization.common.vmNameExistInSelectedLocation
74
+ "
75
+ :test-ids="props.nameTestIds"
76
+ @submit="emits('change-name', $event)"
77
+ @has-errors="isNameAlertWrapperEmpty = $event"
78
+ />
79
+ </template>
80
+ </ui-wizard-block>
81
+
82
+ <ui-wizard-block
83
+ v-if="selectedStep.id === props.dynamicSteps.selectStorage"
84
+ :sub-title-height="height2"
85
+ >
86
+ <template #subTitle>
87
+ <div ref="subTitleBlock2">
88
+ <div class="subtitle-block flex flex-col">
89
+ <ui-wizard-subtitle
90
+ :sub-title="
91
+ localization.common.selectStorageConfigurationDiskFiles2
92
+ "
93
+ />
94
+ </div>
95
+ </div>
96
+ </template>
97
+ <template #content>
98
+ <common-vm-actions-common-select-storage
99
+ :storage-submit="props.storageSubmit"
100
+ :datastore="props.datastore"
101
+ :is-datastore-loading="props.isDatastoreLoading"
102
+ :storage="model.storage"
103
+ :get-datastore-table-func="props.getDatastoreTableFunc"
104
+ hide-alert
105
+ @change-storage="emits('change-storage', $event)"
106
+ />
107
+ </template>
108
+ </ui-wizard-block>
109
+
110
+ <ui-wizard-block
111
+ v-if="selectedStep.id === props.dynamicSteps.selectOptions"
112
+ :sub-title-height="height3"
113
+ >
114
+ <template #subTitle>
115
+ <div ref="subTitleBlock3">
116
+ <div class="subtitle-block flex flex-col">
117
+ <ui-wizard-subtitle
118
+ :sub-title="localization.vmWizard.selectAdvancedOptionsCloning"
119
+ />
120
+ </div>
121
+ </div>
122
+ </template>
123
+ <template #content>
124
+ <common-vm-actions-common-select-options
125
+ :is-create-template="props.isNewVmFromTemplate"
126
+ @change="emits('change-select-options', $event)"
127
+ @change-count="emits('change-clone-count', $event)"
128
+ />
129
+ </template>
130
+ </ui-wizard-block>
131
+
132
+ <ui-wizard-block
133
+ v-if="selectedStep.id === props.dynamicSteps.selectGuestOSMachineType"
134
+ :sub-title-height="height4"
135
+ >
136
+ <template #subTitle>
137
+ <div ref="subTitleBlock4">
138
+ <div class="subtitle-block flex flex-col">
139
+ <ui-wizard-subtitle
140
+ :sub-title="
141
+ localization.common
142
+ .chooseGuestOSInstalledVmAndMachineTypeUsedCreateVm
143
+ "
144
+ />
145
+ </div>
146
+ </div>
147
+ </template>
148
+ <template #content>
149
+ <common-vm-actions-common-select-os
150
+ v-model:guest-os-family="model.guest_os_family"
151
+ v-model:guest-os-version="model.guest_os_version"
152
+ v-model:machine-type="model.machine_type"
153
+ :families-options="props.guestOsFamilies"
154
+ :versions-options="props.guestOsVersions"
155
+ :machine-types-options="props.machineTypes"
156
+ :error-validation-fields="props.errorValidationFields"
157
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
158
+ />
159
+ </template>
160
+ </ui-wizard-block>
161
+
162
+ <ui-wizard-block
163
+ v-if="selectedStep.id === props.dynamicSteps.customizeHardware"
164
+ >
165
+ <template #content>
166
+ <common-vm-actions-common-customize-hardware
167
+ v-model="model"
168
+ :storage="model.storage"
169
+ :customize-hardware-submit="props.customizeHardwareSubmit"
170
+ :max-memory="props.maxMemory"
171
+ :cpu-models="props.cpuModels"
172
+ :selected-nav-item="props.selectedNavItem"
173
+ :nodes="props.nodes"
174
+ :files="props.files"
175
+ :networks-table="props.networksTable"
176
+ :error-validation-fields="props.errorValidationFields"
177
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
178
+ :passthrough-devices="props.passthroughDevices"
179
+ :mediated-devices="props.mediatedDevices"
180
+ :get-datastore-table-func="props.getDatastoreTableFunc"
181
+ :datastore="props.datastore"
182
+ :is-datastore-loading="props.isDatastoreLoading"
183
+ :project="props.project"
184
+ is-clone
185
+ @get-storage="emits('get-storage', $event)"
186
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
187
+ @get-active-device-child="emits('get-active-device-child', $event)"
188
+ @show-datastore-child="emits('show-datastore-child', $event)"
189
+ @get-networks-table="emits('get-networks-table', $event)"
190
+ @get-pci-devices="emits('get-pci-devices')"
191
+ />
192
+ </template>
193
+ </ui-wizard-block>
194
+
195
+ <ui-wizard-block
196
+ v-if="selectedStep.id === props.dynamicSteps.selectComputeResource"
197
+ :sub-title-height="height5"
198
+ >
199
+ <template #subTitle>
200
+ <div ref="subTitleBlock5">
201
+ <div class="subtitle-block">
202
+ <ui-alert
203
+ v-if="props.computeResourceAlert.length"
204
+ :messages="props.computeResourceAlert"
205
+ test-id="computed-resource-alert"
206
+ type="error"
207
+ size="md"
208
+ class="subtitle-block__alert"
209
+ />
210
+ <ui-wizard-subtitle
211
+ :sub-title="
212
+ localization.vmWizard
213
+ .selectDestinationComputeResourceForThisOperation
214
+ "
215
+ />
216
+ </div>
217
+ </div>
218
+ </template>
219
+ <template #content>
220
+ <common-wizards-common-steps-compute-resource
221
+ v-if="props.isSphere"
222
+ v-show="
223
+ selectedStep.id === props.dynamicSteps.selectComputeResource
224
+ "
225
+ v-model="computeResource"
226
+ :node="computeResourceTreeLocal"
227
+ :alert-messages="props.computeResourceAlert"
228
+ :is-loading="props.isLoadingComputeTree"
229
+ :compatibility-text="props.compatibilityText"
230
+ />
231
+ </template>
232
+ </ui-wizard-block>
233
+
234
+ <ui-wizard-block
235
+ v-if="selectedStep.id === props.dynamicSteps.readyComplete"
236
+ :sub-title-height="heightReadyComplete"
237
+ >
238
+ <template #subTitle>
239
+ <div ref="subTitleBlockReadyComplete">
240
+ <div class="subtitle-block">
241
+ <ui-wizard-subtitle
242
+ :sub-title="localization.vmWizard.lastCreateSubtitle"
243
+ />
244
+ </div>
245
+ </div>
246
+ </template>
247
+ <template #content>
248
+ <div class="select-block-wrap h-full flex flex-col mt-3">
249
+ <common-ready-to-complete :data="props.readyCompleteTableInfo" />
250
+ <div
251
+ class="vm-hardware-version-wrap justify-end flex flex-1 mt-4 pb-4"
252
+ >
253
+ <span class="vm-hardware-version">{{
254
+ props.compatibilityInfo
255
+ }}</span>
256
+ </div>
257
+ </div>
258
+ </template>
259
+ </ui-wizard-block>
260
+ </template>
261
+ </ui-wizard>
262
+ </template>
263
+
264
+ <script setup lang="ts">
265
+ import { useElementSize } from '@vueuse/core'
266
+ import type {
267
+ UI_I_WizardStep,
268
+ UI_I_WizardTexts,
269
+ } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
270
+ import type Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
271
+ import type {
272
+ UI_I_ArbitraryObject,
273
+ UI_I_Localization,
274
+ } from '~/lib/models/interfaces'
275
+ import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
276
+ import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
277
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
278
+ import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
279
+ import type { UI_T_Project } from '~/lib/models/types'
280
+ import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
281
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
282
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
283
+ import type { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
284
+ import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
285
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
286
+ import type {
287
+ UI_I_MediatedDevice,
288
+ UI_I_PciDevice,
289
+ } from '~/lib/models/store/vm/interfaces'
290
+ import type {
291
+ UI_I_DatastoreTableItem,
292
+ UI_I_FolderOrFileTreePayload,
293
+ } from '~/lib/models/store/storage/interfaces'
294
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
295
+ import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
296
+
297
+ const model = defineModel<UI_I_CreateVmData>({ required: true })
298
+
299
+ const schedulerTaskForm = defineModel<UI_I_ScheduleNewTasksForm>(
300
+ 'scheduler-task-form'
301
+ )
302
+ const computeResource = defineModel<UI_I_TreeNode | undefined>(
303
+ 'compute-resource'
304
+ )
305
+ const location = defineModel<UI_I_TreeNode | null>('location')
306
+ const props = withDefaults(
307
+ defineProps<{
308
+ project: UI_T_Project
309
+ nodes: UI_I_FileTreeNode[]
310
+ files: UI_I_FileTreeNode[]
311
+ networksTable: UI_I_NetworkTableItem[]
312
+ datastore: UI_I_DatastoreTableItem[]
313
+ isDatastoreLoading: boolean
314
+ errorValidationFields: UI_I_ErrorValidationField[]
315
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
316
+ vmCpuHelpTextSecond: string
317
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
318
+ passthroughDevices: UI_I_PciDevice[]
319
+ mediatedDevices: UI_I_MediatedDevice[]
320
+ nameRequestUrl: string
321
+ wizard: Wizard
322
+ selectedScheme: number[]
323
+ selectedVirtualMachine: string
324
+ isNewVmFromTemplate: boolean | undefined
325
+ computeResourceTree: UI_I_TreeNode[] | undefined // для сферы
326
+ locationNodes: UI_I_TreeNode[] | undefined // для сферы
327
+ title: string
328
+ nameFormSubmit: null | Function
329
+ storageSubmit: null | Function
330
+ customizeHardwareSubmit: null | Function
331
+ selectedNavItem: UI_T_SelectedNavItem
332
+ allowedLocationKinds: number[]
333
+ isSphere: boolean
334
+ locationDescription: string
335
+ nameTestIds: UI_I_NameTestIds
336
+ guestOsFamilies: UI_I_OptionItem[]
337
+ guestOsVersions: UI_I_ArbitraryObject<UI_I_OptionItem[]>
338
+ machineTypes: UI_I_OptionItem[]
339
+ maxMemory: number
340
+ cpuModels: UI_I_OptionItem[]
341
+ dynamicSteps: UI_I_ArbitraryObject<number>
342
+ isLoadingComputeTree?: boolean // для сферы
343
+ computeResourceAlert?: string[] // для сферы
344
+ compatibilityText?: [UI_T_CompatibilityStatus, string] // для сферы
345
+ }>(),
346
+ {
347
+ isLoadingComputeTree: false,
348
+ computeResourceAlert: () => [],
349
+ compatibilityText: () => ['none', ''],
350
+ }
351
+ )
352
+
353
+ const emits = defineEmits<{
354
+ (event: 'get-storage', value: UI_I_TablePayload): void
355
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
356
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
357
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
358
+ (event: 'remove-error-by-title', value: string): void
359
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
360
+ (event: 'get-pci-devices'): void
361
+ (event: 'change-steps', value: UI_I_WizardStep[]): void
362
+ (event: 'change-name', value: [string, UI_I_TreeNode | null]): void
363
+ (event: 'change-storage', value: UI_I_DatastoreTableItem | null): void
364
+ (event: 'change-select-options', value: string[]): void
365
+ (event: 'change-clone-count', value: number): void
366
+ (event: 'hide'): void
367
+ (event: 'finish'): void
368
+ }>()
369
+
370
+ const localization = computed<UI_I_Localization>(() => useLocal())
371
+
372
+ const computeResourceTreeLocal = computed<UI_I_TreeNode | null>(() => {
373
+ // для сферы
374
+ return props.computeResourceTree?.[0] || null
375
+ })
376
+
377
+ const texts = computed<UI_I_WizardTexts>(() => ({
378
+ cancel: localization.value.common.cancel,
379
+ back: localization.value.common.backCap,
380
+ processing: localization.value.common.processing,
381
+ next: localization.value.common.next,
382
+ finish: localization.value.common.create,
383
+ incompleteTitle: localization.value.common.incompleteProcess,
384
+ incompleteMessage: localization.value.common.incompleteProcessMessage,
385
+ incompleteCancel: localization.value.common.cancel,
386
+ incompleteLeave: localization.value.common.leave,
387
+ step: localization.value.common.step,
388
+ of: localization.value.common.of2,
389
+ }))
390
+
391
+ const subTitleBlock0 = ref<HTMLElement | null>(null)
392
+ const { height: height0 } = useElementSize(subTitleBlock0)
393
+
394
+ const subTitleBlock1 = ref<HTMLElement | null>(null)
395
+ const { height: height1 } = useElementSize(subTitleBlock1)
396
+
397
+ const subTitleBlock2 = ref<HTMLElement | null>(null)
398
+ const { height: height2 } = useElementSize(subTitleBlock2)
399
+
400
+ const subTitleBlock3 = ref<HTMLElement | null>(null)
401
+ const { height: height3 } = useElementSize(subTitleBlock3)
402
+
403
+ const subTitleBlock4 = ref<HTMLElement | null>(null)
404
+ const { height: height4 } = useElementSize(subTitleBlock4)
405
+
406
+ const subTitleBlock5 = ref<HTMLElement | null>(null)
407
+ const { height: height5 } = useElementSize(subTitleBlock5)
408
+
409
+ const subTitleBlockReadyComplete = ref<HTMLElement | null>(null)
410
+ const { height: heightReadyComplete } = useElementSize(
411
+ subTitleBlockReadyComplete
412
+ )
413
+
414
+ const isNameAlertWrapperEmpty = ref<boolean>(false)
415
+
416
+ const selectNameStepSubtitle = computed<string>(() =>
417
+ props.project === 'sphere'
418
+ ? localization.value.vmWizard.specifyUniqueNameAndTargetLocationForVm
419
+ : localization.value.common.specifyUniqueNameForVm
420
+ )
421
+
422
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
423
+ emits('change-steps', value)
424
+
425
+ const onHideModal = (): void => emits('hide')
426
+ const onClone = (): void => emits('finish')
427
+ </script>
428
+
429
+ <style scoped lang="scss">
430
+ .subtitle-block {
431
+ display: flex;
432
+ flex-direction: column;
433
+ row-gap: 16px;
434
+ border-bottom: 1px solid var(--wizard-line);
435
+ padding-bottom: 12px;
436
+ }
437
+ </style>