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.
Files changed (70) hide show
  1. package/components/common/select/input/lib/models/interfaces.ts +1 -0
  2. package/components/common/wizards/vmNew/common/computeResource/TreeView.vue +61 -0
  3. package/components/common/wizards/vmNew/common/tooltip/Tooltip.vue +84 -0
  4. package/components/common/wizards/vmNew/common/validation/compatibility/Compatibility.vue +62 -0
  5. package/components/common/wizards/vmNew/common/validation/lib/models/enums.ts +5 -0
  6. package/components/common/wizards/vmNew/migrate/Migrate.vue +231 -0
  7. package/components/common/wizards/vmNew/migrate/lib/config/constructDataReady.ts +83 -0
  8. package/components/common/wizards/vmNew/migrate/lib/config/steps.ts +82 -0
  9. package/components/common/wizards/vmNew/migrate/lib/models/enums.ts +6 -0
  10. package/components/common/wizards/vmNew/migrate/lib/models/interfaces.ts +38 -0
  11. package/components/common/wizards/vmNew/migrate/lib/utils.ts +0 -0
  12. package/components/common/wizards/vmNew/migrate/lib/validations.ts +29 -0
  13. package/components/common/wizards/vmNew/migrate/select/computeResource/ComputeResource.vue +219 -0
  14. package/components/common/wizards/vmNew/migrate/select/computeResource/lib/config/tabsPannel.ts +28 -0
  15. package/components/common/wizards/vmNew/migrate/select/computeResource/lib/models/enums.ts +6 -0
  16. package/components/common/wizards/vmNew/migrate/select/computeResource/lib/models/interfaces.ts +30 -0
  17. package/components/common/wizards/vmNew/migrate/select/computeResource/lib/models/types.ts +12 -0
  18. package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/TableView.vue +143 -0
  19. package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/config/clusterTable.ts +113 -0
  20. package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/config/hostTable.ts +124 -0
  21. package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/config/resourcePoolTable.ts +115 -0
  22. package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/config/tableKeys.ts +65 -0
  23. package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/config/vappsTable.ts +66 -0
  24. package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/models/interfaces.ts +50 -0
  25. package/components/common/wizards/vmNew/migrate/select/computeResource/tableView/lib/models/types.ts +60 -0
  26. package/components/common/wizards/vmNew/migrate/select/network/Network.vue +125 -0
  27. package/components/common/wizards/vmNew/migrate/select/network/table/network/Network.vue +114 -0
  28. package/components/common/wizards/vmNew/migrate/select/network/table/network/lib/config/advancedTable.ts +78 -0
  29. package/components/common/wizards/vmNew/migrate/select/network/table/network/lib/config/basicTable.ts +70 -0
  30. package/components/common/wizards/vmNew/migrate/select/network/table/network/lib/config/tableKeys.ts +13 -0
  31. package/components/common/wizards/vmNew/migrate/select/network/table/network/lib/models/interfaces.ts +12 -0
  32. package/components/common/wizards/vmNew/migrate/select/network/table/network/lib/models/types.ts +21 -0
  33. package/components/common/wizards/vmNew/migrate/select/network/table/useAt/UseAt.vue +54 -0
  34. package/components/common/wizards/vmNew/migrate/select/network/table/useAt/lib/config/tableKeys.ts +7 -0
  35. package/components/common/wizards/vmNew/migrate/select/network/table/useAt/lib/config/useAtTable.ts +47 -0
  36. package/components/common/wizards/vmNew/migrate/select/network/table/useAt/lib/models/interfaces.ts +1 -0
  37. package/components/common/wizards/vmNew/migrate/select/network/table/useAt/lib/models/types.ts +5 -0
  38. package/components/common/wizards/vmNew/migrate/select/priority/Priority.vue +39 -0
  39. package/components/common/wizards/vmNew/migrate/select/priority/lib/config/typeOptions.ts +21 -0
  40. package/components/common/wizards/vmNew/migrate/select/priority/lib/models/types.ts +1 -0
  41. package/components/common/wizards/vmNew/migrate/select/storage/Storage.vue +201 -0
  42. package/components/common/wizards/vmNew/migrate/select/storage/configure/batch/Batch.vue +58 -0
  43. package/components/common/wizards/vmNew/migrate/select/storage/configure/batch/config/virtualDiskFormat.ts +30 -0
  44. package/components/common/wizards/vmNew/migrate/select/storage/configure/batch/table/Table.vue +118 -0
  45. package/components/common/wizards/vmNew/migrate/select/storage/configure/batch/table/lib/config/datastoreTable.ts +177 -0
  46. package/components/common/wizards/vmNew/migrate/select/storage/configure/batch/table/lib/models/types.ts +15 -0
  47. package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/Disk.vue +68 -0
  48. package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/table/Table.vue +74 -0
  49. package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/table/lib/config/diskTable.ts +135 -0
  50. package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/table/lib/config/tableKeys.ts +15 -0
  51. package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/table/lib/models/interfaces.ts +24 -0
  52. package/components/common/wizards/vmNew/migrate/select/storage/configure/disk/table/lib/models/types.ts +13 -0
  53. package/components/common/wizards/vmNew/migrate/select/storage/lib/config/tabsPannel.ts +20 -0
  54. package/components/common/wizards/vmNew/migrate/select/storage/lib/models/enums.ts +6 -0
  55. package/components/common/wizards/vmNew/migrate/select/storage/lib/models/interfaces.ts +14 -0
  56. package/components/common/wizards/vmNew/migrate/select/storage/lib/models/types.ts +9 -0
  57. package/components/common/wizards/vmNew/migrate/select/storage/policy/Policy.vue +84 -0
  58. package/components/common/wizards/vmNew/migrate/select/storage/selectedPerDisk/SelectedPerDisk.vue +80 -0
  59. package/components/common/wizards/vmNew/migrate/select/targetServer/lib/config/tabsPannel.ts +18 -0
  60. package/components/common/wizards/vmNew/migrate/select/targetServer/lib/models/types.ts +1 -0
  61. package/components/common/wizards/vmNew/migrate/select/targetServer/new/New.vue +294 -0
  62. package/components/common/wizards/vmNew/migrate/select/targetServer/new/lib/config/defaultForm.ts +36 -0
  63. package/components/common/wizards/vmNew/migrate/select/targetServer/new/lib/models/interfaces.ts +13 -0
  64. package/components/common/wizards/vmNew/migrate/select/targetServer/saved/Saved.vue +27 -0
  65. package/components/common/wizards/vmNew/migrate/select/targetServer/targetServer.vue +41 -0
  66. package/components/common/wizards/vmNew/migrate/select/type/Type.vue +27 -0
  67. package/components/common/wizards/vmNew/migrate/select/type/lib/config/typeOptions.ts +41 -0
  68. package/components/common/wizards/vmNew/migrate/select/type/lib/models/interfaces.ts +5 -0
  69. package/components/common/wizards/vmNew/migrate/select/type/lib/models/types.ts +5 -0
  70. package/package.json +1 -1
@@ -2,4 +2,5 @@ export interface UI_I_SelectInputItem {
2
2
  label: string
3
3
  value: string | number
4
4
  disabled?: boolean
5
+ testId?: string
5
6
  }
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <div class="tree-view">
3
+ <atoms-loader-pre-loader
4
+ v-show="loading"
5
+ id="loader"
6
+ class="absolute-center tree-view__loading"
7
+ :show="true"
8
+ />
9
+ <common-recursion-tree
10
+ :nodes="props.computeResourceTree"
11
+ class="recursion-tree"
12
+ @get-nodes="onShowNodes"
13
+ @select-node="onSelectNode"
14
+ @contextmenu.prevent
15
+ />
16
+ </div>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
21
+
22
+ const props = defineProps<{
23
+ modelValue: UI_I_TreeNode | null
24
+ computeResourceTree: UI_I_TreeNode[]
25
+ }>()
26
+
27
+ const emits = defineEmits<{
28
+ (event: 'update:modelValue', value: UI_I_TreeNode): void
29
+ (
30
+ event: 'get-compute-resource-tree',
31
+ value: { id: string | number; cb: () => void }
32
+ ): void
33
+ (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void
34
+ (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void
35
+ (event: 'clear-compute-resource-tree'): void
36
+ }>()
37
+
38
+ const loading = ref<boolean>(false)
39
+ const onShowNodes = (event: any): void => {
40
+ emits('show-compute-resource-tree', event)
41
+ }
42
+ const onSelectNode = (node: UI_I_TreeNode): void => {
43
+ emits('select-compute-resource-tree', node)
44
+
45
+ emits('update:modelValue', node)
46
+ }
47
+ </script>
48
+
49
+ <style scoped lang="scss">
50
+ .tree-view {
51
+ &__loading {
52
+ :deep(.spinner.spinner-inverse) {
53
+ position: static;
54
+ width: 45px;
55
+ height: 45px;
56
+ min-width: 45px;
57
+ min-height: 45px;
58
+ }
59
+ }
60
+ }
61
+ </style>
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <td :id="tooltipTestId" class="sign-post">
3
+ <a
4
+ v-if="props.isShowElement"
5
+ href="javascript:void(0)"
6
+ data-id="show-find-help-button"
7
+ @click.stop="isShowTooltip = !isShowTooltip"
8
+ >{{ localization.common.vmOrigin }}
9
+ </a>
10
+ <atoms-the-icon
11
+ id="help-tooltip-icon"
12
+ data-id="show-help-tooltip-icon"
13
+ class="info-icon"
14
+ name="info-circle"
15
+ @click.stop="isShowTooltip = !isShowTooltip"
16
+ />
17
+
18
+ <atoms-tooltip-signpost
19
+ v-if="isShowTooltip"
20
+ :elem-id="tooltipTestId"
21
+ class="sign-post__content"
22
+ @hide="isShowTooltip = false"
23
+ >
24
+ <slot name="content"> </slot>
25
+ </atoms-tooltip-signpost>
26
+ </td>
27
+ </template>
28
+
29
+ <script lang="ts" setup>
30
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
31
+
32
+ const props = withDefaults(
33
+ defineProps<{
34
+ testId?: string
35
+ isShowElement?: boolean
36
+ }>(),
37
+ {
38
+ testId: 'tooltip',
39
+ isShowElement: false,
40
+ }
41
+ )
42
+
43
+ const localization = computed<UI_I_Localization>(() => useLocal())
44
+
45
+ const tooltipTestId = computed<string>(
46
+ () => `${props.testId}-configure-navigation`
47
+ )
48
+
49
+ const isShowTooltip = ref<boolean>(false)
50
+ </script>
51
+
52
+ <style lang="scss" scoped>
53
+ @import '../../../../../../assets/scss/common/mixins';
54
+ .sign-post {
55
+ @include flex($align: center);
56
+ padding-left: 6px;
57
+ margin-top: 5px;
58
+ &__content {
59
+ max-width: 350px;
60
+ }
61
+ &__alert {
62
+ :deep(.alert-items) {
63
+ padding: 3px 5px;
64
+ }
65
+ :deep(.alert-text) {
66
+ @include text($fs: 11px, $c: var(--global-font-color2));
67
+ margin-right: 0;
68
+ }
69
+ }
70
+ &__title {
71
+ @include text($fs: 22px, $fw: 300, $c: var(--global-font-color));
72
+ }
73
+ &__desc {
74
+ @include text($fs: 14px, $fw: 400, $c: var(--global-font-color));
75
+ }
76
+
77
+ .info-icon {
78
+ width: 24px;
79
+ height: 24px;
80
+ fill: var(--dropdown-item-color);
81
+ cursor: pointer;
82
+ }
83
+ }
84
+ </style>
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <div class="compatibility">
3
+ <p class="compatibility__title">{{ localization.inventorySummary.compatibility }}</p>
4
+ <div class="flex-align-center compatibility__content">
5
+ <template v-if="!props.loading">
6
+ <div class="compatibility__message">
7
+ <div :class="['icon', iconStatus]" />
8
+ <span>{{ validationText }}</span>
9
+ </div>
10
+ </template>
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
17
+ import { UI_E_ValidationCompatibilityStatusIcon } from '~/components/common/wizards/vm/common/validation/lib/models/enums'
18
+
19
+ const props = withDefaults(
20
+ defineProps<{
21
+ loading?: boolean
22
+ text: string
23
+ status: 'Error' | 'Success' | 'Warning'
24
+ }>(),
25
+ {
26
+ loading: true,
27
+ }
28
+ )
29
+
30
+ const localization = computed<UI_I_Localization>(() => useLocal())
31
+
32
+ const iconStatus = computed<string>(
33
+ () => UI_E_ValidationCompatibilityStatusIcon[props.status]
34
+ )
35
+
36
+ const validationText = computed<string>(() => localization.value.common[props.text])
37
+ </script>
38
+
39
+ <style lang="scss" scoped>
40
+ @import 'assets/scss/common/mixins';
41
+ .compatibility {
42
+ padding-top: 10px;
43
+
44
+ &__title {
45
+ }
46
+
47
+ &__content {
48
+ align-items: self-start;
49
+ border: 1px solid #000;
50
+ padding-top: 5px;
51
+ padding-left: 5px;
52
+ overflow: auto;
53
+ min-height: 75px;
54
+ }
55
+ &__message {
56
+ @include flex($align: center);
57
+ .icon {
58
+ margin-right: 5px;
59
+ }
60
+ }
61
+ }
62
+ </style>
@@ -0,0 +1,5 @@
1
+ export enum UI_E_ValidationCompatibilityStatusIcon {
2
+ Success = 'icon-status-ok',
3
+ Error = 'vsphere-icon-status-error',
4
+ Warning = 'vsphere-icon-status-warning',
5
+ }
@@ -0,0 +1,231 @@
1
+ <template>
2
+ <div class="migrate-vm">
3
+ <atoms-wizard
4
+ show
5
+ :wizard="wizard"
6
+ :selected-scheme="selectedScheme"
7
+ :title="localization.migrate"
8
+ :localization="localization"
9
+ class="migrate-vm-wizard"
10
+ test-id="migrate-vm-wizard"
11
+ @change-steps="onChangeSteps"
12
+ @hide="onHideModal"
13
+ @submit="onFinish"
14
+ >
15
+ <template #modalBody="{ selectedStep }">
16
+ <common-wizards-vm-new-migrate-select-type
17
+ v-if="selectedStep.id === 0"
18
+ v-model="form.migrate_type"
19
+ :project="props.project"
20
+ />
21
+
22
+ <common-wizards-vm-migrate-select-target-server v-if="false" />
23
+
24
+ <common-wizards-vm-migrate-select-compute-resource
25
+ v-if="false"
26
+ v-model="form"
27
+ :submit="selectComputeResourceSubmit"
28
+ :get-compute-resource-data="props.getComputeResourceData"
29
+ :migrate-type="form.migrate_type"
30
+ :compute-resource-data="props.computeResourceTableData"
31
+ :compute-resource-tree="props.computeResourceTree"
32
+ />
33
+
34
+ <common-wizards-vm-new-migrate-select-storage
35
+ v-show="selectedStep.id === 3"
36
+ v-model="form"
37
+ :alert-messages="alertMessages[3]"
38
+ :submit="selectStorageSubmit"
39
+ :get-datastore-table-func="props.getDatastoreTableFunc"
40
+ :datastore="props.datastore"
41
+ :connected-storage-id-default="connectedStorageIdOnVm"
42
+ :configure-per-disks="props.configurePerDisks"
43
+ @hide-alert="onHideAlert"
44
+ />
45
+
46
+ <common-wizards-vm-migrate-select-network
47
+ v-if="false"
48
+ v-model:is-basic-network-mode="
49
+ dataFormLocal.selectNetwork.isShowNetworkBasic
50
+ "
51
+ v-model:network-data="dataFormLocal.selectNetwork.data"
52
+ />
53
+
54
+ <common-wizards-vm-migrate-select-priority
55
+ v-if="false"
56
+ v-model="selectedVMotionPriority"
57
+ />
58
+
59
+ <common-ready-to-complete
60
+ v-if="selectedStep.id === 6"
61
+ :data="dataReadyView"
62
+ />
63
+ </template>
64
+ </atoms-wizard>
65
+ </div>
66
+ </template>
67
+
68
+ <script setup lang="ts">
69
+ import type {
70
+ UI_I_WizardStep,
71
+ UI_I_ValidationReturn,
72
+ } from '~/components/atoms/wizard/lib/models/interfaces'
73
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
74
+ import {
75
+ stepsFunc,
76
+ stepsSchemeInitial,
77
+ } from '~/components/common/wizards/vmNew/migrate/lib/config/steps'
78
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
79
+ import type { UI_T_Project } from '~/lib/models/types'
80
+ import type {
81
+ UI_I_MigrateFormLocal,
82
+ UI_I_ChangeStepsSchemes,
83
+ } from '~/components/common/wizards/vmNew/migrate/lib/models/interfaces'
84
+ import type { UI_T_VmMigrateType } from '~/components/common/wizards/vmNew/migrate/select/type/lib/models/types'
85
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
86
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
87
+ import type { UI_I_VmSettings } from '~/lib/models/store/vm/interfaces'
88
+ import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
89
+ import type { UI_I_StorageConfigurePerDiskItem } from '~/components/common/wizards/vm/migrate/select/storage/table/disk/lib/models/interfaces'
90
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
91
+ import type { UI_T_SelectVMotionPriority } from '~/components/common/wizards/vm/migrate/select/priority/lib/models/types'
92
+ import type { UI_I_CollectedDataFormLocal } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
93
+ import { constructDataReadyViewFunc } from '~/components/common/wizards/vmNew/migrate/lib/config/constructDataReady'
94
+ import * as validation from '~/components/common/wizards/vmNew/migrate/lib/validations'
95
+
96
+ const props = defineProps<{
97
+ project: UI_T_Project
98
+ vmSettings: UI_I_VmSettings | null
99
+ vmName: string
100
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
101
+ getComputeResourceData: (payload: UI_I_TablePayload) => Promise<void>
102
+ datastore: UI_I_DatastoreTableItem[]
103
+ configurePerDisks: UI_I_StorageConfigurePerDiskItem[]
104
+ computeResourceTableData?: any
105
+ computeResourceTree?: UI_I_TreeNode
106
+ }>()
107
+ const emits = defineEmits<{
108
+ (event: 'hide'): void
109
+ (event: 'finish', value: UI_I_MigrateFormLocal): void
110
+ }>()
111
+
112
+ const localization = computed<UI_I_Localization>(() => useLocal())
113
+
114
+ const wizard: Wizard = new Wizard(
115
+ stepsFunc(localization.value),
116
+ stepsSchemeInitial
117
+ )
118
+
119
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
120
+ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
121
+
122
+ const form = ref<UI_I_MigrateFormLocal>({
123
+ migrate_type: props.project === 'procurator' ? 'storage' : 'resource',
124
+ disk_format: 0,
125
+ storage: null,
126
+ configure: {
127
+ type: 'batch-configure',
128
+ disks: [],
129
+ },
130
+ })
131
+
132
+ const validationFunc = async (
133
+ value: UI_I_WizardStep[],
134
+ currentStep: UI_I_WizardStep,
135
+ nextStep: UI_I_WizardStep
136
+ ): Promise<UI_I_ValidationReturn> => {
137
+ let stepHasError = false
138
+
139
+ if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
140
+ const nameValidation = await validation.checkSelectedDatastoreSync(
141
+ localization.value,
142
+ form.value.storage,
143
+ wizard,
144
+ value
145
+ )
146
+
147
+ value = nameValidation.newValue
148
+
149
+ stepHasError = nameValidation.stepHasError
150
+ }
151
+
152
+ return {
153
+ newValue: value,
154
+ stepHasError,
155
+ }
156
+ }
157
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
158
+ wizard.changeSteps(value, validationFunc)
159
+
160
+ // Choosing Scheme
161
+ watch(
162
+ form.migrate_type,
163
+ (newValue: UI_T_VmMigrateType) => {
164
+ const schemes: UI_I_ChangeStepsSchemes = {
165
+ procurator: {
166
+ storage: 0,
167
+ },
168
+ sphere: {
169
+ storage: 0,
170
+ resource: 1,
171
+ },
172
+ }
173
+
174
+ const projectSchemes = schemes[props.project]
175
+
176
+ if (projectSchemes && projectSchemes[newValue] !== undefined) {
177
+ wizard.changeScheme(projectSchemes[newValue] as number)
178
+ }
179
+ },
180
+ { deep: true, immediate: true }
181
+ )
182
+
183
+ const loading = ref<boolean>(false)
184
+
185
+ const selectStorageSubmit = ref<number>(0)
186
+ const selectComputeResourceSubmit = ref<number>(0)
187
+
188
+ const selectedVMotionPriority = ref<UI_T_SelectVMotionPriority>('high')
189
+
190
+ const connectedStorageIdOnVm = computed<string>(
191
+ () => props.vmSettings?.storage.id || ''
192
+ )
193
+
194
+ const dataReadyView = computed<UI_I_TableInfoItem>(() =>
195
+ constructDataReadyViewFunc(props.vmName, form.value, dataFormLocal.value)
196
+ )
197
+
198
+ const dataFormLocal = ref<UI_I_CollectedDataFormLocal>({
199
+ selectedComputeResource: null,
200
+ selectStorage: null,
201
+ selectNetwork: {
202
+ isShowNetworkBasic: true,
203
+ data: null,
204
+ },
205
+ selectedVMotionPriority: 'high',
206
+ })
207
+ const onFinish = (): void => {
208
+ loading.value = true
209
+ emits('finish', form.value)
210
+ loading.value = false
211
+ }
212
+
213
+ const onHideModal = (): void => {
214
+ emits('hide')
215
+ }
216
+
217
+ const onHideAlert = (stepId: number): void => {
218
+ wizard.hideAlertMessagesByStepId(stepId)
219
+ }
220
+ </script>
221
+
222
+ <style scoped lang="scss">
223
+ @import 'assets/scss/common/mixins.scss';
224
+ .migrate-vm {
225
+ &__wrapper {
226
+ @include flex($dir: column);
227
+ //height: 100%;
228
+ padding-left: 10px;
229
+ }
230
+ }
231
+ </style>
@@ -0,0 +1,83 @@
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type { UI_I_MigrateReadyBlockData } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
3
+ import type { UI_I_MigrateFormLocal } from '~/components/common/wizards/vmNew/migrate/lib/models/interfaces'
4
+ import { UI_E_VmMigrationType } from '~/components/common/wizards/vm/migrate/lib/models/enums'
5
+ import { UI_E_SelectStorageDiskFormat } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/enums'
6
+ import { vmDiskFormatOptions } from '~/components/common/wizards/vm/migrate/select/storage/diskFormat/lib/config/formatOptions'
7
+
8
+ const storageDetailsFunc = (
9
+ localization: UI_I_Localization,
10
+ migrationType: string,
11
+ name: string,
12
+ form: UI_I_MigrateFormLocal
13
+ ): UI_I_MigrateReadyBlockData[] => {
14
+ const { disk_format, configure, storage } = form
15
+
16
+ const isActivePerDiskTab: boolean = configure.type === 'configure-disk'
17
+
18
+ const diskFormat = vmDiskFormatOptions().find(
19
+ (file) => file.value === disk_format
20
+ )!
21
+
22
+ let result: UI_I_MigrateReadyBlockData[] = [
23
+ {
24
+ label: localization.common.migrationType,
25
+ value: migrationType,
26
+ permissions: ['batch-configure', 'configure-disk'],
27
+ },
28
+ {
29
+ label: localization.common.virtualMachine,
30
+ value: name,
31
+ permissions: ['batch-configure', 'configure-disk'],
32
+ },
33
+ {
34
+ label: localization.common.storage,
35
+ value: storage?.name,
36
+ permissions: ['batch-configure'],
37
+ },
38
+ {
39
+ label: localization.common.diskFormat,
40
+ value: diskFormat.text,
41
+ permissions: ['batch-configure'],
42
+ },
43
+ {
44
+ label: name,
45
+ value: '',
46
+ permissions: ['configure-disk'],
47
+ },
48
+ ]
49
+
50
+ if (isActivePerDiskTab && configure.disks) {
51
+ const perDiskItems: UI_I_MigrateReadyBlockData[] = configure.disks.map(
52
+ (disk) => {
53
+ const isConfigurationFile = disk.file === 'Configuration file'
54
+ const diskFormat = UI_E_SelectStorageDiskFormat[disk.disk_format]
55
+
56
+ const text = isConfigurationFile
57
+ ? disk.storage
58
+ : `${disk.storage} (${diskFormat})`
59
+
60
+ return {
61
+ label: disk.file,
62
+ value: text,
63
+ permissions: ['configure-disk'],
64
+ isProperty: true,
65
+ }
66
+ }
67
+ )
68
+ result = result.concat(perDiskItems)
69
+ }
70
+
71
+ return result.filter((option) => option.permissions.includes(configure.type))
72
+ }
73
+ export const constructDataReadyViewFunc = (
74
+ name: string,
75
+ data: UI_I_MigrateFormLocal
76
+ ): UI_I_MigrateReadyBlockData[] => {
77
+ const localization: UI_I_Localization = useLocal()
78
+
79
+ const migrationType =
80
+ localization.common[UI_E_VmMigrationType[data.migrate_type]]
81
+
82
+ return storageDetailsFunc(localization, migrationType, name, data)
83
+ }
@@ -0,0 +1,82 @@
1
+ import { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import { UI_I_WizardStep } from '~/components/atoms/wizard/lib/models/interfaces'
3
+ import { UI_E_WIZARD_STATUS } from '~/components/atoms/wizard/lib/models/enums'
4
+
5
+ export const stepsFunc = (
6
+ localization: UI_I_Localization
7
+ ): UI_I_WizardStep[] => [
8
+ {
9
+ id: 0,
10
+ title: localization.common.selectMigrationType,
11
+ subTitle: localization.common.selectMigrationTypeDesc,
12
+ status: UI_E_WIZARD_STATUS.SELECTED,
13
+ fields: {},
14
+ isValid: true,
15
+ testId: 'migrate-vm-select-type',
16
+ },
17
+ {
18
+ id: 1,
19
+ title: localization.common.selectTargetVCenterSer,
20
+ subTitle: localization.common.selectComputeResourceDesc,
21
+ status: UI_E_WIZARD_STATUS.INACTIVE,
22
+ fields: {},
23
+ isValid: true,
24
+ testId: 'migrate-vm-select-target-server',
25
+ },
26
+ {
27
+ id: 2,
28
+ title: localization.common.selectComputeResource,
29
+ subTitle: localization.common.selectComputeResourceDesc,
30
+ status: UI_E_WIZARD_STATUS.INACTIVE,
31
+ fields: {},
32
+ isValid: true,
33
+ testId: 'migrate-vm-select-compute-resource',
34
+ },
35
+ {
36
+ id: 3,
37
+ title: localization.common.selectStorage,
38
+ subTitle: localization.common.selectStorageDesc,
39
+ status: UI_E_WIZARD_STATUS.INACTIVE,
40
+ fields: {
41
+ name: {
42
+ alert: '',
43
+ field: '',
44
+ },
45
+ },
46
+ isValid: true,
47
+ testId: 'migrate-vm-select-storage',
48
+ },
49
+ {
50
+ id: 4,
51
+ title: localization.common.selectNetworks,
52
+ subTitle: localization.common.selectNetworksDesc,
53
+ status: UI_E_WIZARD_STATUS.INACTIVE,
54
+ fields: {},
55
+ isValid: true,
56
+ testId: 'migrate-vm-select-networks',
57
+ },
58
+ {
59
+ id: 5,
60
+ title: localization.common.selectVMotionPriority,
61
+ subTitle: localization.common.selectVMotionPriorityDesc,
62
+ status: UI_E_WIZARD_STATUS.INACTIVE,
63
+ fields: {},
64
+ isValid: true,
65
+ testId: 'migrate-vm-select-vMotion-priority',
66
+ },
67
+ {
68
+ id: 6,
69
+ title: localization.common.readyComplete,
70
+ subTitle: '',
71
+ status: UI_E_WIZARD_STATUS.INACTIVE,
72
+ fields: {},
73
+ isValid: true,
74
+ testId: 'migrate-vm-ready-complete',
75
+ },
76
+ ]
77
+
78
+ export const stepsSchemeInitial: number[][] = [
79
+ [0, 3, 6], // Procurator Scheme for "Change storage only" type
80
+ [0, 1, 3, 4, 5, 6], // Sphere Scheme for "shared-storm" type
81
+ [0, 1, 3, 4, 5, 6], // Sphere Scheme for "nfs" type
82
+ ]
@@ -0,0 +1,6 @@
1
+ export enum UI_E_VmMigrationType {
2
+ resource = 'changeComputeResourceOriginalStorage',
3
+ storage = 'changeStorageComputeResource',
4
+ 'resource-storage' = 'changeComputeResourceAndStorage',
5
+ server = '',
6
+ }
@@ -0,0 +1,38 @@
1
+ import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
2
+ import type { UI_T_VmMigrateSelectStorageTab } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/types'
3
+ import type { UI_I_SelectStorageReadyData } from '~/components/common/wizards/vm/migrate/select/storage/lib/models/interfaces'
4
+ import type { UI_T_SelectVMotionPriority } from '~/components/common/wizards/vm/migrate/select/priority/lib/models/types'
5
+ import type { UI_I_ComputeResourceDataLocal } from '~/components/common/wizards/vm/migrate/select/computeResource/lib/models/interfaces'
6
+ import type { UI_T_VmMigrateType } from '~/components/common/wizards/vmNew/migrate/select/type/lib/models/types'
7
+ import type { UI_I_StorageConfigurePerDiskItem } from '~/components/common/wizards/vm/migrate/select/storage/table/disk/lib/models/interfaces'
8
+
9
+ export interface UI_I_MigrateFormLocal {
10
+ migrate_type: UI_T_VmMigrateType
11
+ disk_format: number
12
+ storage: any
13
+
14
+ configure: {
15
+ type: UI_T_VmMigrateSelectStorageTab
16
+ disks: UI_I_StorageConfigurePerDiskItem[]
17
+ }
18
+ }
19
+
20
+ export interface UI_I_ChangeStepsSchemes {
21
+ [key: string]: {
22
+ [key in UI_T_VmMigrateType]?: number
23
+ }
24
+ }
25
+
26
+ export interface UI_I_MigrateReadyBlockData extends UI_I_TableInfoItem {
27
+ permissions: UI_T_VmMigrateSelectStorageTab[]
28
+ }
29
+
30
+ export interface UI_I_CollectedDataFormLocal {
31
+ selectedComputeResource: UI_I_ComputeResourceDataLocal
32
+ selectStorage: UI_I_SelectStorageReadyData
33
+ selectNetwork: {
34
+ isShowNetworkBasic: boolean
35
+ data: any // добавить интерфае потом
36
+ }
37
+ selectedVMotionPriority: UI_T_SelectVMotionPriority
38
+ }