bfg-common 1.5.490 → 1.5.492
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/backup/storage/actions/add/Add.vue +251 -248
- package/components/common/backup/storage/actions/add/lib/utils.ts +62 -30
- package/components/common/backup/storage/actions/add/lib/validations.ts +16 -8
- package/components/common/vm/actions/add/Add.vue +2 -2
- package/components/common/vm/actions/add/New.vue +1 -1
- package/components/common/vm/actions/add/Old.vue +1 -1
- package/components/common/vm/actions/add/lib/config/steps.ts +347 -331
- package/components/common/vm/actions/clone/Clone.vue +1 -1
- package/components/common/vm/actions/clone/toTemplate/ToTemplate.vue +1 -1
- package/components/common/vm/actions/common/select/name/Name.vue +6 -6
- package/components/common/vm/actions/common/select/name/New.vue +3 -4
- package/components/common/vm/actions/common/select/name/Old.vue +4 -5
- package/components/common/vm/actions/register/Register.vue +1 -1
- package/components/common/wizards/datastore/add/Add.vue +228 -224
- package/components/common/wizards/datastore/add/lib/utils.ts +93 -63
- package/components/common/wizards/datastore/add/lib/validations.ts +16 -8
- package/package.json +1 -1
- package/components/common/vmt/actions/add/Add.vue +0 -549
- package/components/common/vmt/actions/add/New.vue +0 -346
- package/components/common/vmt/actions/add/Old.vue +0 -305
- package/components/common/vmt/actions/add/lib/config/steps.ts +0 -107
- package/components/common/vmt/actions/add/lib/models/interfaces.ts +0 -23
|
@@ -1,248 +1,251 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<common-backup-storage-actions-add-new
|
|
3
|
-
v-if="isNewView"
|
|
4
|
-
v-model="form"
|
|
5
|
-
:project="props.project"
|
|
6
|
-
:wizard="wizard"
|
|
7
|
-
:selected-scheme="selectedScheme"
|
|
8
|
-
:alert-messages="alertMessages"
|
|
9
|
-
:title="title"
|
|
10
|
-
:hosts="props.hosts"
|
|
11
|
-
:datastore="props.datastore"
|
|
12
|
-
:is-datastore-loading="props.isDatastoreLoading"
|
|
13
|
-
:get-datastore-table-func="props.getDatastoreTableFunc"
|
|
14
|
-
@change-steps="onChangeSteps"
|
|
15
|
-
@change-storage="onChangeStorage"
|
|
16
|
-
@submit="onCreate"
|
|
17
|
-
@hide="onHideModal"
|
|
18
|
-
/>
|
|
19
|
-
<common-backup-storage-actions-add-old
|
|
20
|
-
v-else
|
|
21
|
-
v-model="form"
|
|
22
|
-
:project="props.project"
|
|
23
|
-
:wizard="wizard"
|
|
24
|
-
:selected-scheme="selectedScheme"
|
|
25
|
-
:alert-messages="alertMessages"
|
|
26
|
-
:title="title"
|
|
27
|
-
:hosts="props.hosts"
|
|
28
|
-
:datastore="props.datastore"
|
|
29
|
-
:is-datastore-loading="props.isDatastoreLoading"
|
|
30
|
-
:get-datastore-table-func="props.getDatastoreTableFunc"
|
|
31
|
-
@change-steps="onChangeSteps"
|
|
32
|
-
@change-storage="onChangeStorage"
|
|
33
|
-
@submit="onCreate"
|
|
34
|
-
@hide="onHideModal"
|
|
35
|
-
/>
|
|
36
|
-
</template>
|
|
37
|
-
|
|
38
|
-
<script setup lang="ts">
|
|
39
|
-
import type {
|
|
40
|
-
UI_I_ValidationReturn,
|
|
41
|
-
UI_I_WizardStep,
|
|
42
|
-
} from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
|
|
43
|
-
import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
|
|
44
|
-
import type { UI_T_Project } from '~/lib/models/types'
|
|
45
|
-
import type { UI_I_CreateDatastoreForm } from '~/components/common/backup/storage/actions/add/lib/models/interfaces'
|
|
46
|
-
import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
|
|
47
|
-
import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
|
48
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
49
|
-
import type { UI_T_DatastoreTypeCode } from '~/components/common/backup/storage/actions/add/lib/models/types'
|
|
50
|
-
// TODO use from uikit
|
|
51
|
-
import {
|
|
52
|
-
stepsFunc,
|
|
53
|
-
stepsSchemeInitial,
|
|
54
|
-
} from '~/components/common/backup/storage/actions/add/lib/config/steps'
|
|
55
|
-
import { datastoreDefaultFormFunc } from '~/components/common/backup/storage/actions/add/lib/config/createDatastore'
|
|
56
|
-
import {
|
|
57
|
-
dynamicSteps,
|
|
58
|
-
getStepScheme,
|
|
59
|
-
} from '~/components/common/backup/storage/actions/add/lib/config/steps'
|
|
60
|
-
import * as validation from '~/components/common/backup/storage/actions/add/lib/validations'
|
|
61
|
-
|
|
62
|
-
const props = withDefaults(
|
|
63
|
-
defineProps<{
|
|
64
|
-
project: UI_T_Project
|
|
65
|
-
datastore: UI_I_DatastoreTableItem[]
|
|
66
|
-
isDatastoreLoading: boolean
|
|
67
|
-
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
|
68
|
-
hosts?: any[]
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
(event: '
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
value,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
value
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
value
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
//
|
|
159
|
-
//
|
|
160
|
-
// value
|
|
161
|
-
//
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
|
|
167
|
-
//
|
|
168
|
-
// value
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
value
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
value
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<common-backup-storage-actions-add-new
|
|
3
|
+
v-if="isNewView"
|
|
4
|
+
v-model="form"
|
|
5
|
+
:project="props.project"
|
|
6
|
+
:wizard="wizard"
|
|
7
|
+
:selected-scheme="selectedScheme"
|
|
8
|
+
:alert-messages="alertMessages"
|
|
9
|
+
:title="title"
|
|
10
|
+
:hosts="props.hosts"
|
|
11
|
+
:datastore="props.datastore"
|
|
12
|
+
:is-datastore-loading="props.isDatastoreLoading"
|
|
13
|
+
:get-datastore-table-func="props.getDatastoreTableFunc"
|
|
14
|
+
@change-steps="onChangeSteps"
|
|
15
|
+
@change-storage="onChangeStorage"
|
|
16
|
+
@submit="onCreate"
|
|
17
|
+
@hide="onHideModal"
|
|
18
|
+
/>
|
|
19
|
+
<common-backup-storage-actions-add-old
|
|
20
|
+
v-else
|
|
21
|
+
v-model="form"
|
|
22
|
+
:project="props.project"
|
|
23
|
+
:wizard="wizard"
|
|
24
|
+
:selected-scheme="selectedScheme"
|
|
25
|
+
:alert-messages="alertMessages"
|
|
26
|
+
:title="title"
|
|
27
|
+
:hosts="props.hosts"
|
|
28
|
+
:datastore="props.datastore"
|
|
29
|
+
:is-datastore-loading="props.isDatastoreLoading"
|
|
30
|
+
:get-datastore-table-func="props.getDatastoreTableFunc"
|
|
31
|
+
@change-steps="onChangeSteps"
|
|
32
|
+
@change-storage="onChangeStorage"
|
|
33
|
+
@submit="onCreate"
|
|
34
|
+
@hide="onHideModal"
|
|
35
|
+
/>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
import type {
|
|
40
|
+
UI_I_ValidationReturn,
|
|
41
|
+
UI_I_WizardStep,
|
|
42
|
+
} from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
|
|
43
|
+
import Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
|
|
44
|
+
import type { UI_T_Project } from '~/lib/models/types'
|
|
45
|
+
import type { UI_I_CreateDatastoreForm } from '~/components/common/backup/storage/actions/add/lib/models/interfaces'
|
|
46
|
+
import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
|
|
47
|
+
import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
|
|
48
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
49
|
+
import type { UI_T_DatastoreTypeCode } from '~/components/common/backup/storage/actions/add/lib/models/types'
|
|
50
|
+
// TODO use from uikit
|
|
51
|
+
import {
|
|
52
|
+
stepsFunc,
|
|
53
|
+
stepsSchemeInitial,
|
|
54
|
+
} from '~/components/common/backup/storage/actions/add/lib/config/steps'
|
|
55
|
+
import { datastoreDefaultFormFunc } from '~/components/common/backup/storage/actions/add/lib/config/createDatastore'
|
|
56
|
+
import {
|
|
57
|
+
dynamicSteps,
|
|
58
|
+
getStepScheme,
|
|
59
|
+
} from '~/components/common/backup/storage/actions/add/lib/config/steps'
|
|
60
|
+
import * as validation from '~/components/common/backup/storage/actions/add/lib/validations'
|
|
61
|
+
|
|
62
|
+
const props = withDefaults(
|
|
63
|
+
defineProps<{
|
|
64
|
+
project: UI_T_Project
|
|
65
|
+
datastore: UI_I_DatastoreTableItem[]
|
|
66
|
+
isDatastoreLoading: boolean
|
|
67
|
+
getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
|
|
68
|
+
hosts?: any[]
|
|
69
|
+
datacenterId?: string
|
|
70
|
+
}>(),
|
|
71
|
+
{ hosts: [], datacenterId: '' }
|
|
72
|
+
)
|
|
73
|
+
const emits = defineEmits<{
|
|
74
|
+
(event: 'create', value: UI_I_CreateDatastoreForm): void
|
|
75
|
+
(event: 'hide'): void
|
|
76
|
+
}>()
|
|
77
|
+
|
|
78
|
+
const { $store }: any = useNuxtApp()
|
|
79
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
80
|
+
|
|
81
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
82
|
+
|
|
83
|
+
const title = ref(localization.value.common.newBackupStorage)
|
|
84
|
+
|
|
85
|
+
const wizard: Wizard = new Wizard(
|
|
86
|
+
stepsFunc(localization.value),
|
|
87
|
+
stepsSchemeInitial
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
|
|
91
|
+
const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
|
|
92
|
+
|
|
93
|
+
const form = ref<UI_I_CreateDatastoreForm>(
|
|
94
|
+
useDeepCopy(datastoreDefaultFormFunc())
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
const validationFunc = async (
|
|
98
|
+
value: UI_I_WizardStep[],
|
|
99
|
+
currentStep: UI_I_WizardStep,
|
|
100
|
+
nextStep: UI_I_WizardStep
|
|
101
|
+
): Promise<UI_I_ValidationReturn> => {
|
|
102
|
+
let stepHasError = false
|
|
103
|
+
|
|
104
|
+
if (
|
|
105
|
+
wizard.isValidateForStep(dynamicSteps.name, currentStep.id, nextStep.id)
|
|
106
|
+
) {
|
|
107
|
+
const nameValidation = await validation.checkDatastoreNameAsync(
|
|
108
|
+
localization.value,
|
|
109
|
+
value,
|
|
110
|
+
form.value,
|
|
111
|
+
dynamicSteps.name,
|
|
112
|
+
'name',
|
|
113
|
+
wizard,
|
|
114
|
+
props.project,
|
|
115
|
+
props.datacenterId
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
value = nameValidation.newValue
|
|
119
|
+
|
|
120
|
+
stepHasError = nameValidation.stepHasError
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (
|
|
124
|
+
wizard.isValidateForStep(
|
|
125
|
+
dynamicSteps.nameAndConfigure,
|
|
126
|
+
currentStep.id,
|
|
127
|
+
nextStep.id
|
|
128
|
+
)
|
|
129
|
+
) {
|
|
130
|
+
const nameValidation = await validation.checkDatastoreNameAsync(
|
|
131
|
+
localization.value,
|
|
132
|
+
value,
|
|
133
|
+
form.value,
|
|
134
|
+
dynamicSteps.nameAndConfigure,
|
|
135
|
+
'name',
|
|
136
|
+
wizard,
|
|
137
|
+
props.project,
|
|
138
|
+
props.datacenterId
|
|
139
|
+
)
|
|
140
|
+
value = nameValidation.newValue
|
|
141
|
+
|
|
142
|
+
const folderValidation = validation.checkFolderSync(
|
|
143
|
+
localization.value,
|
|
144
|
+
form.value.folder,
|
|
145
|
+
wizard,
|
|
146
|
+
value
|
|
147
|
+
)
|
|
148
|
+
value = folderValidation.newValue
|
|
149
|
+
|
|
150
|
+
const serverValidation = validation.checkServerSync(
|
|
151
|
+
localization.value,
|
|
152
|
+
form.value.server,
|
|
153
|
+
wizard,
|
|
154
|
+
value
|
|
155
|
+
)
|
|
156
|
+
value = serverValidation.newValue
|
|
157
|
+
|
|
158
|
+
// PC-2542
|
|
159
|
+
// const usernameValidation = validation.checkUsernameSync(
|
|
160
|
+
// localization.value,
|
|
161
|
+
// form.value.user,
|
|
162
|
+
// wizard,
|
|
163
|
+
// value
|
|
164
|
+
// )
|
|
165
|
+
// value = usernameValidation.newValue
|
|
166
|
+
|
|
167
|
+
// const passwordValidation = validation.checkPasswordSync(
|
|
168
|
+
// localization.value,
|
|
169
|
+
// form.value.password,
|
|
170
|
+
// wizard,
|
|
171
|
+
// value
|
|
172
|
+
// )
|
|
173
|
+
// value = passwordValidation.newValue
|
|
174
|
+
|
|
175
|
+
stepHasError =
|
|
176
|
+
nameValidation.stepHasError ||
|
|
177
|
+
folderValidation.stepHasError ||
|
|
178
|
+
serverValidation.stepHasError
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (
|
|
182
|
+
wizard.isValidateForStep(
|
|
183
|
+
dynamicSteps.hostAccessibility,
|
|
184
|
+
currentStep.id,
|
|
185
|
+
nextStep.id
|
|
186
|
+
)
|
|
187
|
+
) {
|
|
188
|
+
const hostsValidation = await validation.checkHostsAccessibilitySync(
|
|
189
|
+
localization.value,
|
|
190
|
+
form.value.hosts,
|
|
191
|
+
wizard,
|
|
192
|
+
value
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
value = hostsValidation.newValue
|
|
196
|
+
|
|
197
|
+
stepHasError = hostsValidation.stepHasError
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (
|
|
201
|
+
wizard.isValidateForStep(dynamicSteps.storage, currentStep.id, nextStep.id)
|
|
202
|
+
) {
|
|
203
|
+
const storageValidation = await validation.checkStorageSync(
|
|
204
|
+
localization.value,
|
|
205
|
+
form.value.storm_id,
|
|
206
|
+
wizard,
|
|
207
|
+
value
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
value = storageValidation.newValue
|
|
211
|
+
|
|
212
|
+
stepHasError = storageValidation.stepHasError
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return {
|
|
216
|
+
newValue: value,
|
|
217
|
+
stepHasError,
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
|
|
222
|
+
wizard.changeSteps(value, validationFunc)
|
|
223
|
+
|
|
224
|
+
// Choosing Scheme
|
|
225
|
+
watch(
|
|
226
|
+
() => form.value.type_code,
|
|
227
|
+
(newValue: UI_T_DatastoreTypeCode) => {
|
|
228
|
+
const step = getStepScheme(props.project, newValue)
|
|
229
|
+
if (step !== undefined) {
|
|
230
|
+
wizard.changeScheme(step)
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
{ immediate: true }
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
const onChangeStorage = (storage: UI_I_DatastoreTableItem | null): void => {
|
|
237
|
+
if (!storage) return
|
|
238
|
+
|
|
239
|
+
form.value.storm_id = storage.id
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const onCreate = async (): Promise<void> => {
|
|
243
|
+
emits('create', form.value)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const onHideModal = (): void => {
|
|
247
|
+
emits('hide')
|
|
248
|
+
}
|
|
249
|
+
</script>
|
|
250
|
+
|
|
251
|
+
<style scoped lang="scss"></style>
|
|
@@ -1,30 +1,62 @@
|
|
|
1
|
-
import type Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
|
|
2
|
-
import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
|
|
3
|
-
import type { UI_T_Project } from '~/lib/models/types'
|
|
4
|
-
import { UI_E_Kind } from '~/lib/models/enums'
|
|
5
|
-
|
|
6
|
-
export const checkValidityName = async (
|
|
7
|
-
name
|
|
8
|
-
wizard
|
|
9
|
-
project
|
|
10
|
-
sendMessage
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import type Wizard from '~/node_modules/bfg-uikit/components/ui/wizard/lib/utils/utils'
|
|
2
|
+
import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
|
|
3
|
+
import type { UI_T_Project } from '~/lib/models/types'
|
|
4
|
+
import { UI_E_Kind } from '~/lib/models/enums'
|
|
5
|
+
|
|
6
|
+
export const checkValidityName = async ({
|
|
7
|
+
name,
|
|
8
|
+
wizard,
|
|
9
|
+
project,
|
|
10
|
+
sendMessage,
|
|
11
|
+
datacenterId,
|
|
12
|
+
}: {
|
|
13
|
+
name: string
|
|
14
|
+
wizard: Wizard
|
|
15
|
+
project: UI_T_Project
|
|
16
|
+
sendMessage: (message: string) => void
|
|
17
|
+
datacenterId?: string
|
|
18
|
+
}): Promise<void> => {
|
|
19
|
+
wizard.setLoader(true)
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
const url = buildValidationUrl(name, project, datacenterId)
|
|
23
|
+
|
|
24
|
+
const { error } = await useMyFetch<null, API_UI_I_Error>(url, {
|
|
25
|
+
method: 'GET',
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
if (
|
|
29
|
+
error?.value?.data?.error_code !== 0
|
|
30
|
+
) {
|
|
31
|
+
const existError =
|
|
32
|
+
error.value.data?.error_message ?? String(error.value.data)
|
|
33
|
+
sendMessage(existError)
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
sendMessage('')
|
|
38
|
+
} catch (e) {
|
|
39
|
+
const msg = e instanceof Error ? e.message : 'Unknown error'
|
|
40
|
+
sendMessage(msg)
|
|
41
|
+
} finally {
|
|
42
|
+
wizard.setLoader(false)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const buildValidationUrl = (
|
|
47
|
+
name: string,
|
|
48
|
+
project: UI_T_Project,
|
|
49
|
+
datacenterId?: string
|
|
50
|
+
): string => {
|
|
51
|
+
if (project === 'procurator') {
|
|
52
|
+
const params = new URLSearchParams({ name })
|
|
53
|
+
return `/ui/ds/validate?${params.toString()}`
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const params = new URLSearchParams()
|
|
57
|
+
params.set('name', name)
|
|
58
|
+
params.set('kind', String(UI_E_Kind.STORAGE_VALIDATION_NAME))
|
|
59
|
+
if (datacenterId) params.set('datacenter', datacenterId)
|
|
60
|
+
|
|
61
|
+
return `/ui/object/validate_name?${params.toString()}`
|
|
62
|
+
}
|
|
@@ -14,15 +14,22 @@ const checkName = async (
|
|
|
14
14
|
form: UI_I_CreateDatastoreForm,
|
|
15
15
|
localization: UI_I_Localization,
|
|
16
16
|
wizard: Wizard,
|
|
17
|
-
project: UI_T_Project
|
|
17
|
+
project: UI_T_Project,
|
|
18
|
+
datacenterId?: string
|
|
18
19
|
): Promise<UI_I_AsyncCheckReturn> => {
|
|
19
20
|
if (form.name) {
|
|
20
21
|
return new Promise((resolve, _reject) =>
|
|
21
|
-
checkValidityName(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
checkValidityName({
|
|
23
|
+
name: form.name,
|
|
24
|
+
wizard,
|
|
25
|
+
project,
|
|
26
|
+
datacenterId,
|
|
27
|
+
sendMessage: (message: string) => {
|
|
28
|
+
resolve({
|
|
29
|
+
isValid: message === '',
|
|
30
|
+
message: message === '' ? '' : message,
|
|
31
|
+
})
|
|
32
|
+
},
|
|
26
33
|
})
|
|
27
34
|
)
|
|
28
35
|
} else {
|
|
@@ -39,14 +46,15 @@ export const checkDatastoreNameAsync = async (
|
|
|
39
46
|
stepId: number,
|
|
40
47
|
fieldName: string,
|
|
41
48
|
wizard: Wizard,
|
|
42
|
-
project: UI_T_Project
|
|
49
|
+
project: UI_T_Project,
|
|
50
|
+
datacenterId?: string
|
|
43
51
|
): Promise<UI_I_ValidationReturn> => {
|
|
44
52
|
let stepHasError = false
|
|
45
53
|
|
|
46
54
|
const labelValidation: {
|
|
47
55
|
isValid: boolean
|
|
48
56
|
message: string
|
|
49
|
-
} = await checkName(form, localization, wizard, project)
|
|
57
|
+
} = await checkName(form, localization, wizard, project, datacenterId)
|
|
50
58
|
|
|
51
59
|
if (!labelValidation.isValid) {
|
|
52
60
|
stepHasError = wizard.setValidation(stepId, fieldName, {
|
|
@@ -297,7 +297,7 @@ const selectedCreateType = ref<string>('0')
|
|
|
297
297
|
if (props.isVmt) selectedCreateType.value = '-1'
|
|
298
298
|
|
|
299
299
|
const wizard: Wizard = new Wizard(
|
|
300
|
-
stepsFunc(localization.value, props.isVmt),
|
|
300
|
+
stepsFunc(localization.value, props.isVmt, isSphere.value),
|
|
301
301
|
stepsSchemeInitial
|
|
302
302
|
)
|
|
303
303
|
watch(
|
|
@@ -311,7 +311,7 @@ watch(
|
|
|
311
311
|
wizard.changeScheme(isSphere.value ? 6 : 2)
|
|
312
312
|
break
|
|
313
313
|
case '-1':
|
|
314
|
-
wizard.changeScheme(10)
|
|
314
|
+
wizard.changeScheme(isSphere.value ? 11 : 10)
|
|
315
315
|
break
|
|
316
316
|
}
|
|
317
317
|
},
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
selectedStep.id === dynamicSteps.selectNameFolder
|
|
72
72
|
"
|
|
73
73
|
:name-form-submit="props.nameFormSubmit"
|
|
74
|
-
:
|
|
74
|
+
:has-location="props.project === 'sphere'"
|
|
75
75
|
:is-vmt="props.isVmt"
|
|
76
76
|
:data-center="props.dataCenter"
|
|
77
77
|
:validate-empty-name="props.validateEmptyName"
|