bfg-common 1.3.456 → 1.3.458
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.
|
@@ -166,13 +166,22 @@ const datastoreForm = ref<UI_I_CreateDatastoreForm>({
|
|
|
166
166
|
},
|
|
167
167
|
})
|
|
168
168
|
|
|
169
|
-
const
|
|
169
|
+
const checkName = async (
|
|
170
170
|
label: string,
|
|
171
171
|
localization: UI_I_Localization,
|
|
172
172
|
wizard: Wizard
|
|
173
173
|
// emits: UI_I_AddNetworkingEmits
|
|
174
174
|
): Promise<UI_I_AsyncCheckReturn> => {
|
|
175
|
-
|
|
175
|
+
const typeCode = form.value.type_code
|
|
176
|
+
|
|
177
|
+
let help = typeCode === 1
|
|
178
|
+
if (typeCode === 2) {
|
|
179
|
+
help = form.value.lunDisk.length
|
|
180
|
+
}
|
|
181
|
+
if (typeCode === 4) {
|
|
182
|
+
help = form.value.folder && form.value.server
|
|
183
|
+
}
|
|
184
|
+
if (label && help) {
|
|
176
185
|
return new Promise((resolve, _reject) =>
|
|
177
186
|
checkValidityName(label, wizard, (message: string) => {
|
|
178
187
|
resolve({
|
|
@@ -188,11 +197,12 @@ const checkNetwork = async (
|
|
|
188
197
|
}
|
|
189
198
|
}
|
|
190
199
|
}
|
|
191
|
-
|
|
192
|
-
const checkNameAsync = async (
|
|
200
|
+
const checkDatastoreNameAsync = async (
|
|
193
201
|
localization: UI_I_Localization,
|
|
194
202
|
value: UI_I_WizardStep[],
|
|
195
203
|
label: string,
|
|
204
|
+
stepId: number,
|
|
205
|
+
fieldName: string,
|
|
196
206
|
wizard: Wizard
|
|
197
207
|
): Promise<UI_I_ValidationReturn> => {
|
|
198
208
|
let stepHasError = false
|
|
@@ -200,15 +210,15 @@ const checkNameAsync = async (
|
|
|
200
210
|
const labelValidation: {
|
|
201
211
|
isValid: boolean
|
|
202
212
|
message: string
|
|
203
|
-
} = await
|
|
213
|
+
} = await checkName(label, localization, wizard)
|
|
204
214
|
|
|
205
215
|
if (!labelValidation.isValid) {
|
|
206
|
-
stepHasError = wizard.setValidation(
|
|
216
|
+
stepHasError = wizard.setValidation(stepId, fieldName, {
|
|
207
217
|
fieldMessage: labelValidation.message,
|
|
208
218
|
alertMessage: label ? labelValidation.message : '',
|
|
209
219
|
})
|
|
210
|
-
} else if (wizard.hasMessage(
|
|
211
|
-
value = wizard.removeValidation(
|
|
220
|
+
} else if (wizard.hasMessage(stepId, fieldName)) {
|
|
221
|
+
value = wizard.removeValidation(stepId, fieldName, value)
|
|
212
222
|
}
|
|
213
223
|
|
|
214
224
|
return {
|
|
@@ -269,50 +279,43 @@ const checkNameAndDeviceAsync = async (
|
|
|
269
279
|
}
|
|
270
280
|
}
|
|
271
281
|
|
|
272
|
-
const
|
|
273
|
-
form: any,
|
|
282
|
+
const checkNfsFolderSync = (
|
|
274
283
|
localization: UI_I_Localization,
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
284
|
+
name: string,
|
|
285
|
+
wizard: Wizard,
|
|
286
|
+
value: UI_I_WizardStep[]
|
|
287
|
+
): UI_I_ValidationReturn => {
|
|
288
|
+
let stepHasError = false
|
|
289
|
+
|
|
290
|
+
if (!name) {
|
|
291
|
+
stepHasError = wizard.setValidation(5, 'folder', {
|
|
292
|
+
fieldMessage: localization.specifyFolderName,
|
|
293
|
+
alertMessage: '',
|
|
294
|
+
})
|
|
295
|
+
} else if (wizard.hasMessage(5, 'folder')) {
|
|
296
|
+
value = wizard.removeValidation(5, 'folder', value)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return {
|
|
300
|
+
newValue: value,
|
|
301
|
+
stepHasError,
|
|
294
302
|
}
|
|
295
303
|
}
|
|
296
|
-
const
|
|
304
|
+
const checkNfsServerSync = (
|
|
297
305
|
localization: UI_I_Localization,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
):
|
|
306
|
+
name: string,
|
|
307
|
+
wizard: Wizard,
|
|
308
|
+
value: UI_I_WizardStep[]
|
|
309
|
+
): UI_I_ValidationReturn => {
|
|
302
310
|
let stepHasError = false
|
|
303
311
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
if (!labelValidation.isValid) {
|
|
310
|
-
stepHasError = wizard.setValidation(5, 'name', {
|
|
311
|
-
fieldMessage: labelValidation.message,
|
|
312
|
-
alertMessage: form.name ? labelValidation.message : '',
|
|
312
|
+
if (!name) {
|
|
313
|
+
stepHasError = wizard.setValidation(5, 'server', {
|
|
314
|
+
fieldMessage: localization.specifyServerName,
|
|
315
|
+
alertMessage: '',
|
|
313
316
|
})
|
|
314
|
-
} else if (wizard.hasMessage(5, '
|
|
315
|
-
value = wizard.removeValidation(5, '
|
|
317
|
+
} else if (wizard.hasMessage(5, 'server')) {
|
|
318
|
+
value = wizard.removeValidation(5, 'server', value)
|
|
316
319
|
}
|
|
317
320
|
|
|
318
321
|
return {
|
|
@@ -329,10 +332,12 @@ const validationFunc = async (
|
|
|
329
332
|
let stepHasError = false
|
|
330
333
|
|
|
331
334
|
if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
|
|
332
|
-
const nameValidation = await
|
|
335
|
+
const nameValidation = await checkDatastoreNameAsync(
|
|
333
336
|
localization.value,
|
|
334
337
|
value,
|
|
335
338
|
form.value.name,
|
|
339
|
+
1,
|
|
340
|
+
'datastoreName',
|
|
336
341
|
wizard
|
|
337
342
|
)
|
|
338
343
|
|
|
@@ -355,16 +360,35 @@ const validationFunc = async (
|
|
|
355
360
|
}
|
|
356
361
|
|
|
357
362
|
if (wizard.isValidateForStep(5, currentStep.id, nextStep.id)) {
|
|
358
|
-
const nameValidation = await
|
|
363
|
+
const nameValidation = await checkDatastoreNameAsync(
|
|
359
364
|
localization.value,
|
|
360
365
|
value,
|
|
361
|
-
form.value,
|
|
366
|
+
form.value.name,
|
|
367
|
+
5,
|
|
368
|
+
'name',
|
|
362
369
|
wizard
|
|
363
370
|
)
|
|
364
371
|
|
|
365
372
|
value = nameValidation.newValue
|
|
366
373
|
|
|
367
|
-
|
|
374
|
+
const folderValidation = checkNfsFolderSync(
|
|
375
|
+
localization.value,
|
|
376
|
+
form.value.folder,
|
|
377
|
+
wizard,
|
|
378
|
+
value
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
const serverValidation = checkNfsServerSync(
|
|
382
|
+
localization.value,
|
|
383
|
+
form.value.folder,
|
|
384
|
+
wizard,
|
|
385
|
+
value
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
stepHasError =
|
|
389
|
+
folderValidation.stepHasError ||
|
|
390
|
+
nameValidation.stepHasError ||
|
|
391
|
+
serverValidation.stepHasError
|
|
368
392
|
}
|
|
369
393
|
|
|
370
394
|
return {
|