bfg-common 1.5.645 → 1.5.647

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 (87) 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/collapse/CollapseNav.vue +170 -170
  8. package/components/atoms/perPage/PerPage.vue +58 -58
  9. package/components/atoms/table/dataGrid/DataGrid.vue +1718 -1718
  10. package/components/atoms/table/dataGrid/DataGridPagination.vue +97 -97
  11. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  12. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  13. package/components/common/backup/storage/actions/add/lib/utils.ts +51 -51
  14. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  15. package/components/common/diagramMain/modals/lib/config/portModal.ts +251 -251
  16. package/components/common/diagramMain/modals/lib/config/vCenterModal.ts +48 -48
  17. package/components/common/diagramMain/port/Port.vue +580 -580
  18. package/components/common/layout/theHeader/helpMenu/About.vue +79 -79
  19. package/components/common/layout/theHeader/helpMenu/aboutOld/AboutOld.vue +79 -79
  20. package/components/common/pages/backups/DetailView.vue +52 -52
  21. package/components/common/pages/backups/lib/models/interfaces.ts +36 -36
  22. package/components/common/pages/backups/modals/Modals.vue +243 -243
  23. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -6
  24. package/components/common/pages/backups/modals/createBackup/lib/config/readyToCompleteOptions.ts +69 -69
  25. package/components/common/pages/backups/modals/lib/config/restore.ts +115 -115
  26. package/components/common/pages/backups/modals/lib/models/interfaces.ts +186 -186
  27. package/components/common/pages/backups/modals/restore/name/lib/models/interfaces.ts +6 -6
  28. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  29. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  30. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  31. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  32. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  33. package/components/common/pages/scheduledTasks/lib/utils/utils.ts +84 -84
  34. package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
  35. package/components/common/select/radio/RadioGroup.vue +137 -137
  36. package/components/common/spiceConsole/Drawer.vue +420 -420
  37. package/components/common/spiceConsole/SpiceConsole.vue +184 -184
  38. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  39. package/components/common/tools/Actions.vue +207 -207
  40. package/components/common/treeView/TreeView.vue +52 -52
  41. package/components/common/vm/actions/clone/lib/config/steps.ts +295 -295
  42. package/components/common/vm/actions/clone/new/New.vue +437 -437
  43. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
  44. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +283 -283
  45. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +156 -156
  46. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
  47. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
  48. package/components/common/vm/actions/common/select/storage/Old.vue +125 -125
  49. package/components/common/vm/actions/common/select/storage/new/New.vue +311 -311
  50. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
  51. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
  52. package/components/common/vm/actions/common/select/template/old/Old.vue +50 -50
  53. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  54. package/components/common/wizards/common/compatibility/Compatibility.vue +35 -35
  55. package/components/common/wizards/common/compatibility/New.vue +99 -99
  56. package/components/common/wizards/common/compatibility/Old.vue +53 -53
  57. package/components/common/wizards/common/steps/computeResource/New.vue +93 -93
  58. package/components/common/wizards/common/steps/name/Name.vue +178 -178
  59. package/components/common/wizards/common/steps/name/New.vue +221 -221
  60. package/components/common/wizards/common/steps/name/Old.vue +121 -121
  61. package/components/common/wizards/common/steps/name/lib/models/interfaces.ts +4 -4
  62. package/components/common/wizards/common/steps/name/location/New.vue +40 -40
  63. package/components/common/wizards/datastore/add/Add.vue +228 -228
  64. package/components/common/wizards/datastore/add/lib/utils.ts +85 -85
  65. package/components/common/wizards/datastore/add/steps/typeMode/lib/config/typeOptions.ts +43 -43
  66. package/composables/useAppVersion.ts +21 -21
  67. package/composables/useLocal.ts +6 -6
  68. package/composables/useLocalCommon.ts +39 -39
  69. package/package.json +2 -2
  70. package/plugins/console.ts +21 -21
  71. package/plugins/mouse.ts +21 -21
  72. package/plugins/panelStates.ts +70 -70
  73. package/plugins/text.ts +59 -59
  74. package/public/spice-console/application/clientgui.js +854 -854
  75. package/public/spice-console/application/packetfactory.js +211 -211
  76. package/public/spice-console/application/virtualmouse.js +147 -147
  77. package/public/spice-console/lib/images/bitmap.js +203 -203
  78. package/public/spice-console/network/spicechannel.js +440 -440
  79. package/public/spice-console/process/cursorprocess.js +128 -128
  80. package/public/spice-console/process/inputprocess.js +227 -227
  81. package/public/spice-console/process/mainprocess.js +212 -212
  82. package/public/spice-console/run.js +210 -210
  83. package/store/main/mutations.ts +7 -7
  84. package/store/main/state.ts +7 -7
  85. package/store/tasks/actions.ts +165 -165
  86. package/store/tasks/mappers/recentTasks.ts +123 -123
  87. package/store/tasks/mutations.ts +82 -82
@@ -1,437 +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 :sub-title="selectNameStepSubtitle" />
50
- </div>
51
- </div>
52
- </template>
53
- <template #content>
54
- <common-wizards-common-steps-name
55
- v-model:name="model.name"
56
- v-model:location="location"
57
- :show="
58
- selectedStep.id === props.dynamicSteps.selectName ||
59
- selectedStep.id === props.dynamicSteps.selectNameFolder
60
- "
61
- :name-form-submit="props.nameFormSubmit"
62
- :name-request-url="props.nameRequestUrl"
63
- :has-location="props.project === 'sphere'"
64
- :location-nodes="props.locationNodes"
65
- :allowed-location-kinds="props.allowedLocationKinds"
66
- :location-description="props.locationDescription"
67
- :validation-description="
68
- localization.common.enterValidLocationVirtualMachine
69
- "
70
- :name-exist-validation-description="
71
- localization.common.vmNameExistInSelectedLocation
72
- "
73
- :test-ids="props.nameTestIds"
74
- @submit="emits('change-name', $event)"
75
- @has-errors="isNameAlertWrapperEmpty = $event"
76
- />
77
- </template>
78
- </ui-wizard-block>
79
-
80
- <ui-wizard-block
81
- v-if="selectedStep.id === props.dynamicSteps.selectStorage"
82
- :sub-title-height="height2"
83
- >
84
- <template #subTitle>
85
- <div ref="subTitleBlock2">
86
- <div class="subtitle-block flex flex-col">
87
- <ui-wizard-subtitle
88
- :sub-title="
89
- localization.common.selectStorageConfigurationDiskFiles2
90
- "
91
- />
92
- </div>
93
- </div>
94
- </template>
95
- <template #content>
96
- <common-vm-actions-common-select-storage
97
- :storage-submit="props.storageSubmit"
98
- :datastore="props.datastore"
99
- :is-datastore-loading="props.isDatastoreLoading"
100
- :storage="model.storage"
101
- :get-datastore-table-func="props.getDatastoreTableFunc"
102
- hide-alert
103
- @change-storage="emits('change-storage', $event)"
104
- />
105
- </template>
106
- </ui-wizard-block>
107
-
108
- <ui-wizard-block
109
- v-if="selectedStep.id === props.dynamicSteps.selectOptions"
110
- :sub-title-height="height3"
111
- >
112
- <template #subTitle>
113
- <div ref="subTitleBlock3">
114
- <div class="subtitle-block flex flex-col">
115
- <ui-wizard-subtitle
116
- :sub-title="localization.vmWizard.selectAdvancedOptionsCloning"
117
- />
118
- </div>
119
- </div>
120
- </template>
121
- <template #content>
122
- <common-vm-actions-common-select-options
123
- :is-new-vm-from-template="props.isNewVmFromTemplate"
124
- @change="emits('change-select-options', $event)"
125
- @change-count="emits('change-clone-count', $event)"
126
- />
127
- </template>
128
- </ui-wizard-block>
129
-
130
- <ui-wizard-block
131
- v-if="selectedStep.id === props.dynamicSteps.selectGuestOSMachineType"
132
- :sub-title-height="height4"
133
- >
134
- <template #subTitle>
135
- <div ref="subTitleBlock4">
136
- <div class="subtitle-block flex flex-col">
137
- <ui-wizard-subtitle
138
- :sub-title="
139
- localization.common
140
- .chooseGuestOSInstalledVmAndMachineTypeUsedCreateVm
141
- "
142
- />
143
- </div>
144
- </div>
145
- </template>
146
- <template #content>
147
- <common-vm-actions-common-select-os
148
- v-model:guest-os-family="model.guest_os_family"
149
- v-model:guest-os-version="model.guest_os_version"
150
- v-model:machine-type="model.machine_type"
151
- :families-options="props.guestOsFamilies"
152
- :versions-options="props.guestOsVersions"
153
- :machine-types-options="props.machineTypes"
154
- :error-validation-fields="props.errorValidationFields"
155
- @remove-error-by-title="emits('remove-error-by-title', $event)"
156
- />
157
- </template>
158
- </ui-wizard-block>
159
-
160
- <ui-wizard-block
161
- v-if="selectedStep.id === props.dynamicSteps.customizeHardware"
162
- >
163
- <template #content>
164
- <common-vm-actions-common-customize-hardware
165
- v-model="model"
166
- :storage="model.storage"
167
- :customize-hardware-submit="props.customizeHardwareSubmit"
168
- :max-memory="props.maxMemory"
169
- :cpu-models="props.cpuModels"
170
- :selected-nav-item="props.selectedNavItem"
171
- :nodes="props.nodes"
172
- :files="props.files"
173
- :networks-table="props.networksTable"
174
- :error-validation-fields="props.errorValidationFields"
175
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
176
- :passthrough-devices="props.passthroughDevices"
177
- :mediated-devices="props.mediatedDevices"
178
- :get-datastore-table-func="props.getDatastoreTableFunc"
179
- :datastore="props.datastore"
180
- :is-datastore-loading="props.isDatastoreLoading"
181
- :project="props.project"
182
- is-clone
183
- @get-storage="emits('get-storage', $event)"
184
- @get-folders-or-files="emits('get-folders-or-files', $event)"
185
- @get-active-device-child="emits('get-active-device-child', $event)"
186
- @show-datastore-child="emits('show-datastore-child', $event)"
187
- @get-networks-table="emits('get-networks-table', $event)"
188
- @get-pci-devices="emits('get-pci-devices')"
189
- />
190
- </template>
191
- </ui-wizard-block>
192
-
193
- <ui-wizard-block
194
- v-if="selectedStep.id === props.dynamicSteps.selectComputeResource"
195
- :sub-title-height="height5"
196
- >
197
- <template #subTitle>
198
- <div ref="subTitleBlock5">
199
- <div class="subtitle-block">
200
- <ui-alert
201
- v-if="props.computeResourceAlert.length"
202
- :messages="props.computeResourceAlert"
203
- test-id="computed-resource-alert"
204
- type="error"
205
- size="md"
206
- class="subtitle-block__alert"
207
- />
208
- <ui-wizard-subtitle
209
- :sub-title="
210
- localization.vmWizard
211
- .selectDestinationComputeResourceForThisOperation
212
- "
213
- />
214
- </div>
215
- </div>
216
- </template>
217
- <template #content>
218
- <common-wizards-common-steps-compute-resource
219
- v-if="props.isSphere"
220
- v-show="
221
- selectedStep.id === props.dynamicSteps.selectComputeResource
222
- "
223
- v-model="computeResource"
224
- :nodes="computeResourceTreeLocal"
225
- :alert-messages="props.computeResourceAlert"
226
- :is-loading="props.isLoadingComputeTree"
227
- :compatibility-text="props.compatibilityText"
228
- />
229
- </template>
230
- </ui-wizard-block>
231
-
232
- <ui-wizard-block
233
- v-if="selectedStep.id === props.dynamicSteps.readyComplete"
234
- :sub-title-height="heightReadyComplete"
235
- >
236
- <template #subTitle>
237
- <div ref="subTitleBlockReadyComplete">
238
- <div class="subtitle-block">
239
- <ui-wizard-subtitle
240
- :sub-title="localization.vmWizard.lastCreateSubtitle"
241
- />
242
- </div>
243
- </div>
244
- </template>
245
- <template #content>
246
- <div class="select-block-wrap h-full flex flex-col mt-3">
247
- <common-ready-to-complete :data="props.readyCompleteTableInfo" />
248
- <div
249
- class="vm-hardware-version-wrap justify-end flex flex-1 mt-4 pb-4"
250
- >
251
- <span class="vm-hardware-version">{{
252
- props.compatibilityInfo
253
- }}</span>
254
- </div>
255
- </div>
256
- </template>
257
- </ui-wizard-block>
258
- </template>
259
- </ui-wizard>
260
- </template>
261
-
262
- <script setup lang="ts">
263
- import { useElementSize } from '@vueuse/core'
264
- import type {
265
- UI_I_WizardStep,
266
- UI_I_WizardTexts,
267
- } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
268
- import type Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
269
- import type {
270
- UI_I_ArbitraryObject,
271
- UI_I_Localization,
272
- } from '~/lib/models/interfaces'
273
- import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
274
- import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
275
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
276
- import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
277
- import type { UI_T_Project } from '~/lib/models/types'
278
- import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
279
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
280
- import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
281
- import type { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
282
- import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
283
- import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
284
- import type {
285
- UI_I_MediatedDevice,
286
- UI_I_PciDevice,
287
- } from '~/lib/models/store/vm/interfaces'
288
- import type {
289
- UI_I_DatastoreTableItem,
290
- UI_I_FolderOrFileTreePayload,
291
- } from '~/lib/models/store/storage/interfaces'
292
- import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
293
- import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
294
-
295
- const model = defineModel<UI_I_CreateVmData>({ required: true })
296
-
297
- const schedulerTaskForm = defineModel<UI_I_ScheduleNewTasksForm>(
298
- 'scheduler-task-form'
299
- )
300
- const computeResource = defineModel<UI_I_TreeNode | undefined>(
301
- 'compute-resource'
302
- )
303
- const location = defineModel<UI_I_TreeNode | null>('location')
304
- const props = withDefaults(
305
- defineProps<{
306
- project: UI_T_Project
307
- nodes: UI_I_FileTreeNode[]
308
- files: UI_I_FileTreeNode[]
309
- networksTable: UI_I_NetworkTableItem[]
310
- datastore: UI_I_DatastoreTableItem[]
311
- isDatastoreLoading: boolean
312
- errorValidationFields: UI_I_ErrorValidationField[]
313
- readyCompleteTableInfo: UI_I_TableInfoItem[]
314
- vmCpuHelpTextSecond: string
315
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
316
- passthroughDevices: UI_I_PciDevice[]
317
- mediatedDevices: UI_I_MediatedDevice[]
318
- nameRequestUrl: string
319
- wizard: Wizard
320
- selectedScheme: number[]
321
- selectedVirtualMachine: string
322
- isNewVmFromTemplate: boolean | undefined
323
- computeResourceTree: UI_I_TreeNode[] | undefined // для сферы
324
- locationNodes: UI_I_TreeNode[] | undefined // для сферы
325
- title: string
326
- nameFormSubmit: null | Function
327
- storageSubmit: null | Function
328
- customizeHardwareSubmit: null | Function
329
- selectedNavItem: UI_T_SelectedNavItem
330
- allowedLocationKinds: number[]
331
- isSphere: boolean
332
- locationDescription: string
333
- nameTestIds: UI_I_NameTestIds
334
- guestOsFamilies: UI_I_OptionItem[]
335
- guestOsVersions: UI_I_ArbitraryObject<UI_I_OptionItem[]>
336
- machineTypes: UI_I_OptionItem[]
337
- maxMemory: number
338
- cpuModels: UI_I_OptionItem[]
339
- dynamicSteps: UI_I_ArbitraryObject<number>
340
- isLoadingComputeTree?: boolean // для сферы
341
- computeResourceAlert?: string[] // для сферы
342
- compatibilityText?: [UI_T_CompatibilityStatus, string] // для сферы
343
- }>(),
344
- {
345
- isLoadingComputeTree: false,
346
- computeResourceAlert: () => [],
347
- compatibilityText: () => ['none', ''],
348
- }
349
- )
350
-
351
- const emits = defineEmits<{
352
- (event: 'get-storage', value: UI_I_TablePayload): void
353
- (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
354
- (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
355
- (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
356
- (event: 'remove-error-by-title', value: string): void
357
- (event: 'get-networks-table', value: UI_I_TablePayload): void
358
- (event: 'get-pci-devices'): void
359
- (event: 'change-steps', value: UI_I_WizardStep[]): void
360
- (event: 'change-name', value: [string, UI_I_TreeNode | null]): void
361
- (event: 'change-storage', value: UI_I_DatastoreTableItem | null): void
362
- (event: 'change-select-options', value: string[]): void
363
- (event: 'change-clone-count', value: number): void
364
- (event: 'hide'): void
365
- (event: 'finish'): void
366
- }>()
367
-
368
- const localization = computed<UI_I_Localization>(() => useLocal())
369
-
370
- const computeResourceTreeLocal = computed<UI_I_TreeNode[]>(() => {
371
- // для сферы
372
- return props.computeResourceTree || []
373
- })
374
-
375
- const texts = computed<UI_I_WizardTexts>(() => ({
376
- cancel: localization.value.common.cancel,
377
- back: localization.value.common.backCap,
378
- processing: localization.value.common.processing,
379
- next: localization.value.common.next,
380
- finish: props.isNewVmFromTemplate
381
- ? localization.value.common.create
382
- : 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 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>
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 :sub-title="selectNameStepSubtitle" />
50
+ </div>
51
+ </div>
52
+ </template>
53
+ <template #content>
54
+ <common-wizards-common-steps-name
55
+ v-model:name="model.name"
56
+ v-model:location="location"
57
+ :show="
58
+ selectedStep.id === props.dynamicSteps.selectName ||
59
+ selectedStep.id === props.dynamicSteps.selectNameFolder
60
+ "
61
+ :name-form-submit="props.nameFormSubmit"
62
+ :name-request-url="props.nameRequestUrl"
63
+ :has-location="props.project === 'sphere'"
64
+ :location-nodes="props.locationNodes"
65
+ :allowed-location-kinds="props.allowedLocationKinds"
66
+ :location-description="props.locationDescription"
67
+ :validation-description="
68
+ localization.common.enterValidLocationVirtualMachine
69
+ "
70
+ :name-exist-validation-description="
71
+ localization.common.vmNameExistInSelectedLocation
72
+ "
73
+ :test-ids="props.nameTestIds"
74
+ @submit="emits('change-name', $event)"
75
+ @has-errors="isNameAlertWrapperEmpty = $event"
76
+ />
77
+ </template>
78
+ </ui-wizard-block>
79
+
80
+ <ui-wizard-block
81
+ v-if="selectedStep.id === props.dynamicSteps.selectStorage"
82
+ :sub-title-height="height2"
83
+ >
84
+ <template #subTitle>
85
+ <div ref="subTitleBlock2">
86
+ <div class="subtitle-block flex flex-col">
87
+ <ui-wizard-subtitle
88
+ :sub-title="
89
+ localization.common.selectStorageConfigurationDiskFiles2
90
+ "
91
+ />
92
+ </div>
93
+ </div>
94
+ </template>
95
+ <template #content>
96
+ <common-vm-actions-common-select-storage
97
+ :storage-submit="props.storageSubmit"
98
+ :datastore="props.datastore"
99
+ :is-datastore-loading="props.isDatastoreLoading"
100
+ :storage="model.storage"
101
+ :get-datastore-table-func="props.getDatastoreTableFunc"
102
+ hide-alert
103
+ @change-storage="emits('change-storage', $event)"
104
+ />
105
+ </template>
106
+ </ui-wizard-block>
107
+
108
+ <ui-wizard-block
109
+ v-if="selectedStep.id === props.dynamicSteps.selectOptions"
110
+ :sub-title-height="height3"
111
+ >
112
+ <template #subTitle>
113
+ <div ref="subTitleBlock3">
114
+ <div class="subtitle-block flex flex-col">
115
+ <ui-wizard-subtitle
116
+ :sub-title="localization.vmWizard.selectAdvancedOptionsCloning"
117
+ />
118
+ </div>
119
+ </div>
120
+ </template>
121
+ <template #content>
122
+ <common-vm-actions-common-select-options
123
+ :is-new-vm-from-template="props.isNewVmFromTemplate"
124
+ @change="emits('change-select-options', $event)"
125
+ @change-count="emits('change-clone-count', $event)"
126
+ />
127
+ </template>
128
+ </ui-wizard-block>
129
+
130
+ <ui-wizard-block
131
+ v-if="selectedStep.id === props.dynamicSteps.selectGuestOSMachineType"
132
+ :sub-title-height="height4"
133
+ >
134
+ <template #subTitle>
135
+ <div ref="subTitleBlock4">
136
+ <div class="subtitle-block flex flex-col">
137
+ <ui-wizard-subtitle
138
+ :sub-title="
139
+ localization.common
140
+ .chooseGuestOSInstalledVmAndMachineTypeUsedCreateVm
141
+ "
142
+ />
143
+ </div>
144
+ </div>
145
+ </template>
146
+ <template #content>
147
+ <common-vm-actions-common-select-os
148
+ v-model:guest-os-family="model.guest_os_family"
149
+ v-model:guest-os-version="model.guest_os_version"
150
+ v-model:machine-type="model.machine_type"
151
+ :families-options="props.guestOsFamilies"
152
+ :versions-options="props.guestOsVersions"
153
+ :machine-types-options="props.machineTypes"
154
+ :error-validation-fields="props.errorValidationFields"
155
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
156
+ />
157
+ </template>
158
+ </ui-wizard-block>
159
+
160
+ <ui-wizard-block
161
+ v-if="selectedStep.id === props.dynamicSteps.customizeHardware"
162
+ >
163
+ <template #content>
164
+ <common-vm-actions-common-customize-hardware
165
+ v-model="model"
166
+ :storage="model.storage"
167
+ :customize-hardware-submit="props.customizeHardwareSubmit"
168
+ :max-memory="props.maxMemory"
169
+ :cpu-models="props.cpuModels"
170
+ :selected-nav-item="props.selectedNavItem"
171
+ :nodes="props.nodes"
172
+ :files="props.files"
173
+ :networks-table="props.networksTable"
174
+ :error-validation-fields="props.errorValidationFields"
175
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
176
+ :passthrough-devices="props.passthroughDevices"
177
+ :mediated-devices="props.mediatedDevices"
178
+ :get-datastore-table-func="props.getDatastoreTableFunc"
179
+ :datastore="props.datastore"
180
+ :is-datastore-loading="props.isDatastoreLoading"
181
+ :project="props.project"
182
+ is-clone
183
+ @get-storage="emits('get-storage', $event)"
184
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
185
+ @get-active-device-child="emits('get-active-device-child', $event)"
186
+ @show-datastore-child="emits('show-datastore-child', $event)"
187
+ @get-networks-table="emits('get-networks-table', $event)"
188
+ @get-pci-devices="emits('get-pci-devices')"
189
+ />
190
+ </template>
191
+ </ui-wizard-block>
192
+
193
+ <ui-wizard-block
194
+ v-if="selectedStep.id === props.dynamicSteps.selectComputeResource"
195
+ :sub-title-height="height5"
196
+ >
197
+ <template #subTitle>
198
+ <div ref="subTitleBlock5">
199
+ <div class="subtitle-block">
200
+ <ui-alert
201
+ v-if="props.computeResourceAlert.length"
202
+ :messages="props.computeResourceAlert"
203
+ test-id="computed-resource-alert"
204
+ type="error"
205
+ size="md"
206
+ class="subtitle-block__alert"
207
+ />
208
+ <ui-wizard-subtitle
209
+ :sub-title="
210
+ localization.vmWizard
211
+ .selectDestinationComputeResourceForThisOperation
212
+ "
213
+ />
214
+ </div>
215
+ </div>
216
+ </template>
217
+ <template #content>
218
+ <common-wizards-common-steps-compute-resource
219
+ v-if="props.isSphere"
220
+ v-show="
221
+ selectedStep.id === props.dynamicSteps.selectComputeResource
222
+ "
223
+ v-model="computeResource"
224
+ :nodes="computeResourceTreeLocal"
225
+ :alert-messages="props.computeResourceAlert"
226
+ :is-loading="props.isLoadingComputeTree"
227
+ :compatibility-text="props.compatibilityText"
228
+ />
229
+ </template>
230
+ </ui-wizard-block>
231
+
232
+ <ui-wizard-block
233
+ v-if="selectedStep.id === props.dynamicSteps.readyComplete"
234
+ :sub-title-height="heightReadyComplete"
235
+ >
236
+ <template #subTitle>
237
+ <div ref="subTitleBlockReadyComplete">
238
+ <div class="subtitle-block">
239
+ <ui-wizard-subtitle
240
+ :sub-title="localization.vmWizard.lastCreateSubtitle"
241
+ />
242
+ </div>
243
+ </div>
244
+ </template>
245
+ <template #content>
246
+ <div class="select-block-wrap h-full flex flex-col mt-3">
247
+ <common-ready-to-complete :data="props.readyCompleteTableInfo" />
248
+ <div
249
+ class="vm-hardware-version-wrap justify-end flex flex-1 mt-4 pb-4"
250
+ >
251
+ <span class="vm-hardware-version">{{
252
+ props.compatibilityInfo
253
+ }}</span>
254
+ </div>
255
+ </div>
256
+ </template>
257
+ </ui-wizard-block>
258
+ </template>
259
+ </ui-wizard>
260
+ </template>
261
+
262
+ <script setup lang="ts">
263
+ import { useElementSize } from '@vueuse/core'
264
+ import type {
265
+ UI_I_WizardStep,
266
+ UI_I_WizardTexts,
267
+ } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
268
+ import type Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
269
+ import type {
270
+ UI_I_ArbitraryObject,
271
+ UI_I_Localization,
272
+ } from '~/lib/models/interfaces'
273
+ import type { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
274
+ import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
275
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
276
+ import type { UI_I_NameTestIds } from '~/components/common/wizards/common/steps/name/lib/models/interfaces'
277
+ import type { UI_T_Project } from '~/lib/models/types'
278
+ import type { UI_I_CreateVmData } from '~/components/common/vm/actions/common/lib/models/interfaces'
279
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
280
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
281
+ import type { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
282
+ import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
283
+ import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
284
+ import type {
285
+ UI_I_MediatedDevice,
286
+ UI_I_PciDevice,
287
+ } from '~/lib/models/store/vm/interfaces'
288
+ import type {
289
+ UI_I_DatastoreTableItem,
290
+ UI_I_FolderOrFileTreePayload,
291
+ } from '~/lib/models/store/storage/interfaces'
292
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
293
+ import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
294
+
295
+ const model = defineModel<UI_I_CreateVmData>({ required: true })
296
+
297
+ const schedulerTaskForm = defineModel<UI_I_ScheduleNewTasksForm>(
298
+ 'scheduler-task-form'
299
+ )
300
+ const computeResource = defineModel<UI_I_TreeNode | undefined>(
301
+ 'compute-resource'
302
+ )
303
+ const location = defineModel<UI_I_TreeNode | null>('location')
304
+ const props = withDefaults(
305
+ defineProps<{
306
+ project: UI_T_Project
307
+ nodes: UI_I_FileTreeNode[]
308
+ files: UI_I_FileTreeNode[]
309
+ networksTable: UI_I_NetworkTableItem[]
310
+ datastore: UI_I_DatastoreTableItem[]
311
+ isDatastoreLoading: boolean
312
+ errorValidationFields: UI_I_ErrorValidationField[]
313
+ readyCompleteTableInfo: UI_I_TableInfoItem[]
314
+ vmCpuHelpTextSecond: string
315
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
316
+ passthroughDevices: UI_I_PciDevice[]
317
+ mediatedDevices: UI_I_MediatedDevice[]
318
+ nameRequestUrl: string
319
+ wizard: Wizard
320
+ selectedScheme: number[]
321
+ selectedVirtualMachine: string
322
+ isNewVmFromTemplate: boolean | undefined
323
+ computeResourceTree: UI_I_TreeNode[] | undefined // для сферы
324
+ locationNodes: UI_I_TreeNode[] | undefined // для сферы
325
+ title: string
326
+ nameFormSubmit: null | Function
327
+ storageSubmit: null | Function
328
+ customizeHardwareSubmit: null | Function
329
+ selectedNavItem: UI_T_SelectedNavItem
330
+ allowedLocationKinds: number[]
331
+ isSphere: boolean
332
+ locationDescription: string
333
+ nameTestIds: UI_I_NameTestIds
334
+ guestOsFamilies: UI_I_OptionItem[]
335
+ guestOsVersions: UI_I_ArbitraryObject<UI_I_OptionItem[]>
336
+ machineTypes: UI_I_OptionItem[]
337
+ maxMemory: number
338
+ cpuModels: UI_I_OptionItem[]
339
+ dynamicSteps: UI_I_ArbitraryObject<number>
340
+ isLoadingComputeTree?: boolean // для сферы
341
+ computeResourceAlert?: string[] // для сферы
342
+ compatibilityText?: [UI_T_CompatibilityStatus, string] // для сферы
343
+ }>(),
344
+ {
345
+ isLoadingComputeTree: false,
346
+ computeResourceAlert: () => [],
347
+ compatibilityText: () => ['none', ''],
348
+ }
349
+ )
350
+
351
+ const emits = defineEmits<{
352
+ (event: 'get-storage', value: UI_I_TablePayload): void
353
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
354
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
355
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
356
+ (event: 'remove-error-by-title', value: string): void
357
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
358
+ (event: 'get-pci-devices'): void
359
+ (event: 'change-steps', value: UI_I_WizardStep[]): void
360
+ (event: 'change-name', value: [string, UI_I_TreeNode | null]): void
361
+ (event: 'change-storage', value: UI_I_DatastoreTableItem | null): void
362
+ (event: 'change-select-options', value: string[]): void
363
+ (event: 'change-clone-count', value: number): void
364
+ (event: 'hide'): void
365
+ (event: 'finish'): void
366
+ }>()
367
+
368
+ const localization = computed<UI_I_Localization>(() => useLocal())
369
+
370
+ const computeResourceTreeLocal = computed<UI_I_TreeNode[]>(() => {
371
+ // для сферы
372
+ return props.computeResourceTree || []
373
+ })
374
+
375
+ const texts = computed<UI_I_WizardTexts>(() => ({
376
+ cancel: localization.value.common.cancel,
377
+ back: localization.value.common.backCap,
378
+ processing: localization.value.common.processing,
379
+ next: localization.value.common.next,
380
+ finish: props.isNewVmFromTemplate
381
+ ? localization.value.common.create
382
+ : 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 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>