bfg-common 1.4.95 → 1.4.97
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/wizards/vmNew/migrate/Migrate.vue +23 -22
- package/components/common/wizards/vmNew/migrate/lib/config/steps.ts +5 -5
- package/components/common/wizards/vmNew/migrate/lib/models/interfaces.ts +1 -0
- package/components/common/wizards/vmNew/migrate/lib/validations.ts +29 -0
- package/components/common/wizards/vmNew/migrate/select/storage/Storage.vue +11 -9
- package/package.json +1 -1
|
@@ -19,12 +19,10 @@
|
|
|
19
19
|
:project="props.project"
|
|
20
20
|
/>
|
|
21
21
|
|
|
22
|
-
<common-wizards-vm-migrate-select-target-server
|
|
23
|
-
v-if="false"
|
|
24
|
-
/>
|
|
22
|
+
<common-wizards-vm-migrate-select-target-server v-if="false" />
|
|
25
23
|
|
|
26
24
|
<common-wizards-vm-migrate-select-compute-resource
|
|
27
|
-
|
|
25
|
+
v-if="false"
|
|
28
26
|
v-model="form"
|
|
29
27
|
:submit="selectComputeResourceSubmit"
|
|
30
28
|
:get-compute-resource-data="props.getComputeResourceData"
|
|
@@ -35,15 +33,17 @@
|
|
|
35
33
|
|
|
36
34
|
<common-wizards-vm-new-migrate-select-storage
|
|
37
35
|
v-show="selectedStep.id === 3"
|
|
36
|
+
:alert-messages="alertMessages[3]"
|
|
38
37
|
:submit="selectStorageSubmit"
|
|
39
38
|
:get-datastore-table-func="props.getDatastoreTableFunc"
|
|
40
39
|
:datastore="props.datastore"
|
|
41
40
|
:connected-storage-id-default="connectedStorageIdOnVm"
|
|
42
41
|
:configure-per-disks="props.configurePerDisks"
|
|
42
|
+
@hide-alert="onHideAlert"
|
|
43
43
|
/>
|
|
44
44
|
|
|
45
45
|
<common-wizards-vm-migrate-select-network
|
|
46
|
-
|
|
46
|
+
v-if="false"
|
|
47
47
|
v-model:is-basic-network-mode="
|
|
48
48
|
dataFormLocal.selectNetwork.isShowNetworkBasic
|
|
49
49
|
"
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
/>
|
|
52
52
|
|
|
53
53
|
<common-wizards-vm-migrate-select-priority
|
|
54
|
-
|
|
54
|
+
v-if="false"
|
|
55
55
|
v-model="selectedVMotionPriority"
|
|
56
56
|
/>
|
|
57
57
|
|
|
@@ -90,6 +90,7 @@ import type { UI_I_StorageConfigurePerDiskItem } from '~/components/common/wizar
|
|
|
90
90
|
import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
|
|
91
91
|
import type { UI_T_SelectVMotionPriority } from '~/components/common/wizards/vm/migrate/select/priority/lib/models/types'
|
|
92
92
|
import type { UI_I_CollectedDataFormLocal } from '~/components/common/wizards/vm/migrate/lib/models/interfaces'
|
|
93
|
+
import * as validation from '~/components/common/wizards/vmNew/migrate/lib/validations'
|
|
93
94
|
|
|
94
95
|
const props = defineProps<{
|
|
95
96
|
project: UI_T_Project
|
|
@@ -119,6 +120,7 @@ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
|
|
|
119
120
|
|
|
120
121
|
const form = ref<UI_I_MigrateFormLocal>({
|
|
121
122
|
migrate_type: props.project === 'procurator' ? 'storage' : 'resource',
|
|
123
|
+
storage: ''
|
|
122
124
|
})
|
|
123
125
|
|
|
124
126
|
const validationFunc = async (
|
|
@@ -128,22 +130,17 @@ const validationFunc = async (
|
|
|
128
130
|
): Promise<UI_I_ValidationReturn> => {
|
|
129
131
|
let stepHasError = false
|
|
130
132
|
|
|
131
|
-
if (wizard.isValidateForStep(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
// value = nameValidation.newValue
|
|
143
|
-
value = 'nameValidation.newValue'
|
|
144
|
-
|
|
145
|
-
// stepHasError = nameValidation.stepHasError
|
|
146
|
-
stepHasError = false
|
|
133
|
+
if (wizard.isValidateForStep(3, currentStep.id, nextStep.id)) {
|
|
134
|
+
const nameValidation = await validation.checkSelectedDatastoreSync(
|
|
135
|
+
localization.value,
|
|
136
|
+
form.value.storage,
|
|
137
|
+
wizard,
|
|
138
|
+
value
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
value = nameValidation.newValue
|
|
142
|
+
|
|
143
|
+
stepHasError = nameValidation.stepHasError
|
|
147
144
|
}
|
|
148
145
|
|
|
149
146
|
return {
|
|
@@ -211,6 +208,10 @@ const onFinish = (): void => {
|
|
|
211
208
|
const onHideModal = (): void => {
|
|
212
209
|
emits('hide')
|
|
213
210
|
}
|
|
211
|
+
|
|
212
|
+
const onHideAlert = (stepId: number): void => {
|
|
213
|
+
wizard.hideAlertMessagesByStepId(stepId)
|
|
214
|
+
}
|
|
214
215
|
</script>
|
|
215
216
|
|
|
216
217
|
<style scoped lang="scss">
|
|
@@ -18,7 +18,7 @@ export const stepsFunc = (
|
|
|
18
18
|
id: 1,
|
|
19
19
|
title: localization.common.selectTargetVCenterSer,
|
|
20
20
|
subTitle: localization.common.selectComputeResourceDesc,
|
|
21
|
-
status: UI_E_WIZARD_STATUS.
|
|
21
|
+
status: UI_E_WIZARD_STATUS.INACTIVE,
|
|
22
22
|
fields: {},
|
|
23
23
|
isValid: true,
|
|
24
24
|
testId: 'migrate-vm-select-target-server',
|
|
@@ -27,7 +27,7 @@ export const stepsFunc = (
|
|
|
27
27
|
id: 2,
|
|
28
28
|
title: localization.common.selectComputeResource,
|
|
29
29
|
subTitle: localization.common.selectComputeResourceDesc,
|
|
30
|
-
status: UI_E_WIZARD_STATUS.
|
|
30
|
+
status: UI_E_WIZARD_STATUS.INACTIVE,
|
|
31
31
|
fields: {},
|
|
32
32
|
isValid: true,
|
|
33
33
|
testId: 'migrate-vm-select-compute-resource',
|
|
@@ -36,7 +36,7 @@ export const stepsFunc = (
|
|
|
36
36
|
id: 3,
|
|
37
37
|
title: localization.common.selectStorage,
|
|
38
38
|
subTitle: localization.common.selectStorageDesc,
|
|
39
|
-
status: UI_E_WIZARD_STATUS.
|
|
39
|
+
status: UI_E_WIZARD_STATUS.INACTIVE,
|
|
40
40
|
fields: {
|
|
41
41
|
name: {
|
|
42
42
|
alert: '',
|
|
@@ -50,7 +50,7 @@ export const stepsFunc = (
|
|
|
50
50
|
id: 4,
|
|
51
51
|
title: localization.common.selectNetworks,
|
|
52
52
|
subTitle: localization.common.selectNetworksDesc,
|
|
53
|
-
status: UI_E_WIZARD_STATUS.
|
|
53
|
+
status: UI_E_WIZARD_STATUS.INACTIVE,
|
|
54
54
|
fields: {},
|
|
55
55
|
isValid: true,
|
|
56
56
|
testId: 'migrate-vm-select-networks',
|
|
@@ -59,7 +59,7 @@ export const stepsFunc = (
|
|
|
59
59
|
id: 5,
|
|
60
60
|
title: localization.common.selectVMotionPriority,
|
|
61
61
|
subTitle: localization.common.selectVMotionPriorityDesc,
|
|
62
|
-
status: UI_E_WIZARD_STATUS.
|
|
62
|
+
status: UI_E_WIZARD_STATUS.INACTIVE,
|
|
63
63
|
fields: {},
|
|
64
64
|
isValid: true,
|
|
65
65
|
testId: 'migrate-vm-select-vMotion-priority',
|
|
@@ -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
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="select-storage">
|
|
3
3
|
<atoms-alert
|
|
4
|
-
v-
|
|
4
|
+
v-show="props.alertMessages?.length"
|
|
5
5
|
test-id="select-storage-alert"
|
|
6
6
|
status="alert-danger"
|
|
7
|
-
:items="
|
|
8
|
-
@remove="
|
|
7
|
+
:items="props.alertMessages"
|
|
8
|
+
@remove="onHideAlert"
|
|
9
9
|
/>
|
|
10
10
|
|
|
11
11
|
<common-wizards-vm-migrate-select-storage-selected-per-disk
|
|
@@ -77,6 +77,7 @@ import type {
|
|
|
77
77
|
import { vmMigrateSelectStorageTabsFunc } from '~/components/common/wizards/vm/migrate/select/storage/lib/config/tabsPannel'
|
|
78
78
|
|
|
79
79
|
const props = defineProps<{
|
|
80
|
+
alertMessages: string[]
|
|
80
81
|
submit: number
|
|
81
82
|
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
|
82
83
|
datastore: UI_I_DatastoreTableItem[]
|
|
@@ -84,6 +85,7 @@ const props = defineProps<{
|
|
|
84
85
|
configurePerDisks: UI_I_StorageConfigurePerDiskItem[]
|
|
85
86
|
}>()
|
|
86
87
|
const emits = defineEmits<{
|
|
88
|
+
(event: 'hide-alert', value: number): void
|
|
87
89
|
(event: 'next-step', value: UI_I_SelectStorageReadyData): void
|
|
88
90
|
}>()
|
|
89
91
|
|
|
@@ -94,7 +96,6 @@ const selectStorageTabs = computed<UI_I_CollapseNavItem[]>(() =>
|
|
|
94
96
|
vmMigrateSelectStorageTabsFunc(localization.value)
|
|
95
97
|
)
|
|
96
98
|
|
|
97
|
-
const errorMessages = ref<string[]>([])
|
|
98
99
|
const selectStorageDataLocal = ref<UI_I_SelectStorageDataLocal>({
|
|
99
100
|
vmDiskFormat: 0,
|
|
100
101
|
storage: null,
|
|
@@ -160,18 +161,15 @@ const isHideSelectDiskFormat = computed<boolean>(() => {
|
|
|
160
161
|
selectedPerDisks.value[0].file === 'Configuration file'
|
|
161
162
|
)
|
|
162
163
|
})
|
|
163
|
-
const onHideErrorMessageAlert = (): void => {
|
|
164
|
-
errorMessages.value = []
|
|
165
|
-
}
|
|
166
164
|
|
|
167
165
|
const checkValidityBlock = (): boolean => {
|
|
168
166
|
if (!selectStorageDataLocal.value.storage) {
|
|
169
167
|
const errorText = localization.value.common.selectValidDestinationStorage
|
|
168
|
+
console.log(errorText)
|
|
170
169
|
|
|
171
|
-
errorMessages.value = [errorText]
|
|
172
170
|
return false
|
|
173
171
|
}
|
|
174
|
-
|
|
172
|
+
|
|
175
173
|
const isActivePerDiskTab = activeTab.value === 'configure-disk'
|
|
176
174
|
emits('next-step', {
|
|
177
175
|
...selectStorageDataLocal.value,
|
|
@@ -189,6 +187,10 @@ watch(
|
|
|
189
187
|
checkValidityBlock()
|
|
190
188
|
}
|
|
191
189
|
)
|
|
190
|
+
|
|
191
|
+
const onHideAlert = (): void => {
|
|
192
|
+
emits('hide-alert', 3)
|
|
193
|
+
}
|
|
192
194
|
</script>
|
|
193
195
|
|
|
194
196
|
<style lang="scss" scoped>
|