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,201 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="select-storage">
|
|
3
|
+
<atoms-alert
|
|
4
|
+
v-show="props.alertMessages?.length"
|
|
5
|
+
test-id="select-storage-alert"
|
|
6
|
+
status="alert-danger"
|
|
7
|
+
:items="props.alertMessages"
|
|
8
|
+
@remove="onHideAlert"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<common-wizards-vm-migrate-select-storage-selected-per-disk
|
|
12
|
+
v-if="isShowSelectedPerDisks"
|
|
13
|
+
v-model="isShowSelectedPerDisks"
|
|
14
|
+
v-model:active-tab="model.configure.type"
|
|
15
|
+
v-model:connected-storage-id-local="connectedStorageIdLocal"
|
|
16
|
+
:data="selectedPerDisks"
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<atoms-tabs
|
|
20
|
+
v-else
|
|
21
|
+
v-model="model.configure.type"
|
|
22
|
+
test-id="migrate-select-storage-tabs"
|
|
23
|
+
:items="selectStorageTabs"
|
|
24
|
+
size="small"
|
|
25
|
+
class="select-storage__tabs"
|
|
26
|
+
@change="onChangeMigrateMode"
|
|
27
|
+
/>
|
|
28
|
+
|
|
29
|
+
<common-wizards-vm-new-migrate-select-storage-configure-batch
|
|
30
|
+
v-show="model.configure.type === 'batch-configure'"
|
|
31
|
+
v-model="model"
|
|
32
|
+
:get-datastore-table-func="props.getDatastoreTableFunc"
|
|
33
|
+
:datastore="props.datastore"
|
|
34
|
+
:connected-storage-id="connectedStorageId"
|
|
35
|
+
:is-hide-select-disk-format="isHideSelectDiskFormat"
|
|
36
|
+
>
|
|
37
|
+
<template v-if="isShowSelectedPerDisks" #buttonConfirm>
|
|
38
|
+
<button
|
|
39
|
+
class="btn btn-sm btn-primary"
|
|
40
|
+
data-id="apply-selected-per-disks-button"
|
|
41
|
+
@click="onApplyChanges"
|
|
42
|
+
>
|
|
43
|
+
{{ localization.common.confirm }}
|
|
44
|
+
</button>
|
|
45
|
+
</template>
|
|
46
|
+
</common-wizards-vm-new-migrate-select-storage-configure-batch>
|
|
47
|
+
|
|
48
|
+
<common-wizards-vm-new-migrate-select-storage-configure-disk
|
|
49
|
+
v-show="model.configure.type === 'configure-disk'"
|
|
50
|
+
v-model="isShowSelectedPerDisks"
|
|
51
|
+
v-model:selected-per-disk-keys="selectedPerDiskKeys"
|
|
52
|
+
v-model:active-tab="model.configure.type"
|
|
53
|
+
:configure-per-disks="model.configure.disks"
|
|
54
|
+
@update-selected-per-disks="onChangePerDiskStorage"
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
<common-wizards-vm-common-validation-compatibility
|
|
58
|
+
:loading="!model.storage"
|
|
59
|
+
:status="'Success'"
|
|
60
|
+
text="compatibilityChecksSucceeded"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script lang="ts" setup>
|
|
66
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
67
|
+
import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
|
68
|
+
import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
|
|
69
|
+
import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
|
|
70
|
+
import type { UI_I_StorageConfigurePerDiskItem } from '~/components/common/wizards/vm/migrate/select/storage/table/disk/lib/models/interfaces'
|
|
71
|
+
import type { UI_I_SelectStorageReadyData } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/interfaces'
|
|
72
|
+
import type { UI_I_MigrateFormLocal } from '~/components/common/wizards/vmNew/migrate/lib/models/interfaces'
|
|
73
|
+
import { vmMigrateSelectStorageTabsFunc } from '~/components/common/wizards/vm/migrate/select/storage/lib/config/tabsPannel'
|
|
74
|
+
|
|
75
|
+
const props = defineProps<{
|
|
76
|
+
alertMessages: string[]
|
|
77
|
+
submit: number
|
|
78
|
+
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
|
79
|
+
datastore: UI_I_DatastoreTableItem[]
|
|
80
|
+
connectedStorageIdDefault: string | null
|
|
81
|
+
configurePerDisks: UI_I_StorageConfigurePerDiskItem[]
|
|
82
|
+
}>()
|
|
83
|
+
const model = defineModel<UI_I_MigrateFormLocal>({ required: true })
|
|
84
|
+
const emits = defineEmits<{
|
|
85
|
+
(event: 'hide-alert', value: number): void
|
|
86
|
+
(event: 'next-step', value: UI_I_SelectStorageReadyData): void
|
|
87
|
+
}>()
|
|
88
|
+
|
|
89
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
90
|
+
|
|
91
|
+
const selectStorageTabs = computed<UI_I_CollapseNavItem[]>(() =>
|
|
92
|
+
vmMigrateSelectStorageTabsFunc(localization.value)
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
const isShowSelectedPerDisks = ref<boolean>(false)
|
|
96
|
+
|
|
97
|
+
const selectedPerDiskKeys = ref<number[]>([])
|
|
98
|
+
const selectedPerDisks = ref<UI_I_StorageConfigurePerDiskItem[]>([])
|
|
99
|
+
|
|
100
|
+
const connectedStorageIdLocal = ref<string>('')
|
|
101
|
+
const connectedStorageId = computed<string | null>(
|
|
102
|
+
() => connectedStorageIdLocal.value || props.connectedStorageIdDefault
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
const onChangeMigrateMode = (event: string): void => {
|
|
106
|
+
if (event === 'batch-configure') {
|
|
107
|
+
connectedStorageIdLocal.value = ''
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const onChangePerDiskStorage = (
|
|
111
|
+
event: UI_I_StorageConfigurePerDiskItem[]
|
|
112
|
+
): void => {
|
|
113
|
+
connectedStorageIdLocal.value = event[0].extra.datastore_id
|
|
114
|
+
model.value.disk_format = event[0].disk_format
|
|
115
|
+
|
|
116
|
+
selectedPerDisks.value = event
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const onApplyChanges = (): void => {
|
|
120
|
+
/* TODO сделать рефакторинг потом */
|
|
121
|
+
model.value.configure.disks.forEach((disk) => {
|
|
122
|
+
const selectedDisk = selectedPerDisks.value.find(
|
|
123
|
+
(selected) =>
|
|
124
|
+
selected.virtual_machine === disk.virtual_machine &&
|
|
125
|
+
selected.file === disk.file &&
|
|
126
|
+
selected.extra.datastore_id === disk.extra.datastore_id
|
|
127
|
+
)!
|
|
128
|
+
|
|
129
|
+
if (selectedDisk) {
|
|
130
|
+
const { storage, disk_format } = model.value
|
|
131
|
+
|
|
132
|
+
// ;({ name: disk.storage, id: disk.extra.datastore_id } = storage)
|
|
133
|
+
disk.storage = storage.name
|
|
134
|
+
disk.extra.datastore_id = storage.id
|
|
135
|
+
disk.disk_format = disk_format
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
isShowSelectedPerDisks.value = false
|
|
140
|
+
model.value.configure.type = 'configure-disk'
|
|
141
|
+
selectedPerDisks.value = []
|
|
142
|
+
selectedPerDiskKeys.value = []
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const isHideSelectDiskFormat = computed<boolean>(() => {
|
|
146
|
+
return (
|
|
147
|
+
isShowSelectedPerDisks &&
|
|
148
|
+
selectedPerDisks.value.length === 1 &&
|
|
149
|
+
selectedPerDisks.value[0].file === 'Configuration file'
|
|
150
|
+
)
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
const checkValidityBlock = (): boolean => {
|
|
154
|
+
if (!model.value.storage) {
|
|
155
|
+
return false
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const isActivePerDiskTab = model.value.configure.type === 'configure-disk'
|
|
159
|
+
emits('next-step', {
|
|
160
|
+
...model.value,
|
|
161
|
+
tab: model.value.configure.type,
|
|
162
|
+
// ...(isActivePerDiskTab && { configureDisks: props.configurePerDisks }),
|
|
163
|
+
configureDisks: isActivePerDiskTab
|
|
164
|
+
? model.value.configure.disks
|
|
165
|
+
: props.configurePerDisks,
|
|
166
|
+
})
|
|
167
|
+
return true
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
watch(
|
|
171
|
+
() => props.configurePerDisks,
|
|
172
|
+
(newValue: UI_I_StorageConfigurePerDiskItem) => {
|
|
173
|
+
model.value.configure.disks = newValue
|
|
174
|
+
},
|
|
175
|
+
{ immediate: true }
|
|
176
|
+
)
|
|
177
|
+
watch(
|
|
178
|
+
() => props.submit,
|
|
179
|
+
() => {
|
|
180
|
+
checkValidityBlock()
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
const onHideAlert = (): void => {
|
|
185
|
+
emits('hide-alert', 3)
|
|
186
|
+
}
|
|
187
|
+
</script>
|
|
188
|
+
|
|
189
|
+
<style lang="scss" scoped>
|
|
190
|
+
@import 'assets/scss/common/mixins.scss';
|
|
191
|
+
.select-storage {
|
|
192
|
+
@include flex($dir: column);
|
|
193
|
+
height: inherit;
|
|
194
|
+
&__tabs {
|
|
195
|
+
width: 100%;
|
|
196
|
+
:deep(.nav) {
|
|
197
|
+
margin-top: 0;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
</style>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="configure-batch-mode">
|
|
3
|
+
<common-select-input
|
|
4
|
+
v-if="!isHideSelectDiskFormat"
|
|
5
|
+
v-model="model.disk_format"
|
|
6
|
+
:data="virtualDiskFormatOptions"
|
|
7
|
+
:label="localization.common.selectVirtualDiskFormat"
|
|
8
|
+
class="configure-batch-mode__disk-format"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<common-wizards-vm-new-migrate-select-storage-configure-batch-table
|
|
12
|
+
v-model="model.storage"
|
|
13
|
+
:get-datastore-table-func="props.getDatastoreTableFunc"
|
|
14
|
+
:datastore="props.datastore"
|
|
15
|
+
:connected-storage-id="props.connectedStorageId"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<div
|
|
19
|
+
v-if="$slots.buttonConfirm"
|
|
20
|
+
class="clr-justify-content-end configure-batch-mode__button"
|
|
21
|
+
>
|
|
22
|
+
<slot name="buttonConfirm"></slot>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script lang="ts" setup>
|
|
28
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
29
|
+
import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
|
30
|
+
import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
|
31
|
+
import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
|
|
32
|
+
import type { UI_I_MigrateFormLocal } from '~/components/common/wizards/vmNew/migrate/lib/models/interfaces'
|
|
33
|
+
import { virtualDiskFormatOptionsFunc } from '~/components/common/wizards/vmNew/migrate/select/storage/configure/batch/config/virtualDiskFormat'
|
|
34
|
+
|
|
35
|
+
const props = defineProps<{
|
|
36
|
+
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
|
37
|
+
datastore: UI_I_DatastoreTableItem[]
|
|
38
|
+
connectedStorageId: string | null
|
|
39
|
+
isHideSelectDiskFormat: boolean
|
|
40
|
+
}>()
|
|
41
|
+
const model = defineModel<UI_I_MigrateFormLocal>({ required: true })
|
|
42
|
+
|
|
43
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
44
|
+
|
|
45
|
+
const virtualDiskFormatOptions = computed<UI_I_OptionItem[]>(() =>
|
|
46
|
+
virtualDiskFormatOptionsFunc()
|
|
47
|
+
)
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<style lang="scss" scoped>
|
|
51
|
+
.configure-batch-mode {
|
|
52
|
+
&__disk-format {
|
|
53
|
+
}
|
|
54
|
+
&__button {
|
|
55
|
+
display: flex;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
2
|
+
|
|
3
|
+
export const virtualDiskFormatOptionsFunc = (): UI_I_SelectInputItem[] => {
|
|
4
|
+
return [
|
|
5
|
+
{
|
|
6
|
+
label: 'Same Format as source',
|
|
7
|
+
value: 0,
|
|
8
|
+
testId: 'migrate-disk-format-same-as-source',
|
|
9
|
+
// value: 'same-format-source',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: 'Thick Provision Lazy Zeroed',
|
|
13
|
+
value: 2,
|
|
14
|
+
testId: 'migrate-disk-format-thick-provision-lazy-zeroed',
|
|
15
|
+
// value: 'thick-provision-lazy-zeroed',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: 'Thick Provision Eager Zeroed',
|
|
19
|
+
value: 3,
|
|
20
|
+
testId: 'migrate-disk-format-thick-provision-eager-zeroed',
|
|
21
|
+
// value: 'thick-provision-eager-zeroed',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: 'Thin Provision',
|
|
25
|
+
value: 1,
|
|
26
|
+
testId: 'migrate-disk-format-thin-provision',
|
|
27
|
+
// value: 'thin-provision',
|
|
28
|
+
},
|
|
29
|
+
]
|
|
30
|
+
}
|
package/components/common/wizards/vmNew/migrate/select/storage/configure/batch/table/Table.vue
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="table-wrap">
|
|
3
|
+
<atoms-table-data-grid
|
|
4
|
+
v-model:selected-row="selectedStorageKeyLocal"
|
|
5
|
+
v-model:column-keys="columnKeys"
|
|
6
|
+
v-model:page-size="pagination.pageSize"
|
|
7
|
+
v-model:page="pagination.page"
|
|
8
|
+
type="radio"
|
|
9
|
+
test-id="datastore-table"
|
|
10
|
+
:head-items="headItems"
|
|
11
|
+
:body-items="bodyItems"
|
|
12
|
+
:total-items="bodyItems.length"
|
|
13
|
+
:total-pages="1"
|
|
14
|
+
server-off
|
|
15
|
+
hide-page-size
|
|
16
|
+
@sorting="sorting"
|
|
17
|
+
@change="selectStorageFromTable"
|
|
18
|
+
>
|
|
19
|
+
<template #icon="{ item }">
|
|
20
|
+
<span :class="['datagrid-cell-icon', item.data]" />
|
|
21
|
+
<span class="text-ellipsis">
|
|
22
|
+
{{ item.text }}
|
|
23
|
+
</span>
|
|
24
|
+
</template>
|
|
25
|
+
</atoms-table-data-grid>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script lang="ts" setup>
|
|
30
|
+
import type {
|
|
31
|
+
UI_I_ColumnKey,
|
|
32
|
+
UI_I_HeadItem,
|
|
33
|
+
UI_I_BodyItem,
|
|
34
|
+
} from '~/components/atoms/table/dataGrid/lib/models/interfaces'
|
|
35
|
+
import type {
|
|
36
|
+
UI_I_TablePayload,
|
|
37
|
+
UI_I_Pagination,
|
|
38
|
+
} from '~/lib/models/table/interfaces'
|
|
39
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
40
|
+
import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
|
|
41
|
+
import * as table from '~/components/common/wizards/vm/migrate/select/storage/table/datastore/lib/config/config'
|
|
42
|
+
|
|
43
|
+
const props = defineProps<{
|
|
44
|
+
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
|
45
|
+
datastore: UI_I_DatastoreTableItem[]
|
|
46
|
+
connectedStorageId: string | null
|
|
47
|
+
}>()
|
|
48
|
+
const modelStorageLocal = defineModel<UI_I_DatastoreTableItem>({
|
|
49
|
+
required: true,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
53
|
+
|
|
54
|
+
const selectedStorageKeyLocal = ref<number | null>(null)
|
|
55
|
+
const sort = ref<string | null>(null)
|
|
56
|
+
const pagination = ref<UI_I_Pagination>({
|
|
57
|
+
page: 1,
|
|
58
|
+
pageSize: 100,
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const headItems = ref<UI_I_HeadItem[]>(table.headItems(localization.value))
|
|
62
|
+
const columnKeys = ref<UI_I_ColumnKey[]>(table.columnKeys(localization.value))
|
|
63
|
+
watch(localization, () => {
|
|
64
|
+
columnKeys.value = table.columnKeys(localization.value)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const bodyItems = computed<UI_I_BodyItem[][]>(() => {
|
|
68
|
+
return table.bodyItems(props.datastore || [], localization.value)
|
|
69
|
+
})
|
|
70
|
+
const sorting = (data: [string, boolean]): void => {
|
|
71
|
+
const [column, status] = data
|
|
72
|
+
const direction = status ? 'asc' : 'desc'
|
|
73
|
+
sort.value = `${column}.${direction}`
|
|
74
|
+
|
|
75
|
+
InitStorageData()
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const InitStorageData = async (): Promise<void> => {
|
|
79
|
+
const payload: UI_I_TablePayload = {
|
|
80
|
+
pagination: pagination.value,
|
|
81
|
+
sortBy: sort.value,
|
|
82
|
+
type: 'datastore',
|
|
83
|
+
schema: 'full',
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
props.getDatastoreTableFunc(payload).then(() => {
|
|
87
|
+
// selectedStorageKeyLocal.value = null
|
|
88
|
+
// defineDefaultSelectedStorage()
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
InitStorageData()
|
|
92
|
+
|
|
93
|
+
const selectStorageFromTable = (index: number): void => {
|
|
94
|
+
if (!props.datastore) return
|
|
95
|
+
|
|
96
|
+
modelStorageLocal.value = props.datastore[index]
|
|
97
|
+
selectedStorageKeyLocal.value = index
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const defineDefaultSelectedStorage = (): void => {
|
|
101
|
+
props.datastore.forEach(
|
|
102
|
+
(datastore: UI_I_DatastoreTableItem, index: number) => {
|
|
103
|
+
if (datastore.id === props.connectedStorageId)
|
|
104
|
+
selectStorageFromTable(index)
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
watch(
|
|
110
|
+
() => props.connectedStorageId,
|
|
111
|
+
(newValue: string) => {
|
|
112
|
+
if (!props.datastore.length || !newValue) return
|
|
113
|
+
defineDefaultSelectedStorage()
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
|
|
2
|
+
import type {
|
|
3
|
+
UI_I_ColumnKey,
|
|
4
|
+
UI_I_HeadItem,
|
|
5
|
+
UI_I_BodyItem,
|
|
6
|
+
} from '~/components/atoms/table/dataGrid/lib/models/interfaces'
|
|
7
|
+
import * as defaultSettings from '~/components/atoms/table/dataGrid/lib/config/settingsTable'
|
|
8
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
9
|
+
import type { UI_T_DatastoreTableItemsTuple } from '~/components/common/wizards/vmNew/migrate/select/storage/configure/batch/table/lib/models/types'
|
|
10
|
+
import {
|
|
11
|
+
datastoreIconByState,
|
|
12
|
+
datastoreLocalizationByState,
|
|
13
|
+
} from '~/components/common/lib/config/states'
|
|
14
|
+
|
|
15
|
+
export const datastoreTableKeys: UI_T_DatastoreTableItemsTuple = [
|
|
16
|
+
'name',
|
|
17
|
+
'state',
|
|
18
|
+
'capacity_mb',
|
|
19
|
+
'provisioned_mb',
|
|
20
|
+
'free_mb',
|
|
21
|
+
'used_mb',
|
|
22
|
+
'type_text',
|
|
23
|
+
'thin_provisioning',
|
|
24
|
+
'access_mode',
|
|
25
|
+
'hardware_acceleration',
|
|
26
|
+
'drive_type',
|
|
27
|
+
'device',
|
|
28
|
+
'storage_io_control',
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
const getItems = (
|
|
32
|
+
localization: UI_I_Localization
|
|
33
|
+
): [string, boolean, string, string][] => {
|
|
34
|
+
return [
|
|
35
|
+
[localization.common.name, true, '96px', datastoreTableKeys[0]],
|
|
36
|
+
[localization.inventorySummary.state, true, '138px', datastoreTableKeys[1]],
|
|
37
|
+
[localization.common.capacity, true, '110px', datastoreTableKeys[2]],
|
|
38
|
+
[localization.common.provisioned, true, '128px', datastoreTableKeys[3]],
|
|
39
|
+
[localization.common.free, true, '110px', datastoreTableKeys[4]],
|
|
40
|
+
[localization.common.used, true, '110px', datastoreTableKeys[5]],
|
|
41
|
+
[localization.common.type, true, '110px', datastoreTableKeys[6]],
|
|
42
|
+
[
|
|
43
|
+
localization.common.thinProvisioning,
|
|
44
|
+
true,
|
|
45
|
+
'132px',
|
|
46
|
+
datastoreTableKeys[7],
|
|
47
|
+
],
|
|
48
|
+
[localization.common.access, true, '110px', datastoreTableKeys[8]],
|
|
49
|
+
[
|
|
50
|
+
localization.common.hardwareAcceleration,
|
|
51
|
+
true,
|
|
52
|
+
'134px',
|
|
53
|
+
datastoreTableKeys[9],
|
|
54
|
+
],
|
|
55
|
+
[localization.common.driverType, true, '110px', datastoreTableKeys[10]],
|
|
56
|
+
[localization.common.device, true, '110px', datastoreTableKeys[11]],
|
|
57
|
+
[
|
|
58
|
+
localization.common.storageIoControl,
|
|
59
|
+
true,
|
|
60
|
+
'110px',
|
|
61
|
+
datastoreTableKeys[12],
|
|
62
|
+
],
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const columnKeys = (
|
|
67
|
+
localization: UI_I_Localization
|
|
68
|
+
): UI_I_ColumnKey[] => {
|
|
69
|
+
return defaultSettings.defaultColumnKeys(getItems(localization), {
|
|
70
|
+
icon: [0],
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
|
|
75
|
+
return defaultSettings.defaultHeadItems(getItems(localization), {
|
|
76
|
+
icon: [0],
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const bodyItems = (
|
|
81
|
+
data: UI_I_DatastoreTableItem[],
|
|
82
|
+
localization: UI_I_Localization
|
|
83
|
+
): UI_I_BodyItem[][] => {
|
|
84
|
+
const bodyItems: UI_I_BodyItem[][] = []
|
|
85
|
+
const { $binary }: any = useNuxtApp()
|
|
86
|
+
|
|
87
|
+
data.forEach((storage: UI_I_DatastoreTableItem, key: number) => {
|
|
88
|
+
const state =
|
|
89
|
+
localization.common[
|
|
90
|
+
datastoreLocalizationByState[storage[datastoreTableKeys[1]]]
|
|
91
|
+
]
|
|
92
|
+
bodyItems.push([
|
|
93
|
+
{
|
|
94
|
+
key: 'icon',
|
|
95
|
+
text: storage[datastoreTableKeys[0]],
|
|
96
|
+
data: `vsphere-icon-${datastoreIconByState[storage.state]}`,
|
|
97
|
+
id: key,
|
|
98
|
+
testId: storage[datastoreTableKeys[0]],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: 'col1',
|
|
102
|
+
text: state,
|
|
103
|
+
id: key,
|
|
104
|
+
testId: storage[datastoreTableKeys[0]],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
key: 'col2',
|
|
108
|
+
text: $binary.round(storage.capacity[datastoreTableKeys[2]]),
|
|
109
|
+
id: key,
|
|
110
|
+
testId: storage[datastoreTableKeys[0]],
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
key: 'col3',
|
|
114
|
+
text: $binary.round(storage.capacity[datastoreTableKeys[3]]),
|
|
115
|
+
id: key,
|
|
116
|
+
testId: storage[datastoreTableKeys[0]],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
key: 'col4',
|
|
120
|
+
text: $binary.round(storage.capacity[datastoreTableKeys[4]]),
|
|
121
|
+
id: key,
|
|
122
|
+
testId: storage[datastoreTableKeys[0]],
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
key: 'col5',
|
|
126
|
+
text: $binary.round(storage.capacity[datastoreTableKeys[5]]),
|
|
127
|
+
id: key,
|
|
128
|
+
testId: storage[datastoreTableKeys[0]],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
key: 'col6',
|
|
132
|
+
text: storage[datastoreTableKeys[6]],
|
|
133
|
+
id: key,
|
|
134
|
+
testId: storage[datastoreTableKeys[0]],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
key: 'col7',
|
|
138
|
+
text: storage[datastoreTableKeys[7]]
|
|
139
|
+
? localization.common.yes
|
|
140
|
+
: localization.common.no,
|
|
141
|
+
id: key,
|
|
142
|
+
testId: storage[datastoreTableKeys[0]],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
key: 'col8',
|
|
146
|
+
text: storage[datastoreTableKeys[8]],
|
|
147
|
+
id: key,
|
|
148
|
+
testId: storage[datastoreTableKeys[0]],
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
key: 'col9',
|
|
152
|
+
text: storage[datastoreTableKeys[9]],
|
|
153
|
+
id: key,
|
|
154
|
+
testId: storage[datastoreTableKeys[0]],
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
key: 'col10',
|
|
158
|
+
text: storage[datastoreTableKeys[10]],
|
|
159
|
+
id: key,
|
|
160
|
+
testId: storage[datastoreTableKeys[0]],
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
key: 'col11',
|
|
164
|
+
text: storage[datastoreTableKeys[11]],
|
|
165
|
+
id: key,
|
|
166
|
+
testId: storage[datastoreTableKeys[0]],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
key: 'col12',
|
|
170
|
+
text: storage[datastoreTableKeys[12]],
|
|
171
|
+
id: key,
|
|
172
|
+
testId: storage[datastoreTableKeys[0]],
|
|
173
|
+
},
|
|
174
|
+
])
|
|
175
|
+
})
|
|
176
|
+
return bodyItems
|
|
177
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type UI_T_DatastoreTableItemsTuple = [
|
|
2
|
+
'name',
|
|
3
|
+
'state',
|
|
4
|
+
'capacity_mb',
|
|
5
|
+
'provisioned_mb',
|
|
6
|
+
'free_mb',
|
|
7
|
+
'used_mb',
|
|
8
|
+
'type_text',
|
|
9
|
+
'thin_provisioning',
|
|
10
|
+
'access_mode',
|
|
11
|
+
'hardware_acceleration',
|
|
12
|
+
'drive_type',
|
|
13
|
+
'device',
|
|
14
|
+
'storage_io_control'
|
|
15
|
+
]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="migrate-configure-disk">
|
|
3
|
+
<div class="btn-group">
|
|
4
|
+
<button
|
|
5
|
+
id="vm-migrate-configure"
|
|
6
|
+
data-id="vm-migrate-configure-button"
|
|
7
|
+
class="btn btn-link btn-sm"
|
|
8
|
+
:disabled="!selectedDisksFromTable.length"
|
|
9
|
+
@click="onConfigure"
|
|
10
|
+
>
|
|
11
|
+
{{ localization.inventoryTabs.configure }}
|
|
12
|
+
</button>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<common-wizards-vm-new-migrate-select-storage-configure-disk-table
|
|
16
|
+
v-model="selectedPerDiskKeysLocal"
|
|
17
|
+
:configure-per-disks="props.configurePerDisks"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
24
|
+
import type { UI_I_StorageConfigurePerDiskItem } from '~/components/common/wizards/vm/migrate/select/storage/table/disk/lib/models/interfaces'
|
|
25
|
+
import type { UI_T_VmMigrateSelectStorageTab } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/types'
|
|
26
|
+
|
|
27
|
+
const props = defineProps<{
|
|
28
|
+
configurePerDisks: UI_I_StorageConfigurePerDiskItem[]
|
|
29
|
+
}>()
|
|
30
|
+
const modelShowSelectedPerDisk = defineModel<boolean>({ required: true })
|
|
31
|
+
const modelActiveTab = defineModel<UI_T_VmMigrateSelectStorageTab>('activeTab')
|
|
32
|
+
const selectedPerDiskKeysLocal = defineModel<number[]>('selectedPerDiskKeys', {
|
|
33
|
+
required: true,
|
|
34
|
+
})
|
|
35
|
+
const emits = defineEmits<{
|
|
36
|
+
(
|
|
37
|
+
event: 'update-selected-per-disks',
|
|
38
|
+
value: UI_I_StorageConfigurePerDiskItem[]
|
|
39
|
+
): void
|
|
40
|
+
}>()
|
|
41
|
+
|
|
42
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
43
|
+
|
|
44
|
+
const selectedDisksFromTable = computed<UI_I_StorageConfigurePerDiskItem[]>(
|
|
45
|
+
() => {
|
|
46
|
+
if (!props.configurePerDisks) return []
|
|
47
|
+
|
|
48
|
+
return props.configurePerDisks.filter((_: never, key: number) =>
|
|
49
|
+
selectedPerDiskKeysLocal.value.includes(key)
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
const onConfigure = (): void => {
|
|
55
|
+
emits('update-selected-per-disks', selectedDisksFromTable.value)
|
|
56
|
+
modelShowSelectedPerDisk.value = true
|
|
57
|
+
modelActiveTab.value = 'batch-configure'
|
|
58
|
+
}
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<style lang="scss" scoped>
|
|
62
|
+
@import 'assets/scss/common/mixins.scss';
|
|
63
|
+
.migrate-configure-disk {
|
|
64
|
+
@include flex($dir: column);
|
|
65
|
+
height: inherit;
|
|
66
|
+
margin-top: 10px;
|
|
67
|
+
}
|
|
68
|
+
</style>
|