bfg-common 1.5.487 → 1.5.489
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_STYLE.md +109 -109
- package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
- package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
- package/assets/img/icons/icons-sprite-light-3.svg +227 -227
- package/assets/img/icons/icons-sprite-light-5.svg +488 -488
- package/assets/localization/local_be.json +7 -1
- package/assets/localization/local_en.json +17 -11
- package/assets/localization/local_hy.json +7 -1
- package/assets/localization/local_kk.json +7 -1
- package/assets/localization/local_ru.json +7 -1
- package/assets/localization/local_zh.json +7 -1
- package/components/atoms/TheIcon3.vue +50 -50
- package/components/atoms/collapse/CollapseNav.vue +170 -170
- package/components/atoms/perPage/PerPage.vue +58 -58
- package/components/atoms/table/dataGrid/DataGridPagination.vue +97 -97
- package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
- package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
- package/components/common/adapterManager/AdapterManager.vue +189 -545
- package/components/common/adapterManager/AdapterManagerNew.vue +300 -0
- package/components/common/adapterManager/AdapterManagerOld.vue +498 -0
- package/components/common/adapterManager/addAdapterModal/AddAdapterModal.vue +70 -0
- package/components/common/adapterManager/addAdapterModal/AddAdapterModalNew.vue +77 -0
- package/components/common/adapterManager/{AddAdapterModal.vue → addAdapterModal/AddAdapterModalOld.vue} +16 -46
- package/components/common/adapterManager/addAdapterWarningModal/AddAdapterWarningModal.vue +32 -0
- package/components/common/adapterManager/addAdapterWarningModal/AddAdapterWarningModalNew.vue +38 -0
- package/components/common/adapterManager/{AddAdapterWarningModal.vue → addAdapterWarningModal/AddAdapterWarningModalOld.vue} +5 -14
- package/components/common/adapterManager/noActiveAdaptersModal/NoActiveAdaptersModal.vue +31 -0
- package/components/common/adapterManager/noActiveAdaptersModal/NoActiveAdaptersModalNew.vue +34 -0
- package/components/common/adapterManager/{NoActiveAdaptersModal.vue → noActiveAdaptersModal/NoActiveAdaptersModalOld.vue} +2 -6
- package/components/common/adapterManager/noConnectedActiveAdaptersModal/NoConnectedActiveAdaptersModal.vue +31 -0
- package/components/common/adapterManager/noConnectedActiveAdaptersModal/NoConnectedActiveAdaptersModalNew.vue +34 -0
- package/components/common/adapterManager/{NoConnectedActiveAdaptersModal.vue → noConnectedActiveAdaptersModal/NoConnectedActiveAdaptersModalOld.vue} +2 -6
- package/components/common/adapterManager/ui/actions/bar/Bar.vue +57 -0
- package/components/common/adapterManager/ui/actions/bar/BarNew.vue +38 -0
- package/components/common/adapterManager/ui/actions/moveDownAdapterButton/MoveDownAdapterButton.vue +28 -0
- package/components/common/adapterManager/ui/actions/moveDownAdapterButton/MoveDownAdapterButtonNew.vue +75 -0
- package/components/common/adapterManager/ui/actions/{MoveDownAdapterButton.vue → moveDownAdapterButton/MoveDownAdapterButtonOld.vue} +3 -9
- package/components/common/adapterManager/ui/actions/moveUpAdapterButton/MoveUpAdapterButton.vue +28 -0
- package/components/common/adapterManager/ui/actions/moveUpAdapterButton/MoveUpAdapterButtonNew.vue +76 -0
- package/components/common/adapterManager/ui/actions/{MoveUpAdapterButton.vue → moveUpAdapterButton/MoveUpAdapterButtonOld.vue} +3 -9
- package/components/common/adapterManager/ui/noSelectedAdapter/NoSelectedAdapter.vue +24 -0
- package/components/common/adapterManager/ui/noSelectedAdapter/NoSelectedAdapterNew.vue +13 -0
- package/components/common/adapterManager/ui/secondTitle/SecondTitle.vue +31 -0
- package/components/common/adapterManager/ui/secondTitle/SecondTitleNew.vue +36 -0
- package/components/common/adapterManager/ui/{SecondTitle.vue → secondTitle/SecondTitleOld.vue} +0 -1
- package/components/common/adapterManager/ui/table/Table.vue +59 -133
- package/components/common/adapterManager/ui/table/TableNew.vue +136 -0
- package/components/common/adapterManager/ui/table/TableOld.vue +141 -0
- package/components/common/adapterManager/ui/table/adapters/Adapters.vue +44 -0
- package/components/common/adapterManager/ui/table/adapters/AdaptersNew.vue +153 -0
- package/components/common/adapterManager/ui/table/{Adapters.vue → adapters/AdaptersOld.vue} +5 -10
- package/components/common/adapterManager/ui/table/header/Header.vue +57 -0
- package/components/common/adapterManager/ui/table/header/HeaderNew.vue +77 -0
- package/components/common/adapterManager/ui/table/{Header.vue → header/HeaderOld.vue} +3 -20
- package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
- package/components/common/browse/blocks/lib/models/types.ts +1 -1
- package/components/common/browse/lib/models/interfaces.ts +5 -5
- package/components/common/context/lib/models/interfaces.ts +33 -33
- package/components/common/diagramMain/DiagramMain.vue +905 -900
- package/components/common/diagramMain/lib/models/interfaces.ts +5 -2
- package/components/common/diagramMain/modals/ManagePhysicalAdaptersModal.vue +6 -5
- package/components/common/diagramMain/modals/Modals.vue +19 -1
- package/components/common/diagramMain/modals/lib/config/adapterModal.ts +23 -20
- package/components/common/diagramMain/modals/lib/config/networkModal.ts +401 -398
- package/components/common/diagramMain/modals/lib/config/switchModal.ts +3 -0
- package/components/common/diagramMain/modals/remove/RemoveModal.vue +8 -0
- package/components/common/diagramMain/modals/remove/RemoveModalNew.vue +106 -95
- package/components/common/diagramMain/modals/remove/RemoveModalOld.vue +12 -1
- package/components/common/diagramMain/modals/viewSettings/info/Info.vue +0 -2
- package/components/common/diagramMain/modals/viewSettings/viewSettings/ViewSettings.vue +6 -0
- package/components/common/diagramMain/modals/viewSettings/viewSettings/ViewSettingsNew.vue +140 -71
- package/components/common/diagramMain/modals/viewSettings/viewSettings/ViewSettingsOld.vue +4 -4
- package/components/common/diagramMain/network/Contents.vue +497 -497
- package/components/common/layout/theHeader/helpMenu/About.vue +79 -79
- package/components/common/layout/theHeader/helpMenu/aboutOld/AboutOld.vue +79 -79
- package/components/common/pages/backups/DetailView.vue +52 -52
- package/components/common/pages/backups/lib/models/interfaces.ts +36 -36
- package/components/common/pages/backups/modals/Modals.vue +243 -243
- package/components/common/pages/backups/modals/createBackup/configuration/Configuration.vue +29 -29
- package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -6
- package/components/common/pages/backups/modals/createBackup/datastores/tableView/TableView.vue +95 -95
- package/components/common/pages/backups/modals/createBackup/general/General.vue +141 -141
- package/components/common/pages/backups/modals/createBackup/lib/config/strategyOptions.ts +12 -12
- package/components/common/pages/backups/modals/lib/config/restore.ts +115 -115
- package/components/common/pages/backups/modals/lib/models/interfaces.ts +186 -186
- package/components/common/pages/backups/modals/restore/disks/Disks.vue +27 -27
- package/components/common/pages/backups/modals/restore/disks/tableView/lib/config/table.ts +117 -117
- package/components/common/pages/backups/modals/restore/name/Name.vue +166 -166
- package/components/common/pages/backups/modals/restore/name/lib/models/interfaces.ts +6 -6
- package/components/common/pages/backups/modals/restore/networks/Networks.vue +67 -67
- package/components/common/pages/backups/modals/restore/networks/table/Table.vue +214 -214
- package/components/common/pages/backups/modals/restore/types/lib/config/typeOptions.ts +25 -25
- package/components/common/pages/backups/tools/Tools.vue +75 -75
- package/components/common/pages/backups/tools/lib/config/tabs.ts +36 -36
- package/components/common/pages/home/lib/models/interfaces.ts +48 -48
- package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
- package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
- package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
- package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
- package/components/common/pages/scheduledTasks/lib/utils/utils.ts +84 -84
- package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
- package/components/common/select/radio/RadioGroup.vue +137 -137
- package/components/common/spiceConsole/Drawer.vue +392 -392
- package/components/common/spiceConsole/SpiceConsole.vue +184 -184
- package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
- package/components/common/tools/Actions.vue +207 -207
- package/components/common/treeView/TreeView.vue +52 -52
- package/components/common/vm/actions/add/Add.vue +877 -877
- package/components/common/vm/actions/add/folderTreeView/FolderTreeView.vue +72 -72
- package/components/common/vm/actions/add/folderTreeView/New.vue +40 -40
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +368 -368
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/Shares.vue +140 -140
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/Location.vue +154 -154
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/location/new/table/Table.vue +99 -99
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +119 -119
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIo.vue +31 -31
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +16 -16
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/numberDisplays/NumberDisplays.vue +53 -53
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +32 -32
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +60 -60
- package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +174 -174
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +32 -32
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +103 -103
- package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirection.vue +28 -28
- package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
- package/components/common/vm/actions/common/select/computeResource/ComputeResource.vue +143 -143
- package/components/common/vm/actions/common/select/computeResource/New.vue +184 -184
- package/components/common/vm/actions/common/select/computeResource/treeView/TreeView.vue +131 -131
- package/components/common/vm/actions/common/select/createType/CreateType.vue +38 -38
- package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
- package/components/common/vm/actions/common/select/name/Name.vue +200 -200
- package/components/common/vm/actions/common/select/name/Old.vue +131 -131
- package/components/common/vm/actions/common/select/os/Old.vue +152 -152
- package/components/common/vm/actions/common/select/os/Os.vue +139 -139
- package/components/common/vm/actions/common/select/storage/new/New.vue +320 -320
- package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
- package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
- package/components/common/vm/actions/common/select/template/old/Old.vue +50 -50
- package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
- package/components/common/vm/actions/register/Register.vue +267 -267
- package/components/common/vm/actions/register/lib/config/steps.ts +86 -86
- package/components/common/vmt/actions/add/Add.vue +549 -549
- package/components/common/wizards/datastore/add/steps/typeMode/lib/config/typeOptions.ts +43 -43
- package/components/common/wizards/network/add/Add.vue +9 -3
- package/components/common/wizards/network/add/AddNew.vue +291 -354
- package/components/common/wizards/network/add/AddOld.vue +0 -3
- package/components/common/wizards/network/add/lib/config/config.ts +1 -0
- package/components/common/wizards/network/add/lib/config/initialData.ts +9 -0
- package/components/common/wizards/network/add/lib/config/steps.ts +35 -5
- package/components/common/wizards/network/add/lib/models/interfaces.ts +12 -2
- package/components/common/wizards/network/add/steps/connectionSettings/ConnectionSettings.vue +83 -0
- package/components/common/wizards/network/add/steps/connectionSettings/ConnectionSettingsNew.vue +114 -0
- package/components/common/wizards/network/add/steps/{ConnectionSettings.vue → connectionSettings/ConnectionSettingsOld.vue} +11 -42
- package/components/common/wizards/network/add/steps/createStandardSwitch/CreateStandardSwitch.vue +99 -0
- package/components/common/wizards/network/add/steps/createStandardSwitch/CreateStandardSwitchNew.vue +80 -0
- package/components/common/wizards/network/add/steps/{CreateStandardSwitch.vue → createStandardSwitch/CreateStandardSwitchOld.vue} +24 -33
- package/components/common/wizards/network/add/steps/ipFourSettings/IpFourSettings.vue +143 -0
- package/components/common/wizards/network/add/steps/ipFourSettings/IpFourSettingsNew.vue +224 -0
- package/components/common/wizards/network/add/steps/{IpFourSettings.vue → ipFourSettings/IpFourSettingsOld.vue} +13 -101
- package/components/common/wizards/network/add/steps/portProperties/PortProperties.vue +214 -0
- package/components/common/wizards/network/add/steps/portProperties/PortPropertiesNew.vue +289 -0
- package/components/common/wizards/network/add/steps/{PortProperties.vue → portProperties/PortPropertiesOld.vue} +19 -166
- package/components/common/wizards/network/add/steps/readyComplete/ReadyComplete.vue +22 -0
- package/components/common/wizards/network/add/steps/readyComplete/ReadyCompleteNew.vue +30 -0
- package/components/common/wizards/network/add/steps/selectTargetDevice/SelectTargetDevice.vue +7 -2
- package/components/common/wizards/network/add/steps/selectTargetDevice/SelectTargetDeviceNew.vue +1 -3
- package/components/common/wizards/network/add/steps/selectTargetDevice/SelectTargetDeviceOld.vue +0 -2
- package/components/common/wizards/network/add/validations/common.ts +1 -2
- package/components/common/wizards/network/add/validations/connectionSettings.ts +14 -7
- package/components/common/wizards/network/add/validations/ipFourSettings.ts +24 -10
- package/components/common/wizards/network/add/validations/networkValidation.ts +1 -1
- package/components/common/wizards/network/add/validations/portProperties.ts +52 -20
- package/components/common/wizards/network/add/validations/targetDevice.ts +18 -4
- package/components/common/wizards/vm/migrate/select/network/Network.vue +103 -103
- package/composables/useAppVersion.ts +21 -21
- package/composables/useLocal.ts +6 -6
- package/composables/useLocalCommon.ts +39 -39
- package/package.json +2 -2
- package/plugins/date.ts +233 -233
- package/plugins/panelStates.ts +70 -70
- package/plugins/text.ts +59 -59
- package/public/spice-console/lib/images/bitmap.js +203 -203
- package/public/spice-console/network/spicechannel.js +440 -440
- package/public/spice-console/run.js +210 -210
- package/store/main/mutations.ts +7 -7
- package/store/main/state.ts +7 -7
- package/components/common/wizards/network/add/steps/PhysicalAdapter.vue +0 -13
- /package/components/common/adapterManager/ui/actions/{ActionsBar.vue → bar/BarOld.vue} +0 -0
- /package/components/common/adapterManager/ui/{NoSelectedAdapter.vue → noSelectedAdapter/NoSelectedAdapterOld.vue} +0 -0
- /package/components/common/wizards/network/add/steps/{ReadyComplete.vue → readyComplete/ReadyCompleteOld.vue} +0 -0
@@ -1,877 +1,877 @@
|
|
1
|
-
<template>
|
2
|
-
<common-vm-actions-add-new
|
3
|
-
v-if="isNewView"
|
4
|
-
v-model:vm-form="vmForm"
|
5
|
-
v-model:selected-create-type="selectedCreateType"
|
6
|
-
v-model:is-power-on-by-default="isPowerOnByDefault"
|
7
|
-
:project="props.project"
|
8
|
-
:is-vmt="props.isVmt"
|
9
|
-
:nodes="props.nodes"
|
10
|
-
:files="props.files"
|
11
|
-
:networks-table="props.networksTable"
|
12
|
-
:datastore="props.datastore"
|
13
|
-
:is-datastore-loading="props.isDatastoreLoading"
|
14
|
-
:error-validation-fields="props.errorValidationFields"
|
15
|
-
:ready-complete-table-info="props.readyCompleteTableInfo"
|
16
|
-
:vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
|
17
|
-
:import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
|
18
|
-
:get-datastore-table-func="props.getDatastoreTableFunc"
|
19
|
-
:passthrough-devices="props.passthroughDevices"
|
20
|
-
:mediated-devices="props.mediatedDevices"
|
21
|
-
:templates-tree="props.templatesTree"
|
22
|
-
:wizard="wizard"
|
23
|
-
:selected-scheme="selectedScheme"
|
24
|
-
:template-submit="templateSubmit"
|
25
|
-
:name-form-submit="nameFormSubmit"
|
26
|
-
:storage-submit="storageSubmit"
|
27
|
-
:customize-hardware-submit="customizeHardwareSubmit"
|
28
|
-
:customize-hardware-for-template-submit="customizeHardwareForTemplateSubmit"
|
29
|
-
:is-sphere="isSphere"
|
30
|
-
:compatibility="compatibility"
|
31
|
-
:guestOsFamilies="guestOsFamilies"
|
32
|
-
:guestOsVersions="guestOsVersions"
|
33
|
-
:machineTypes="machineTypes"
|
34
|
-
:virtual-hardware-hard-disks-local="virtualHardwareHardDisksLocal"
|
35
|
-
:virtual-hardware-cd-dvd-drives-local="virtualHardwareCdDvdDrivesLocal"
|
36
|
-
:virtual-hardware-networks-local="virtualHardwareNetworksLocal"
|
37
|
-
:max-cpus="maxCpus"
|
38
|
-
:max-memory="maxMemory"
|
39
|
-
:cpu-models="cpuModels"
|
40
|
-
:selected-nav-item="selectedNavItem"
|
41
|
-
:compatibility-info="compatibilityInfo"
|
42
|
-
:is-show-power-on="isShowPowerOn"
|
43
|
-
:is-show-select-template="isShowSelectTemplate"
|
44
|
-
:compute-resource-submit="computeResourceSubmit"
|
45
|
-
:data-center="props.dataCenter"
|
46
|
-
:compute-resource="props.computeResource"
|
47
|
-
:compute-resource-tree="props.computeResourceTree"
|
48
|
-
:vmt-settings="props.vmtSettings"
|
49
|
-
:is-loading="isLoading"
|
50
|
-
:selected-template-id="props.selectedTemplateId"
|
51
|
-
:validate-empty-name="props.validateEmptyName"
|
52
|
-
:title="title"
|
53
|
-
@check-name="emits('check-name', $event)"
|
54
|
-
@get-storage="emits('get-storage', $event)"
|
55
|
-
@get-folders-or-files="emits('get-folders-or-files', $event)"
|
56
|
-
@get-active-device-child="emits('get-active-device-child', $event)"
|
57
|
-
@show-datastore-child="emits('show-datastore-child', $event)"
|
58
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
59
|
-
@get-networks-table="emits('get-networks-table', $event)"
|
60
|
-
@get-pci-devices="emits('get-pci-devices')"
|
61
|
-
@change-steps="onChangeSteps"
|
62
|
-
@change-template="onChangeTemplate"
|
63
|
-
@change-name="onChangeName(...$event)"
|
64
|
-
@change-storage="onChangeStorage"
|
65
|
-
@change-select-options="onChangeSelectOptions"
|
66
|
-
@change-compatibility="onChangeCompatibility"
|
67
|
-
@change-boot-order="onChangeBootOrder"
|
68
|
-
@change-customize-hardware="onChangeCustomizeHardware"
|
69
|
-
@clear-compute-resource-tree="emits('clear-compute-resource-tree')"
|
70
|
-
@change-compute-resource="onChangeComputeResource"
|
71
|
-
@select-compute-resource-tree="onSelectComputeResourceTree"
|
72
|
-
@get-compute-resource-tree="emits('get-compute-resource-tree', $event)"
|
73
|
-
@show-compute-resource-tree="emits('show-compute-resource-tree', $event)"
|
74
|
-
@finish="onFinish"
|
75
|
-
@hide="onHideModal"
|
76
|
-
/>
|
77
|
-
<common-vm-actions-add-old
|
78
|
-
v-else
|
79
|
-
v-model:vm-form="vmForm"
|
80
|
-
v-model:selected-create-type="selectedCreateType"
|
81
|
-
v-model:is-power-on-by-default="isPowerOnByDefault"
|
82
|
-
:project="props.project"
|
83
|
-
:is-vmt="props.isVmt"
|
84
|
-
:nodes="props.nodes"
|
85
|
-
:files="props.files"
|
86
|
-
:networks-table="props.networksTable"
|
87
|
-
:datastore="props.datastore"
|
88
|
-
:is-datastore-loading="props.isDatastoreLoading"
|
89
|
-
:error-validation-fields="props.errorValidationFields"
|
90
|
-
:ready-complete-table-info="props.readyCompleteTableInfo"
|
91
|
-
:vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
|
92
|
-
:import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
|
93
|
-
:get-datastore-table-func="props.getDatastoreTableFunc"
|
94
|
-
:passthrough-devices="props.passthroughDevices"
|
95
|
-
:mediated-devices="props.mediatedDevices"
|
96
|
-
:templates-tree="props.templatesTree"
|
97
|
-
:wizard="wizard"
|
98
|
-
:selected-scheme="selectedScheme"
|
99
|
-
:template-submit="templateSubmit"
|
100
|
-
:name-form-submit="nameFormSubmit"
|
101
|
-
:storage-submit="storageSubmit"
|
102
|
-
:customize-hardware-submit="customizeHardwareSubmit"
|
103
|
-
:customize-hardware-for-template-submit="customizeHardwareForTemplateSubmit"
|
104
|
-
:is-sphere="isSphere"
|
105
|
-
:compatibility="compatibility"
|
106
|
-
:guestOsFamilies="guestOsFamilies"
|
107
|
-
:guestOsVersions="guestOsVersions"
|
108
|
-
:machineTypes="machineTypes"
|
109
|
-
:virtual-hardware-hard-disks-local="virtualHardwareHardDisksLocal"
|
110
|
-
:virtual-hardware-cd-dvd-drives-local="virtualHardwareCdDvdDrivesLocal"
|
111
|
-
:virtual-hardware-networks-local="virtualHardwareNetworksLocal"
|
112
|
-
:max-cpus="maxCpus"
|
113
|
-
:max-memory="maxMemory"
|
114
|
-
:cpu-models="cpuModels"
|
115
|
-
:selected-nav-item="selectedNavItem"
|
116
|
-
:compatibility-info="compatibilityInfo"
|
117
|
-
:is-show-power-on="isShowPowerOn"
|
118
|
-
:compute-resource-submit="computeResourceSubmit"
|
119
|
-
:data-center="props.dataCenter"
|
120
|
-
:compute-resource="props.computeResource"
|
121
|
-
:compute-resource-tree="props.computeResourceTree"
|
122
|
-
:vmt-settings="props.vmtSettings"
|
123
|
-
:is-loading="isLoading"
|
124
|
-
:validate-empty-name="props.validateEmptyName"
|
125
|
-
:title="title"
|
126
|
-
@check-name="emits('check-name', $event)"
|
127
|
-
@get-storage="emits('get-storage', $event)"
|
128
|
-
@get-folders-or-files="emits('get-folders-or-files', $event)"
|
129
|
-
@get-active-device-child="emits('get-active-device-child', $event)"
|
130
|
-
@show-datastore-child="emits('show-datastore-child', $event)"
|
131
|
-
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
132
|
-
@get-networks-table="emits('get-networks-table', $event)"
|
133
|
-
@get-pci-devices="emits('get-pci-devices')"
|
134
|
-
@change-steps="onChangeSteps"
|
135
|
-
@change-template="onChangeTemplate"
|
136
|
-
@change-name="onChangeName(...$event)"
|
137
|
-
@change-storage="onChangeStorage"
|
138
|
-
@change-select-options="onChangeSelectOptions"
|
139
|
-
@change-compatibility="onChangeCompatibility"
|
140
|
-
@change-boot-order="onChangeBootOrder"
|
141
|
-
@change-customize-hardware="onChangeCustomizeHardware"
|
142
|
-
@clear-compute-resource-tree="emits('clear-compute-resource-tree')"
|
143
|
-
@change-compute-resource="onChangeComputeResource"
|
144
|
-
@select-compute-resource-tree="onSelectComputeResourceTree"
|
145
|
-
@get-compute-resource-tree="emits('get-compute-resource-tree', $event)"
|
146
|
-
@show-compute-resource-tree="emits('show-compute-resource-tree', $event)"
|
147
|
-
@finish="onFinish"
|
148
|
-
@hide="onHideModal"
|
149
|
-
/>
|
150
|
-
</template>
|
151
|
-
|
152
|
-
<script setup lang="ts">
|
153
|
-
import type {
|
154
|
-
UI_I_ValidationReturn,
|
155
|
-
UI_I_WizardStep,
|
156
|
-
} from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
|
157
|
-
import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
|
158
|
-
import type {
|
159
|
-
UI_I_Localization,
|
160
|
-
UI_I_ArbitraryObject,
|
161
|
-
} from '~/lib/models/interfaces'
|
162
|
-
import type { UI_T_Project } from '~/lib/models/types'
|
163
|
-
import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
|
164
|
-
import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
|
165
|
-
import type {
|
166
|
-
UI_I_DatastoreTableItem,
|
167
|
-
UI_I_FolderOrFileTreePayload,
|
168
|
-
} from '~/lib/models/store/storage/interfaces'
|
169
|
-
import type {
|
170
|
-
// API_UI_I_Error,
|
171
|
-
UI_I_ErrorValidationField,
|
172
|
-
} from '~/lib/models/store/interfaces'
|
173
|
-
import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
174
|
-
import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
|
175
|
-
import type {
|
176
|
-
UI_T_AddVmFinishFunc,
|
177
|
-
UI_T_SelectedNavItem,
|
178
|
-
} from '~/components/common/vm/actions/common/lib/models/types'
|
179
|
-
import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
|
180
|
-
import type {
|
181
|
-
UI_I_Capabilities,
|
182
|
-
UI_I_VmForm,
|
183
|
-
UI_I_VmFormCash,
|
184
|
-
} from '~/components/common/vm/actions/common/lib/models/interfaces'
|
185
|
-
import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
|
186
|
-
import type {
|
187
|
-
UI_I_SendDataCpu,
|
188
|
-
UI_I_SendDataMemory,
|
189
|
-
UI_I_SendDataNewCdDvdDrive,
|
190
|
-
UI_I_SendDataNewHardDisk,
|
191
|
-
UI_I_SendDataNewNetwork,
|
192
|
-
} from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
|
193
|
-
import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
194
|
-
import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
|
195
|
-
import type {
|
196
|
-
UI_I_MediatedDevice,
|
197
|
-
UI_I_PciDevice,
|
198
|
-
UI_I_VmSettings,
|
199
|
-
} from '~/lib/models/store/vm/interfaces'
|
200
|
-
import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
|
201
|
-
import {
|
202
|
-
stepsSchemeInitial,
|
203
|
-
stepsFunc,
|
204
|
-
dynamicSteps,
|
205
|
-
} from '~/components/common/vm/actions/add/lib/config/steps'
|
206
|
-
import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
|
207
|
-
|
208
|
-
const props = withDefaults(
|
209
|
-
defineProps<{
|
210
|
-
project: UI_T_Project
|
211
|
-
nodes: UI_I_FileTreeNode[]
|
212
|
-
files: UI_I_FileTreeNode[]
|
213
|
-
networksTable: UI_I_NetworkTableItem[]
|
214
|
-
datastore: UI_I_DatastoreTableItem[]
|
215
|
-
isDatastoreLoading: boolean
|
216
|
-
errorValidationFields: UI_I_ErrorValidationField[]
|
217
|
-
readyCompleteTableInfo: UI_I_TableInfoItem[]
|
218
|
-
vmCpuHelpTextSecond: string
|
219
|
-
importFromVMWarevSphere: string
|
220
|
-
finishFunc: UI_T_AddVmFinishFunc
|
221
|
-
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
222
|
-
validateSendDataFunc: UI_T_AddVmFinishFunc<
|
223
|
-
[UI_T_SelectedNavItem, null | number] | null
|
224
|
-
>
|
225
|
-
passthroughDevices: UI_I_PciDevice[]
|
226
|
-
mediatedDevices: UI_I_MediatedDevice[]
|
227
|
-
vmNameInWizard: string
|
228
|
-
templatesTree?: UI_I_TreeNode[]
|
229
|
-
capabilities?: UI_I_Capabilities
|
230
|
-
vmtSettings?: UI_I_VmSettings | null
|
231
|
-
validateEmptyName?: boolean
|
232
|
-
dataCenter?: UI_I_TreeNode // для сферы
|
233
|
-
computeResource?: UI_I_TreeNode // для сферы
|
234
|
-
computeResourceTree?: UI_I_TreeNode[] // для сферы
|
235
|
-
selectedTemplateId?: string // для сферы
|
236
|
-
isVmt?: boolean // для сферы
|
237
|
-
}>(),
|
238
|
-
{
|
239
|
-
templatesTree: [],
|
240
|
-
capabilities: undefined,
|
241
|
-
vmtSettings: undefined,
|
242
|
-
validateEmptyName: false,
|
243
|
-
dataCenter: undefined,
|
244
|
-
computeResource: undefined,
|
245
|
-
computeResourceTree: undefined,
|
246
|
-
selectedTemplateId: '',
|
247
|
-
isVmt: false,
|
248
|
-
}
|
249
|
-
)
|
250
|
-
|
251
|
-
const emits = defineEmits<{
|
252
|
-
(
|
253
|
-
event: 'check-name',
|
254
|
-
value: [[string, UI_I_TreeNode | null], (error: any) => void]
|
255
|
-
): void
|
256
|
-
(event: 'get-storage', value: UI_I_TablePayload): void
|
257
|
-
(event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
|
258
|
-
(event: 'get-active-device-child', value: UI_I_FileTreeNode): void
|
259
|
-
(event: 'show-datastore-child', value: UI_I_FileTreeNode): void
|
260
|
-
(event: 'remove-error-by-title', value: string): void
|
261
|
-
(event: 'get-networks-table', value: UI_I_TablePayload): void
|
262
|
-
(event: 'get-pci-devices'): void
|
263
|
-
(event: 'get-pci-devices'): void
|
264
|
-
(event: 'hide'): void
|
265
|
-
(event: 'select-template', value: string): void
|
266
|
-
(
|
267
|
-
event: 'get-compute-resource-tree',
|
268
|
-
value: { id: string | number; cb: () => void }
|
269
|
-
): void // для сферы
|
270
|
-
(event: 'show-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
|
271
|
-
(event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
|
272
|
-
(event: 'clear-compute-resource-tree'): void // для сферы
|
273
|
-
}>()
|
274
|
-
|
275
|
-
const { $store, $recursion }: any = useNuxtApp()
|
276
|
-
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
277
|
-
|
278
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
279
|
-
|
280
|
-
const isSphere = computed<boolean>(() => props.project === 'sphere')
|
281
|
-
|
282
|
-
const title = computed<string>(() =>
|
283
|
-
props.isVmt
|
284
|
-
? localization.value.vmt.newTemplate
|
285
|
-
: localization.value.common.newVirtualMachine2
|
286
|
-
)
|
287
|
-
|
288
|
-
watch(
|
289
|
-
() => props.capabilities,
|
290
|
-
() => {
|
291
|
-
if (props.capabilities) mapCapabilities(props.capabilities)
|
292
|
-
},
|
293
|
-
{ deep: true, immediate: true }
|
294
|
-
)
|
295
|
-
|
296
|
-
const selectedCreateType = ref<string>('0')
|
297
|
-
if (props.isVmt) selectedCreateType.value = '-1'
|
298
|
-
|
299
|
-
const wizard: Wizard = new Wizard(
|
300
|
-
stepsFunc(localization.value, props.isVmt),
|
301
|
-
stepsSchemeInitial
|
302
|
-
)
|
303
|
-
watch(
|
304
|
-
selectedCreateType,
|
305
|
-
(newValue) => {
|
306
|
-
switch (newValue) {
|
307
|
-
case '0':
|
308
|
-
wizard.changeScheme(isSphere.value ? 1 : 0)
|
309
|
-
break
|
310
|
-
case '1':
|
311
|
-
wizard.changeScheme(isSphere.value ? 6 : 2)
|
312
|
-
break
|
313
|
-
case '-1':
|
314
|
-
wizard.changeScheme(10)
|
315
|
-
break
|
316
|
-
}
|
317
|
-
},
|
318
|
-
{ immediate: true }
|
319
|
-
)
|
320
|
-
|
321
|
-
// if (isSphere.value) wizard.changeScheme(1)
|
322
|
-
const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
|
323
|
-
// const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
|
324
|
-
|
325
|
-
const isShowSelectTemplate = computed<boolean>(
|
326
|
-
() =>
|
327
|
-
wizard.selectedStepId === dynamicSteps.selectTemplate &&
|
328
|
-
selectedCreateType.value === '1'
|
329
|
-
)
|
330
|
-
|
331
|
-
const isShowPowerOn = computed<boolean>(
|
332
|
-
() =>
|
333
|
-
wizard.selectedStepId > dynamicSteps.customizeHardware &&
|
334
|
-
selectedCreateType.value !== '1' &&
|
335
|
-
!props.isVmt
|
336
|
-
)
|
337
|
-
|
338
|
-
const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
|
339
|
-
wizard.changeSteps(value, validationFunc, validateSendData)
|
340
|
-
}
|
341
|
-
const validationFunc = async (
|
342
|
-
value: UI_I_WizardStep[],
|
343
|
-
currentStep: UI_I_WizardStep,
|
344
|
-
nextStep: UI_I_WizardStep
|
345
|
-
): Promise<UI_I_ValidationReturn> => {
|
346
|
-
let stepHasError = false
|
347
|
-
let stepShouldStop = {
|
348
|
-
ifOnCurrentStep: false,
|
349
|
-
ifFromAnyStep: false,
|
350
|
-
stoppageStepId: -1,
|
351
|
-
}
|
352
|
-
|
353
|
-
wizard.setLoader(true)
|
354
|
-
if (
|
355
|
-
wizard.isValidateForStep(
|
356
|
-
dynamicSteps.selectTemplate,
|
357
|
-
currentStep.id,
|
358
|
-
nextStep.id
|
359
|
-
)
|
360
|
-
) {
|
361
|
-
const templateValidation = await checkTemplate(value)
|
362
|
-
|
363
|
-
value = templateValidation.newValue
|
364
|
-
stepHasError = stepHasError || templateValidation.stepHasError
|
365
|
-
} else if (
|
366
|
-
wizard.isValidateForStep(
|
367
|
-
isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
|
368
|
-
currentStep.id,
|
369
|
-
nextStep.id
|
370
|
-
)
|
371
|
-
) {
|
372
|
-
const nameValidation = await onCheckName(value)
|
373
|
-
|
374
|
-
value = nameValidation.newValue
|
375
|
-
stepHasError = stepHasError || nameValidation.stepHasError
|
376
|
-
} else if (
|
377
|
-
isSphere.value &&
|
378
|
-
wizard.isValidateForStep(
|
379
|
-
dynamicSteps.selectComputeResource,
|
380
|
-
currentStep.id,
|
381
|
-
nextStep.id
|
382
|
-
)
|
383
|
-
) {
|
384
|
-
const computeResourceValidation = await checkComputeResource(value)
|
385
|
-
|
386
|
-
value = computeResourceValidation.newValue
|
387
|
-
stepHasError = stepHasError || computeResourceValidation.stepHasError
|
388
|
-
} else if (
|
389
|
-
wizard.isValidateForStep(
|
390
|
-
dynamicSteps.selectStorage,
|
391
|
-
currentStep.id,
|
392
|
-
nextStep.id
|
393
|
-
)
|
394
|
-
) {
|
395
|
-
const storageValidation = await checkStorage(value)
|
396
|
-
|
397
|
-
value = storageValidation.newValue
|
398
|
-
|
399
|
-
stepHasError = stepHasError || storageValidation.stepHasError
|
400
|
-
} else if (
|
401
|
-
wizard.isValidateForStep(
|
402
|
-
dynamicSteps.customizeHardware,
|
403
|
-
currentStep.id,
|
404
|
-
nextStep.id
|
405
|
-
)
|
406
|
-
) {
|
407
|
-
const validation = await checkCustomizeHardware(value)
|
408
|
-
|
409
|
-
value = validation.newValue
|
410
|
-
|
411
|
-
stepHasError = stepHasError || validation.stepHasError
|
412
|
-
} else if (
|
413
|
-
wizard.isValidateForStep(
|
414
|
-
dynamicSteps.customizeHardwareTemplate,
|
415
|
-
currentStep.id,
|
416
|
-
nextStep.id
|
417
|
-
)
|
418
|
-
) {
|
419
|
-
const validation = await checkCustomizeHardwareForTemplate(value)
|
420
|
-
|
421
|
-
value = validation.newValue
|
422
|
-
|
423
|
-
stepHasError = stepHasError || validation.stepHasError
|
424
|
-
}
|
425
|
-
wizard.setLoader(false)
|
426
|
-
|
427
|
-
return {
|
428
|
-
newValue: value,
|
429
|
-
stepHasError,
|
430
|
-
stepShouldStop,
|
431
|
-
}
|
432
|
-
}
|
433
|
-
|
434
|
-
const checkTemplate = async (
|
435
|
-
value: UI_I_WizardStep[]
|
436
|
-
): Promise<UI_I_ValidationReturn> => {
|
437
|
-
let stepHasError = false
|
438
|
-
|
439
|
-
return new Promise((resolve) => {
|
440
|
-
templateSubmit.value = (isValid: boolean) => {
|
441
|
-
if (!isValid) {
|
442
|
-
stepHasError = wizard.setValidation(
|
443
|
-
dynamicSteps.selectTemplate,
|
444
|
-
'template',
|
445
|
-
{
|
446
|
-
fieldMessage: 'aaa',
|
447
|
-
alertMessage: 'aaa',
|
448
|
-
}
|
449
|
-
)
|
450
|
-
} else if (wizard.hasMessage(dynamicSteps.selectTemplate, 'template')) {
|
451
|
-
value = wizard.removeValidation(
|
452
|
-
dynamicSteps.selectTemplate,
|
453
|
-
'template',
|
454
|
-
value
|
455
|
-
)
|
456
|
-
}
|
457
|
-
|
458
|
-
resolve({
|
459
|
-
stepHasError,
|
460
|
-
newValue: value,
|
461
|
-
})
|
462
|
-
templateSubmit.value = null
|
463
|
-
}
|
464
|
-
})
|
465
|
-
}
|
466
|
-
const onCheckName = async (
|
467
|
-
value: UI_I_WizardStep[]
|
468
|
-
): Promise<UI_I_ValidationReturn> => {
|
469
|
-
let stepHasError = false
|
470
|
-
|
471
|
-
return new Promise((resolve) => {
|
472
|
-
const step = isSphere.value
|
473
|
-
? dynamicSteps.selectNameFolder
|
474
|
-
: dynamicSteps.selectName
|
475
|
-
nameFormSubmit.value = (isValid: boolean) => {
|
476
|
-
if (!isValid) {
|
477
|
-
stepHasError = wizard.setValidation(step, 'name', {
|
478
|
-
fieldMessage: 'aaa',
|
479
|
-
alertMessage: 'aaa',
|
480
|
-
})
|
481
|
-
} else if (wizard.hasMessage(step, 'name')) {
|
482
|
-
value = wizard.removeValidation(step, 'name', value)
|
483
|
-
}
|
484
|
-
|
485
|
-
resolve({
|
486
|
-
stepHasError,
|
487
|
-
newValue: value,
|
488
|
-
})
|
489
|
-
nameFormSubmit.value = null
|
490
|
-
}
|
491
|
-
})
|
492
|
-
}
|
493
|
-
const checkComputeResource = async (
|
494
|
-
value: UI_I_WizardStep[]
|
495
|
-
): Promise<UI_I_ValidationReturn> => {
|
496
|
-
let stepHasError = false
|
497
|
-
|
498
|
-
return new Promise((resolve) => {
|
499
|
-
computeResourceSubmit.value = (isValid: boolean) => {
|
500
|
-
if (!isValid) {
|
501
|
-
stepHasError = wizard.setValidation(
|
502
|
-
dynamicSteps.selectComputeResource,
|
503
|
-
'computeResource',
|
504
|
-
{
|
505
|
-
fieldMessage: 'aaa',
|
506
|
-
alertMessage: 'aaa',
|
507
|
-
}
|
508
|
-
)
|
509
|
-
} else if (
|
510
|
-
wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
|
511
|
-
) {
|
512
|
-
value = wizard.removeValidation(
|
513
|
-
dynamicSteps.selectComputeResource,
|
514
|
-
'computeResource',
|
515
|
-
value
|
516
|
-
)
|
517
|
-
}
|
518
|
-
|
519
|
-
resolve({
|
520
|
-
stepHasError,
|
521
|
-
newValue: value,
|
522
|
-
})
|
523
|
-
computeResourceSubmit.value = null
|
524
|
-
}
|
525
|
-
})
|
526
|
-
}
|
527
|
-
const checkStorage = async (
|
528
|
-
value: UI_I_WizardStep[]
|
529
|
-
): Promise<UI_I_ValidationReturn> => {
|
530
|
-
let stepHasError = false
|
531
|
-
|
532
|
-
return new Promise((resolve) => {
|
533
|
-
storageSubmit.value = (isValid: boolean) => {
|
534
|
-
if (!isValid) {
|
535
|
-
stepHasError = wizard.setValidation(
|
536
|
-
dynamicSteps.selectStorage,
|
537
|
-
'storage',
|
538
|
-
{
|
539
|
-
fieldMessage: 'aaa',
|
540
|
-
alertMessage: 'aaa',
|
541
|
-
}
|
542
|
-
)
|
543
|
-
} else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
|
544
|
-
value = wizard.removeValidation(
|
545
|
-
dynamicSteps.selectStorage,
|
546
|
-
'storage',
|
547
|
-
value
|
548
|
-
)
|
549
|
-
}
|
550
|
-
|
551
|
-
resolve({
|
552
|
-
stepHasError,
|
553
|
-
newValue: value,
|
554
|
-
})
|
555
|
-
storageSubmit.value = null
|
556
|
-
}
|
557
|
-
})
|
558
|
-
}
|
559
|
-
const checkCustomizeHardware = async (
|
560
|
-
value: UI_I_WizardStep[]
|
561
|
-
): Promise<UI_I_ValidationReturn> => {
|
562
|
-
let stepHasError = false
|
563
|
-
isLoading.value = true
|
564
|
-
|
565
|
-
return new Promise((resolve) => {
|
566
|
-
customizeHardwareSubmit.value = (isValid: boolean) => {
|
567
|
-
if (!isValid) {
|
568
|
-
stepHasError = wizard.setValidation(
|
569
|
-
dynamicSteps.customizeHardware,
|
570
|
-
'customizeHardware',
|
571
|
-
{
|
572
|
-
fieldMessage: 'aaa',
|
573
|
-
alertMessage: 'aaa',
|
574
|
-
}
|
575
|
-
)
|
576
|
-
} else if (
|
577
|
-
wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
|
578
|
-
) {
|
579
|
-
wizard.removeValidationLocal(
|
580
|
-
dynamicSteps.customizeHardware,
|
581
|
-
'customizeHardware'
|
582
|
-
)
|
583
|
-
value = wizard.removeValidation(
|
584
|
-
dynamicSteps.customizeHardware,
|
585
|
-
'customizeHardware',
|
586
|
-
value
|
587
|
-
)
|
588
|
-
}
|
589
|
-
|
590
|
-
resolve({
|
591
|
-
stepHasError,
|
592
|
-
newValue: value,
|
593
|
-
})
|
594
|
-
storageSubmit.value = null
|
595
|
-
isLoading.value = false
|
596
|
-
}
|
597
|
-
})
|
598
|
-
}
|
599
|
-
const checkCustomizeHardwareForTemplate = async (
|
600
|
-
value: UI_I_WizardStep[]
|
601
|
-
): Promise<UI_I_ValidationReturn> => {
|
602
|
-
let stepHasError = false
|
603
|
-
|
604
|
-
return new Promise((resolve) => {
|
605
|
-
customizeHardwareForTemplateSubmit.value = (isValid: boolean) => {
|
606
|
-
if (!isValid) {
|
607
|
-
stepHasError = wizard.setValidation(
|
608
|
-
dynamicSteps.customizeHardwareTemplate,
|
609
|
-
'customizeHardwareForTemplate',
|
610
|
-
{
|
611
|
-
fieldMessage: 'aaa',
|
612
|
-
alertMessage: 'aaa',
|
613
|
-
}
|
614
|
-
)
|
615
|
-
} else if (
|
616
|
-
wizard.hasMessage(
|
617
|
-
dynamicSteps.customizeHardwareTemplate,
|
618
|
-
'customizeHardwareForTemplate'
|
619
|
-
)
|
620
|
-
) {
|
621
|
-
value = wizard.removeValidation(
|
622
|
-
dynamicSteps.customizeHardwareTemplate,
|
623
|
-
'customizeHardwareForTemplate',
|
624
|
-
value
|
625
|
-
)
|
626
|
-
}
|
627
|
-
|
628
|
-
resolve({
|
629
|
-
stepHasError,
|
630
|
-
newValue: value,
|
631
|
-
})
|
632
|
-
storageSubmit.value = null
|
633
|
-
}
|
634
|
-
})
|
635
|
-
}
|
636
|
-
|
637
|
-
const storageIdCash = ref<string | null>(null)
|
638
|
-
const vmForm = ref<UI_I_VmForm>({
|
639
|
-
name: '',
|
640
|
-
compatibility: '',
|
641
|
-
guestMachineType: null,
|
642
|
-
guestOsFamily: null,
|
643
|
-
guestOsVersion: null,
|
644
|
-
computeResource: null,
|
645
|
-
storage: null,
|
646
|
-
locationPath: '',
|
647
|
-
dataCenter: null,
|
648
|
-
})
|
649
|
-
|
650
|
-
// TODO remove (not used)
|
651
|
-
const vmFormCash = ref<UI_I_VmFormCash>({
|
652
|
-
dataCenterId: null,
|
653
|
-
computeResourceTypeAndId: null,
|
654
|
-
})
|
655
|
-
|
656
|
-
const onChangeName = (name: string, node: UI_I_TreeNode | null): void => {
|
657
|
-
vmForm.value.name = name
|
658
|
-
if (isSphere.value) {
|
659
|
-
vmForm.value.locationPath = node.id
|
660
|
-
vmForm.value.dataCenter = $recursion.findParentByValue(
|
661
|
-
node,
|
662
|
-
'datacenter',
|
663
|
-
'type',
|
664
|
-
'parent'
|
665
|
-
)
|
666
|
-
vmFormCash.value.dataCenterId = vmForm.value.dataCenter?.id || null
|
667
|
-
}
|
668
|
-
}
|
669
|
-
// // Для сферы
|
670
|
-
const computeResourcePath = ref<string>('')
|
671
|
-
const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
|
672
|
-
emits('select-compute-resource-tree', node)
|
673
|
-
computeResourcePath.value = node.id
|
674
|
-
}
|
675
|
-
const onChangeComputeResource = (node: UI_I_TreeNode): void => {
|
676
|
-
vmForm.value.computeResource = node
|
677
|
-
// const type = node.type.toUpperCase()
|
678
|
-
// schedRequirementsTemplate.value = `sched_requirements="(${type}_ID=${node.id})"\\`
|
679
|
-
vmFormCash.value.computeResourceTypeAndId = `${node.type}${node.id}` || null
|
680
|
-
}
|
681
|
-
const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
|
682
|
-
if (!storage) return
|
683
|
-
|
684
|
-
vmForm.value.storage = storage
|
685
|
-
storageIdCash.value = storage.id
|
686
|
-
}
|
687
|
-
const compatibilityInfo = ref<string>('')
|
688
|
-
const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
|
689
|
-
vmForm.value.compatibility = compatibility.value
|
690
|
-
|
691
|
-
const version = compatibility.value.split('-')[1]
|
692
|
-
compatibilityInfo.value = `${localization.value.common.compatibility}: ${compatibility.text} (${localization.value.common.vmVersion} ${version})`
|
693
|
-
}
|
694
|
-
const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
|
695
|
-
const onChangeCustomizeHardware = (
|
696
|
-
data: UI_I_SendDataCustomizeHardware
|
697
|
-
): void => {
|
698
|
-
customizeHardware.value = data
|
699
|
-
}
|
700
|
-
|
701
|
-
const virtualHardwareHardDisksLocal = computed<
|
702
|
-
UI_I_SendDataNewHardDisk[] | null
|
703
|
-
>(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
|
704
|
-
const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
|
705
|
-
() => customizeHardware.value?.virtualHardware?.networks || null
|
706
|
-
)
|
707
|
-
const virtualHardwareCdDvdDrivesLocal = computed<
|
708
|
-
UI_I_SendDataNewCdDvdDrive[] | null
|
709
|
-
>(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
|
710
|
-
|
711
|
-
const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
|
712
|
-
() => customizeHardware.value?.virtualHardware?.cpu || null
|
713
|
-
)
|
714
|
-
const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
|
715
|
-
() => customizeHardware.value?.virtualHardware?.memory || null
|
716
|
-
)
|
717
|
-
const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
|
718
|
-
const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
|
719
|
-
null
|
720
|
-
)
|
721
|
-
const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
|
722
|
-
const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
|
723
|
-
virtualHardwareHardDisks.value = data[0]
|
724
|
-
virtualHardwareCdDvdDrives.value = data[1]
|
725
|
-
virtualHardwareNetworks.value = data[2]
|
726
|
-
}
|
727
|
-
|
728
|
-
const isPowerOnByDefault = ref<boolean>(true)
|
729
|
-
|
730
|
-
watch(
|
731
|
-
() => props.vmNameInWizard,
|
732
|
-
(newValue) => {
|
733
|
-
vmForm.value.name = newValue
|
734
|
-
}
|
735
|
-
)
|
736
|
-
|
737
|
-
const validateSendData = async (
|
738
|
-
value: UI_I_WizardStep[]
|
739
|
-
): Promise<UI_I_ValidationReturn> => {
|
740
|
-
wizard.setLoader(true)
|
741
|
-
let stepHasError = false
|
742
|
-
isLoading.value = true
|
743
|
-
|
744
|
-
const data = await props.validateSendDataFunc(
|
745
|
-
vmForm.value,
|
746
|
-
virtualHardwareCpu.value,
|
747
|
-
virtualHardwareMemory.value,
|
748
|
-
customizeHardware.value,
|
749
|
-
virtualHardwareNetworks.value,
|
750
|
-
virtualHardwareHardDisks.value,
|
751
|
-
virtualHardwareCdDvdDrives.value,
|
752
|
-
isPowerOnByDefault.value,
|
753
|
-
localization.value,
|
754
|
-
vmForm.value.locationPath, // для сферы
|
755
|
-
computeResourcePath.value // для сферы
|
756
|
-
)
|
757
|
-
|
758
|
-
isLoading.value = false
|
759
|
-
wizard.setLoader(false)
|
760
|
-
if (data) {
|
761
|
-
stepHasError = true
|
762
|
-
selectedNavItem.value = data[0]
|
763
|
-
data[1] !== null && wizard.selectStepHard(data[1])
|
764
|
-
}
|
765
|
-
|
766
|
-
return {
|
767
|
-
stepHasError,
|
768
|
-
newValue: value,
|
769
|
-
}
|
770
|
-
}
|
771
|
-
|
772
|
-
const isLoading = ref<boolean>(false)
|
773
|
-
const onFinish = (): void => {
|
774
|
-
isLoading.value = true
|
775
|
-
wizard.setLoader(false)
|
776
|
-
props
|
777
|
-
.finishFunc(
|
778
|
-
vmForm.value,
|
779
|
-
virtualHardwareCpu.value,
|
780
|
-
virtualHardwareMemory.value,
|
781
|
-
customizeHardware.value,
|
782
|
-
virtualHardwareNetworks.value,
|
783
|
-
virtualHardwareHardDisks.value,
|
784
|
-
virtualHardwareCdDvdDrives.value,
|
785
|
-
isPowerOnByDefault.value,
|
786
|
-
localization.value,
|
787
|
-
vmForm.value.locationPath, // для сферы
|
788
|
-
computeResourcePath.value, // для сферы
|
789
|
-
false,
|
790
|
-
selectedTemplate.value,
|
791
|
-
selectedCreateType.value
|
792
|
-
)
|
793
|
-
.then(() => {
|
794
|
-
onHideModal()
|
795
|
-
wizard.setLoader(false)
|
796
|
-
isLoading.value = false
|
797
|
-
})
|
798
|
-
}
|
799
|
-
|
800
|
-
const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
|
801
|
-
|
802
|
-
const nameFormSubmit = ref<null | Function>(null)
|
803
|
-
const templateSubmit = ref<null | Function>(null)
|
804
|
-
const computeResourceSubmit = ref<null | Function>(null)
|
805
|
-
const storageSubmit = ref<null | Function>(null)
|
806
|
-
const customizeHardwareSubmit = ref<null | Function>(null)
|
807
|
-
const customizeHardwareForTemplateSubmit = ref<null | Function>(null)
|
808
|
-
const compatibility = ref<UI_I_OptionItem[]>(capabilities.value.compatibility)
|
809
|
-
const guestOsFamilies = ref<UI_I_OptionItem[]>(
|
810
|
-
capabilities.value.guestOsFamilies
|
811
|
-
)
|
812
|
-
const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
|
813
|
-
capabilities.value.guestOsVersions
|
814
|
-
)
|
815
|
-
const machineTypes = ref<UI_I_OptionItem[]>(capabilities.value.machineTypes)
|
816
|
-
const cpuModels = ref<UI_I_OptionItem[]>(capabilities.value.cpuModels)
|
817
|
-
const maxCpus = ref<number>(capabilities.value.maxCpus)
|
818
|
-
const maxMemory = ref<number>(capabilities.value.maxMemory)
|
819
|
-
|
820
|
-
const selectedTemplate = ref<string>('')
|
821
|
-
const onChangeTemplate = (node: UI_I_TreeNode): void => {
|
822
|
-
selectedTemplate.value = node.id.toString()
|
823
|
-
emits('select-template', node.id.toString())
|
824
|
-
}
|
825
|
-
const selectedOptions = ref<string[]>([])
|
826
|
-
const onChangeSelectOptions = (options: string[]) => {
|
827
|
-
selectedOptions.value = options
|
828
|
-
if (
|
829
|
-
options.includes('customize-os') &&
|
830
|
-
options.includes('customize-hardware')
|
831
|
-
) {
|
832
|
-
wizard.changeScheme(isSphere.value ? 9 : 5)
|
833
|
-
} else if (options.includes('customize-os')) {
|
834
|
-
wizard.changeScheme(isSphere.value ? 7 : 3)
|
835
|
-
} else if (options.includes('customize-hardware')) {
|
836
|
-
wizard.changeScheme(isSphere.value ? 8 : 4)
|
837
|
-
} else {
|
838
|
-
wizard.changeScheme(isSphere.value ? 6 : 2)
|
839
|
-
}
|
840
|
-
|
841
|
-
isPowerOnByDefault.value = options.includes('power-on')
|
842
|
-
}
|
843
|
-
|
844
|
-
const onHideModal = (): void => {
|
845
|
-
emits('hide')
|
846
|
-
}
|
847
|
-
|
848
|
-
watch(
|
849
|
-
() => props.vmtSettings,
|
850
|
-
(newValue) => {
|
851
|
-
if (newValue) {
|
852
|
-
vmForm.value.name = newValue.name
|
853
|
-
vmForm.value.compatibility =
|
854
|
-
newValue.compatibility || vmForm.value.compatibility
|
855
|
-
vmForm.value.storage = newValue.storage
|
856
|
-
if (customizeHardware.value?.virtualHardware) {
|
857
|
-
customizeHardware.value.virtualHardware.cdDvdDrives =
|
858
|
-
newValue.cdDvdDrives
|
859
|
-
customizeHardware.value.virtualHardware.hardDisks = newValue.hardDisks
|
860
|
-
customizeHardware.value.virtualHardware.networks = newValue.networks
|
861
|
-
customizeHardware.value.virtualHardware.cpu = newValue.cpu
|
862
|
-
customizeHardware.value.virtualHardware.memory = newValue.memory
|
863
|
-
customizeHardware.value.virtualHardware.videoCard = newValue.videoCard
|
864
|
-
customizeHardware.value.virtualHardware.usbController =
|
865
|
-
newValue.usbController
|
866
|
-
customizeHardware.value.virtualHardware.pciDevices = newValue.pciDevices
|
867
|
-
customizeHardware.value.vmOptions = newValue.options
|
868
|
-
}
|
869
|
-
maxCpus.value = newValue.cpu.max_vcpus
|
870
|
-
cpuModels.value = newValue.cpu.model
|
871
|
-
isPowerOnByDefault.value = false
|
872
|
-
}
|
873
|
-
}
|
874
|
-
)
|
875
|
-
</script>
|
876
|
-
|
877
|
-
<style scoped lang="scss"></style>
|
1
|
+
<template>
|
2
|
+
<common-vm-actions-add-new
|
3
|
+
v-if="isNewView"
|
4
|
+
v-model:vm-form="vmForm"
|
5
|
+
v-model:selected-create-type="selectedCreateType"
|
6
|
+
v-model:is-power-on-by-default="isPowerOnByDefault"
|
7
|
+
:project="props.project"
|
8
|
+
:is-vmt="props.isVmt"
|
9
|
+
:nodes="props.nodes"
|
10
|
+
:files="props.files"
|
11
|
+
:networks-table="props.networksTable"
|
12
|
+
:datastore="props.datastore"
|
13
|
+
:is-datastore-loading="props.isDatastoreLoading"
|
14
|
+
:error-validation-fields="props.errorValidationFields"
|
15
|
+
:ready-complete-table-info="props.readyCompleteTableInfo"
|
16
|
+
:vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
|
17
|
+
:import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
|
18
|
+
:get-datastore-table-func="props.getDatastoreTableFunc"
|
19
|
+
:passthrough-devices="props.passthroughDevices"
|
20
|
+
:mediated-devices="props.mediatedDevices"
|
21
|
+
:templates-tree="props.templatesTree"
|
22
|
+
:wizard="wizard"
|
23
|
+
:selected-scheme="selectedScheme"
|
24
|
+
:template-submit="templateSubmit"
|
25
|
+
:name-form-submit="nameFormSubmit"
|
26
|
+
:storage-submit="storageSubmit"
|
27
|
+
:customize-hardware-submit="customizeHardwareSubmit"
|
28
|
+
:customize-hardware-for-template-submit="customizeHardwareForTemplateSubmit"
|
29
|
+
:is-sphere="isSphere"
|
30
|
+
:compatibility="compatibility"
|
31
|
+
:guestOsFamilies="guestOsFamilies"
|
32
|
+
:guestOsVersions="guestOsVersions"
|
33
|
+
:machineTypes="machineTypes"
|
34
|
+
:virtual-hardware-hard-disks-local="virtualHardwareHardDisksLocal"
|
35
|
+
:virtual-hardware-cd-dvd-drives-local="virtualHardwareCdDvdDrivesLocal"
|
36
|
+
:virtual-hardware-networks-local="virtualHardwareNetworksLocal"
|
37
|
+
:max-cpus="maxCpus"
|
38
|
+
:max-memory="maxMemory"
|
39
|
+
:cpu-models="cpuModels"
|
40
|
+
:selected-nav-item="selectedNavItem"
|
41
|
+
:compatibility-info="compatibilityInfo"
|
42
|
+
:is-show-power-on="isShowPowerOn"
|
43
|
+
:is-show-select-template="isShowSelectTemplate"
|
44
|
+
:compute-resource-submit="computeResourceSubmit"
|
45
|
+
:data-center="props.dataCenter"
|
46
|
+
:compute-resource="props.computeResource"
|
47
|
+
:compute-resource-tree="props.computeResourceTree"
|
48
|
+
:vmt-settings="props.vmtSettings"
|
49
|
+
:is-loading="isLoading"
|
50
|
+
:selected-template-id="props.selectedTemplateId"
|
51
|
+
:validate-empty-name="props.validateEmptyName"
|
52
|
+
:title="title"
|
53
|
+
@check-name="emits('check-name', $event)"
|
54
|
+
@get-storage="emits('get-storage', $event)"
|
55
|
+
@get-folders-or-files="emits('get-folders-or-files', $event)"
|
56
|
+
@get-active-device-child="emits('get-active-device-child', $event)"
|
57
|
+
@show-datastore-child="emits('show-datastore-child', $event)"
|
58
|
+
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
59
|
+
@get-networks-table="emits('get-networks-table', $event)"
|
60
|
+
@get-pci-devices="emits('get-pci-devices')"
|
61
|
+
@change-steps="onChangeSteps"
|
62
|
+
@change-template="onChangeTemplate"
|
63
|
+
@change-name="onChangeName(...$event)"
|
64
|
+
@change-storage="onChangeStorage"
|
65
|
+
@change-select-options="onChangeSelectOptions"
|
66
|
+
@change-compatibility="onChangeCompatibility"
|
67
|
+
@change-boot-order="onChangeBootOrder"
|
68
|
+
@change-customize-hardware="onChangeCustomizeHardware"
|
69
|
+
@clear-compute-resource-tree="emits('clear-compute-resource-tree')"
|
70
|
+
@change-compute-resource="onChangeComputeResource"
|
71
|
+
@select-compute-resource-tree="onSelectComputeResourceTree"
|
72
|
+
@get-compute-resource-tree="emits('get-compute-resource-tree', $event)"
|
73
|
+
@show-compute-resource-tree="emits('show-compute-resource-tree', $event)"
|
74
|
+
@finish="onFinish"
|
75
|
+
@hide="onHideModal"
|
76
|
+
/>
|
77
|
+
<common-vm-actions-add-old
|
78
|
+
v-else
|
79
|
+
v-model:vm-form="vmForm"
|
80
|
+
v-model:selected-create-type="selectedCreateType"
|
81
|
+
v-model:is-power-on-by-default="isPowerOnByDefault"
|
82
|
+
:project="props.project"
|
83
|
+
:is-vmt="props.isVmt"
|
84
|
+
:nodes="props.nodes"
|
85
|
+
:files="props.files"
|
86
|
+
:networks-table="props.networksTable"
|
87
|
+
:datastore="props.datastore"
|
88
|
+
:is-datastore-loading="props.isDatastoreLoading"
|
89
|
+
:error-validation-fields="props.errorValidationFields"
|
90
|
+
:ready-complete-table-info="props.readyCompleteTableInfo"
|
91
|
+
:vm-cpu-help-text-second="props.vmCpuHelpTextSecond"
|
92
|
+
:import-from-v-m-warev-sphere="props.importFromVMWarevSphere"
|
93
|
+
:get-datastore-table-func="props.getDatastoreTableFunc"
|
94
|
+
:passthrough-devices="props.passthroughDevices"
|
95
|
+
:mediated-devices="props.mediatedDevices"
|
96
|
+
:templates-tree="props.templatesTree"
|
97
|
+
:wizard="wizard"
|
98
|
+
:selected-scheme="selectedScheme"
|
99
|
+
:template-submit="templateSubmit"
|
100
|
+
:name-form-submit="nameFormSubmit"
|
101
|
+
:storage-submit="storageSubmit"
|
102
|
+
:customize-hardware-submit="customizeHardwareSubmit"
|
103
|
+
:customize-hardware-for-template-submit="customizeHardwareForTemplateSubmit"
|
104
|
+
:is-sphere="isSphere"
|
105
|
+
:compatibility="compatibility"
|
106
|
+
:guestOsFamilies="guestOsFamilies"
|
107
|
+
:guestOsVersions="guestOsVersions"
|
108
|
+
:machineTypes="machineTypes"
|
109
|
+
:virtual-hardware-hard-disks-local="virtualHardwareHardDisksLocal"
|
110
|
+
:virtual-hardware-cd-dvd-drives-local="virtualHardwareCdDvdDrivesLocal"
|
111
|
+
:virtual-hardware-networks-local="virtualHardwareNetworksLocal"
|
112
|
+
:max-cpus="maxCpus"
|
113
|
+
:max-memory="maxMemory"
|
114
|
+
:cpu-models="cpuModels"
|
115
|
+
:selected-nav-item="selectedNavItem"
|
116
|
+
:compatibility-info="compatibilityInfo"
|
117
|
+
:is-show-power-on="isShowPowerOn"
|
118
|
+
:compute-resource-submit="computeResourceSubmit"
|
119
|
+
:data-center="props.dataCenter"
|
120
|
+
:compute-resource="props.computeResource"
|
121
|
+
:compute-resource-tree="props.computeResourceTree"
|
122
|
+
:vmt-settings="props.vmtSettings"
|
123
|
+
:is-loading="isLoading"
|
124
|
+
:validate-empty-name="props.validateEmptyName"
|
125
|
+
:title="title"
|
126
|
+
@check-name="emits('check-name', $event)"
|
127
|
+
@get-storage="emits('get-storage', $event)"
|
128
|
+
@get-folders-or-files="emits('get-folders-or-files', $event)"
|
129
|
+
@get-active-device-child="emits('get-active-device-child', $event)"
|
130
|
+
@show-datastore-child="emits('show-datastore-child', $event)"
|
131
|
+
@remove-error-by-title="emits('remove-error-by-title', $event)"
|
132
|
+
@get-networks-table="emits('get-networks-table', $event)"
|
133
|
+
@get-pci-devices="emits('get-pci-devices')"
|
134
|
+
@change-steps="onChangeSteps"
|
135
|
+
@change-template="onChangeTemplate"
|
136
|
+
@change-name="onChangeName(...$event)"
|
137
|
+
@change-storage="onChangeStorage"
|
138
|
+
@change-select-options="onChangeSelectOptions"
|
139
|
+
@change-compatibility="onChangeCompatibility"
|
140
|
+
@change-boot-order="onChangeBootOrder"
|
141
|
+
@change-customize-hardware="onChangeCustomizeHardware"
|
142
|
+
@clear-compute-resource-tree="emits('clear-compute-resource-tree')"
|
143
|
+
@change-compute-resource="onChangeComputeResource"
|
144
|
+
@select-compute-resource-tree="onSelectComputeResourceTree"
|
145
|
+
@get-compute-resource-tree="emits('get-compute-resource-tree', $event)"
|
146
|
+
@show-compute-resource-tree="emits('show-compute-resource-tree', $event)"
|
147
|
+
@finish="onFinish"
|
148
|
+
@hide="onHideModal"
|
149
|
+
/>
|
150
|
+
</template>
|
151
|
+
|
152
|
+
<script setup lang="ts">
|
153
|
+
import type {
|
154
|
+
UI_I_ValidationReturn,
|
155
|
+
UI_I_WizardStep,
|
156
|
+
} from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
|
157
|
+
import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
|
158
|
+
import type {
|
159
|
+
UI_I_Localization,
|
160
|
+
UI_I_ArbitraryObject,
|
161
|
+
} from '~/lib/models/interfaces'
|
162
|
+
import type { UI_T_Project } from '~/lib/models/types'
|
163
|
+
import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
|
164
|
+
import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
|
165
|
+
import type {
|
166
|
+
UI_I_DatastoreTableItem,
|
167
|
+
UI_I_FolderOrFileTreePayload,
|
168
|
+
} from '~/lib/models/store/storage/interfaces'
|
169
|
+
import type {
|
170
|
+
// API_UI_I_Error,
|
171
|
+
UI_I_ErrorValidationField,
|
172
|
+
} from '~/lib/models/store/interfaces'
|
173
|
+
import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
174
|
+
import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
|
175
|
+
import type {
|
176
|
+
UI_T_AddVmFinishFunc,
|
177
|
+
UI_T_SelectedNavItem,
|
178
|
+
} from '~/components/common/vm/actions/common/lib/models/types'
|
179
|
+
import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
|
180
|
+
import type {
|
181
|
+
UI_I_Capabilities,
|
182
|
+
UI_I_VmForm,
|
183
|
+
UI_I_VmFormCash,
|
184
|
+
} from '~/components/common/vm/actions/common/lib/models/interfaces'
|
185
|
+
import type { UI_I_SendDataCustomizeHardware } from '~/components/common/vm/actions/common/customizeHardware/lib/models/interfaces'
|
186
|
+
import type {
|
187
|
+
UI_I_SendDataCpu,
|
188
|
+
UI_I_SendDataMemory,
|
189
|
+
UI_I_SendDataNewCdDvdDrive,
|
190
|
+
UI_I_SendDataNewHardDisk,
|
191
|
+
UI_I_SendDataNewNetwork,
|
192
|
+
} from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/lib/models/interfaces'
|
193
|
+
import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
194
|
+
import type { UI_T_ChangeBootOrder } from '~/components/common/vm/actions/lib/models/types'
|
195
|
+
import type {
|
196
|
+
UI_I_MediatedDevice,
|
197
|
+
UI_I_PciDevice,
|
198
|
+
UI_I_VmSettings,
|
199
|
+
} from '~/lib/models/store/vm/interfaces'
|
200
|
+
import { capabilities } from '~/components/common/vm/actions/common/lib/config/capabilities'
|
201
|
+
import {
|
202
|
+
stepsSchemeInitial,
|
203
|
+
stepsFunc,
|
204
|
+
dynamicSteps,
|
205
|
+
} from '~/components/common/vm/actions/add/lib/config/steps'
|
206
|
+
import { mapCapabilities } from '~/components/common/vm/actions/common/lib/utils/capabilities'
|
207
|
+
|
208
|
+
const props = withDefaults(
|
209
|
+
defineProps<{
|
210
|
+
project: UI_T_Project
|
211
|
+
nodes: UI_I_FileTreeNode[]
|
212
|
+
files: UI_I_FileTreeNode[]
|
213
|
+
networksTable: UI_I_NetworkTableItem[]
|
214
|
+
datastore: UI_I_DatastoreTableItem[]
|
215
|
+
isDatastoreLoading: boolean
|
216
|
+
errorValidationFields: UI_I_ErrorValidationField[]
|
217
|
+
readyCompleteTableInfo: UI_I_TableInfoItem[]
|
218
|
+
vmCpuHelpTextSecond: string
|
219
|
+
importFromVMWarevSphere: string
|
220
|
+
finishFunc: UI_T_AddVmFinishFunc
|
221
|
+
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
222
|
+
validateSendDataFunc: UI_T_AddVmFinishFunc<
|
223
|
+
[UI_T_SelectedNavItem, null | number] | null
|
224
|
+
>
|
225
|
+
passthroughDevices: UI_I_PciDevice[]
|
226
|
+
mediatedDevices: UI_I_MediatedDevice[]
|
227
|
+
vmNameInWizard: string
|
228
|
+
templatesTree?: UI_I_TreeNode[]
|
229
|
+
capabilities?: UI_I_Capabilities
|
230
|
+
vmtSettings?: UI_I_VmSettings | null
|
231
|
+
validateEmptyName?: boolean
|
232
|
+
dataCenter?: UI_I_TreeNode // для сферы
|
233
|
+
computeResource?: UI_I_TreeNode // для сферы
|
234
|
+
computeResourceTree?: UI_I_TreeNode[] // для сферы
|
235
|
+
selectedTemplateId?: string // для сферы
|
236
|
+
isVmt?: boolean // для сферы
|
237
|
+
}>(),
|
238
|
+
{
|
239
|
+
templatesTree: [],
|
240
|
+
capabilities: undefined,
|
241
|
+
vmtSettings: undefined,
|
242
|
+
validateEmptyName: false,
|
243
|
+
dataCenter: undefined,
|
244
|
+
computeResource: undefined,
|
245
|
+
computeResourceTree: undefined,
|
246
|
+
selectedTemplateId: '',
|
247
|
+
isVmt: false,
|
248
|
+
}
|
249
|
+
)
|
250
|
+
|
251
|
+
const emits = defineEmits<{
|
252
|
+
(
|
253
|
+
event: 'check-name',
|
254
|
+
value: [[string, UI_I_TreeNode | null], (error: any) => void]
|
255
|
+
): void
|
256
|
+
(event: 'get-storage', value: UI_I_TablePayload): void
|
257
|
+
(event: 'get-folders-or-files', value: UI_I_FolderOrFileTreePayload): void
|
258
|
+
(event: 'get-active-device-child', value: UI_I_FileTreeNode): void
|
259
|
+
(event: 'show-datastore-child', value: UI_I_FileTreeNode): void
|
260
|
+
(event: 'remove-error-by-title', value: string): void
|
261
|
+
(event: 'get-networks-table', value: UI_I_TablePayload): void
|
262
|
+
(event: 'get-pci-devices'): void
|
263
|
+
(event: 'get-pci-devices'): void
|
264
|
+
(event: 'hide'): void
|
265
|
+
(event: 'select-template', value: string): void
|
266
|
+
(
|
267
|
+
event: 'get-compute-resource-tree',
|
268
|
+
value: { id: string | number; cb: () => void }
|
269
|
+
): void // для сферы
|
270
|
+
(event: 'show-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
|
271
|
+
(event: 'select-compute-resource-tree', value: UI_I_TreeNode): void // для сферы
|
272
|
+
(event: 'clear-compute-resource-tree'): void // для сферы
|
273
|
+
}>()
|
274
|
+
|
275
|
+
const { $store, $recursion }: any = useNuxtApp()
|
276
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
277
|
+
|
278
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
279
|
+
|
280
|
+
const isSphere = computed<boolean>(() => props.project === 'sphere')
|
281
|
+
|
282
|
+
const title = computed<string>(() =>
|
283
|
+
props.isVmt
|
284
|
+
? localization.value.vmt.newTemplate
|
285
|
+
: localization.value.common.newVirtualMachine2
|
286
|
+
)
|
287
|
+
|
288
|
+
watch(
|
289
|
+
() => props.capabilities,
|
290
|
+
() => {
|
291
|
+
if (props.capabilities) mapCapabilities(props.capabilities)
|
292
|
+
},
|
293
|
+
{ deep: true, immediate: true }
|
294
|
+
)
|
295
|
+
|
296
|
+
const selectedCreateType = ref<string>('0')
|
297
|
+
if (props.isVmt) selectedCreateType.value = '-1'
|
298
|
+
|
299
|
+
const wizard: Wizard = new Wizard(
|
300
|
+
stepsFunc(localization.value, props.isVmt),
|
301
|
+
stepsSchemeInitial
|
302
|
+
)
|
303
|
+
watch(
|
304
|
+
selectedCreateType,
|
305
|
+
(newValue) => {
|
306
|
+
switch (newValue) {
|
307
|
+
case '0':
|
308
|
+
wizard.changeScheme(isSphere.value ? 1 : 0)
|
309
|
+
break
|
310
|
+
case '1':
|
311
|
+
wizard.changeScheme(isSphere.value ? 6 : 2)
|
312
|
+
break
|
313
|
+
case '-1':
|
314
|
+
wizard.changeScheme(10)
|
315
|
+
break
|
316
|
+
}
|
317
|
+
},
|
318
|
+
{ immediate: true }
|
319
|
+
)
|
320
|
+
|
321
|
+
// if (isSphere.value) wizard.changeScheme(1)
|
322
|
+
const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
|
323
|
+
// const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
|
324
|
+
|
325
|
+
const isShowSelectTemplate = computed<boolean>(
|
326
|
+
() =>
|
327
|
+
wizard.selectedStepId === dynamicSteps.selectTemplate &&
|
328
|
+
selectedCreateType.value === '1'
|
329
|
+
)
|
330
|
+
|
331
|
+
const isShowPowerOn = computed<boolean>(
|
332
|
+
() =>
|
333
|
+
wizard.selectedStepId > dynamicSteps.customizeHardware &&
|
334
|
+
selectedCreateType.value !== '1' &&
|
335
|
+
!props.isVmt
|
336
|
+
)
|
337
|
+
|
338
|
+
const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
|
339
|
+
wizard.changeSteps(value, validationFunc, validateSendData)
|
340
|
+
}
|
341
|
+
const validationFunc = async (
|
342
|
+
value: UI_I_WizardStep[],
|
343
|
+
currentStep: UI_I_WizardStep,
|
344
|
+
nextStep: UI_I_WizardStep
|
345
|
+
): Promise<UI_I_ValidationReturn> => {
|
346
|
+
let stepHasError = false
|
347
|
+
let stepShouldStop = {
|
348
|
+
ifOnCurrentStep: false,
|
349
|
+
ifFromAnyStep: false,
|
350
|
+
stoppageStepId: -1,
|
351
|
+
}
|
352
|
+
|
353
|
+
wizard.setLoader(true)
|
354
|
+
if (
|
355
|
+
wizard.isValidateForStep(
|
356
|
+
dynamicSteps.selectTemplate,
|
357
|
+
currentStep.id,
|
358
|
+
nextStep.id
|
359
|
+
)
|
360
|
+
) {
|
361
|
+
const templateValidation = await checkTemplate(value)
|
362
|
+
|
363
|
+
value = templateValidation.newValue
|
364
|
+
stepHasError = stepHasError || templateValidation.stepHasError
|
365
|
+
} else if (
|
366
|
+
wizard.isValidateForStep(
|
367
|
+
isSphere.value ? dynamicSteps.selectNameFolder : dynamicSteps.selectName,
|
368
|
+
currentStep.id,
|
369
|
+
nextStep.id
|
370
|
+
)
|
371
|
+
) {
|
372
|
+
const nameValidation = await onCheckName(value)
|
373
|
+
|
374
|
+
value = nameValidation.newValue
|
375
|
+
stepHasError = stepHasError || nameValidation.stepHasError
|
376
|
+
} else if (
|
377
|
+
isSphere.value &&
|
378
|
+
wizard.isValidateForStep(
|
379
|
+
dynamicSteps.selectComputeResource,
|
380
|
+
currentStep.id,
|
381
|
+
nextStep.id
|
382
|
+
)
|
383
|
+
) {
|
384
|
+
const computeResourceValidation = await checkComputeResource(value)
|
385
|
+
|
386
|
+
value = computeResourceValidation.newValue
|
387
|
+
stepHasError = stepHasError || computeResourceValidation.stepHasError
|
388
|
+
} else if (
|
389
|
+
wizard.isValidateForStep(
|
390
|
+
dynamicSteps.selectStorage,
|
391
|
+
currentStep.id,
|
392
|
+
nextStep.id
|
393
|
+
)
|
394
|
+
) {
|
395
|
+
const storageValidation = await checkStorage(value)
|
396
|
+
|
397
|
+
value = storageValidation.newValue
|
398
|
+
|
399
|
+
stepHasError = stepHasError || storageValidation.stepHasError
|
400
|
+
} else if (
|
401
|
+
wizard.isValidateForStep(
|
402
|
+
dynamicSteps.customizeHardware,
|
403
|
+
currentStep.id,
|
404
|
+
nextStep.id
|
405
|
+
)
|
406
|
+
) {
|
407
|
+
const validation = await checkCustomizeHardware(value)
|
408
|
+
|
409
|
+
value = validation.newValue
|
410
|
+
|
411
|
+
stepHasError = stepHasError || validation.stepHasError
|
412
|
+
} else if (
|
413
|
+
wizard.isValidateForStep(
|
414
|
+
dynamicSteps.customizeHardwareTemplate,
|
415
|
+
currentStep.id,
|
416
|
+
nextStep.id
|
417
|
+
)
|
418
|
+
) {
|
419
|
+
const validation = await checkCustomizeHardwareForTemplate(value)
|
420
|
+
|
421
|
+
value = validation.newValue
|
422
|
+
|
423
|
+
stepHasError = stepHasError || validation.stepHasError
|
424
|
+
}
|
425
|
+
wizard.setLoader(false)
|
426
|
+
|
427
|
+
return {
|
428
|
+
newValue: value,
|
429
|
+
stepHasError,
|
430
|
+
stepShouldStop,
|
431
|
+
}
|
432
|
+
}
|
433
|
+
|
434
|
+
const checkTemplate = async (
|
435
|
+
value: UI_I_WizardStep[]
|
436
|
+
): Promise<UI_I_ValidationReturn> => {
|
437
|
+
let stepHasError = false
|
438
|
+
|
439
|
+
return new Promise((resolve) => {
|
440
|
+
templateSubmit.value = (isValid: boolean) => {
|
441
|
+
if (!isValid) {
|
442
|
+
stepHasError = wizard.setValidation(
|
443
|
+
dynamicSteps.selectTemplate,
|
444
|
+
'template',
|
445
|
+
{
|
446
|
+
fieldMessage: 'aaa',
|
447
|
+
alertMessage: 'aaa',
|
448
|
+
}
|
449
|
+
)
|
450
|
+
} else if (wizard.hasMessage(dynamicSteps.selectTemplate, 'template')) {
|
451
|
+
value = wizard.removeValidation(
|
452
|
+
dynamicSteps.selectTemplate,
|
453
|
+
'template',
|
454
|
+
value
|
455
|
+
)
|
456
|
+
}
|
457
|
+
|
458
|
+
resolve({
|
459
|
+
stepHasError,
|
460
|
+
newValue: value,
|
461
|
+
})
|
462
|
+
templateSubmit.value = null
|
463
|
+
}
|
464
|
+
})
|
465
|
+
}
|
466
|
+
const onCheckName = async (
|
467
|
+
value: UI_I_WizardStep[]
|
468
|
+
): Promise<UI_I_ValidationReturn> => {
|
469
|
+
let stepHasError = false
|
470
|
+
|
471
|
+
return new Promise((resolve) => {
|
472
|
+
const step = isSphere.value
|
473
|
+
? dynamicSteps.selectNameFolder
|
474
|
+
: dynamicSteps.selectName
|
475
|
+
nameFormSubmit.value = (isValid: boolean) => {
|
476
|
+
if (!isValid) {
|
477
|
+
stepHasError = wizard.setValidation(step, 'name', {
|
478
|
+
fieldMessage: 'aaa',
|
479
|
+
alertMessage: 'aaa',
|
480
|
+
})
|
481
|
+
} else if (wizard.hasMessage(step, 'name')) {
|
482
|
+
value = wizard.removeValidation(step, 'name', value)
|
483
|
+
}
|
484
|
+
|
485
|
+
resolve({
|
486
|
+
stepHasError,
|
487
|
+
newValue: value,
|
488
|
+
})
|
489
|
+
nameFormSubmit.value = null
|
490
|
+
}
|
491
|
+
})
|
492
|
+
}
|
493
|
+
const checkComputeResource = async (
|
494
|
+
value: UI_I_WizardStep[]
|
495
|
+
): Promise<UI_I_ValidationReturn> => {
|
496
|
+
let stepHasError = false
|
497
|
+
|
498
|
+
return new Promise((resolve) => {
|
499
|
+
computeResourceSubmit.value = (isValid: boolean) => {
|
500
|
+
if (!isValid) {
|
501
|
+
stepHasError = wizard.setValidation(
|
502
|
+
dynamicSteps.selectComputeResource,
|
503
|
+
'computeResource',
|
504
|
+
{
|
505
|
+
fieldMessage: 'aaa',
|
506
|
+
alertMessage: 'aaa',
|
507
|
+
}
|
508
|
+
)
|
509
|
+
} else if (
|
510
|
+
wizard.hasMessage(dynamicSteps.selectComputeResource, 'computeResource')
|
511
|
+
) {
|
512
|
+
value = wizard.removeValidation(
|
513
|
+
dynamicSteps.selectComputeResource,
|
514
|
+
'computeResource',
|
515
|
+
value
|
516
|
+
)
|
517
|
+
}
|
518
|
+
|
519
|
+
resolve({
|
520
|
+
stepHasError,
|
521
|
+
newValue: value,
|
522
|
+
})
|
523
|
+
computeResourceSubmit.value = null
|
524
|
+
}
|
525
|
+
})
|
526
|
+
}
|
527
|
+
const checkStorage = async (
|
528
|
+
value: UI_I_WizardStep[]
|
529
|
+
): Promise<UI_I_ValidationReturn> => {
|
530
|
+
let stepHasError = false
|
531
|
+
|
532
|
+
return new Promise((resolve) => {
|
533
|
+
storageSubmit.value = (isValid: boolean) => {
|
534
|
+
if (!isValid) {
|
535
|
+
stepHasError = wizard.setValidation(
|
536
|
+
dynamicSteps.selectStorage,
|
537
|
+
'storage',
|
538
|
+
{
|
539
|
+
fieldMessage: 'aaa',
|
540
|
+
alertMessage: 'aaa',
|
541
|
+
}
|
542
|
+
)
|
543
|
+
} else if (wizard.hasMessage(dynamicSteps.selectStorage, 'storage')) {
|
544
|
+
value = wizard.removeValidation(
|
545
|
+
dynamicSteps.selectStorage,
|
546
|
+
'storage',
|
547
|
+
value
|
548
|
+
)
|
549
|
+
}
|
550
|
+
|
551
|
+
resolve({
|
552
|
+
stepHasError,
|
553
|
+
newValue: value,
|
554
|
+
})
|
555
|
+
storageSubmit.value = null
|
556
|
+
}
|
557
|
+
})
|
558
|
+
}
|
559
|
+
const checkCustomizeHardware = async (
|
560
|
+
value: UI_I_WizardStep[]
|
561
|
+
): Promise<UI_I_ValidationReturn> => {
|
562
|
+
let stepHasError = false
|
563
|
+
isLoading.value = true
|
564
|
+
|
565
|
+
return new Promise((resolve) => {
|
566
|
+
customizeHardwareSubmit.value = (isValid: boolean) => {
|
567
|
+
if (!isValid) {
|
568
|
+
stepHasError = wizard.setValidation(
|
569
|
+
dynamicSteps.customizeHardware,
|
570
|
+
'customizeHardware',
|
571
|
+
{
|
572
|
+
fieldMessage: 'aaa',
|
573
|
+
alertMessage: 'aaa',
|
574
|
+
}
|
575
|
+
)
|
576
|
+
} else if (
|
577
|
+
wizard.hasMessage(dynamicSteps.customizeHardware, 'customizeHardware')
|
578
|
+
) {
|
579
|
+
wizard.removeValidationLocal(
|
580
|
+
dynamicSteps.customizeHardware,
|
581
|
+
'customizeHardware'
|
582
|
+
)
|
583
|
+
value = wizard.removeValidation(
|
584
|
+
dynamicSteps.customizeHardware,
|
585
|
+
'customizeHardware',
|
586
|
+
value
|
587
|
+
)
|
588
|
+
}
|
589
|
+
|
590
|
+
resolve({
|
591
|
+
stepHasError,
|
592
|
+
newValue: value,
|
593
|
+
})
|
594
|
+
storageSubmit.value = null
|
595
|
+
isLoading.value = false
|
596
|
+
}
|
597
|
+
})
|
598
|
+
}
|
599
|
+
const checkCustomizeHardwareForTemplate = async (
|
600
|
+
value: UI_I_WizardStep[]
|
601
|
+
): Promise<UI_I_ValidationReturn> => {
|
602
|
+
let stepHasError = false
|
603
|
+
|
604
|
+
return new Promise((resolve) => {
|
605
|
+
customizeHardwareForTemplateSubmit.value = (isValid: boolean) => {
|
606
|
+
if (!isValid) {
|
607
|
+
stepHasError = wizard.setValidation(
|
608
|
+
dynamicSteps.customizeHardwareTemplate,
|
609
|
+
'customizeHardwareForTemplate',
|
610
|
+
{
|
611
|
+
fieldMessage: 'aaa',
|
612
|
+
alertMessage: 'aaa',
|
613
|
+
}
|
614
|
+
)
|
615
|
+
} else if (
|
616
|
+
wizard.hasMessage(
|
617
|
+
dynamicSteps.customizeHardwareTemplate,
|
618
|
+
'customizeHardwareForTemplate'
|
619
|
+
)
|
620
|
+
) {
|
621
|
+
value = wizard.removeValidation(
|
622
|
+
dynamicSteps.customizeHardwareTemplate,
|
623
|
+
'customizeHardwareForTemplate',
|
624
|
+
value
|
625
|
+
)
|
626
|
+
}
|
627
|
+
|
628
|
+
resolve({
|
629
|
+
stepHasError,
|
630
|
+
newValue: value,
|
631
|
+
})
|
632
|
+
storageSubmit.value = null
|
633
|
+
}
|
634
|
+
})
|
635
|
+
}
|
636
|
+
|
637
|
+
const storageIdCash = ref<string | null>(null)
|
638
|
+
const vmForm = ref<UI_I_VmForm>({
|
639
|
+
name: '',
|
640
|
+
compatibility: '',
|
641
|
+
guestMachineType: null,
|
642
|
+
guestOsFamily: null,
|
643
|
+
guestOsVersion: null,
|
644
|
+
computeResource: null,
|
645
|
+
storage: null,
|
646
|
+
locationPath: '',
|
647
|
+
dataCenter: null,
|
648
|
+
})
|
649
|
+
|
650
|
+
// TODO remove (not used)
|
651
|
+
const vmFormCash = ref<UI_I_VmFormCash>({
|
652
|
+
dataCenterId: null,
|
653
|
+
computeResourceTypeAndId: null,
|
654
|
+
})
|
655
|
+
|
656
|
+
const onChangeName = (name: string, node: UI_I_TreeNode | null): void => {
|
657
|
+
vmForm.value.name = name
|
658
|
+
if (isSphere.value) {
|
659
|
+
vmForm.value.locationPath = node.id
|
660
|
+
vmForm.value.dataCenter = $recursion.findParentByValue(
|
661
|
+
node,
|
662
|
+
'datacenter',
|
663
|
+
'type',
|
664
|
+
'parent'
|
665
|
+
)
|
666
|
+
vmFormCash.value.dataCenterId = vmForm.value.dataCenter?.id || null
|
667
|
+
}
|
668
|
+
}
|
669
|
+
// // Для сферы
|
670
|
+
const computeResourcePath = ref<string>('')
|
671
|
+
const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
|
672
|
+
emits('select-compute-resource-tree', node)
|
673
|
+
computeResourcePath.value = node.id
|
674
|
+
}
|
675
|
+
const onChangeComputeResource = (node: UI_I_TreeNode): void => {
|
676
|
+
vmForm.value.computeResource = node
|
677
|
+
// const type = node.type.toUpperCase()
|
678
|
+
// schedRequirementsTemplate.value = `sched_requirements="(${type}_ID=${node.id})"\\`
|
679
|
+
vmFormCash.value.computeResourceTypeAndId = `${node.type}${node.id}` || null
|
680
|
+
}
|
681
|
+
const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
|
682
|
+
if (!storage) return
|
683
|
+
|
684
|
+
vmForm.value.storage = storage
|
685
|
+
storageIdCash.value = storage.id
|
686
|
+
}
|
687
|
+
const compatibilityInfo = ref<string>('')
|
688
|
+
const onChangeCompatibility = (compatibility: UI_I_OptionItem): void => {
|
689
|
+
vmForm.value.compatibility = compatibility.value
|
690
|
+
|
691
|
+
const version = compatibility.value.split('-')[1]
|
692
|
+
compatibilityInfo.value = `${localization.value.common.compatibility}: ${compatibility.text} (${localization.value.common.vmVersion} ${version})`
|
693
|
+
}
|
694
|
+
const customizeHardware = ref<UI_I_SendDataCustomizeHardware | null>(null)
|
695
|
+
const onChangeCustomizeHardware = (
|
696
|
+
data: UI_I_SendDataCustomizeHardware
|
697
|
+
): void => {
|
698
|
+
customizeHardware.value = data
|
699
|
+
}
|
700
|
+
|
701
|
+
const virtualHardwareHardDisksLocal = computed<
|
702
|
+
UI_I_SendDataNewHardDisk[] | null
|
703
|
+
>(() => customizeHardware.value?.virtualHardware?.hardDisks || null)
|
704
|
+
const virtualHardwareNetworksLocal = computed<UI_I_SendDataNewNetwork[] | null>(
|
705
|
+
() => customizeHardware.value?.virtualHardware?.networks || null
|
706
|
+
)
|
707
|
+
const virtualHardwareCdDvdDrivesLocal = computed<
|
708
|
+
UI_I_SendDataNewCdDvdDrive[] | null
|
709
|
+
>(() => customizeHardware.value?.virtualHardware?.cdDvdDrives || null)
|
710
|
+
|
711
|
+
const virtualHardwareCpu = computed<UI_I_SendDataCpu | null>(
|
712
|
+
() => customizeHardware.value?.virtualHardware?.cpu || null
|
713
|
+
)
|
714
|
+
const virtualHardwareMemory = computed<UI_I_SendDataMemory | null>(
|
715
|
+
() => customizeHardware.value?.virtualHardware?.memory || null
|
716
|
+
)
|
717
|
+
const virtualHardwareHardDisks = ref<UI_I_SendDataNewHardDisk[] | null>(null)
|
718
|
+
const virtualHardwareCdDvdDrives = ref<UI_I_SendDataNewCdDvdDrive[] | null>(
|
719
|
+
null
|
720
|
+
)
|
721
|
+
const virtualHardwareNetworks = ref<UI_I_SendDataNewNetwork[] | null>(null)
|
722
|
+
const onChangeBootOrder = (data: UI_T_ChangeBootOrder): void => {
|
723
|
+
virtualHardwareHardDisks.value = data[0]
|
724
|
+
virtualHardwareCdDvdDrives.value = data[1]
|
725
|
+
virtualHardwareNetworks.value = data[2]
|
726
|
+
}
|
727
|
+
|
728
|
+
const isPowerOnByDefault = ref<boolean>(true)
|
729
|
+
|
730
|
+
watch(
|
731
|
+
() => props.vmNameInWizard,
|
732
|
+
(newValue) => {
|
733
|
+
vmForm.value.name = newValue
|
734
|
+
}
|
735
|
+
)
|
736
|
+
|
737
|
+
const validateSendData = async (
|
738
|
+
value: UI_I_WizardStep[]
|
739
|
+
): Promise<UI_I_ValidationReturn> => {
|
740
|
+
wizard.setLoader(true)
|
741
|
+
let stepHasError = false
|
742
|
+
isLoading.value = true
|
743
|
+
|
744
|
+
const data = await props.validateSendDataFunc(
|
745
|
+
vmForm.value,
|
746
|
+
virtualHardwareCpu.value,
|
747
|
+
virtualHardwareMemory.value,
|
748
|
+
customizeHardware.value,
|
749
|
+
virtualHardwareNetworks.value,
|
750
|
+
virtualHardwareHardDisks.value,
|
751
|
+
virtualHardwareCdDvdDrives.value,
|
752
|
+
isPowerOnByDefault.value,
|
753
|
+
localization.value,
|
754
|
+
vmForm.value.locationPath, // для сферы
|
755
|
+
computeResourcePath.value // для сферы
|
756
|
+
)
|
757
|
+
|
758
|
+
isLoading.value = false
|
759
|
+
wizard.setLoader(false)
|
760
|
+
if (data) {
|
761
|
+
stepHasError = true
|
762
|
+
selectedNavItem.value = data[0]
|
763
|
+
data[1] !== null && wizard.selectStepHard(data[1])
|
764
|
+
}
|
765
|
+
|
766
|
+
return {
|
767
|
+
stepHasError,
|
768
|
+
newValue: value,
|
769
|
+
}
|
770
|
+
}
|
771
|
+
|
772
|
+
const isLoading = ref<boolean>(false)
|
773
|
+
const onFinish = (): void => {
|
774
|
+
isLoading.value = true
|
775
|
+
wizard.setLoader(false)
|
776
|
+
props
|
777
|
+
.finishFunc(
|
778
|
+
vmForm.value,
|
779
|
+
virtualHardwareCpu.value,
|
780
|
+
virtualHardwareMemory.value,
|
781
|
+
customizeHardware.value,
|
782
|
+
virtualHardwareNetworks.value,
|
783
|
+
virtualHardwareHardDisks.value,
|
784
|
+
virtualHardwareCdDvdDrives.value,
|
785
|
+
isPowerOnByDefault.value,
|
786
|
+
localization.value,
|
787
|
+
vmForm.value.locationPath, // для сферы
|
788
|
+
computeResourcePath.value, // для сферы
|
789
|
+
false,
|
790
|
+
selectedTemplate.value,
|
791
|
+
selectedCreateType.value
|
792
|
+
)
|
793
|
+
.then(() => {
|
794
|
+
onHideModal()
|
795
|
+
wizard.setLoader(false)
|
796
|
+
isLoading.value = false
|
797
|
+
})
|
798
|
+
}
|
799
|
+
|
800
|
+
const selectedNavItem = ref<UI_T_SelectedNavItem>(0)
|
801
|
+
|
802
|
+
const nameFormSubmit = ref<null | Function>(null)
|
803
|
+
const templateSubmit = ref<null | Function>(null)
|
804
|
+
const computeResourceSubmit = ref<null | Function>(null)
|
805
|
+
const storageSubmit = ref<null | Function>(null)
|
806
|
+
const customizeHardwareSubmit = ref<null | Function>(null)
|
807
|
+
const customizeHardwareForTemplateSubmit = ref<null | Function>(null)
|
808
|
+
const compatibility = ref<UI_I_OptionItem[]>(capabilities.value.compatibility)
|
809
|
+
const guestOsFamilies = ref<UI_I_OptionItem[]>(
|
810
|
+
capabilities.value.guestOsFamilies
|
811
|
+
)
|
812
|
+
const guestOsVersions = ref<UI_I_ArbitraryObject<UI_I_OptionItem[]>>(
|
813
|
+
capabilities.value.guestOsVersions
|
814
|
+
)
|
815
|
+
const machineTypes = ref<UI_I_OptionItem[]>(capabilities.value.machineTypes)
|
816
|
+
const cpuModels = ref<UI_I_OptionItem[]>(capabilities.value.cpuModels)
|
817
|
+
const maxCpus = ref<number>(capabilities.value.maxCpus)
|
818
|
+
const maxMemory = ref<number>(capabilities.value.maxMemory)
|
819
|
+
|
820
|
+
const selectedTemplate = ref<string>('')
|
821
|
+
const onChangeTemplate = (node: UI_I_TreeNode): void => {
|
822
|
+
selectedTemplate.value = node.id.toString()
|
823
|
+
emits('select-template', node.id.toString())
|
824
|
+
}
|
825
|
+
const selectedOptions = ref<string[]>([])
|
826
|
+
const onChangeSelectOptions = (options: string[]) => {
|
827
|
+
selectedOptions.value = options
|
828
|
+
if (
|
829
|
+
options.includes('customize-os') &&
|
830
|
+
options.includes('customize-hardware')
|
831
|
+
) {
|
832
|
+
wizard.changeScheme(isSphere.value ? 9 : 5)
|
833
|
+
} else if (options.includes('customize-os')) {
|
834
|
+
wizard.changeScheme(isSphere.value ? 7 : 3)
|
835
|
+
} else if (options.includes('customize-hardware')) {
|
836
|
+
wizard.changeScheme(isSphere.value ? 8 : 4)
|
837
|
+
} else {
|
838
|
+
wizard.changeScheme(isSphere.value ? 6 : 2)
|
839
|
+
}
|
840
|
+
|
841
|
+
isPowerOnByDefault.value = options.includes('power-on')
|
842
|
+
}
|
843
|
+
|
844
|
+
const onHideModal = (): void => {
|
845
|
+
emits('hide')
|
846
|
+
}
|
847
|
+
|
848
|
+
watch(
|
849
|
+
() => props.vmtSettings,
|
850
|
+
(newValue) => {
|
851
|
+
if (newValue) {
|
852
|
+
vmForm.value.name = newValue.name
|
853
|
+
vmForm.value.compatibility =
|
854
|
+
newValue.compatibility || vmForm.value.compatibility
|
855
|
+
vmForm.value.storage = newValue.storage
|
856
|
+
if (customizeHardware.value?.virtualHardware) {
|
857
|
+
customizeHardware.value.virtualHardware.cdDvdDrives =
|
858
|
+
newValue.cdDvdDrives
|
859
|
+
customizeHardware.value.virtualHardware.hardDisks = newValue.hardDisks
|
860
|
+
customizeHardware.value.virtualHardware.networks = newValue.networks
|
861
|
+
customizeHardware.value.virtualHardware.cpu = newValue.cpu
|
862
|
+
customizeHardware.value.virtualHardware.memory = newValue.memory
|
863
|
+
customizeHardware.value.virtualHardware.videoCard = newValue.videoCard
|
864
|
+
customizeHardware.value.virtualHardware.usbController =
|
865
|
+
newValue.usbController
|
866
|
+
customizeHardware.value.virtualHardware.pciDevices = newValue.pciDevices
|
867
|
+
customizeHardware.value.vmOptions = newValue.options
|
868
|
+
}
|
869
|
+
maxCpus.value = newValue.cpu.max_vcpus
|
870
|
+
cpuModels.value = newValue.cpu.model
|
871
|
+
isPowerOnByDefault.value = false
|
872
|
+
}
|
873
|
+
}
|
874
|
+
)
|
875
|
+
</script>
|
876
|
+
|
877
|
+
<style scoped lang="scss"></style>
|