bfg-common 1.5.540 → 1.5.541

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 (124) hide show
  1. package/CODE_STYLE.md +109 -109
  2. package/assets/img/icons/icons-sprite-dark-3.svg +227 -227
  3. package/assets/img/icons/icons-sprite-dark-5.svg +488 -488
  4. package/assets/img/icons/icons-sprite-light-3.svg +227 -227
  5. package/assets/img/icons/icons-sprite-light-5.svg +488 -488
  6. package/components/atoms/TheIcon3.vue +50 -50
  7. package/components/atoms/collapse/CollapseNav.vue +170 -170
  8. package/components/atoms/perPage/PerPage.vue +58 -58
  9. package/components/atoms/table/dataGrid/DataGrid.vue +1718 -1718
  10. package/components/atoms/table/dataGrid/DataGridPagination.vue +97 -97
  11. package/components/atoms/table/dataGrid/lib/config/settingsTable.ts +94 -94
  12. package/components/atoms/table/dataGrid/lib/utils/export.ts +16 -16
  13. package/components/common/backup/storage/actions/add/Add.vue +251 -251
  14. package/components/common/backup/storage/actions/add/lib/utils.ts +51 -51
  15. package/components/common/browse/blocks/contents/filesNew/Skeleton.vue +18 -18
  16. package/components/common/diagramMain/modals/lib/config/portModal.ts +251 -251
  17. package/components/common/diagramMain/modals/lib/config/vCenterModal.ts +48 -48
  18. package/components/common/diagramMain/port/Port.vue +580 -580
  19. package/components/common/layout/theHeader/helpMenu/About.vue +79 -79
  20. package/components/common/layout/theHeader/helpMenu/aboutOld/AboutOld.vue +79 -79
  21. package/components/common/pages/backups/DetailView.vue +52 -52
  22. package/components/common/pages/backups/lib/models/interfaces.ts +36 -36
  23. package/components/common/pages/backups/modals/Modals.vue +243 -243
  24. package/components/common/pages/backups/modals/createBackup/configuration/backupWindow/BackupWindow.vue +29 -29
  25. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/MaxBandwidth.vue +69 -69
  26. package/components/common/pages/backups/modals/createBackup/configuration/strategy/Strategy.vue +38 -38
  27. package/components/common/pages/backups/modals/createBackup/lib/config/readyToCompleteOptions.ts +69 -69
  28. package/components/common/pages/backups/modals/createBackup/lib/models/interfaces.ts +8 -8
  29. package/components/common/pages/backups/modals/lib/config/restore.ts +115 -115
  30. package/components/common/pages/backups/modals/lib/models/interfaces.ts +186 -186
  31. package/components/common/pages/backups/modals/restore/name/lib/models/interfaces.ts +6 -6
  32. package/components/common/pages/backups/modals/restore/networks/Networks.vue +1 -0
  33. package/components/common/pages/hardwareHealth/tableView/lib/config/sensorTable.ts +1 -1
  34. package/components/common/pages/hardwareHealth/tableView/modal/SensorWarning.vue +1 -1
  35. package/components/common/pages/home/lib/models/interfaces.ts +48 -48
  36. package/components/common/pages/home/widgets/hosts/Hosts.vue +27 -27
  37. package/components/common/pages/home/widgets/hosts/lib/config/items.ts +23 -23
  38. package/components/common/pages/home/widgets/vms/VmsOld.vue +35 -35
  39. package/components/common/pages/home/widgets/vms/lib/config/items.ts +19 -19
  40. package/components/common/pages/scheduledTasks/lib/utils/utils.ts +84 -84
  41. package/components/common/readyToComplete/ReadyToComplete.vue +17 -17
  42. package/components/common/select/radio/RadioGroup.vue +137 -137
  43. package/components/common/spiceConsole/Drawer.vue +420 -420
  44. package/components/common/spiceConsole/SpiceConsole.vue +184 -184
  45. package/components/common/spiceConsole/lib/models/interfaces.ts +5 -5
  46. package/components/common/tools/Actions.vue +207 -207
  47. package/components/common/tooltip/Help.vue +5 -0
  48. package/components/common/treeView/TreeView.vue +52 -52
  49. package/components/common/vm/actions/add/Add.vue +950 -949
  50. package/components/common/vm/actions/add/New.vue +690 -689
  51. package/components/common/vm/actions/add/Old.vue +402 -400
  52. package/components/common/vm/actions/add/lib/config/steps.ts +347 -347
  53. package/components/common/vm/actions/clone/Clone.vue +809 -808
  54. package/components/common/vm/actions/clone/new/New.vue +457 -454
  55. package/components/common/vm/actions/clone/old/Old.vue +378 -378
  56. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +368 -368
  57. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/Shares.vue +140 -140
  58. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/shares/lib/config/options.ts +28 -28
  59. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +427 -427
  60. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/location/Location.vue +154 -154
  61. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/macAddress/MacAddress.vue +119 -119
  62. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newPciDevice/dynamicDirectPathIo/DynamicDirectPathIo.vue +31 -31
  63. package/components/common/vm/actions/common/customizeHardware/virtualHardware/other/Other.vue +16 -16
  64. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/numberDisplays/NumberDisplays.vue +53 -53
  65. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/delay/Delay.vue +32 -32
  66. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/firmware/Firmware.vue +60 -60
  67. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +174 -174
  68. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +32 -32
  69. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/password/Password.vue +103 -103
  70. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/usbRedirection/UsbRedirection.vue +28 -28
  71. package/components/common/vm/actions/common/select/compatibility/Old.vue +107 -107
  72. package/components/common/vm/actions/common/select/createType/CreateType.vue +38 -38
  73. package/components/common/vm/actions/common/select/createType/lib/models/interfaces.ts +5 -5
  74. package/components/common/vm/actions/common/select/os/Old.vue +152 -152
  75. package/components/common/vm/actions/common/select/os/Os.vue +139 -139
  76. package/components/common/vm/actions/common/select/storage/Old.vue +125 -132
  77. package/components/common/vm/actions/common/select/storage/Storage.vue +178 -167
  78. package/components/common/vm/actions/common/select/storage/new/New.vue +311 -330
  79. package/components/common/vm/actions/common/select/storage/new/lib/models/interfaces.ts +5 -5
  80. package/components/common/vm/actions/common/select/storage/new/lib/utils/utils.ts +21 -21
  81. package/components/common/vm/actions/common/select/template/old/Old.vue +50 -50
  82. package/components/common/vm/actions/editSettings/new/Skeleton.vue +88 -88
  83. package/components/common/vm/actions/register/Register.vue +352 -352
  84. package/components/common/vm/actions/register/lib/config/steps.ts +86 -86
  85. package/components/common/wizards/common/{steps/computeResource/compatibility → compatibility}/Compatibility.vue +35 -31
  86. package/components/common/wizards/common/{steps/computeResource/compatibility → compatibility}/New.vue +99 -98
  87. package/components/common/wizards/common/{steps/computeResource/compatibility → compatibility}/Old.vue +53 -54
  88. package/components/common/wizards/common/{steps/computeResource/compatibility → compatibility}/lib/models/enums.ts +1 -1
  89. package/components/common/wizards/common/compatibility/lib/models/types.ts +1 -0
  90. package/components/common/wizards/common/steps/computeResource/ComputeResource.vue +86 -85
  91. package/components/common/wizards/common/steps/computeResource/New.vue +93 -92
  92. package/components/common/wizards/common/steps/computeResource/Old.vue +103 -102
  93. package/components/common/wizards/common/steps/name/Name.vue +178 -178
  94. package/components/common/wizards/common/steps/name/New.vue +221 -221
  95. package/components/common/wizards/common/steps/name/Old.vue +121 -121
  96. package/components/common/wizards/common/steps/name/lib/models/interfaces.ts +4 -4
  97. package/components/common/wizards/common/steps/name/location/Location.vue +85 -85
  98. package/components/common/wizards/common/steps/name/location/New.vue +40 -40
  99. package/components/common/wizards/datastore/add/Add.vue +228 -228
  100. package/components/common/wizards/datastore/add/lib/utils.ts +85 -85
  101. package/components/common/wizards/datastore/add/steps/typeMode/lib/config/typeOptions.ts +43 -43
  102. package/components/common/wizards/vm/migrate/select/computeResource/ComputeResource.vue +205 -195
  103. package/components/common/wizards/vm/migrate/select/network/Network.vue +103 -103
  104. package/components/common/wizards/vm/migrate/select/storage/Storage.vue +1 -1
  105. package/composables/useAppVersion.ts +21 -21
  106. package/composables/useLocal.ts +6 -6
  107. package/composables/useLocalCommon.ts +39 -39
  108. package/package.json +1 -1
  109. package/plugins/console.ts +21 -21
  110. package/plugins/date.ts +233 -233
  111. package/plugins/mouse.ts +21 -21
  112. package/plugins/panelStates.ts +70 -70
  113. package/plugins/text.ts +59 -59
  114. package/public/spice-console/application/clientgui.js +854 -854
  115. package/public/spice-console/application/packetfactory.js +211 -211
  116. package/public/spice-console/application/virtualmouse.js +147 -147
  117. package/public/spice-console/lib/images/bitmap.js +203 -203
  118. package/public/spice-console/network/spicechannel.js +440 -440
  119. package/public/spice-console/process/cursorprocess.js +121 -121
  120. package/public/spice-console/process/inputprocess.js +227 -227
  121. package/public/spice-console/process/mainprocess.js +210 -210
  122. package/public/spice-console/run.js +210 -210
  123. package/store/main/mutations.ts +7 -7
  124. package/store/main/state.ts +7 -7
@@ -1,43 +1,43 @@
1
- import type { UI_I_Localization } from '~/lib/models/interfaces'
2
- import type { UI_T_Project } from '~/lib/models/types'
3
- import type { UI_I_RadioOption } from '~/components/common/select/radio/lib/models/interfaces'
4
-
5
- export const datastoreTypesFunc = (
6
- localization: UI_I_Localization,
7
- _project?: UI_T_Project
8
- ): UI_I_RadioOption[] => {
9
- return [
10
- {
11
- id: 'datastore-type-shared-storm',
12
- label: localization.common.stormSharedStorage,
13
- value: 2,
14
- disabled: false,
15
- description: localization.common.sharedStormDesc,
16
- isTooltip: false,
17
- tooltipContent: localization.common.stormSharedStorageHelpDesc,
18
- testId: 'datastore-type-shared-storm',
19
- },
20
- {
21
- id: 'datastore-type-nfs',
22
- label: localization.common.nfs,
23
- value: 4,
24
- disabled: false,
25
- description: localization.common.nfsDesc,
26
- isTooltip: false,
27
- tooltipContent: localization.common.nfsHelpDesc,
28
- testId: 'datastore-type-nfs',
29
- },
30
- ]
31
-
32
- // if (project === 'procurator') {
33
- // types.unshift({
34
- // label: localization.common.localStorage,
35
- // value: 1,
36
- // disabled: false,
37
- // description: localization.common.localDesc,
38
- // isTooltip: false,
39
- // tooltipContent: localization.common.localStorageHelpDesc,
40
- // testId: 'datastore-type-local',
41
- // })
42
- // }
43
- }
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type { UI_T_Project } from '~/lib/models/types'
3
+ import type { UI_I_RadioOption } from '~/components/common/select/radio/lib/models/interfaces'
4
+
5
+ export const datastoreTypesFunc = (
6
+ localization: UI_I_Localization,
7
+ _project?: UI_T_Project
8
+ ): UI_I_RadioOption[] => {
9
+ return [
10
+ {
11
+ id: 'datastore-type-shared-storm',
12
+ label: localization.common.stormSharedStorage,
13
+ value: 2,
14
+ disabled: false,
15
+ description: localization.common.sharedStormDesc,
16
+ isTooltip: false,
17
+ tooltipContent: localization.common.stormSharedStorageHelpDesc,
18
+ testId: 'datastore-type-shared-storm',
19
+ },
20
+ {
21
+ id: 'datastore-type-nfs',
22
+ label: localization.common.nfs,
23
+ value: 4,
24
+ disabled: false,
25
+ description: localization.common.nfsDesc,
26
+ isTooltip: false,
27
+ tooltipContent: localization.common.nfsHelpDesc,
28
+ testId: 'datastore-type-nfs',
29
+ },
30
+ ]
31
+
32
+ // if (project === 'procurator') {
33
+ // types.unshift({
34
+ // label: localization.common.localStorage,
35
+ // value: 1,
36
+ // disabled: false,
37
+ // description: localization.common.localDesc,
38
+ // isTooltip: false,
39
+ // tooltipContent: localization.common.localStorageHelpDesc,
40
+ // testId: 'datastore-type-local',
41
+ // })
42
+ // }
43
+ }
@@ -1,195 +1,205 @@
1
- <template>
2
- <div class="compute-resource">
3
- <atoms-alert
4
- v-show="props.alertMessages?.length"
5
- :items="props.alertMessages"
6
- test-id="compute-resource-alert"
7
- status="alert-danger"
8
- @remove="onHideAlert"
9
- />
10
-
11
- <div
12
- v-if="model.migrate_type === 'resource-storage'"
13
- class="tree-view-wrap mt-1"
14
- >
15
- <common-wizards-vm-common-compute-resource-tree-view
16
- v-model="model.resource.selectedNode"
17
- :compute-resource-tree="nodes"
18
- @show-compute-resource-tree="onShowComputeResourceTree"
19
- @select-compute-resource-tree="onSelectComputeResourceTree"
20
- />
21
- </div>
22
-
23
- <template v-else>
24
- <atoms-tabs
25
- v-model="activeTab"
26
- :items="selectStorageTabs"
27
- test-id="migrate-select-storage-tabs"
28
- size="small"
29
- class="compute-resource__tabs"
30
- />
31
-
32
- <common-wizards-vm-migrate-select-compute-resource-table-view
33
- v-model="selectedTableDataKeys[activeTab]"
34
- :type="activeTab"
35
- :data-table="props.computeResourceData?.items || []"
36
- :total-items="props.computeResourceData?.total_items || 0"
37
- :total-pages="props.computeResourceData?.total_pages || 1"
38
- :get-compute-resource-data="props.getComputeResourceData"
39
- />
40
- </template>
41
-
42
- <common-wizards-common-steps-compute-resource-compatibility
43
- :loading="!model.resource.selectedNode"
44
- :status="compatibilityText[0]"
45
- :text="compatibilityText[1]"
46
- />
47
- </div>
48
- </template>
49
-
50
- <script lang="ts" setup>
51
- import type { UI_I_Localization } from '~/lib/models/interfaces'
52
- import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
53
- import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
54
- import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
55
- import type { UI_T_SelectComputeResourceTabType } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/types'
56
- import type { UI_I_MigrateFormLocal } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
57
- import type { UI_I_SelectedTableDataKeys } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/interfaces'
58
- import { UI_E_ComputeResourceTabKamelKeys } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/enums'
59
- import { vmMigrateComputeResourceTabsFunc } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/config/tabsPannel'
60
-
61
- const props = withDefaults(
62
- defineProps<{
63
- alertMessages: string[]
64
- getComputeResourceData: (payload: UI_I_TablePayload) => Promise<void>
65
- computeResourceData: any
66
- computeResourceTree: UI_I_TreeNode | null
67
- vmState?: number
68
- }>(),
69
- {
70
- vmState: undefined,
71
- }
72
- )
73
- const model = defineModel<UI_I_MigrateFormLocal>({ required: true })
74
- const emits = defineEmits<{
75
- (event: 'hide-alert', value: number): void
76
- (event: 'next-step', value: any): void
77
- }>()
78
-
79
- const localization = computed<UI_I_Localization>(() => useLocal())
80
- const { $recursion }: any = useNuxtApp()
81
-
82
- const activeTab = ref<UI_T_SelectComputeResourceTabType>('host')
83
- const selectStorageTabs = computed<UI_I_CollapseNavItem[]>(() =>
84
- vmMigrateComputeResourceTabsFunc(localization.value, props.vmState || -1)
85
- )
86
-
87
- const selectedTableDataKeys = ref<UI_I_SelectedTableDataKeys>({
88
- host: null,
89
- cluster: null,
90
- 'resource-pool': null,
91
- 'v-apps': null,
92
- })
93
- watch(
94
- selectedTableDataKeys,
95
- (newValue) => {
96
- if (!props.computeResourceData?.items.length) return
97
-
98
- const data = props.computeResourceData.items.find(
99
- (_: never, key: number) => newValue[activeTab.value] === key
100
- )
101
- if (data) {
102
- const dataKeys = UI_E_ComputeResourceTabKamelKeys[activeTab.value]
103
- model.value.resource[dataKeys] = data
104
- model.value.resource.selectedNode = data
105
- }
106
- },
107
- { immediate: true, deep: true }
108
- )
109
-
110
- const nodes = ref<UI_I_TreeNode[]>([])
111
- watch(
112
- props.computeResourceTree,
113
- (newValue) => {
114
- if (nodes.value.length) return
115
-
116
- nodes.value = useDeepCopy([newValue])
117
- },
118
- { immediate: true, deep: true }
119
- )
120
-
121
- const onShowComputeResourceTree = ({
122
- node,
123
- cb,
124
- }: {
125
- node: UI_I_TreeNode
126
- cb: () => void
127
- }): void => {
128
- $recursion.findAndShow(
129
- nodes.value,
130
- [node.id, node.type],
131
- ['id', 'type'],
132
- 'nodes'
133
- )
134
- cb()
135
- }
136
- const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
137
- $recursion.findAndActivate(
138
- nodes.value,
139
- [node.type, node.id],
140
- ['type', 'id'],
141
- 'nodes'
142
- )
143
- }
144
- const compatibilityText = computed<[string, string]>(() => {
145
- const { selectedNode } = model.value.resource
146
-
147
- if (!selectedNode) return ['none', '']
148
-
149
- let res: [string, string] = ['success', localization.value.common.compatibilityChecksSucceeded]
150
-
151
- if (selectedNode.type === 'datacenter' || selectedNode.type === 'folder') {
152
- res = ['error', localization.value.common.selectValidClusterOrHostDestination]
153
- }
154
- if (selectedNode.type === 'cluster') {
155
- const hasHost = !!selectedNode.nodes.length
156
- if (!hasHost) {
157
- res = ['error', localization.value.common.clusterNotContainAnyHosts]
158
- }
159
- }
160
-
161
- if (selectedNode.type === 'host') {
162
- if (selectedNode.state === 'Error') {
163
- // TODO check Maintenance Mode
164
- res = ['error', localization.value.common.selectedHostDisconnectedMaintenanceMode]
165
- }
166
- }
167
-
168
- return res
169
- })
170
- const onHideAlert = (): void => {
171
- emits('hide-alert', 3)
172
- }
173
- </script>
174
-
175
- <style lang="scss" scoped>
176
- @import 'assets/scss/common/mixins';
177
- .compute-resource {
178
- @include flex($dir: column);
179
- height: inherit;
180
- .tree-view-wrap {
181
- max-height: 250px;
182
- min-height: 200px;
183
- position: relative;
184
- border: 1px solid #000;
185
- padding: 5px 0 0 5px;
186
- overflow: auto;
187
- }
188
- &__tabs {
189
- width: 100%;
190
- :deep(.nav) {
191
- margin-top: 0;
192
- }
193
- }
194
- }
195
- </style>
1
+ <template>
2
+ <div class="compute-resource">
3
+ <atoms-alert
4
+ v-show="props.alertMessages?.length"
5
+ :items="props.alertMessages"
6
+ test-id="compute-resource-alert"
7
+ status="alert-danger"
8
+ @remove="onHideAlert"
9
+ />
10
+
11
+ <div
12
+ v-if="model.migrate_type === 'resource-storage'"
13
+ class="tree-view-wrap mt-1"
14
+ >
15
+ <common-wizards-vm-common-compute-resource-tree-view
16
+ v-model="model.resource.selectedNode"
17
+ :compute-resource-tree="nodes"
18
+ @show-compute-resource-tree="onShowComputeResourceTree"
19
+ @select-compute-resource-tree="onSelectComputeResourceTree"
20
+ />
21
+ </div>
22
+
23
+ <template v-else>
24
+ <atoms-tabs
25
+ v-model="activeTab"
26
+ :items="selectStorageTabs"
27
+ test-id="migrate-select-storage-tabs"
28
+ size="small"
29
+ class="compute-resource__tabs"
30
+ />
31
+
32
+ <common-wizards-vm-migrate-select-compute-resource-table-view
33
+ v-model="selectedTableDataKeys[activeTab]"
34
+ :type="activeTab"
35
+ :data-table="props.computeResourceData?.items || []"
36
+ :total-items="props.computeResourceData?.total_items || 0"
37
+ :total-pages="props.computeResourceData?.total_pages || 1"
38
+ :get-compute-resource-data="props.getComputeResourceData"
39
+ />
40
+ </template>
41
+
42
+ <common-wizards-common-compatibility
43
+ :loading="!model.resource.selectedNode"
44
+ :status="compatibilityText[0]"
45
+ :text="compatibilityText[1]"
46
+ />
47
+ </div>
48
+ </template>
49
+
50
+ <script lang="ts" setup>
51
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
52
+ import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
53
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
54
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
55
+ import type { UI_T_SelectComputeResourceTabType } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/types'
56
+ import type { UI_I_MigrateFormLocal } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
57
+ import type { UI_I_SelectedTableDataKeys } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/interfaces'
58
+ import type { UI_T_CompatibilityStatus } from '~/components/common/wizards/common/compatibility/lib/models/types'
59
+ import { UI_E_ComputeResourceTabKamelKeys } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/enums'
60
+ import { vmMigrateComputeResourceTabsFunc } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/config/tabsPannel'
61
+
62
+ const props = withDefaults(
63
+ defineProps<{
64
+ alertMessages: string[]
65
+ getComputeResourceData: (payload: UI_I_TablePayload) => Promise<void>
66
+ computeResourceData: any
67
+ computeResourceTree: UI_I_TreeNode | null
68
+ vmState?: number
69
+ }>(),
70
+ {
71
+ vmState: undefined,
72
+ }
73
+ )
74
+ const model = defineModel<UI_I_MigrateFormLocal>({ required: true })
75
+ const emits = defineEmits<{
76
+ (event: 'hide-alert', value: number): void
77
+ (event: 'next-step', value: any): void
78
+ }>()
79
+
80
+ const localization = computed<UI_I_Localization>(() => useLocal())
81
+ const { $recursion }: any = useNuxtApp()
82
+
83
+ const activeTab = ref<UI_T_SelectComputeResourceTabType>('host')
84
+ const selectStorageTabs = computed<UI_I_CollapseNavItem[]>(() =>
85
+ vmMigrateComputeResourceTabsFunc(localization.value, props.vmState || -1)
86
+ )
87
+
88
+ const selectedTableDataKeys = ref<UI_I_SelectedTableDataKeys>({
89
+ host: null,
90
+ cluster: null,
91
+ 'resource-pool': null,
92
+ 'v-apps': null,
93
+ })
94
+ watch(
95
+ selectedTableDataKeys,
96
+ (newValue) => {
97
+ if (!props.computeResourceData?.items.length) return
98
+
99
+ const data = props.computeResourceData.items.find(
100
+ (_: never, key: number) => newValue[activeTab.value] === key
101
+ )
102
+ if (data) {
103
+ const dataKeys = UI_E_ComputeResourceTabKamelKeys[activeTab.value]
104
+ model.value.resource[dataKeys] = data
105
+ model.value.resource.selectedNode = data
106
+ }
107
+ },
108
+ { immediate: true, deep: true }
109
+ )
110
+
111
+ const nodes = ref<UI_I_TreeNode[]>([])
112
+ watch(
113
+ props.computeResourceTree,
114
+ (newValue) => {
115
+ if (nodes.value.length) return
116
+
117
+ nodes.value = useDeepCopy([newValue])
118
+ },
119
+ { immediate: true, deep: true }
120
+ )
121
+
122
+ const onShowComputeResourceTree = ({
123
+ node,
124
+ cb,
125
+ }: {
126
+ node: UI_I_TreeNode
127
+ cb: () => void
128
+ }): void => {
129
+ $recursion.findAndShow(
130
+ nodes.value,
131
+ [node.id, node.type],
132
+ ['id', 'type'],
133
+ 'nodes'
134
+ )
135
+ cb()
136
+ }
137
+ const onSelectComputeResourceTree = (node: UI_I_TreeNode): void => {
138
+ $recursion.findAndActivate(
139
+ nodes.value,
140
+ [node.type, node.id],
141
+ ['type', 'id'],
142
+ 'nodes'
143
+ )
144
+ }
145
+ const compatibilityText = computed<[UI_T_CompatibilityStatus, string]>(() => {
146
+ const { selectedNode } = model.value.resource
147
+
148
+ if (!selectedNode) return ['none', '']
149
+
150
+ let res: [UI_T_CompatibilityStatus, string] = [
151
+ 'success',
152
+ localization.value.common.compatibilityChecksSucceeded,
153
+ ]
154
+
155
+ if (selectedNode.type === 'datacenter' || selectedNode.type === 'folder') {
156
+ res = [
157
+ 'error',
158
+ localization.value.common.selectValidClusterOrHostDestination,
159
+ ]
160
+ }
161
+ if (selectedNode.type === 'cluster') {
162
+ const hasHost = !!selectedNode.nodes.length
163
+ if (!hasHost) {
164
+ res = ['error', localization.value.common.clusterNotContainAnyHosts]
165
+ }
166
+ }
167
+
168
+ if (selectedNode.type === 'host') {
169
+ if (selectedNode.state === 'Error') {
170
+ // TODO check Maintenance Mode
171
+ res = [
172
+ 'error',
173
+ localization.value.common.selectedHostDisconnectedMaintenanceMode,
174
+ ]
175
+ }
176
+ }
177
+
178
+ return res
179
+ })
180
+ const onHideAlert = (): void => {
181
+ emits('hide-alert', 3)
182
+ }
183
+ </script>
184
+
185
+ <style lang="scss" scoped>
186
+ @import 'assets/scss/common/mixins';
187
+ .compute-resource {
188
+ @include flex($dir: column);
189
+ height: inherit;
190
+ .tree-view-wrap {
191
+ max-height: 250px;
192
+ min-height: 200px;
193
+ position: relative;
194
+ border: 1px solid #000;
195
+ padding: 5px 0 0 5px;
196
+ overflow: auto;
197
+ }
198
+ &__tabs {
199
+ width: 100%;
200
+ :deep(.nav) {
201
+ margin-top: 0;
202
+ }
203
+ }
204
+ }
205
+ </style>