bfg-common 1.3.440 → 1.3.442

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 (56) hide show
  1. package/components/common/vm/actions/editSettings/EditSettings.vue +30 -30
  2. package/components/common/wizards/datastoreNew/add/Add.vue +611 -0
  3. package/components/common/wizards/datastoreNew/add/lib/config/stepItems.ts +191 -0
  4. package/components/common/wizards/datastoreNew/add/lib/config/steps.ts +202 -0
  5. package/components/common/wizards/datastoreNew/add/lib/models/interfaces.ts +38 -0
  6. package/components/common/wizards/datastoreNew/add/lib/models/types.ts +14 -0
  7. package/components/common/wizards/datastoreNew/add/lib/utils.ts +72 -0
  8. package/components/common/wizards/datastoreNew/add/local/Local.vue +44 -0
  9. package/components/common/wizards/datastoreNew/add/local/createName/CreateName.vue +129 -0
  10. package/components/common/wizards/datastoreNew/add/local/createName/lib/config/defaultForm.ts +15 -0
  11. package/components/common/wizards/datastoreNew/add/nfs/Nfs.vue +99 -0
  12. package/components/common/wizards/datastoreNew/add/nfs/accessibility/Accessibility.vue +104 -0
  13. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/config/tabsPannel.ts +24 -0
  14. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/interfaces.ts +9 -0
  15. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/types.ts +5 -0
  16. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/TablesView.vue +142 -0
  17. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -0
  18. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +53 -0
  19. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/incompatibleTable.ts +68 -0
  20. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/tableKeys.ts +15 -0
  21. package/components/common/wizards/datastoreNew/add/nfs/configuration/Configuration.vue +385 -0
  22. package/components/common/wizards/datastoreNew/add/nfs/configuration/lib/config/defaultForm.ts +33 -0
  23. package/components/common/wizards/datastoreNew/add/nfs/configuration/lib/models/interfaces.ts +12 -0
  24. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/DeletePopover.vue +100 -0
  25. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/ServersList.vue +124 -0
  26. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/config/serversListConfig.ts +41 -0
  27. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/config/tableKeys.ts +3 -0
  28. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/models/interfaces.ts +11 -0
  29. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/models/types.ts +1 -0
  30. package/components/common/wizards/datastoreNew/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +55 -0
  31. package/components/common/wizards/datastoreNew/add/nfs/kerberosAuthentication/lib/config/radioOptions.ts +27 -0
  32. package/components/common/wizards/datastoreNew/add/nfs/version/Version.vue +42 -0
  33. package/components/common/wizards/datastoreNew/add/nfs/version/lib/config/versionOptions.ts +20 -0
  34. package/components/common/wizards/datastoreNew/add/readyComplete/ReadyComplete.vue +88 -0
  35. package/components/common/wizards/datastoreNew/add/readyComplete/lib/config/propertiesDetails.ts +175 -0
  36. package/components/common/wizards/datastoreNew/add/readyComplete/lib/models/interfaces.ts +4 -0
  37. package/components/common/wizards/datastoreNew/add/sharedStorm/SharedStorm.vue +90 -0
  38. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/DeviceSelection.vue +424 -0
  39. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/defaultForm.ts +18 -0
  40. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/selectOptions.ts +14 -0
  41. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces.ts +58 -0
  42. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/types.ts +14 -0
  43. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/Table.vue +134 -0
  44. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/hostsTable.ts +87 -0
  45. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/tableKeys.ts +11 -0
  46. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +232 -0
  47. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/graphicTooltip/graphicTooltip.vue +64 -0
  48. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/lib/config/selectOptions.ts +46 -0
  49. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/sizeGraphic/sizeGraphic.vue +225 -0
  50. package/components/common/wizards/datastoreNew/add/sharedStorm/version/Version.vue +39 -0
  51. package/components/common/wizards/datastoreNew/add/sharedStorm/version/lib/config/versionOptions.ts +21 -0
  52. package/components/common/wizards/datastoreNew/add/types/Types.vue +71 -0
  53. package/components/common/wizards/datastoreNew/add/types/lib/config/typeOptions.ts +49 -0
  54. package/lib/models/interfaces.ts +1 -0
  55. package/lib/utils/sendTask.ts +2 -1
  56. package/package.json +1 -1
@@ -0,0 +1,611 @@
1
+ <template>
2
+ <div class="new-datastore">
3
+ <atoms-wizard
4
+ show
5
+ :wizard="wizard"
6
+ :selected-scheme="selectedScheme"
7
+ :title="localization.newDatastore"
8
+ :localization="localization"
9
+ class="add-datastore"
10
+ test-id="add-datastore-wizard"
11
+ @change-steps="onChangeSteps"
12
+ @hide="onHideModal"
13
+ @submit="onFinish"
14
+ >
15
+ <template #modalBody="{ selectedStep }">
16
+ {{ form }}
17
+ <common-wizards-datastore-new-add-types
18
+ v-if="selectedStep.id === 0"
19
+ v-model:datastore-type="datastoreType"
20
+ :project="props.project"
21
+ />
22
+
23
+ <common-wizards-datastore-new-add-local
24
+ v-show="selectedStep.id === 1"
25
+ v-model="form"
26
+ :project="props.project"
27
+ :step-id="selectedStep.id"
28
+ :datastore-type="datastoreType"
29
+ :alert-messages="alertMessages[1]"
30
+ :messages-fields="selectedStep.fields"
31
+ @hide-alert="onHideAlert"
32
+ />
33
+
34
+ <common-wizards-datastore-new-add-shared-storm
35
+ v-show="datastoreType === 'shared-storm'"
36
+ v-model="form"
37
+ :project="props.project"
38
+ :step-id="selectedStep.id"
39
+ :datastore-type="datastoreType"
40
+ :alert-messages="alertMessages[selectedStep.id]"
41
+ :messages-fields="selectedStep.fields"
42
+ :datacenter-hosts="props.datacenterHosts"
43
+ :is-main-filter="props.isMainFilter"
44
+ :host-id="props.hostId"
45
+ @hide-alert="onHideAlert"
46
+ @loading="(e) => (loading = e)"
47
+ @submit="onSaveAndNextSharedStorm"
48
+ @main-filter="emits('main-filter', $event)"
49
+ />
50
+
51
+ <common-wizards-datastore-new-add-nfs
52
+ v-show="datastoreType === 'nfs'"
53
+ :mode="props.project"
54
+ :step-id="selectedStep.id"
55
+ :datastore-type="datastoreType"
56
+ :nfs-configuration-submit="nfsConfigurationSubmit"
57
+ :host-accessibility-submit="hostAccessibilitySubmit"
58
+ :hosts="props.nfsHosts"
59
+ @loading="(e) => (loading = e)"
60
+ @change-nfs-version="updateNfsVersion"
61
+ @submit="saveChangesAndNextNfs"
62
+ />
63
+
64
+ <common-wizards-datastore-add-ready-complete
65
+ v-show="selectedStep.id === 11"
66
+ :data-ready-view="dataReadyView"
67
+ />
68
+ </template>
69
+ </atoms-wizard>
70
+ </div>
71
+ </template>
72
+
73
+ <script setup lang="ts">
74
+ import type {
75
+ UI_I_WizardStep,
76
+ UI_I_ValidationReturn,
77
+ UI_I_AsyncCheckReturn,
78
+ } from '~/components/atoms/wizard/lib/models/interfaces'
79
+ import Wizard from '~/components/atoms/wizard/lib/utils/utils'
80
+ import {
81
+ stepsFunc,
82
+ stepsSchemeInitial,
83
+ } from '~/components/common/wizards/datastoreNew/add/lib/config/steps'
84
+
85
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
86
+ import type { UI_T_Project } from '~/lib/models/types'
87
+ // import { UI_I_VerticalStepItem } from '~/components/atoms/lib/models/interfaces'
88
+ import type {
89
+ UI_T_DatastoreType,
90
+ UI_T_NfsType,
91
+ // UI_T_WizardDatastoreMode,
92
+ } from '~/components/common/wizards/datastore/add/lib/models/types'
93
+ import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastoreNew/add/lib/models/interfaces'
94
+ import type {
95
+ UI_I_LunDisk,
96
+ UI_I_SelectHostOptions,
97
+ } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
98
+ // import { stepItemsFunc } from '~/components/common/wizards/datastore/add/lib/config/stepItems'
99
+ import type { UI_I_DetailsItem } from '~/components/common/details/lib/models/interfaces'
100
+ import { constructDataReadyViewFunc } from '~/components/common/wizards/datastoreNew/add/readyComplete/lib/config/propertiesDetails'
101
+ import { checkValidityName } from '~/components/common/wizards/datastoreNew/add/lib/utils'
102
+
103
+ const props = defineProps<{
104
+ project: UI_T_Project
105
+ finishFunc: (
106
+ datastoreForm: UI_I_CreateDatastoreForm,
107
+ datastoreType: UI_T_DatastoreType,
108
+ version: UI_T_NfsType
109
+ ) => Promise<void>
110
+ datacenterHosts?: UI_I_SelectHostOptions[]
111
+ nfsHosts?: any
112
+ isMainFilter?: boolean
113
+ hostId?: string
114
+ }>()
115
+ const emits = defineEmits<{
116
+ (event: 'hide'): void
117
+ (event: 'global-refresh'): void
118
+ (event: 'main-filter', value: string): void
119
+ }>()
120
+
121
+ const localization = computed<UI_I_Localization>(() => useLocal())
122
+
123
+ const wizard: Wizard = new Wizard(
124
+ stepsFunc(localization.value),
125
+ stepsSchemeInitial
126
+ )
127
+
128
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
129
+ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
130
+
131
+ const loading = ref<boolean>(false)
132
+ const datastoreType = ref<UI_T_DatastoreType>(
133
+ props.project === 'procurator' ? 'local' : 'shared-storm'
134
+ )
135
+ const nfsVersion = ref<UI_T_NfsType>('nfs-3')
136
+
137
+ const stepPosition = ref<number>(0)
138
+ // const dataReadyView = ref<any>([])
139
+
140
+ const form = ref({
141
+ name: '',
142
+ lunDisk: [],
143
+ })
144
+ const datastoreForm = ref<UI_I_CreateDatastoreForm>({
145
+ local: {
146
+ name: '',
147
+ hosts: [],
148
+ type_code: 1,
149
+ },
150
+ sharedStorm: {
151
+ name: '',
152
+ dev_names: [],
153
+ hosts: [],
154
+ pool_name: '',
155
+ type_code: 2,
156
+ },
157
+ nfs: {
158
+ name: '',
159
+ server: '',
160
+ folder: '',
161
+ readonly: false,
162
+ version: nfsVersion.value,
163
+ type_code: 4,
164
+ hosts: [],
165
+ },
166
+ })
167
+
168
+ const checkNetwork = async (
169
+ label: string,
170
+ localization: UI_I_Localization
171
+ // emits: UI_I_AddNetworkingEmits
172
+ ): Promise<UI_I_AsyncCheckReturn> => {
173
+ if (label) {
174
+ return new Promise((resolve, _reject) =>
175
+ checkValidityName(label, (message: string) => {
176
+ resolve({
177
+ isValid: message === '',
178
+ message: message === '' ? '' : message,
179
+ })
180
+ })
181
+ )
182
+ } else {
183
+ return {
184
+ isValid: false,
185
+ message: localization.specifyDatastoreName,
186
+ }
187
+ }
188
+ }
189
+
190
+ const checkNameAsync = async (
191
+ localization: UI_I_Localization,
192
+ value: UI_I_WizardStep[],
193
+ label: string,
194
+ wizard: Wizard
195
+ ): Promise<UI_I_ValidationReturn> => {
196
+ let stepHasError = false
197
+
198
+ const labelValidation: {
199
+ isValid: boolean
200
+ message: string
201
+ } = await checkNetwork(label, localization)
202
+
203
+ if (!labelValidation.isValid) {
204
+ stepHasError = wizard.setValidation(1, 'datastoreName', {
205
+ fieldMessage: labelValidation.message,
206
+ alertMessage: label ? labelValidation.message : '',
207
+ })
208
+ } else if (wizard.hasMessage(1, 'datastoreName')) {
209
+ value = wizard.removeValidation(1, 'datastoreName', value)
210
+ }
211
+
212
+ return {
213
+ newValue: value,
214
+ stepHasError,
215
+ }
216
+ }
217
+
218
+ const checkNetwork2 = async (
219
+ form: any,
220
+ localization: UI_I_Localization
221
+ // emits: UI_I_AddNetworkingEmits
222
+ ): Promise<UI_I_AsyncCheckReturn> => {
223
+ console.log(form, 'sdsdf')
224
+ if (form.name && form.lunDisk.length) {
225
+ return new Promise((resolve, _reject) =>
226
+ checkValidityName(form.name, (message: string) => {
227
+ resolve({
228
+ isValid: message === '',
229
+ message: message === '' ? '' : message,
230
+ })
231
+ })
232
+ )
233
+ } else {
234
+ return {
235
+ isValid: false,
236
+ message: !form.lunDisk.length
237
+ ? localization.selectHostToContinueAlert
238
+ : localization.specifyDatastoreName,
239
+ }
240
+ }
241
+ }
242
+ const checkName2Async = async (
243
+ localization: UI_I_Localization,
244
+ value: UI_I_WizardStep[],
245
+ form: any,
246
+ wizard: Wizard
247
+ ): Promise<UI_I_ValidationReturn> => {
248
+ let stepHasError = false
249
+
250
+ const labelValidation: {
251
+ isValid: boolean
252
+ message: string
253
+ } = await checkNetwork2(form, localization)
254
+
255
+ if (!labelValidation.isValid) {
256
+ stepHasError = wizard.setValidation(1, 'datastoreName', {
257
+ fieldMessage: labelValidation.message,
258
+ alertMessage: form.name ? labelValidation.message : '',
259
+ })
260
+ } else if (wizard.hasMessage(1, 'datastoreName')) {
261
+ value = wizard.removeValidation(1, 'datastoreName', value)
262
+ }
263
+
264
+ return {
265
+ newValue: value,
266
+ stepHasError,
267
+ }
268
+ }
269
+
270
+ const validationFunc = async (
271
+ value: UI_I_WizardStep[],
272
+ currentStep: UI_I_WizardStep,
273
+ nextStep: UI_I_WizardStep
274
+ ): Promise<UI_I_ValidationReturn> => {
275
+ let stepHasError = false
276
+
277
+ if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
278
+ const nameValidation = await checkNameAsync(
279
+ localization.value,
280
+ value,
281
+ form.value.name,
282
+ wizard
283
+ )
284
+
285
+ value = nameValidation.newValue
286
+
287
+ stepHasError = nameValidation.stepHasError
288
+ }
289
+
290
+ if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
291
+ const nameValidation = await checkName2Async(
292
+ localization.value,
293
+ value,
294
+ form.value,
295
+ wizard
296
+ )
297
+
298
+ value = nameValidation.newValue
299
+
300
+ stepHasError = nameValidation.stepHasError
301
+ }
302
+
303
+ return {
304
+ newValue: value,
305
+ stepHasError,
306
+ }
307
+ }
308
+
309
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
310
+ wizard.changeSteps(value, validationFunc)
311
+
312
+ // Choosing Scheme
313
+ watch(
314
+ datastoreType,
315
+ (newValue: UI_T_DatastoreType) => {
316
+ if (props.project === 'procurator') {
317
+ if (newValue === 'local') {
318
+ wizard.changeScheme(0)
319
+ }
320
+
321
+ if (newValue === 'shared-storm') {
322
+ wizard.changeScheme(1)
323
+ }
324
+
325
+ if (newValue === 'nfs') {
326
+ wizard.changeScheme(2)
327
+ }
328
+ }
329
+ },
330
+ { deep: true, immediate: true }
331
+ )
332
+
333
+ const dataReadyView = computed<UI_I_DetailsItem>(() =>
334
+ constructDataReadyViewFunc(
335
+ localization.value,
336
+ datastoreType.value,
337
+ form.value
338
+ )
339
+ )
340
+
341
+ // const stepItems = computed<UI_I_VerticalStepItem[]>(() =>
342
+ // stepItemsFunc(localization.value, datastoreType.value, props.mode)
343
+ // )
344
+
345
+ // let cashStep = -1
346
+ const onNextStep = (_force = false): void => {
347
+ // const isValid = checkSubmit(force)
348
+ //
349
+ // if (!isValid) {
350
+ // return
351
+ // }
352
+ //
353
+ // const isDisabled = stepItems.value[cashStep]?.disabled
354
+ // if (cashStep !== -1 && !isDisabled) {
355
+ // stepPosition.value = cashStep
356
+ // cashStep = -1
357
+ // return
358
+ // }
359
+ //
360
+ // stepItems.value[stepPosition.value].complete = true
361
+ // stepItems.value[stepPosition.value + 1].disabled = false
362
+ // stepPosition.value++
363
+ }
364
+
365
+ const back = (): void => {
366
+ stepPosition.value--
367
+ }
368
+
369
+ // const onChangeStep = (key: number): void => {
370
+ // if (key < stepPosition.value) {
371
+ // stepPosition.value = key
372
+ // return
373
+ // }
374
+ //
375
+ // const isValid = checkSubmit()
376
+ //
377
+ // if (!isValid) {
378
+ // cashStep = key
379
+ // return
380
+ // }
381
+ //
382
+ // stepPosition.value = key
383
+ // }
384
+ const onHideModal = (): void => {
385
+ emits('hide')
386
+ }
387
+
388
+ const updateNfsVersion = (event: UI_T_NfsType): void => {
389
+ nfsVersion.value = event
390
+ const { name, server, folder, hosts } = datastoreForm.value.nfs
391
+ saveChangesAndNextNfs({ name, server, folder, hosts }, false)
392
+ }
393
+
394
+ const nfsConfigurationSubmit = ref<number>(0)
395
+ const hostAccessibilitySubmit = ref<number>(0)
396
+
397
+ // const checkSubmit = (force = false): boolean => {
398
+ // if (datastoreType.value === 'local') {
399
+ // if (stepPosition.value === 1 && !force) {
400
+ // localCreateNameSubmit.value++
401
+ // return false
402
+ // }
403
+ // }
404
+ //
405
+ // if (datastoreType.value === 'nfs') {
406
+ // if (stepPosition.value === 2 && !force) {
407
+ // nfsConfigurationSubmit.value++
408
+ // return false
409
+ // }
410
+ //
411
+ // if (props.mode === 'sphere' && stepPosition.value === 3 && !force) {
412
+ // hostAccessibilitySubmit.value++
413
+ // return false
414
+ // }
415
+ // // if (
416
+ // // ((stepPosition.value === 4 && nfsVersion.value === 'nfs-4.1') ||
417
+ // // (stepPosition.value === 3 && nfsVersion.value === 'nfs-3')) &&
418
+ // // !force
419
+ // // ) {
420
+ // // hostAccessibilitySubmit.value++
421
+ // // return false
422
+ // // }
423
+ // }
424
+ //
425
+ // return true
426
+ // }
427
+
428
+ const isWizardModeForSphere = computed<boolean>(
429
+ () => props.project === 'sphere'
430
+ )
431
+
432
+ const onSaveAndNextSharedStorm = (event: any): void => {
433
+ const { sharedStorm } = datastoreForm.value
434
+ sharedStorm.name = event.name
435
+ sharedStorm.dev_names = event.lunDisk.map((lun: UI_I_LunDisk) => lun.name)
436
+ sharedStorm.hosts = [event.host]
437
+
438
+ dataReadyView.value = constructDataReadyViewFunc(
439
+ localization.value,
440
+ 'shared-storm',
441
+ event,
442
+ isWizardModeForSphere.value
443
+ )
444
+
445
+ onNextStep(true)
446
+ }
447
+ const saveChangesAndNextNfs = (event: any, next = true): void => {
448
+ const { nfs } = datastoreForm.value
449
+ nfs.name = event.name
450
+ nfs.folder = event.folder
451
+ nfs.server = event.server
452
+ nfs.hosts = event.hosts
453
+
454
+ // TODO refactoring
455
+ const hostsNames = props.nfsHosts
456
+ ? props.nfsHosts.items
457
+ .filter((host) => event.hosts.includes(host.id))
458
+ .map((host) => host.host)
459
+ : []
460
+
461
+ dataReadyView.value = constructDataReadyViewFunc(
462
+ localization.value,
463
+ 'nfs',
464
+ {
465
+ ...event,
466
+ hosts: hostsNames,
467
+ version: nfsVersion.value,
468
+ },
469
+ isWizardModeForSphere.value
470
+ )
471
+
472
+ next && onNextStep(true)
473
+ }
474
+
475
+ // const isShowCompleteBlock = computed<boolean>(() => {
476
+ // // TODO refactoring
477
+ // const localStep = datastoreType.value === 'local' && stepPosition.value === 2
478
+ //
479
+ // const sharesStep =
480
+ // datastoreType.value === 'shared-storm' &&
481
+ // (props.project === 'procurator'
482
+ // ? stepPosition.value === 3
483
+ // : stepPosition.value === 2)
484
+ //
485
+ // let nfsFirst
486
+ // if (props.project === 'procurator') {
487
+ // nfsFirst =
488
+ // datastoreType.value === 'nfs' &&
489
+ // nfsVersion.value === 'nfs-3' &&
490
+ // stepPosition.value === 3
491
+ // } else {
492
+ // nfsFirst =
493
+ // datastoreType.value === 'nfs' &&
494
+ // nfsVersion.value === 'nfs-3' &&
495
+ // stepPosition.value === 4
496
+ // }
497
+ //
498
+ // let nfsSecond
499
+ // if (props.project === 'procurator') {
500
+ // nfsSecond =
501
+ // datastoreType.value === 'nfs' &&
502
+ // nfsVersion.value === 'nfs-4.1' &&
503
+ // stepPosition.value === 3
504
+ // } else {
505
+ // nfsSecond =
506
+ // datastoreType.value === 'nfs' &&
507
+ // nfsVersion.value === 'nfs-4.1' &&
508
+ // stepPosition.value === 4
509
+ // }
510
+ //
511
+ // return localStep || sharesStep || nfsFirst || nfsSecond
512
+ // })
513
+
514
+ const onAddDatastore = async (): Promise<void> => {
515
+ loading.value = true
516
+
517
+ props
518
+ .finishFunc(datastoreForm.value, datastoreType.value, nfsVersion.value)
519
+ .then(() => {
520
+ emits('global-refresh')
521
+ loading.value = false
522
+ onHideModal()
523
+ })
524
+ }
525
+
526
+ // const createDatastoreFromLocal = async (): Promise<API_UI_I_Error> => {
527
+ // const { local } = datastoreForm.value
528
+ //
529
+ // return await createDatastore<Omit<UI_I_CreateDatastoreBodyRequest, 'pool_name'>>(
530
+ // local
531
+ // )
532
+ // }
533
+ // const createDatastoreFromSharedStorm = async (): Promise<API_UI_I_Error> => {
534
+ // const {
535
+ // sharedStorm: { dev_names: disks, ...sendData },
536
+ // } = datastoreForm.value
537
+ //
538
+ // const { data, msg } = await getStoragePoolName<{ dev_names: string[] }>(
539
+ // '/psm/api/v1/storage/lvm/create',
540
+ // { dev_names: disks }
541
+ // )
542
+ //
543
+ // if (!data && msg) return msg
544
+ //
545
+ // sendData.pool_name = data?.pool_name || ''
546
+ //
547
+ // return await createDatastore(sendData)
548
+ // }
549
+
550
+ // const createDatastoreFromNfs = async (): Promise<API_UI_I_Error> => {
551
+ // const {
552
+ // nfs: { server, folder, readonly, name, type_code: type },
553
+ // } = datastoreForm.value
554
+ //
555
+ // const sendDataOne = {
556
+ // server,
557
+ // folder,
558
+ // readonly,
559
+ // version: nfsVersion.value === 'nfs-4.1' ? 4.1 : 3.0,
560
+ // }
561
+ //
562
+ // const { data, msg } = await getStoragePoolName<UI_I_NfsPoolNameForm>(
563
+ // '/psm/api/v1/storage/cnfs',
564
+ // sendDataOne
565
+ // )
566
+ //
567
+ // if (!data && msg) return msg
568
+ //
569
+ // const sendDataTwo = {
570
+ // name,
571
+ // type_code: type,
572
+ // pool_name: data?.pool_name || '',
573
+ // }
574
+ //
575
+ // return await createDatastore(sendDataTwo)
576
+ // }
577
+
578
+ const onHideAlert = (stepId: number): void => {
579
+ wizard.hideAlertMessagesByStepId(stepId)
580
+ }
581
+ const onFinish = async (): Promise<void> => {
582
+ loading.value = true
583
+
584
+ onHideModal()
585
+ loading.value = false
586
+ }
587
+ </script>
588
+
589
+ <style scoped lang="scss">
590
+ @import 'assets/scss/common/mixins.scss';
591
+ .new-datastore {
592
+ &__body {
593
+ @include flex($dir: column);
594
+ height: 100%;
595
+ padding-left: 24px;
596
+ }
597
+ }
598
+
599
+ .finish-block {
600
+ padding: 18px 24px 24px 24px;
601
+
602
+ .add-hosts-ready-to-complete-mt-12 {
603
+ margin-top: 12px;
604
+
605
+ .add-hosts-ready-to-complete-bold {
606
+ line-height: 18px;
607
+ font-weight: 700;
608
+ }
609
+ }
610
+ }
611
+ </style>