bfg-common 1.4.58 → 1.4.60

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 (98) hide show
  1. package/components/common/wizards/datastore/add/Add.vue +232 -362
  2. package/components/common/wizards/{datastoreNew → datastore}/add/lib/config/steps.ts +3 -0
  3. package/components/common/wizards/datastore/add/lib/models/interfaces.ts +11 -30
  4. package/components/common/wizards/datastore/add/lib/models/types.ts +0 -7
  5. package/components/common/wizards/datastore/add/lib/utils.ts +14 -54
  6. package/components/common/wizards/{datastoreNew → datastore}/add/lib/validations.ts +2 -2
  7. package/components/common/wizards/datastore/add/local/Local.vue +19 -45
  8. package/components/common/wizards/datastore/add/local/createName/CreateName.vue +31 -81
  9. package/components/common/wizards/datastore/add/nfs/Nfs.vue +25 -74
  10. package/components/common/wizards/datastore/add/nfs/accessibility/Accessibility.vue +15 -56
  11. package/components/common/wizards/datastore/add/nfs/accessibility/lib/models/interfaces.ts +0 -4
  12. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/TablesView.vue +9 -66
  13. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +1 -1
  14. package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +57 -214
  15. package/components/common/wizards/datastore/add/nfs/configuration/lib/models/interfaces.ts +4 -11
  16. package/components/common/wizards/datastore/add/nfs/version/Version.vue +3 -19
  17. package/components/common/wizards/datastore/add/nfs/version/lib/config/versionOptions.ts +4 -4
  18. package/components/common/wizards/datastore/add/readyComplete/ReadyComplete.vue +3 -10
  19. package/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails.ts +37 -95
  20. package/components/common/wizards/datastore/add/sharedStorm/SharedStorm.vue +32 -45
  21. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/DeviceSelection.vue +64 -267
  22. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/selectOptions.ts +5 -5
  23. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces.ts +1 -11
  24. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/types.ts +1 -14
  25. package/components/common/wizards/{datastoreNew → datastore}/add/sharedStorm/deviceSelection/table/Table.vue +2 -2
  26. package/components/common/wizards/{datastoreNew → datastore}/add/sharedStorm/deviceSelection/table/lib/config/lunDiskTable.ts +1 -1
  27. package/components/common/wizards/{datastoreNew → datastore}/add/sharedStorm/deviceSelection/table/lib/config/tableKeys.ts +1 -1
  28. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +13 -13
  29. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/lib/config/selectOptions.ts +8 -8
  30. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/sizeGraphic/sizeGraphic.vue +2 -2
  31. package/components/common/wizards/datastore/add/types/Types.vue +18 -17
  32. package/components/common/wizards/datastore/add/types/lib/config/typeOptions.ts +7 -16
  33. package/lib/models/enums.ts +1 -0
  34. package/package.json +1 -1
  35. package/components/common/wizards/datastore/add/lib/config/stepItems.ts +0 -225
  36. package/components/common/wizards/datastore/add/local/createName/lib/config/defaultForm.ts +0 -15
  37. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +0 -53
  38. package/components/common/wizards/datastore/add/nfs/configuration/lib/config/defaultForm.ts +0 -33
  39. package/components/common/wizards/datastore/add/nfs/configuration/serversList/DeletePopover.vue +0 -100
  40. package/components/common/wizards/datastore/add/nfs/configuration/serversList/ServersList.vue +0 -124
  41. package/components/common/wizards/datastore/add/nfs/configuration/serversList/lib/config/serversListConfig.ts +0 -40
  42. package/components/common/wizards/datastore/add/nfs/configuration/serversList/lib/config/tableKeys.ts +0 -3
  43. package/components/common/wizards/datastore/add/nfs/configuration/serversList/lib/models/interfaces.ts +0 -11
  44. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +0 -55
  45. package/components/common/wizards/datastore/add/readyComplete/lib/models/interfaces.ts +0 -4
  46. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/HostTable.vue +0 -144
  47. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/lib/config/hostsTable.ts +0 -87
  48. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/lib/config/tableKeys.ts +0 -11
  49. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/defaultForm.ts +0 -18
  50. package/components/common/wizards/datastore/add/sharedStorm/version/Version.vue +0 -39
  51. package/components/common/wizards/datastoreNew/add/Add.vue +0 -307
  52. package/components/common/wizards/datastoreNew/add/lib/models/interfaces.ts +0 -19
  53. package/components/common/wizards/datastoreNew/add/lib/models/types.ts +0 -7
  54. package/components/common/wizards/datastoreNew/add/lib/utils.ts +0 -64
  55. package/components/common/wizards/datastoreNew/add/local/Local.vue +0 -45
  56. package/components/common/wizards/datastoreNew/add/local/createName/CreateName.vue +0 -116
  57. package/components/common/wizards/datastoreNew/add/nfs/Nfs.vue +0 -63
  58. package/components/common/wizards/datastoreNew/add/nfs/_kerberosAuthentication/lib/config/radioOptions.ts +0 -27
  59. package/components/common/wizards/datastoreNew/add/nfs/accessibility/Accessibility.vue +0 -63
  60. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/config/tabsPannel.ts +0 -24
  61. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/interfaces.ts +0 -9
  62. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/types.ts +0 -5
  63. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/TablesView.vue +0 -85
  64. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +0 -62
  65. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/incompatibleTable.ts +0 -68
  66. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/tableKeys.ts +0 -15
  67. package/components/common/wizards/datastoreNew/add/nfs/configuration/Configuration.vue +0 -236
  68. package/components/common/wizards/datastoreNew/add/nfs/configuration/_serversList/lib/models/types.ts +0 -1
  69. package/components/common/wizards/datastoreNew/add/nfs/configuration/lib/models/interfaces.ts +0 -5
  70. package/components/common/wizards/datastoreNew/add/nfs/version/Version.vue +0 -26
  71. package/components/common/wizards/datastoreNew/add/nfs/version/lib/config/versionOptions.ts +0 -22
  72. package/components/common/wizards/datastoreNew/add/readyComplete/ReadyComplete.vue +0 -88
  73. package/components/common/wizards/datastoreNew/add/readyComplete/lib/config/propertiesDetails.ts +0 -140
  74. package/components/common/wizards/datastoreNew/add/sharedStorm/SharedStorm.vue +0 -84
  75. package/components/common/wizards/datastoreNew/add/sharedStorm/_version/lib/config/versionOptions.ts +0 -21
  76. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/DeviceSelection.vue +0 -276
  77. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/selectOptions.ts +0 -23
  78. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces.ts +0 -48
  79. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/types.ts +0 -1
  80. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +0 -236
  81. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/graphicTooltip/graphicTooltip.vue +0 -64
  82. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/lib/config/selectOptions.ts +0 -46
  83. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/sizeGraphic/sizeGraphic.vue +0 -225
  84. package/components/common/wizards/datastoreNew/add/types/Types.vue +0 -83
  85. package/components/common/wizards/datastoreNew/add/types/lib/config/typeOptions.ts +0 -41
  86. /package/components/common/wizards/{datastoreNew → datastore}/add/lib/models/enums.ts +0 -0
  87. /package/components/common/wizards/{datastoreNew → datastore}/add/nfs/_kerberosAuthentication/KerberosAuthentication.vue +0 -0
  88. /package/components/common/wizards/datastore/add/nfs/{kerberosAuthentication → _kerberosAuthentication}/lib/config/radioOptions.ts +0 -0
  89. /package/components/common/wizards/{datastoreNew → datastore}/add/nfs/accessibility/tablesView/lib/models/interfaces.ts +0 -0
  90. /package/components/common/wizards/{datastoreNew → datastore}/add/nfs/configuration/_serversList/DeletePopover.vue +0 -0
  91. /package/components/common/wizards/{datastoreNew → datastore}/add/nfs/configuration/_serversList/ServersList.vue +0 -0
  92. /package/components/common/wizards/{datastoreNew → datastore}/add/nfs/configuration/_serversList/lib/config/serversListConfig.ts +0 -0
  93. /package/components/common/wizards/{datastoreNew → datastore}/add/nfs/configuration/_serversList/lib/config/tableKeys.ts +0 -0
  94. /package/components/common/wizards/{datastoreNew → datastore}/add/nfs/configuration/_serversList/lib/models/interfaces.ts +0 -0
  95. /package/components/common/wizards/datastore/add/nfs/configuration/{serversList → _serversList}/lib/models/types.ts +0 -0
  96. /package/components/common/wizards/{datastoreNew → datastore}/add/sharedStorm/_version/Version.vue +0 -0
  97. /package/components/common/wizards/datastore/add/sharedStorm/{version → _version}/lib/config/versionOptions.ts +0 -0
  98. /package/components/common/wizards/{datastoreNew → datastore}/add/sharedStorm/deviceSelection/table/lib/models/types.ts +0 -0
@@ -1,419 +1,289 @@
1
1
  <template>
2
2
  <div class="new-datastore">
3
- <atoms-modal-by-steps
3
+ <atoms-wizard
4
+ show
5
+ :wizard="wizard"
6
+ :selected-scheme="selectedScheme"
7
+ :title="localization.newDatastore"
8
+ :localization="localization"
9
+ class="add-datastore"
4
10
  test-id="add-datastore-wizard"
5
- :show="true"
6
- :title="localization.common.newDatastore"
7
- :step-items="stepItems"
8
- :step-position="stepPosition"
9
- :loading="loading"
10
- @finish="onAddDatastore"
11
- @next="onNextStep"
12
- @back="back"
13
- @change-step="onChangeStep"
11
+ @change-steps="onChangeSteps"
14
12
  @hide="onHideModal"
13
+ @submit="onFinish"
15
14
  >
16
- <template #modalBody>
17
- <div class="new-datastore__body">
18
- <!-- :project="props.mode"-->
19
- <common-wizards-datastore-add-types
20
- v-show="stepPosition === 0"
21
- v-model:type="datastoreType"
22
- />
23
-
24
- <common-wizards-datastore-add-local
25
- v-show="datastoreType === 'local' && !isShowCompleteBlock"
26
- :mode="props.mode"
27
- :step-position="stepPosition"
28
- :datastore-type="datastoreType"
29
- :local-create-name-submit="localCreateNameSubmit"
30
- :datacenter-hosts="props.datacenterHosts"
31
- :is-main-filter="props.isMainFilter"
32
- @loading="(e) => (loading = e)"
33
- @submit="onSaveNameAndNextLocal"
34
- @main-filter="emits('main-filter', $event)"
35
- />
36
-
37
- <common-wizards-datastore-add-shared-storm
38
- v-show="datastoreType === 'shared-storm' && !isShowCompleteBlock"
39
- :mode="props.mode"
40
- :step-position="stepPosition"
41
- :datastore-type="datastoreType"
42
- :device-selection-submit="deviceSelectionSubmit"
43
- :datacenter-hosts="props.datacenterHosts"
44
- :is-main-filter="props.isMainFilter"
45
- :host-id="props.hostId"
46
- @loading="(e) => (loading = e)"
47
- @submit="onSaveAndNextSharedStorm"
48
- @main-filter="emits('main-filter', $event)"
49
- />
50
-
51
- <common-wizards-datastore-add-nfs
52
- v-show="datastoreType === 'nfs' && !isShowCompleteBlock"
53
- :mode="props.mode"
54
- :step-position="stepPosition"
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="isShowCompleteBlock"
66
- :data-ready-view="dataReadyView"
67
- />
68
- </div>
15
+ <template #modalBody="{ selectedStep }">
16
+ <common-wizards-datastore-add-types
17
+ v-if="selectedStep.id === 0"
18
+ v-model="form"
19
+ v-model:datastore-type="datastoreType"
20
+ :project="props.project"
21
+ />
22
+
23
+ <common-wizards-datastore-add-local
24
+ v-if="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-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
+ :hosts="props.nfsHosts"
43
+ :is-main-filter="props.isMainFilter"
44
+ :host-id="props.hostId"
45
+ @hide-alert="onHideAlert"
46
+ @main-filter="emits('main-filter', $event)"
47
+ />
48
+
49
+ <common-wizards-datastore-add-nfs
50
+ v-show="datastoreType === 'nfs'"
51
+ v-model="form"
52
+ :project="props.project"
53
+ :step-id="selectedStep.id"
54
+ :alert-messages="alertMessages[selectedStep.id]"
55
+ :messages-fields="selectedStep.fields"
56
+ :hosts="props.nfsHosts"
57
+ />
58
+
59
+ <common-wizards-datastore-add-ready-complete
60
+ v-show="selectedStep.id === 11"
61
+ :data-ready-view="dataReadyView"
62
+ />
69
63
  </template>
70
- </atoms-modal-by-steps>
64
+ </atoms-wizard>
71
65
  </div>
72
66
  </template>
73
67
 
74
68
  <script setup lang="ts">
75
- import type { UI_I_Localization } from '~/lib/models/interfaces'
76
- import type { UI_I_VerticalStepItem } from '~/components/atoms/lib/models/interfaces'
77
69
  import type {
78
- UI_T_DatastoreType,
79
- UI_T_NfsType,
80
- UI_T_WizardDatastoreMode,
81
- } from '~/components/common/wizards/datastore/add/lib/models/types'
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/datastore/add/lib/config/steps'
78
+
79
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
80
+ import type { UI_T_Project } from '~/lib/models/types'
81
+ import type { UI_T_DatastoreType } from '~/components/common/wizards/datastore/add/lib/models/types'
82
82
  import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
83
- import type {
84
- UI_I_LunDisk,
85
- UI_I_SelectHostOptions,
86
- } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
87
- import { stepItemsFunc } from '~/components/common/wizards/datastore/add/lib/config/stepItems'
83
+ import type { UI_I_DetailsItem } from '~/components/common/details/lib/models/interfaces'
84
+ import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/models/interfaces'
85
+ import type { UI_I_ChangeStepsSchemes } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
86
+ import { E_DatastoreTypeKode } from '~/components/common/wizards/datastore/add/lib/models/enums'
88
87
  import { constructDataReadyViewFunc } from '~/components/common/wizards/datastore/add/readyComplete/lib/config/propertiesDetails'
88
+ import * as validation from '~/components/common/wizards/datastore/add/lib/validations'
89
89
 
90
90
  const props = defineProps<{
91
- // TODO refactoring to project
92
- mode: UI_T_WizardDatastoreMode
93
- finishFunc: (
94
- datastoreForm: UI_I_CreateDatastoreForm,
95
- datastoreType: UI_T_DatastoreType,
96
- version: UI_T_NfsType
97
- ) => Promise<void>
98
- datacenterHosts?: UI_I_SelectHostOptions[]
99
- nfsHosts?: any
100
- isMainFilter?: boolean
91
+ project: UI_T_Project
92
+ nfsHosts?: UI_I_CreateDatastoreHosts
101
93
  hostId?: string
94
+ isMainFilter?: boolean
102
95
  }>()
103
96
  const emits = defineEmits<{
104
97
  (event: 'hide'): void
105
- (event: 'global-refresh'): void
98
+ (event: 'finish', value: any): void
106
99
  (event: 'main-filter', value: string): void
107
100
  }>()
108
101
 
109
102
  const localization = computed<UI_I_Localization>(() => useLocal())
110
103
 
111
- const loading = ref<boolean>(false)
112
- const datastoreType = ref<UI_T_DatastoreType>(
113
- // props.mode === 'procurator' ? 'local' : 'shared-storm'
114
- 'shared-storm'
104
+ const wizard: Wizard = new Wizard(
105
+ stepsFunc(localization.value),
106
+ stepsSchemeInitial
115
107
  )
116
- const nfsVersion = ref<UI_T_NfsType>('nfs-3')
117
108
 
118
- const stepPosition = ref<number>(0)
119
- const dataReadyView = ref<any>([])
120
-
121
- const datastoreForm = ref<UI_I_CreateDatastoreForm>({
122
- local: {
123
- name: '',
124
- hosts: [],
125
- type_code: 1,
126
- },
127
- sharedStorm: {
128
- name: '',
129
- dev_names: [],
130
- hosts: [],
131
- pool_name: '',
132
- type_code: 2,
133
- },
134
- nfs: {
135
- name: '',
136
- server: '',
137
- folder: '',
138
- readonly: false,
139
- version: nfsVersion.value,
140
- type_code: 4,
141
- hosts: [],
142
- },
109
+ const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
110
+ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
111
+
112
+ // const datastoreType = ref<UI_T_DatastoreType>(
113
+ // props.project === 'procurator' ? 'local' : 'shared-storm'
114
+ // )
115
+ const datastoreType = ref<UI_T_DatastoreType>('shared-storm')
116
+ const form = ref<UI_I_CreateDatastoreForm>({
117
+ name: 'Datastore',
118
+ lunDisk: [],
119
+ hosts: props.hostId ? [props?.hostId] : [],
120
+ type_code: E_DatastoreTypeKode[datastoreType.value],
121
+ nfsVersion: 'nfs-3',
122
+ readonly: false,
123
+ server: '',
124
+ folder: '',
143
125
  })
144
126
 
145
- const stepItems = computed<UI_I_VerticalStepItem[]>(() =>
146
- stepItemsFunc(localization.value, datastoreType.value, props.mode)
147
- )
148
-
149
- let cashStep = -1
150
- const onNextStep = (force = false): void => {
151
- const isValid = checkSubmit(force)
127
+ const validationFunc = async (
128
+ value: UI_I_WizardStep[],
129
+ currentStep: UI_I_WizardStep,
130
+ nextStep: UI_I_WizardStep
131
+ ): Promise<UI_I_ValidationReturn> => {
132
+ let stepHasError = false
133
+
134
+ if (wizard.isValidateForStep(1, currentStep.id, nextStep.id)) {
135
+ const nameValidation = await validation.checkDatastoreNameAsync(
136
+ localization.value,
137
+ value,
138
+ form.value,
139
+ 1,
140
+ 'datastoreName',
141
+ wizard,
142
+ props.project
143
+ )
144
+
145
+ value = nameValidation.newValue
146
+
147
+ stepHasError = nameValidation.stepHasError
148
+ }
152
149
 
153
- if (!isValid) {
154
- return
150
+ if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
151
+ const nameValidation = await validation.checkDatastoreNameAsync(
152
+ localization.value,
153
+ value,
154
+ form.value,
155
+ 2,
156
+ 'datastoreName',
157
+ wizard,
158
+ props.project
159
+ )
160
+
161
+ value = nameValidation.newValue
162
+
163
+ const lunDiskValidation = validation.checkSelectedLunDiskSync(
164
+ localization.value,
165
+ form.value,
166
+ wizard,
167
+ value,
168
+ props.project,
169
+ props.hostId
170
+ )
171
+
172
+ value = lunDiskValidation.newValue
173
+
174
+ stepHasError = nameValidation.stepHasError || lunDiskValidation.stepHasError
155
175
  }
156
176
 
157
- const isDisabled = stepItems.value[cashStep]?.disabled
158
- if (cashStep !== -1 && !isDisabled) {
159
- stepPosition.value = cashStep
160
- cashStep = -1
161
- return
177
+ if (wizard.isValidateForStep(5, currentStep.id, nextStep.id)) {
178
+ const nameValidation = await validation.checkDatastoreNameAsync(
179
+ localization.value,
180
+ value,
181
+ form.value,
182
+ 5,
183
+ 'name',
184
+ wizard,
185
+ props.project
186
+ )
187
+ value = nameValidation.newValue
188
+
189
+ const folderValidation = validation.checkNfsFolderSync(
190
+ localization.value,
191
+ form.value.folder,
192
+ wizard,
193
+ value
194
+ )
195
+ value = folderValidation.newValue
196
+
197
+ const serverValidation = validation.checkNfsServerSync(
198
+ localization.value,
199
+ form.value.server,
200
+ wizard,
201
+ value
202
+ )
203
+ value = serverValidation.newValue
204
+
205
+ stepHasError =
206
+ nameValidation.stepHasError ||
207
+ folderValidation.stepHasError ||
208
+ serverValidation.stepHasError
162
209
  }
163
210
 
164
- stepItems.value[stepPosition.value].complete = true
165
- stepItems.value[stepPosition.value + 1].disabled = false
166
- stepPosition.value++
167
- }
211
+ if (wizard.isValidateForStep(6, currentStep.id, nextStep.id)) {
212
+ const nameValidation = await validation.checkHostsAccessibilitySync(
213
+ localization.value,
214
+ form.value.hosts,
215
+ wizard,
216
+ value
217
+ )
168
218
 
169
- const back = (): void => {
170
- stepPosition.value--
171
- }
219
+ value = nameValidation.newValue
172
220
 
173
- const onChangeStep = (key: number): void => {
174
- if (key < stepPosition.value) {
175
- stepPosition.value = key
176
- return
221
+ stepHasError = nameValidation.stepHasError
177
222
  }
178
223
 
179
- const isValid = checkSubmit()
180
-
181
- if (!isValid) {
182
- cashStep = key
183
- return
224
+ return {
225
+ newValue: value,
226
+ stepHasError,
184
227
  }
185
-
186
- stepPosition.value = key
187
- }
188
- const onHideModal = (): void => {
189
- emits('hide')
190
228
  }
191
229
 
192
- const updateNfsVersion = (event: UI_T_NfsType): void => {
193
- nfsVersion.value = event
194
- const { name, server, folder, hosts } = datastoreForm.value.nfs
195
- saveChangesAndNextNfs({ name, server, folder, hosts }, false)
196
- }
197
-
198
- const localCreateNameSubmit = ref<number>(0)
199
-
200
- const nfsConfigurationSubmit = ref<number>(0)
201
- const hostAccessibilitySubmit = ref<number>(0)
202
-
203
- const deviceSelectionSubmit = ref<number>(0)
204
-
205
- const checkSubmit = (force = false): boolean => {
206
- if (datastoreType.value === 'local') {
207
- if (stepPosition.value === 1 && !force) {
208
- localCreateNameSubmit.value++
209
- return false
210
- }
211
- }
212
-
213
- if (datastoreType.value === 'shared-storm') {
214
- if (stepPosition.value === 1 && !force) {
215
- deviceSelectionSubmit.value++
216
- return false
230
+ const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> =>
231
+ wizard.changeSteps(value, validationFunc)
232
+
233
+ // Choosing Scheme
234
+ watch(
235
+ datastoreType,
236
+ (newValue: UI_T_DatastoreType) => {
237
+ const schemes: UI_I_ChangeStepsSchemes = {
238
+ procurator: {
239
+ local: 0,
240
+ 'shared-storm': 1,
241
+ nfs: 2,
242
+ },
243
+ sphere: {
244
+ 'shared-storm': 3,
245
+ nfs: 4,
246
+ },
217
247
  }
218
- }
219
248
 
220
- if (datastoreType.value === 'nfs') {
221
- if (stepPosition.value === 2 && !force) {
222
- nfsConfigurationSubmit.value++
223
- return false
224
- }
249
+ const projectSchemes = schemes[props.project]
225
250
 
226
- if (props.mode === 'sphere' && stepPosition.value === 3 && !force) {
227
- hostAccessibilitySubmit.value++
228
- return false
251
+ if (projectSchemes && projectSchemes[newValue] !== undefined) {
252
+ wizard.changeScheme(projectSchemes[newValue] as number)
229
253
  }
230
- // if (
231
- // ((stepPosition.value === 4 && nfsVersion.value === 'nfs-4.1') ||
232
- // (stepPosition.value === 3 && nfsVersion.value === 'nfs-3')) &&
233
- // !force
234
- // ) {
235
- // hostAccessibilitySubmit.value++
236
- // return false
237
- // }
238
- }
239
-
240
- return true
241
- }
242
-
243
- const isWizardModeForSphere = computed<boolean>(() => props.mode === 'sphere')
244
-
245
- const onSaveNameAndNextLocal = (event: any): void => {
246
- const { local } = datastoreForm.value
247
-
248
- if (isWizardModeForSphere.value) {
249
- local.name = event.name
250
- local.hosts.push(event.host)
251
- }
252
-
253
- if (!isWizardModeForSphere.value) {
254
- local.name = event
255
- }
256
-
257
- dataReadyView.value = constructDataReadyViewFunc(
258
- localization.value,
259
- 'local',
260
- event,
261
- isWizardModeForSphere.value
262
- )
263
-
264
- onNextStep(true)
265
- }
266
-
267
- const onSaveAndNextSharedStorm = (event: any): void => {
268
- const { sharedStorm } = datastoreForm.value
269
- sharedStorm.name = event.name
270
- sharedStorm.dev_names = event.lunDisk.map((lun: UI_I_LunDisk) => lun.name)
271
- sharedStorm.hosts = [event.host]
254
+ },
255
+ { deep: true, immediate: true }
256
+ )
272
257
 
273
- dataReadyView.value = constructDataReadyViewFunc(
258
+ const dataReadyView = computed<UI_I_DetailsItem>(() =>
259
+ constructDataReadyViewFunc(
274
260
  localization.value,
275
- 'shared-storm',
276
- event,
277
- isWizardModeForSphere.value
261
+ form.value,
262
+ props.project,
263
+ props.nfsHosts
278
264
  )
265
+ )
279
266
 
280
- onNextStep(true)
267
+ const onHideAlert = (stepId: number): void => {
268
+ wizard.hideAlertMessagesByStepId(stepId)
281
269
  }
282
- const saveChangesAndNextNfs = (event: any, next = true): void => {
283
- const { nfs } = datastoreForm.value
284
- nfs.name = event.name
285
- nfs.folder = event.folder
286
- nfs.server = event.server
287
- nfs.hosts = event.hosts
288
-
289
- // TODO refactoring
290
- const hostsNames = props.nfsHosts
291
- ? props.nfsHosts.items
292
- .filter((host) => event.hosts.includes(host.id))
293
- .map((host) => host.host)
294
- : []
295
-
296
- dataReadyView.value = constructDataReadyViewFunc(
297
- localization.value,
298
- 'nfs',
299
- {
300
- ...event,
301
- hosts: hostsNames,
302
- version: nfsVersion.value,
303
- },
304
- isWizardModeForSphere.value
305
- )
306
-
307
- next && onNextStep(true)
270
+ const onHideModal = (): void => {
271
+ emits('hide')
308
272
  }
309
-
310
- const isShowCompleteBlock = computed<boolean>(() => {
311
- // TODO refactoring
312
- const localStep = datastoreType.value === 'local' && stepPosition.value === 2
313
-
314
- const sharesStep =
315
- datastoreType.value === 'shared-storm' &&
316
- (props.mode === 'procurator'
317
- ? stepPosition.value === 3
318
- : stepPosition.value === 2)
319
-
320
- let nfsFirst
321
- if (props.mode === 'procurator') {
322
- nfsFirst =
323
- datastoreType.value === 'nfs' &&
324
- nfsVersion.value === 'nfs-3' &&
325
- stepPosition.value === 3
326
- } else {
327
- nfsFirst =
328
- datastoreType.value === 'nfs' &&
329
- nfsVersion.value === 'nfs-3' &&
330
- stepPosition.value === 4
331
- }
332
-
333
- let nfsSecond
334
- if (props.mode === 'procurator') {
335
- nfsSecond =
336
- datastoreType.value === 'nfs' &&
337
- nfsVersion.value === 'nfs-4.1' &&
338
- stepPosition.value === 3
339
- } else {
340
- nfsSecond =
341
- datastoreType.value === 'nfs' &&
342
- nfsVersion.value === 'nfs-4.1' &&
343
- stepPosition.value === 4
344
- }
345
-
346
- return localStep || sharesStep || nfsFirst || nfsSecond
347
- })
348
-
349
- const onAddDatastore = async (): Promise<void> => {
350
- loading.value = true
351
-
352
- props
353
- .finishFunc(datastoreForm.value, datastoreType.value, nfsVersion.value)
354
- .then(() => {
355
- emits('global-refresh')
356
- loading.value = false
357
- onHideModal()
358
- })
273
+ const onFinish = (): void => {
274
+ emits('finish', form.value)
359
275
  }
360
-
361
- // const createDatastoreFromLocal = async (): Promise<API_UI_I_Error> => {
362
- // const { local } = datastoreForm.value
363
- //
364
- // return await createDatastore<Omit<UI_I_CreateDatastoreBodyRequest, 'pool_name'>>(
365
- // local
366
- // )
367
- // }
368
- // const createDatastoreFromSharedStorm = async (): Promise<API_UI_I_Error> => {
369
- // const {
370
- // sharedStorm: { dev_names: disks, ...sendData },
371
- // } = datastoreForm.value
372
- //
373
- // const { data, msg } = await getStoragePoolName<{ dev_names: string[] }>(
374
- // '/psm/api/v1/storage/lvm/create',
375
- // { dev_names: disks }
376
- // )
377
- //
378
- // if (!data && msg) return msg
379
- //
380
- // sendData.pool_name = data?.pool_name || ''
381
- //
382
- // return await createDatastore(sendData)
383
- // }
384
-
385
- // const createDatastoreFromNfs = async (): Promise<API_UI_I_Error> => {
386
- // const {
387
- // nfs: { server, folder, readonly, name, type_code: type },
388
- // } = datastoreForm.value
389
- //
390
- // const sendDataOne = {
391
- // server,
392
- // folder,
393
- // readonly,
394
- // version: nfsVersion.value === 'nfs-4.1' ? 4.1 : 3.0,
395
- // }
396
- //
397
- // const { data, msg } = await getStoragePoolName<UI_I_NfsPoolNameForm>(
398
- // '/psm/api/v1/storage/cnfs',
399
- // sendDataOne
400
- // )
401
- //
402
- // if (!data && msg) return msg
403
- //
404
- // const sendDataTwo = {
405
- // name,
406
- // type_code: type,
407
- // pool_name: data?.pool_name || '',
408
- // }
409
- //
410
- // return await createDatastore(sendDataTwo)
411
- // }
276
+ // watch(
277
+ // () => props.isLoading,
278
+ // (newValue) => {
279
+ // wizard.setLoader(newValue)
280
+ // },
281
+ // { immediate: true }
282
+ // )
412
283
  </script>
413
284
 
414
285
  <style scoped lang="scss">
415
- @import '~/assets/scss/common/mixins.scss';
416
-
286
+ @import 'assets/scss/common/mixins.scss';
417
287
  .new-datastore {
418
288
  &__body {
419
289
  @include flex($dir: column);
@@ -123,6 +123,9 @@ export const stepsFunc = (
123
123
  fields: {},
124
124
  isValid: true,
125
125
  testId: 'create-datastore-ready-complete',
126
+ // testId: 'create-datastore-storm-ready-complete',
127
+ // testId: 'create-datastore-nfs-ready-complete',
128
+ // testId: 'create-datastore-local-ready-complete',
126
129
  },
127
130
  ]
128
131