bfg-common 1.4.114 → 1.4.115
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/components/common/select/input/lib/models/interfaces.ts +1 -0
- package/components/common/wizards/vmNew/common/computeResource/TreeView.vue +61 -0
- package/components/common/wizards/vmNew/common/tooltip/Tooltip.vue +84 -0
- package/components/common/wizards/vmNew/common/validation/compatibility/Compatibility.vue +62 -0
- package/components/common/wizards/vmNew/common/validation/lib/models/enums.ts +5 -0
- package/components/common/wizards/vmNew/migrate/Migrate.vue +231 -0
- package/components/common/wizards/vmNew/migrate/lib/config/constructDataReady.ts +83 -0
- package/components/common/wizards/vmNew/migrate/lib/config/steps.ts +82 -0
- package/components/common/wizards/vmNew/migrate/lib/models/enums.ts +6 -0
- package/components/common/wizards/vmNew/migrate/lib/models/interfaces.ts +38 -0
- package/components/common/wizards/vmNew/migrate/lib/utils.ts +0 -0
- package/components/common/wizards/vmNew/migrate/lib/validations.ts +29 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/ComputeResource.vue +219 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/lib/config/tabsPannel.ts +28 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/lib/models/enums.ts +6 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/lib/models/interfaces.ts +30 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/lib/models/types.ts +12 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/TableView.vue +143 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/config/clusterTable.ts +113 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/config/hostTable.ts +124 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/config/resourcePoolTable.ts +115 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/config/tableKeys.ts +65 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/config/vappsTable.ts +66 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/models/interfaces.ts +50 -0
- package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/models/types.ts +60 -0
- package/components/common/wizards/vmNew/migrate/select/network/Network.vue +125 -0
- package/components/common/wizards/vmNew/migrate/select/network/table/network/Network.vue +114 -0
- package/components/common/wizards/vmNew/migrate/select/network/table/network/lib/config/advancedTable.ts +78 -0
- package/components/common/wizards/vmNew/migrate/select/network/table/network/lib/config/basicTable.ts +70 -0
- package/components/common/wizards/vmNew/migrate/select/network/table/network/lib/config/tableKeys.ts +13 -0
- package/components/common/wizards/vmNew/migrate/select/network/table/network/lib/models/interfaces.ts +12 -0
- package/components/common/wizards/vmNew/migrate/select/network/table/network/lib/models/types.ts +21 -0
- package/components/common/wizards/vmNew/migrate/select/network/table/useAt/UseAt.vue +54 -0
- package/components/common/wizards/vmNew/migrate/select/network/table/useAt/lib/config/tableKeys.ts +7 -0
- package/components/common/wizards/vmNew/migrate/select/network/table/useAt/lib/config/useAtTable.ts +47 -0
- package/components/common/wizards/vmNew/migrate/select/network/table/useAt/lib/models/interfaces.ts +1 -0
- package/components/common/wizards/vmNew/migrate/select/network/table/useAt/lib/models/types.ts +5 -0
- package/components/common/wizards/vmNew/migrate/select/priority/Priority.vue +39 -0
- package/components/common/wizards/vmNew/migrate/select/priority/lib/config/typeOptions.ts +21 -0
- package/components/common/wizards/vmNew/migrate/select/priority/lib/models/types.ts +1 -0
- package/components/common/wizards/vmNew/migrate/select/storage/Storage.vue +201 -0
- package/components/common/wizards/vmNew/migrate/select/storage/configure/batch/Batch.vue +58 -0
- package/components/common/wizards/vmNew/migrate/select/storage/configure/batch/config/virtualDiskFormat.ts +30 -0
- package/components/common/wizards/vmNew/migrate/select/storage/configure/batch/table/Table.vue +118 -0
- package/components/common/wizards/vmNew/migrate/select/storage/configure/batch/table/lib/config/datastoreTable.ts +177 -0
- package/components/common/wizards/vmNew/migrate/select/storage/configure/batch/table/lib/models/types.ts +15 -0
- package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/Disk.vue +68 -0
- package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/table/Table.vue +74 -0
- package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/table/lib/config/diskTable.ts +135 -0
- package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/table/lib/config/tableKeys.ts +15 -0
- package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/table/lib/models/interfaces.ts +24 -0
- package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/table/lib/models/types.ts +13 -0
- package/components/common/wizards/vmNew/migrate/select/storage/lib/config/tabsPannel.ts +20 -0
- package/components/common/wizards/vmNew/migrate/select/storage/lib/models/enums.ts +6 -0
- package/components/common/wizards/vmNew/migrate/select/storage/lib/models/interfaces.ts +14 -0
- package/components/common/wizards/vmNew/migrate/select/storage/lib/models/types.ts +9 -0
- package/components/common/wizards/vmNew/migrate/select/storage/policy/Policy.vue +84 -0
- package/components/common/wizards/vmNew/migrate/select/storage/selectedPerDisk/SelectedPerDisk.vue +80 -0
- package/components/common/wizards/vmNew/migrate/select/targetServer/lib/config/tabsPannel.ts +18 -0
- package/components/common/wizards/vmNew/migrate/select/targetServer/lib/models/types.ts +1 -0
- package/components/common/wizards/vmNew/migrate/select/targetServer/new/New.vue +294 -0
- package/components/common/wizards/vmNew/migrate/select/targetServer/new/lib/config/defaultForm.ts +36 -0
- package/components/common/wizards/vmNew/migrate/select/targetServer/new/lib/models/interfaces.ts +13 -0
- package/components/common/wizards/vmNew/migrate/select/targetServer/saved/Saved.vue +27 -0
- package/components/common/wizards/vmNew/migrate/select/targetServer/targetServer.vue +41 -0
- package/components/common/wizards/vmNew/migrate/select/type/Type.vue +27 -0
- package/components/common/wizards/vmNew/migrate/select/type/lib/config/typeOptions.ts +41 -0
- package/components/common/wizards/vmNew/migrate/select/type/lib/models/interfaces.ts +5 -0
- package/components/common/wizards/vmNew/migrate/select/type/lib/models/types.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
import type {
|
|
3
|
+
UI_I_ValidationReturn,
|
|
4
|
+
UI_I_WizardStep,
|
|
5
|
+
} from '~/components/atoms/wizard/lib/models/interfaces'
|
|
6
|
+
import type Wizard from '~/components/atoms/wizard/lib/utils/utils'
|
|
7
|
+
|
|
8
|
+
export const checkSelectedDatastoreSync = (
|
|
9
|
+
localization: UI_I_Localization,
|
|
10
|
+
name: string,
|
|
11
|
+
wizard: Wizard,
|
|
12
|
+
value: UI_I_WizardStep[]
|
|
13
|
+
): UI_I_ValidationReturn => {
|
|
14
|
+
let stepHasError = false
|
|
15
|
+
|
|
16
|
+
if (!name) {
|
|
17
|
+
stepHasError = wizard.setValidation(3, 'name', {
|
|
18
|
+
fieldMessage: '',
|
|
19
|
+
alertMessage: localization.common.selectValidDestinationStorage,
|
|
20
|
+
})
|
|
21
|
+
} else if (wizard.hasMessage(3, 'name')) {
|
|
22
|
+
value = wizard.removeValidation(3, 'name', value)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
newValue: value,
|
|
27
|
+
stepHasError,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="compute-resource">
|
|
3
|
+
<atoms-alert
|
|
4
|
+
v-if="errorMessages.length"
|
|
5
|
+
test-id="compute-resource-alert"
|
|
6
|
+
status="alert-danger"
|
|
7
|
+
:items="errorMessages"
|
|
8
|
+
@remove="onHideErrorMessageAlert"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<div
|
|
12
|
+
v-if="props.migrateType === 'resource-storage'"
|
|
13
|
+
class="tree-view-wrap mt-1"
|
|
14
|
+
>
|
|
15
|
+
<common-wizards-vm-common-compute-resource-tree-view
|
|
16
|
+
v-model="computeResourceDataLocal.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
|
+
test-id="migrate-select-storage-tabs"
|
|
27
|
+
:items="selectStorageTabs"
|
|
28
|
+
size="small"
|
|
29
|
+
class="compute-resource__tabs"
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
<common-wizards-vm-migrate-select-compute-resource-table-view
|
|
33
|
+
v-model:selected-data="selectedTableDataKeys[activeTab]"
|
|
34
|
+
:get-compute-resource-data="props.getComputeResourceData"
|
|
35
|
+
:data-table="props.computeResourceData?.items || []"
|
|
36
|
+
:total-items="props.computeResourceData?.total_items || 0"
|
|
37
|
+
:total-pages="props.computeResourceData?.total_pages || 1"
|
|
38
|
+
:type="activeTab"
|
|
39
|
+
/>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<common-wizards-vm-common-validation-compatibility
|
|
43
|
+
:loading="!computeResourceDataLocal.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_E_ComputeResourceTabKamelKeys } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/enums'
|
|
57
|
+
import type { UI_T_VmMigrateType } from '~/components/common/wizards/vm/migrate/lib/models/types'
|
|
58
|
+
import type { UI_I_SelectedTableDataKeys } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/interfaces'
|
|
59
|
+
import { vmMigrateComputeResourceTabsFunc } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/config/tabsPannel'
|
|
60
|
+
|
|
61
|
+
const props = defineProps<{
|
|
62
|
+
submit: number
|
|
63
|
+
getComputeResourceData: (payload: UI_I_TablePayload) => Promise<void>
|
|
64
|
+
migrateType: UI_T_VmMigrateType
|
|
65
|
+
computeResourceData: any
|
|
66
|
+
computeResourceTree: UI_I_TreeNode
|
|
67
|
+
}>()
|
|
68
|
+
const emits = defineEmits<{
|
|
69
|
+
(event: 'next-step', value: any): void
|
|
70
|
+
}>()
|
|
71
|
+
|
|
72
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
73
|
+
const { $recursion } = useNuxtApp()
|
|
74
|
+
|
|
75
|
+
const activeTab = ref<UI_T_SelectComputeResourceTabType>('host')
|
|
76
|
+
const selectStorageTabs = computed<UI_I_CollapseNavItem[]>(() =>
|
|
77
|
+
vmMigrateComputeResourceTabsFunc(localization.value)
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
const computeResourceDataLocal = ref<any>({
|
|
81
|
+
selectedNode: null,
|
|
82
|
+
host: null,
|
|
83
|
+
cluster: null,
|
|
84
|
+
resourcePool: null,
|
|
85
|
+
vApps: null,
|
|
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
|
+
computeResourceDataLocal.value[dataKeys] = 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 } = computeResourceDataLocal.value
|
|
146
|
+
|
|
147
|
+
if (!selectedNode) return ['Success', '']
|
|
148
|
+
|
|
149
|
+
let res: [string, string] = ['Success', 'compatibilityChecksSucceeded']
|
|
150
|
+
|
|
151
|
+
if (selectedNode.type === 'datacenter' || selectedNode.type === 'folder') {
|
|
152
|
+
res = ['Error', 'selectValidClusterOrHostDestination']
|
|
153
|
+
}
|
|
154
|
+
if (selectedNode.type === 'cluster') {
|
|
155
|
+
const hasHost = !!selectedNode.nodes.length
|
|
156
|
+
if (!hasHost) {
|
|
157
|
+
res = ['Error', 'clusterNotContainAnyHosts']
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (selectedNode.type === 'host') {
|
|
162
|
+
if (selectedNode.state === 'Error') {
|
|
163
|
+
// TODO check Maintenance Mode
|
|
164
|
+
res = ['Error', 'selectedHostDisconnectedMaintenanceMode']
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return res
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
const errorMessages = ref<string[]>([])
|
|
172
|
+
const onHideErrorMessageAlert = (): void => {
|
|
173
|
+
errorMessages.value = []
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const checkValidityBlock = (): boolean => {
|
|
177
|
+
const hasSelectedData = Object.values(computeResourceDataLocal.value).some(
|
|
178
|
+
(value) => value !== null
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
if (!hasSelectedData) {
|
|
182
|
+
const errorText = localization.value.common.selectValidDestinationComputeResource
|
|
183
|
+
|
|
184
|
+
errorMessages.value = [errorText]
|
|
185
|
+
return false
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
onHideErrorMessageAlert()
|
|
189
|
+
emits('next-step', {
|
|
190
|
+
...computeResourceDataLocal.value,
|
|
191
|
+
})
|
|
192
|
+
return true
|
|
193
|
+
}
|
|
194
|
+
watch(
|
|
195
|
+
() => props.submit,
|
|
196
|
+
() => {
|
|
197
|
+
checkValidityBlock()
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
</script>
|
|
201
|
+
|
|
202
|
+
<style lang="scss" scoped>
|
|
203
|
+
.compute-resource {
|
|
204
|
+
.tree-view-wrap {
|
|
205
|
+
max-height: 250px;
|
|
206
|
+
min-height: 200px;
|
|
207
|
+
position: relative;
|
|
208
|
+
border: 1px solid #000;
|
|
209
|
+
padding: 5px 0 0 5px;
|
|
210
|
+
overflow: auto;
|
|
211
|
+
}
|
|
212
|
+
&__tabs {
|
|
213
|
+
width: 100%;
|
|
214
|
+
:deep(.nav) {
|
|
215
|
+
margin-top: 0;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
</style>
|
package/components/common/wizards/vmNew/migrate/select/computeResource/lib/config/tabsPannel.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
|
|
3
|
+
export const vmMigrateComputeResourceTabsFunc = (
|
|
4
|
+
localization: UI_I_Localization
|
|
5
|
+
): UI_I_CollapseNavItem[] => {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
text: localization.common.hosts,
|
|
9
|
+
value: 'host',
|
|
10
|
+
disabled: false,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
text: localization.common.clusters,
|
|
14
|
+
value: 'cluster',
|
|
15
|
+
disabled: false,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
text: localization.common.resourcePools,
|
|
19
|
+
value: 'resource-pool',
|
|
20
|
+
disabled: false,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
text: localization.common.vApps,
|
|
24
|
+
value: 'v-apps',
|
|
25
|
+
disabled: false,
|
|
26
|
+
},
|
|
27
|
+
]
|
|
28
|
+
}
|
package/components/common/wizards/vmNew/migrate/select/computeResource/lib/models/interfaces.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { UI_T_ComputeResourceTableItem } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/types'
|
|
2
|
+
import type {
|
|
3
|
+
UI_I_HostTableItem,
|
|
4
|
+
UI_I_ClusterTableItem,
|
|
5
|
+
UI_I_ResourcePoolsTableItem,
|
|
6
|
+
UI_I_VAppsTableItem,
|
|
7
|
+
} from '~/components/common/wizards/vm/migrate/select/computeResource/tableView/lib/models/interfaces'
|
|
8
|
+
import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
|
|
9
|
+
import type { API_UI_I_DataTable } from '~/lib/models/table/interfaces'
|
|
10
|
+
|
|
11
|
+
export interface UI_I_SelectedTableDataKeys {
|
|
12
|
+
host: UI_I_HostTableItem | null
|
|
13
|
+
cluster: UI_I_ClusterTableItem | null
|
|
14
|
+
'resource-pool': UI_I_ResourcePoolsTableItem | null
|
|
15
|
+
'v-apps': UI_I_VAppsTableItem | null
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface UI_I_ComputeResourceDataLocal {
|
|
19
|
+
selectedNode: UI_I_TreeNode | null
|
|
20
|
+
host: UI_I_HostTableItem | null
|
|
21
|
+
cluster: UI_I_ClusterTableItem | null
|
|
22
|
+
resourcePool: UI_I_ResourcePoolsTableItem | null
|
|
23
|
+
vApps: UI_I_VAppsTableItem | null
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface API_UI_I_ComputeResourceTableData
|
|
27
|
+
extends API_UI_I_DataTable<UI_T_ComputeResourceTableItem[]> {}
|
|
28
|
+
|
|
29
|
+
export interface UI_I_ComputeResourceTableData
|
|
30
|
+
extends API_UI_I_ComputeResourceTableData {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UI_I_HostTableItem,
|
|
3
|
+
UI_I_ClusterTableItem,
|
|
4
|
+
UI_I_ResourcePoolsTableItem,
|
|
5
|
+
UI_I_VAppsTableItem,
|
|
6
|
+
} from '~/components/common/wizards/vm/migrate/select/computeResource/tableView/lib/models/interfaces'
|
|
7
|
+
|
|
8
|
+
export type UI_T_ComputeResourceTableItem =
|
|
9
|
+
| UI_I_HostTableItem
|
|
10
|
+
| UI_I_ClusterTableItem
|
|
11
|
+
| UI_I_ResourcePoolsTableItem
|
|
12
|
+
| UI_I_VAppsTableItem
|
package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/TableView.vue
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="data-table-view">
|
|
3
|
+
<atoms-table-data-grid
|
|
4
|
+
v-model:selected-row="selectedRow"
|
|
5
|
+
v-model:column-keys="columnKeys"
|
|
6
|
+
v-model:page-size="pagination.pageSize"
|
|
7
|
+
v-model:page="pagination.page"
|
|
8
|
+
:head-items="headItems"
|
|
9
|
+
:body-items="bodyItems"
|
|
10
|
+
:total-items="props.totalItems"
|
|
11
|
+
:total-pages="props.totalPages"
|
|
12
|
+
:loading="loading"
|
|
13
|
+
class="data-table"
|
|
14
|
+
test-id="compute-resource-table"
|
|
15
|
+
server-off
|
|
16
|
+
hide-page-size
|
|
17
|
+
hide-pagination
|
|
18
|
+
>
|
|
19
|
+
<template #icon="{ item }">
|
|
20
|
+
<span :class="['datagrid-cell-icon', item.data.iconClassName]" />
|
|
21
|
+
|
|
22
|
+
<span class="text-ellipsis">
|
|
23
|
+
{{ item.text }}
|
|
24
|
+
</span>
|
|
25
|
+
</template>
|
|
26
|
+
<template #progress="{ item }">
|
|
27
|
+
<div class="flex-align-center w-100">
|
|
28
|
+
<div class="progress flex-1">
|
|
29
|
+
<progress class="progress-block" :max="100" :value="item.data" />
|
|
30
|
+
</div>
|
|
31
|
+
<span class="text-ellipsis ml-1" :title="item.text">{{
|
|
32
|
+
item.text
|
|
33
|
+
}}</span>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
</atoms-table-data-grid>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script lang="ts" setup>
|
|
41
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
42
|
+
import type {
|
|
43
|
+
UI_I_ColumnKey,
|
|
44
|
+
UI_I_HeadItem,
|
|
45
|
+
UI_I_BodyItem,
|
|
46
|
+
} from '~/components/atoms/table/dataGrid/lib/models/interfaces'
|
|
47
|
+
import type { UI_T_SelectComputeResourceTabType } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/types'
|
|
48
|
+
import type { UI_I_TablePayload, UI_I_Pagination } from '~/lib/models/table/interfaces'
|
|
49
|
+
import type { UI_T_ComputeResourceTableItem } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/types'
|
|
50
|
+
import * as hostTable from '~/components/common/wizards/vm/migrate/select/computeResource/tableView/lib/config/hostTable'
|
|
51
|
+
import * as clusterTable from '~/components/common/wizards/vm/migrate/select/computeResource/tableView/lib/config/clusterTable'
|
|
52
|
+
import * as resourcePoolTable from '~/components/common/wizards/vm/migrate/select/computeResource/tableView/lib/config/resourcePoolTable'
|
|
53
|
+
import * as vAppsTable from '~/components/common/wizards/vm/migrate/select/computeResource/tableView/lib/config/vappsTable'
|
|
54
|
+
|
|
55
|
+
const props = defineProps<{
|
|
56
|
+
getComputeResourceData: (payload: UI_I_TablePayload) => Promise<void>
|
|
57
|
+
selectedData: number
|
|
58
|
+
dataTable: UI_T_ComputeResourceTableItem[]
|
|
59
|
+
totalItems: number
|
|
60
|
+
totalPages: number
|
|
61
|
+
type: UI_T_SelectComputeResourceTabType
|
|
62
|
+
}>()
|
|
63
|
+
const emits = defineEmits<{
|
|
64
|
+
(event: 'update:selected-data', value: number): void
|
|
65
|
+
}>()
|
|
66
|
+
|
|
67
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
68
|
+
|
|
69
|
+
const loading = ref<boolean>(false)
|
|
70
|
+
const pagination = ref<UI_I_Pagination>({
|
|
71
|
+
page: 1,
|
|
72
|
+
pageSize: 100,
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
const table: any = {
|
|
76
|
+
host: hostTable,
|
|
77
|
+
cluster: clusterTable,
|
|
78
|
+
'resource-pool': resourcePoolTable,
|
|
79
|
+
'v-apps': vAppsTable,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const getData = async (
|
|
83
|
+
type: UI_T_SelectComputeResourceTabType
|
|
84
|
+
): Promise<void> => {
|
|
85
|
+
const payload: UI_I_TablePayload = {
|
|
86
|
+
pagination: pagination.value,
|
|
87
|
+
sortBy: null,
|
|
88
|
+
schema: 'full',
|
|
89
|
+
type,
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
props.getComputeResourceData(payload).then(() => {})
|
|
93
|
+
}
|
|
94
|
+
watch(
|
|
95
|
+
() => props.type,
|
|
96
|
+
(newValue: UI_T_SelectComputeResourceTabType) => {
|
|
97
|
+
getData(newValue)
|
|
98
|
+
},
|
|
99
|
+
{ deep: true, immediate: true }
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
const headItems = computed<UI_I_HeadItem[]>(() =>
|
|
103
|
+
table[props.type].headItems(localization.value)
|
|
104
|
+
)
|
|
105
|
+
const columnKeys = computed<UI_I_ColumnKey[]>(() =>
|
|
106
|
+
table[props.type].columnKeys(localization.value)
|
|
107
|
+
)
|
|
108
|
+
watch(localization, () => {
|
|
109
|
+
columnKeys.value = table[props.type].columnKeys(localization.value)
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
const bodyItems = computed<UI_I_BodyItem[][]>(() => {
|
|
113
|
+
return table[props.type].bodyItems(props.dataTable, localization.value)
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const selectedRow = computed<number>({
|
|
117
|
+
get() {
|
|
118
|
+
return props.selectedData
|
|
119
|
+
},
|
|
120
|
+
set(newValue: number) {
|
|
121
|
+
emits('update:selected-data', newValue)
|
|
122
|
+
},
|
|
123
|
+
})
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<style lang="scss" scoped>
|
|
127
|
+
@import 'assets/scss/common/mixins.scss';
|
|
128
|
+
.data-table-view {
|
|
129
|
+
@include flex($dir: column);
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
height: inherit;
|
|
132
|
+
max-height: 250px;
|
|
133
|
+
.data-table {
|
|
134
|
+
@include flex($dir: column);
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
height: inherit;
|
|
138
|
+
:deep(.datagrid-outer-wrapper) {
|
|
139
|
+
height: inherit;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
</style>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UI_I_ColumnKey,
|
|
3
|
+
UI_I_HeadItem,
|
|
4
|
+
UI_I_BodyItem,
|
|
5
|
+
} from '~/components/atoms/table/dataGrid/lib/models/interfaces'
|
|
6
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
7
|
+
import type { UI_I_ClusterTableItem } from '~/components/common/wizards/vm/migrate/select/computeResource/tableView/lib/models/interfaces'
|
|
8
|
+
import { clusterTableItemKeys } from '~/components/common/wizards/vm/migrate/select/computeResource/tableView/lib/config/tableKeys'
|
|
9
|
+
import {
|
|
10
|
+
constructColumnKey,
|
|
11
|
+
constructHeadItem,
|
|
12
|
+
} from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
|
|
13
|
+
|
|
14
|
+
const getItems = (
|
|
15
|
+
localization: UI_I_Localization
|
|
16
|
+
): [string, boolean, string, string][] => {
|
|
17
|
+
return [
|
|
18
|
+
[localization.common.name, true, '180px', clusterTableItemKeys[0]],
|
|
19
|
+
[localization.common.availableCpu, true, '180px', clusterTableItemKeys[1]],
|
|
20
|
+
[localization.common.availableMemory, true, '180px', clusterTableItemKeys[2]],
|
|
21
|
+
[localization.common.availableStorage, true, '180px', clusterTableItemKeys[3]],
|
|
22
|
+
[localization.common.vSphere_DRS, true, '180px', clusterTableItemKeys[4]],
|
|
23
|
+
[localization.common.vSphere_HA, true, '180px', clusterTableItemKeys[5]],
|
|
24
|
+
[localization.common.totalCpu, false, '180px', clusterTableItemKeys[6]],
|
|
25
|
+
[localization.common.totalMemory, false, '180px', clusterTableItemKeys[7]],
|
|
26
|
+
[localization.common.totalStorage, false, '180px', clusterTableItemKeys[8]],
|
|
27
|
+
[localization.common.vms, false, '180px', clusterTableItemKeys[9]],
|
|
28
|
+
[localization.common.hosts, false, '180px', clusterTableItemKeys[10]],
|
|
29
|
+
[localization.common.cpus, false, '180px', clusterTableItemKeys[11]],
|
|
30
|
+
[localization.common.datastores, false, '180px', clusterTableItemKeys[12]],
|
|
31
|
+
[localization.common.vSAN, false, '180px', clusterTableItemKeys[13]],
|
|
32
|
+
[localization.common.vc, false, '180px', clusterTableItemKeys[14]],
|
|
33
|
+
[localization.common.evcCpuMode, true, '180px', clusterTableItemKeys[15]],
|
|
34
|
+
[localization.common.evcGraphicsMode, true, '240px', clusterTableItemKeys[16]],
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const columnKeys = (
|
|
39
|
+
localization: UI_I_Localization
|
|
40
|
+
): UI_I_ColumnKey[] => {
|
|
41
|
+
const result: UI_I_ColumnKey[] = []
|
|
42
|
+
getItems(localization).forEach((item, i) => {
|
|
43
|
+
const col = i === 0 ? 'icon' : `col${i}`
|
|
44
|
+
result.push(constructColumnKey(col, item[0], item[1]))
|
|
45
|
+
})
|
|
46
|
+
return result
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
|
|
50
|
+
const result: UI_I_HeadItem[] = []
|
|
51
|
+
getItems(localization).forEach((item, i) => {
|
|
52
|
+
const col = i === 0 ? 'icon' : `col${i}`
|
|
53
|
+
result.push(constructHeadItem(col, item[0], item[3], false, item[2]))
|
|
54
|
+
})
|
|
55
|
+
return result
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const bodyItems = (data: UI_I_ClusterTableItem[]): UI_I_BodyItem[][] => {
|
|
59
|
+
const { $binary } = useNuxtApp()
|
|
60
|
+
|
|
61
|
+
const bodyItems: UI_I_BodyItem[][] = []
|
|
62
|
+
data.forEach((cluster, key) => {
|
|
63
|
+
bodyItems.push([
|
|
64
|
+
{
|
|
65
|
+
key: 'icon',
|
|
66
|
+
text: cluster[clusterTableItemKeys[0]],
|
|
67
|
+
data: { iconClassName: 'vsphere-icon-cluster' },
|
|
68
|
+
id: key,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: 'col1',
|
|
72
|
+
text: $binary.roundHz(cluster[clusterTableItemKeys[1]]),
|
|
73
|
+
id: key,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: 'col2',
|
|
77
|
+
text: $binary.round(cluster[clusterTableItemKeys[2]]),
|
|
78
|
+
id: key,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: 'col3',
|
|
82
|
+
text: $binary.round(cluster[clusterTableItemKeys[3]]),
|
|
83
|
+
id: key,
|
|
84
|
+
},
|
|
85
|
+
{ key: 'col4', text: cluster[clusterTableItemKeys[4]], id: key },
|
|
86
|
+
{ key: 'col5', text: cluster[clusterTableItemKeys[5]], id: key },
|
|
87
|
+
{
|
|
88
|
+
key: 'col6',
|
|
89
|
+
text: $binary.roundHz(cluster[clusterTableItemKeys[6]]),
|
|
90
|
+
id: key,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: 'col7',
|
|
94
|
+
text: $binary.round(cluster[clusterTableItemKeys[7]]),
|
|
95
|
+
id: key,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: 'col8',
|
|
99
|
+
text: $binary.round(cluster[clusterTableItemKeys[8]]),
|
|
100
|
+
id: key,
|
|
101
|
+
},
|
|
102
|
+
{ key: 'col9', text: cluster[clusterTableItemKeys[9]], id: key },
|
|
103
|
+
{ key: 'col10', text: cluster[clusterTableItemKeys[10]], id: key },
|
|
104
|
+
{ key: 'col11', text: cluster[clusterTableItemKeys[11]], id: key },
|
|
105
|
+
{ key: 'col12', text: cluster[clusterTableItemKeys[12]], id: key },
|
|
106
|
+
{ key: 'col13', text: cluster[clusterTableItemKeys[13]], id: key },
|
|
107
|
+
{ key: 'col14', text: cluster[clusterTableItemKeys[14]], id: key },
|
|
108
|
+
{ key: 'col15', text: cluster[clusterTableItemKeys[15]], id: key },
|
|
109
|
+
{ key: 'col16', text: cluster[clusterTableItemKeys[16]], id: key },
|
|
110
|
+
])
|
|
111
|
+
})
|
|
112
|
+
return bodyItems
|
|
113
|
+
}
|