bfg-common 1.3.391 → 1.3.392

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 (89) hide show
  1. package/assets/img/icons/icons-sprite-dark-1.svg +1 -360
  2. package/assets/img/icons/icons-sprite-dark-2.svg +1 -296
  3. package/assets/img/icons/icons-sprite-dark-3.svg +1 -221
  4. package/assets/img/icons/icons-sprite-dark-4.svg +1 -247
  5. package/assets/img/icons/icons-sprite-light-1.svg +1 -360
  6. package/assets/img/icons/icons-sprite-light-2.svg +1 -296
  7. package/assets/img/icons/icons-sprite-light-3.svg +1 -221
  8. package/assets/img/icons/icons-sprite-light-4.svg +1 -247
  9. package/assets/localization/local_be.json +5 -1
  10. package/assets/localization/local_en.json +5 -1
  11. package/assets/localization/local_hy.json +5 -1
  12. package/assets/localization/local_kk.json +5 -1
  13. package/assets/localization/local_ru.json +5 -1
  14. package/assets/localization/local_zh.json +5 -1
  15. package/assets/scss/common/icons/icons.scss +0 -1
  16. package/components/atoms/loader/Loader.vue +30 -30
  17. package/components/atoms/loader/PreLoader.vue +38 -38
  18. package/components/atoms/switch/Switch.vue +111 -111
  19. package/components/atoms/table/compact/Compact.vue +526 -526
  20. package/components/common/adapterManager/ui/table/Header.vue +93 -93
  21. package/components/common/adapterManager/ui/table/Table.vue +162 -162
  22. package/components/common/context/Context.vue +99 -99
  23. package/components/common/lib/config/states.ts +126 -126
  24. package/components/common/pages/hardwareHealth/tableView/TableView.vue +1 -42
  25. package/components/common/pages/hardwareHealth/tableView/lib/config/alertWarningTable.ts +8 -15
  26. package/components/common/pages/hardwareHealth/tableView/lib/config/sensorTable.ts +1 -1
  27. package/components/common/resource/progressBlock/ProgressBlock.vue +142 -142
  28. package/components/common/split/horizontal/Horizontal.vue +49 -307
  29. package/components/common/split/horizontal/HorizontalOld.vue +307 -0
  30. package/components/common/vm/actions/add/Add.vue +602 -602
  31. package/components/common/vm/actions/clone/Clone.vue +518 -518
  32. package/components/common/vm/actions/common/customizeHardware/CustomizeHardware.vue +273 -273
  33. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +697 -697
  34. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/CdDvdDrive.vue +256 -256
  35. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +458 -458
  36. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +304 -304
  37. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/NewPciDevice.vue +167 -167
  38. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newUsbController/NewUsbController.vue +82 -82
  39. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +32 -32
  40. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +182 -182
  41. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/BootOptions.vue +114 -114
  42. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +188 -188
  43. package/components/common/vm/actions/common/customizeHardware/vmoptions/tools/Tools.vue +72 -72
  44. package/components/common/vm/actions/common/select/computeResource/ComputeResource.vue +164 -164
  45. package/components/common/vm/actions/common/select/name/Name.vue +235 -235
  46. package/components/common/vm/actions/common/select/storage/Storage.vue +198 -198
  47. package/components/common/vm/actions/editSettings/EditSettings.vue +316 -316
  48. package/components/common/weekSelect/lib/config/options.ts +10 -10
  49. package/components/common/wizards/datastore/add/Add.vue +436 -436
  50. package/components/common/wizards/datastore/add/lib/config/stepItems.ts +191 -191
  51. package/components/common/wizards/datastore/add/lib/models/interfaces.ts +38 -38
  52. package/components/common/wizards/datastore/add/lib/utils.ts +70 -70
  53. package/components/common/wizards/datastore/add/local/createName/CreateName.vue +160 -160
  54. package/components/common/wizards/datastore/add/nfs/Nfs.vue +112 -112
  55. package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +104 -104
  56. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -62
  57. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +53 -53
  58. package/components/common/wizards/datastore/add/readyComplete/ReadyComplete.vue +86 -86
  59. package/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails.ts +184 -184
  60. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue +459 -459
  61. package/components/common/wizards/datastore/add/types/Types.vue +80 -80
  62. package/components/common/wizards/datastore/add/types/lib/config/typeOptions.ts +49 -49
  63. package/composables/useAppVersion.ts +21 -21
  64. package/composables/useEnvLanguage.ts +20 -20
  65. package/lib/utils/sendTask.ts +72 -72
  66. package/minify.js +146 -146
  67. package/package.json +1 -1
  68. package/plugins/spice-console/spice.console.ts +147 -147
  69. package/public/spice-console/application/codec.js +263 -263
  70. package/public/spice-console/lib/rasterEngine.js +907 -907
  71. package/public/spice-console/network/spicechannel.js +375 -375
  72. package/store/main/lib/interfaces.ts +9 -9
  73. package/store/tasks/actions.ts +133 -133
  74. package/store/tasks/getters.ts +25 -25
  75. package/store/tasks/lib/models/interfaces.ts +18 -18
  76. package/store/tasks/mutations.ts +58 -58
  77. package/store/tasks/state.ts +16 -16
  78. package/assets/img/icons/icons-sprite-dark-1-old.svg +0 -1
  79. package/assets/img/icons/icons-sprite-dark-2-old.svg +0 -1
  80. package/assets/img/icons/icons-sprite-dark-3-old.svg +0 -1
  81. package/assets/img/icons/icons-sprite-dark-4-old.svg +0 -1
  82. package/assets/img/icons/icons-sprite-dark-7.svg +0 -8
  83. package/assets/img/icons/icons-sprite-light-1-old.svg +0 -1
  84. package/assets/img/icons/icons-sprite-light-2-old.svg +0 -1
  85. package/assets/img/icons/icons-sprite-light-3-old.svg +0 -1
  86. package/assets/img/icons/icons-sprite-light-4-old.svg +0 -1
  87. package/assets/img/icons/icons-sprite-light-7.svg +0 -8
  88. package/assets/scss/common/icons/icons-7.scss +0 -29
  89. package/components/common/pages/hardwareHealth/tableView/modal/sensorWarning.vue +0 -63
@@ -1,273 +1,273 @@
1
- <template>
2
- <div class="customize-hardware">
3
- <atoms-nav-bar v-model="selectedNavItem" :items="navItems" />
4
- <atoms-alert
5
- v-show="errors.length"
6
- status="alert-danger"
7
- :items="errors"
8
- test-id="customize-hardware-alert"
9
- @remove="onRemoveValidationErrors"
10
- />
11
-
12
- <div v-show="selectedNavItem === 0">
13
- <common-vm-actions-common-customize-hardware-virtual-hardware
14
- :vm-name="vmNameLocal"
15
- :storage="props.storage"
16
- :max-cpus="props.maxCpus"
17
- :max-memory="props.maxMemory"
18
- :cpu-models="props.cpuModels"
19
- :cpu="props.cpu"
20
- :memory="props.memory"
21
- :is-edit="props.isEdit"
22
- :is-clone="props.isClone"
23
- :state="props.state"
24
- :hard-disks="props.hardDisks"
25
- :cd-dvd-drives="props.cdDvdDrives"
26
- :networks="props.networks"
27
- :networks-table="props.networksTable"
28
- :video-card="props.videoCard"
29
- :usb-controller="props.usbController"
30
- :pci-devices="props.pciDevices"
31
- :nodes="props.nodes"
32
- :files="props.files"
33
- :error-validation-fields="props.errorValidationFields"
34
- :get-datastore-table-func="props.getDatastoreTableFunc"
35
- :datastore="props.datastore"
36
- :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
37
- :passthrough-devices="props.passthroughDevices"
38
- :project="props.project"
39
- @send-data="onSendDataVirtualHardwareMethod"
40
- @get-storage="emits('get-storage', $event)"
41
- @get-folders-or-files="emits('get-folders-or-files', $event)"
42
- @get-active-device-child="emits('get-active-device-child', $event)"
43
- @show-datastore-child="emits('show-datastore-child', $event)"
44
- @remove-error-by-title="emits('remove-error-by-title', $event)"
45
- @invalid="virtualHardwareInvalid = $event"
46
- @get-networks-table="emits('get-networks-table', $event)"
47
- @get-pci-devices="emits('get-pci-devices')"
48
- />
49
- </div>
50
- <div v-show="selectedNavItem === 1">
51
- <common-vm-actions-common-customize-hardware-vmoptions
52
- v-model:vm-name="vmNameLocal"
53
- v-model:guest-machine-type="guestMachineTypeLocal"
54
- v-model:guest-os-family="guestOsFamilyLocal"
55
- v-model:guest-os-version="guestOsVersionLocal"
56
- :hard-disks="props.hardDisksForBootOptions"
57
- :cd-dvd-drives="props.cdDvdDrivesForBootOptions"
58
- :networks="props.networksForBootOptions"
59
- :options="props.options"
60
- :is-edit="props.isEdit"
61
- :is-clone="props.isClone"
62
- :error-validation-fields="props.errorValidationFields"
63
- :state="props.state"
64
- @change-boot-order="onChangeBootOrder"
65
- @send-data="onSendDataVmOptionsMethod"
66
- @invalid="vmOptionsInvalid = $event"
67
- @remove-error-by-title="emits('remove-error-by-title', $event)"
68
- />
69
- </div>
70
- </div>
71
- </template>
72
-
73
- <script setup lang="ts">
74
- import { UI_T_Project } from '~/lib/models/types'
75
- import { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
76
- import { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
77
- import { UI_I_TablePayload } from '~/lib/models/table/interfaces'
78
- import { UI_I_FolderOrFileTreePayload } from '~/lib/models/store/storage/interfaces'
79
- import { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
80
- import {
81
- UI_I_SendDataNewPciDevice,
82
- UI_I_SendDataNewCdDvdDrive,
83
- UI_I_SendDataNewHardDisk,
84
- UI_I_SendDataNewNetwork,
85
- UI_I_SendDataVideoCard,
86
- UI_I_SendDataVirtualHardware,
87
- } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
88
- import { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
89
- import { UI_I_SendDataVmoptions } from '~/components/common/vm/actions/common/customizeHardware/vmoptions/lib/models/interfaces'
90
- import { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
91
- import { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
92
- import { UI_I_Localization } from '~/lib/models/interfaces'
93
- import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
94
- import { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
95
- import { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
96
- import {
97
- API_UI_I_VmEditCpu,
98
- API_UI_I_VmEditMemory,
99
- UI_I_PciDevice,
100
- } from '~/lib/models/store/vm/interfaces'
101
- import { navItemsFunc } from '~/components/common/vm/actions/common/customizeHardware/lib/config/navItems'
102
-
103
- const props = defineProps<{
104
- vmName: string
105
- errorValidationFields: UI_I_ErrorValidationField[]
106
- storage: UI_I_DatastoreTableItem | null
107
- guestMachineType: UI_I_OptionItem | null
108
- guestOsFamily: UI_I_OptionItem | null
109
- guestOsVersion: UI_I_OptionItem | null
110
- cpuModels: UI_I_OptionItem[]
111
- hardDisksForBootOptions: UI_I_SendDataNewHardDisk[] | null
112
- cdDvdDrivesForBootOptions: UI_I_SendDataNewCdDvdDrive[] | null
113
- networksForBootOptions: UI_I_SendDataNewNetwork[] | null
114
- customizeHardwareSubmit: null | Function
115
- maxCpus: number
116
- maxMemory: number
117
- selectedNavItem: UI_T_SelectedNavItem
118
- nodes: UI_I_FileTreeNode[]
119
- files: UI_I_FileTreeNode[]
120
- networksTable: UI_I_NetworkTableItem[]
121
- cpu?: API_UI_I_VmEditCpu
122
- memory?: API_UI_I_VmEditMemory
123
- vmCpuHelpTextSecond?: string
124
- getDatastoreTableFunc?: (payload: UI_I_TablePayload) => Promise<void>
125
- datastore: UI_I_DatastoreTableItem[]
126
- hardDisks?: UI_I_SendDataNewHardDisk[] | null
127
- cdDvdDrives?: UI_I_SendDataNewCdDvdDrive[] | null
128
- networks?: UI_I_SendDataNewNetwork[] | null
129
- videoCard?: UI_I_SendDataVideoCard
130
- pciDevices?: UI_I_SendDataNewPciDevice[]
131
- usbController?: string
132
- options?: UI_I_SendDataVmoptions
133
- isEdit?: boolean
134
- isClone?: boolean
135
- state?: string | number
136
- passthroughDevices?: UI_I_PciDevice[]
137
- project?: UI_T_Project
138
- }>()
139
- const emits = defineEmits<{
140
- (
141
- event: 'change-boot-order',
142
- value: [
143
- UI_I_SendDataNewHardDisk[],
144
- UI_I_SendDataNewCdDvdDrive[],
145
- UI_I_SendDataNewNetwork[]
146
- ]
147
- ): void
148
- (event: 'send-data', value: UI_I_SendDataCustomizeHardware): void
149
- (event: 'next'): void
150
- (event: 'update:vm-name', value: string): void
151
- (event: 'update:guest-machine-type', value: UI_I_OptionItem | null): void
152
- (event: 'update:guest-os-family', value: UI_I_OptionItem | null): void
153
- (event: 'update:guest-os-version', value: UI_I_OptionItem | null): void
154
- (event: 'get-storage', value: UI_I_TablePayload): void
155
- (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
156
- (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
157
- (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
158
- (event: 'remove-error-by-title', value: string): void
159
- (event: 'get-networks-table', value: UI_I_TablePayload): void
160
- (event: 'get-pci-devices'): void
161
- }>()
162
-
163
- const vmNameLocal = computed<string>({
164
- get() {
165
- return props.vmName
166
- },
167
- set(newValue) {
168
- emits('update:vm-name', newValue)
169
- },
170
- })
171
- const guestMachineTypeLocal = computed<UI_I_OptionItem | null>({
172
- get() {
173
- return props.guestMachineType
174
- },
175
- set(newValue) {
176
- emits('update:guest-machine-type', newValue)
177
- },
178
- })
179
- const guestOsFamilyLocal = computed<UI_I_OptionItem | null>({
180
- get() {
181
- return props.guestOsFamily
182
- },
183
- set(newValue) {
184
- emits('update:guest-os-family', newValue)
185
- },
186
- })
187
- const guestOsVersionLocal = computed<UI_I_OptionItem | null>({
188
- get() {
189
- return props.guestOsVersion
190
- },
191
- set(newValue) {
192
- emits('update:guest-os-version', newValue)
193
- },
194
- })
195
-
196
- const localization = computed<UI_I_Localization>(() => useLocal())
197
-
198
- const navItems = computed<UI_I_CollapseNavItem[]>(() =>
199
- navItemsFunc(localization.value)
200
- )
201
- const selectedNavItem = ref<number>(0)
202
- watch(
203
- () => props.selectedNavItem,
204
- (n) => {
205
- selectedNavItem.value = n
206
- }
207
- )
208
-
209
- const sendDataVirtualHardware = ref<UI_I_SendDataVirtualHardware | null>(null)
210
- const onSendDataVirtualHardwareMethod = (
211
- data: UI_I_SendDataVirtualHardware
212
- ): void => {
213
- sendDataVirtualHardware.value = data
214
- sendData()
215
- }
216
- const sendDataVmOptions = ref<UI_I_SendDataVmoptions | null>(null)
217
- const onSendDataVmOptionsMethod = (data: UI_I_SendDataVmoptions): void => {
218
- sendDataVmOptions.value = data
219
- sendData()
220
- }
221
- const sendData = (): void => {
222
- emits('send-data', {
223
- virtualHardware: sendDataVirtualHardware.value,
224
- vmOptions: sendDataVmOptions.value,
225
- })
226
- }
227
-
228
- const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
229
- emits('change-boot-order', data)
230
- }
231
-
232
- watch(
233
- () => props.customizeHardwareSubmit,
234
- (newValue) => {
235
- newValue && submit(newValue)
236
- }
237
- )
238
- const virtualHardwareInvalid = ref<string[]>([])
239
- const vmOptionsInvalid = ref<string[]>([])
240
- const submit = (cb: Function): void => {
241
- const invalidDevices = [
242
- ...virtualHardwareInvalid.value,
243
- ...vmOptionsInvalid.value,
244
- ]
245
- .filter((item: string) => !!item)
246
- .join(', ')
247
-
248
- if (invalidDevices) {
249
- showValidationErrors([
250
- localization.value.thereErrorsFollowingFields.replace(
251
- '{0}',
252
- invalidDevices
253
- ),
254
- ])
255
- cb(false)
256
- return
257
- }
258
- onRemoveValidationErrors()
259
-
260
- // emits('next')
261
- cb(true)
262
- }
263
-
264
- const errors = ref<string[]>([])
265
- const showValidationErrors = (arr: string[]): void => {
266
- errors.value = arr
267
- }
268
- const onRemoveValidationErrors = (): void => {
269
- errors.value = []
270
- }
271
- </script>
272
-
273
- <style scoped lang="scss"></style>
1
+ <template>
2
+ <div class="customize-hardware">
3
+ <atoms-nav-bar v-model="selectedNavItem" :items="navItems" />
4
+ <atoms-alert
5
+ v-show="errors.length"
6
+ status="alert-danger"
7
+ :items="errors"
8
+ test-id="customize-hardware-alert"
9
+ @remove="onRemoveValidationErrors"
10
+ />
11
+
12
+ <div v-show="selectedNavItem === 0">
13
+ <common-vm-actions-common-customize-hardware-virtual-hardware
14
+ :vm-name="vmNameLocal"
15
+ :storage="props.storage"
16
+ :max-cpus="props.maxCpus"
17
+ :max-memory="props.maxMemory"
18
+ :cpu-models="props.cpuModels"
19
+ :cpu="props.cpu"
20
+ :memory="props.memory"
21
+ :is-edit="props.isEdit"
22
+ :is-clone="props.isClone"
23
+ :state="props.state"
24
+ :hard-disks="props.hardDisks"
25
+ :cd-dvd-drives="props.cdDvdDrives"
26
+ :networks="props.networks"
27
+ :networks-table="props.networksTable"
28
+ :video-card="props.videoCard"
29
+ :usb-controller="props.usbController"
30
+ :pci-devices="props.pciDevices"
31
+ :nodes="props.nodes"
32
+ :files="props.files"
33
+ :error-validation-fields="props.errorValidationFields"
34
+ :get-datastore-table-func="props.getDatastoreTableFunc"
35
+ :datastore="props.datastore"
36
+ :vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
37
+ :passthrough-devices="props.passthroughDevices"
38
+ :project="props.project"
39
+ @send-data="onSendDataVirtualHardwareMethod"
40
+ @get-storage="emits('get-storage', $event)"
41
+ @get-folders-or-files="emits('get-folders-or-files', $event)"
42
+ @get-active-device-child="emits('get-active-device-child', $event)"
43
+ @show-datastore-child="emits('show-datastore-child', $event)"
44
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
45
+ @invalid="virtualHardwareInvalid = $event"
46
+ @get-networks-table="emits('get-networks-table', $event)"
47
+ @get-pci-devices="emits('get-pci-devices')"
48
+ />
49
+ </div>
50
+ <div v-show="selectedNavItem === 1">
51
+ <common-vm-actions-common-customize-hardware-vmoptions
52
+ v-model:vm-name="vmNameLocal"
53
+ v-model:guest-machine-type="guestMachineTypeLocal"
54
+ v-model:guest-os-family="guestOsFamilyLocal"
55
+ v-model:guest-os-version="guestOsVersionLocal"
56
+ :hard-disks="props.hardDisksForBootOptions"
57
+ :cd-dvd-drives="props.cdDvdDrivesForBootOptions"
58
+ :networks="props.networksForBootOptions"
59
+ :options="props.options"
60
+ :is-edit="props.isEdit"
61
+ :is-clone="props.isClone"
62
+ :error-validation-fields="props.errorValidationFields"
63
+ :state="props.state"
64
+ @change-boot-order="onChangeBootOrder"
65
+ @send-data="onSendDataVmOptionsMethod"
66
+ @invalid="vmOptionsInvalid = $event"
67
+ @remove-error-by-title="emits('remove-error-by-title', $event)"
68
+ />
69
+ </div>
70
+ </div>
71
+ </template>
72
+
73
+ <script setup lang="ts">
74
+ import { UI_T_Project } from '~/lib/models/types'
75
+ import { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
76
+ import { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
77
+ import { UI_I_TablePayload } from '~/lib/models/table/interfaces'
78
+ import { UI_I_FolderOrFileTreePayload } from '~/lib/models/store/storage/interfaces'
79
+ import { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
80
+ import {
81
+ UI_I_SendDataNewPciDevice,
82
+ UI_I_SendDataNewCdDvdDrive,
83
+ UI_I_SendDataNewHardDisk,
84
+ UI_I_SendDataNewNetwork,
85
+ UI_I_SendDataVideoCard,
86
+ UI_I_SendDataVirtualHardware,
87
+ } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
88
+ import { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
89
+ import { UI_I_SendDataVmoptions } from '~/components/common/vm/actions/common/customizeHardware/vmoptions/lib/models/interfaces'
90
+ import { UI_T_SelectedNavItem } from '~/components/common/vm/actions/common/lib/models/types'
91
+ import { UI_I_ErrorValidationField } from '~/lib/models/store/interfaces'
92
+ import { UI_I_Localization } from '~/lib/models/interfaces'
93
+ import { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
94
+ import { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
95
+ import { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
96
+ import {
97
+ API_UI_I_VmEditCpu,
98
+ API_UI_I_VmEditMemory,
99
+ UI_I_PciDevice,
100
+ } from '~/lib/models/store/vm/interfaces'
101
+ import { navItemsFunc } from '~/components/common/vm/actions/common/customizeHardware/lib/config/navItems'
102
+
103
+ const props = defineProps<{
104
+ vmName: string
105
+ errorValidationFields: UI_I_ErrorValidationField[]
106
+ storage: UI_I_DatastoreTableItem | null
107
+ guestMachineType: UI_I_OptionItem | null
108
+ guestOsFamily: UI_I_OptionItem | null
109
+ guestOsVersion: UI_I_OptionItem | null
110
+ cpuModels: UI_I_OptionItem[]
111
+ hardDisksForBootOptions: UI_I_SendDataNewHardDisk[] | null
112
+ cdDvdDrivesForBootOptions: UI_I_SendDataNewCdDvdDrive[] | null
113
+ networksForBootOptions: UI_I_SendDataNewNetwork[] | null
114
+ customizeHardwareSubmit: null | Function
115
+ maxCpus: number
116
+ maxMemory: number
117
+ selectedNavItem: UI_T_SelectedNavItem
118
+ nodes: UI_I_FileTreeNode[]
119
+ files: UI_I_FileTreeNode[]
120
+ networksTable: UI_I_NetworkTableItem[]
121
+ cpu?: API_UI_I_VmEditCpu
122
+ memory?: API_UI_I_VmEditMemory
123
+ vmCpuHelpTextSecond?: string
124
+ getDatastoreTableFunc?: (payload: UI_I_TablePayload) => Promise<void>
125
+ datastore: UI_I_DatastoreTableItem[]
126
+ hardDisks?: UI_I_SendDataNewHardDisk[] | null
127
+ cdDvdDrives?: UI_I_SendDataNewCdDvdDrive[] | null
128
+ networks?: UI_I_SendDataNewNetwork[] | null
129
+ videoCard?: UI_I_SendDataVideoCard
130
+ pciDevices?: UI_I_SendDataNewPciDevice[]
131
+ usbController?: string
132
+ options?: UI_I_SendDataVmoptions
133
+ isEdit?: boolean
134
+ isClone?: boolean
135
+ state?: string | number
136
+ passthroughDevices?: UI_I_PciDevice[]
137
+ project?: UI_T_Project
138
+ }>()
139
+ const emits = defineEmits<{
140
+ (
141
+ event: 'change-boot-order',
142
+ value: [
143
+ UI_I_SendDataNewHardDisk[],
144
+ UI_I_SendDataNewCdDvdDrive[],
145
+ UI_I_SendDataNewNetwork[]
146
+ ]
147
+ ): void
148
+ (event: 'send-data', value: UI_I_SendDataCustomizeHardware): void
149
+ (event: 'next'): void
150
+ (event: 'update:vm-name', value: string): void
151
+ (event: 'update:guest-machine-type', value: UI_I_OptionItem | null): void
152
+ (event: 'update:guest-os-family', value: UI_I_OptionItem | null): void
153
+ (event: 'update:guest-os-version', value: UI_I_OptionItem | null): void
154
+ (event: 'get-storage', value: UI_I_TablePayload): void
155
+ (event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
156
+ (event: 'get-active-device-child', value: UI_I_FileTreeNode): void
157
+ (event: 'show-datastore-child', value: UI_I_FileTreeNode): void
158
+ (event: 'remove-error-by-title', value: string): void
159
+ (event: 'get-networks-table', value: UI_I_TablePayload): void
160
+ (event: 'get-pci-devices'): void
161
+ }>()
162
+
163
+ const vmNameLocal = computed<string>({
164
+ get() {
165
+ return props.vmName
166
+ },
167
+ set(newValue) {
168
+ emits('update:vm-name', newValue)
169
+ },
170
+ })
171
+ const guestMachineTypeLocal = computed<UI_I_OptionItem | null>({
172
+ get() {
173
+ return props.guestMachineType
174
+ },
175
+ set(newValue) {
176
+ emits('update:guest-machine-type', newValue)
177
+ },
178
+ })
179
+ const guestOsFamilyLocal = computed<UI_I_OptionItem | null>({
180
+ get() {
181
+ return props.guestOsFamily
182
+ },
183
+ set(newValue) {
184
+ emits('update:guest-os-family', newValue)
185
+ },
186
+ })
187
+ const guestOsVersionLocal = computed<UI_I_OptionItem | null>({
188
+ get() {
189
+ return props.guestOsVersion
190
+ },
191
+ set(newValue) {
192
+ emits('update:guest-os-version', newValue)
193
+ },
194
+ })
195
+
196
+ const localization = computed<UI_I_Localization>(() => useLocal())
197
+
198
+ const navItems = computed<UI_I_CollapseNavItem[]>(() =>
199
+ navItemsFunc(localization.value)
200
+ )
201
+ const selectedNavItem = ref<number>(0)
202
+ watch(
203
+ () => props.selectedNavItem,
204
+ (n) => {
205
+ selectedNavItem.value = n
206
+ }
207
+ )
208
+
209
+ const sendDataVirtualHardware = ref<UI_I_SendDataVirtualHardware | null>(null)
210
+ const onSendDataVirtualHardwareMethod = (
211
+ data: UI_I_SendDataVirtualHardware
212
+ ): void => {
213
+ sendDataVirtualHardware.value = data
214
+ sendData()
215
+ }
216
+ const sendDataVmOptions = ref<UI_I_SendDataVmoptions | null>(null)
217
+ const onSendDataVmOptionsMethod = (data: UI_I_SendDataVmoptions): void => {
218
+ sendDataVmOptions.value = data
219
+ sendData()
220
+ }
221
+ const sendData = (): void => {
222
+ emits('send-data', {
223
+ virtualHardware: sendDataVirtualHardware.value,
224
+ vmOptions: sendDataVmOptions.value,
225
+ })
226
+ }
227
+
228
+ const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
229
+ emits('change-boot-order', data)
230
+ }
231
+
232
+ watch(
233
+ () => props.customizeHardwareSubmit,
234
+ (newValue) => {
235
+ newValue && submit(newValue)
236
+ }
237
+ )
238
+ const virtualHardwareInvalid = ref<string[]>([])
239
+ const vmOptionsInvalid = ref<string[]>([])
240
+ const submit = (cb: Function): void => {
241
+ const invalidDevices = [
242
+ ...virtualHardwareInvalid.value,
243
+ ...vmOptionsInvalid.value,
244
+ ]
245
+ .filter((item: string) => !!item)
246
+ .join(', ')
247
+
248
+ if (invalidDevices) {
249
+ showValidationErrors([
250
+ localization.value.thereErrorsFollowingFields.replace(
251
+ '{0}',
252
+ invalidDevices
253
+ ),
254
+ ])
255
+ cb(false)
256
+ return
257
+ }
258
+ onRemoveValidationErrors()
259
+
260
+ // emits('next')
261
+ cb(true)
262
+ }
263
+
264
+ const errors = ref<string[]>([])
265
+ const showValidationErrors = (arr: string[]): void => {
266
+ errors.value = arr
267
+ }
268
+ const onRemoveValidationErrors = (): void => {
269
+ errors.value = []
270
+ }
271
+ </script>
272
+
273
+ <style scoped lang="scss"></style>