bfg-common 1.5.217 → 1.5.218

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 (100) hide show
  1. package/components/common/backup/lib/utils/getBackupOrBackupStorageId.ts +29 -0
  2. package/components/common/backup/storage/actions/add/Add.vue +51 -0
  3. package/components/common/backup/storage/actions/add/temp/Add.vue +527 -0
  4. package/components/common/backup/storage/actions/add/temp/lib/config/stepItems.ts +236 -0
  5. package/components/common/backup/storage/actions/add/temp/lib/models/interfaces.ts +58 -0
  6. package/components/common/backup/storage/actions/add/temp/lib/models/types.ts +14 -0
  7. package/components/common/backup/storage/actions/add/temp/lib/utils.ts +71 -0
  8. package/components/common/backup/storage/actions/add/temp/local/Local.vue +83 -0
  9. package/components/common/backup/storage/actions/add/temp/local/accessibility/Accessibility.vue +104 -0
  10. package/components/common/backup/storage/actions/add/temp/local/accessibility/lib/config/tabsPannel.ts +25 -0
  11. package/components/common/backup/storage/actions/add/temp/local/accessibility/lib/models/interfaces.ts +9 -0
  12. package/components/common/backup/storage/actions/add/temp/local/accessibility/lib/models/types.ts +5 -0
  13. package/components/common/backup/storage/actions/add/temp/local/accessibility/tablesView/TablesView.vue +141 -0
  14. package/components/common/backup/storage/actions/add/temp/local/accessibility/tablesView/lib/config/compatibleTable.ts +62 -0
  15. package/components/common/backup/storage/actions/add/temp/local/accessibility/tablesView/lib/config/hostsTableItems.ts +27 -0
  16. package/components/common/backup/storage/actions/add/temp/local/accessibility/tablesView/lib/config/incompatibleTable.ts +68 -0
  17. package/components/common/backup/storage/actions/add/temp/local/accessibility/tablesView/lib/config/tableKeys.ts +15 -0
  18. package/components/common/backup/storage/actions/add/temp/local/createName/CreateName.vue +160 -0
  19. package/components/common/backup/storage/actions/add/temp/local/createName/lib/config/defaultForm.ts +15 -0
  20. package/components/common/backup/storage/actions/add/temp/nfs/Nfs.vue +106 -0
  21. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/Accessibility.vue +104 -0
  22. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/lib/config/tabsPannel.ts +25 -0
  23. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/lib/models/interfaces.ts +9 -0
  24. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/lib/models/types.ts +5 -0
  25. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/tablesView/TablesView.vue +141 -0
  26. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -0
  27. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +27 -0
  28. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/tablesView/lib/config/incompatibleTable.ts +68 -0
  29. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/tablesView/lib/config/tableKeys.ts +15 -0
  30. package/components/common/backup/storage/actions/add/temp/nfs/configuration/Configuration.vue +469 -0
  31. package/components/common/backup/storage/actions/add/temp/nfs/configuration/lib/config/defaultForm.ts +51 -0
  32. package/components/common/backup/storage/actions/add/temp/nfs/configuration/lib/models/interfaces.ts +14 -0
  33. package/components/common/backup/storage/actions/add/temp/nfs/configuration/serversList/DeletePopover.vue +99 -0
  34. package/components/common/backup/storage/actions/add/temp/nfs/configuration/serversList/ServersList.vue +125 -0
  35. package/components/common/backup/storage/actions/add/temp/nfs/configuration/serversList/lib/config/serversListConfig.ts +40 -0
  36. package/components/common/backup/storage/actions/add/temp/nfs/configuration/serversList/lib/config/tableKeys.ts +3 -0
  37. package/components/common/backup/storage/actions/add/temp/nfs/configuration/serversList/lib/models/interfaces.ts +13 -0
  38. package/components/common/backup/storage/actions/add/temp/nfs/configuration/serversList/lib/models/types.ts +1 -0
  39. package/components/common/backup/storage/actions/add/temp/nfs/kerberosAuthentication/KerberosAuthentication.vue +55 -0
  40. package/components/common/backup/storage/actions/add/temp/nfs/kerberosAuthentication/lib/config/radioOptions.ts +27 -0
  41. package/components/common/backup/storage/actions/add/temp/nfs/version/Version.vue +42 -0
  42. package/components/common/backup/storage/actions/add/temp/nfs/version/lib/config/versionOptions.ts +22 -0
  43. package/components/common/backup/storage/actions/add/temp/readyComplete/ReadyComplete.vue +85 -0
  44. package/components/common/backup/storage/actions/add/temp/readyComplete/lib/config/propertiesDetails.ts +165 -0
  45. package/components/common/backup/storage/actions/add/temp/readyComplete/lib/models/interfaces.ts +4 -0
  46. package/components/common/backup/storage/actions/add/temp/samba/Samba.vue +95 -0
  47. package/components/common/backup/storage/actions/add/temp/samba/accessibility/Accessibility.vue +104 -0
  48. package/components/common/backup/storage/actions/add/temp/samba/accessibility/lib/config/tabsPannel.ts +25 -0
  49. package/components/common/backup/storage/actions/add/temp/samba/accessibility/lib/models/interfaces.ts +9 -0
  50. package/components/common/backup/storage/actions/add/temp/samba/accessibility/lib/models/types.ts +5 -0
  51. package/components/common/backup/storage/actions/add/temp/samba/accessibility/tablesView/TablesView.vue +141 -0
  52. package/components/common/backup/storage/actions/add/temp/samba/accessibility/tablesView/lib/config/compatibleTable.ts +62 -0
  53. package/components/common/backup/storage/actions/add/temp/samba/accessibility/tablesView/lib/config/hostsTableItems.ts +53 -0
  54. package/components/common/backup/storage/actions/add/temp/samba/accessibility/tablesView/lib/config/incompatibleTable.ts +68 -0
  55. package/components/common/backup/storage/actions/add/temp/samba/accessibility/tablesView/lib/config/tableKeys.ts +15 -0
  56. package/components/common/backup/storage/actions/add/temp/samba/configuration/Configuration.vue +470 -0
  57. package/components/common/backup/storage/actions/add/temp/samba/configuration/lib/config/defaultForm.ts +51 -0
  58. package/components/common/backup/storage/actions/add/temp/samba/configuration/lib/models/interfaces.ts +14 -0
  59. package/components/common/backup/storage/actions/add/temp/samba/configuration/serversList/DeletePopover.vue +99 -0
  60. package/components/common/backup/storage/actions/add/temp/samba/configuration/serversList/ServersList.vue +124 -0
  61. package/components/common/backup/storage/actions/add/temp/samba/configuration/serversList/lib/config/serversListConfig.ts +40 -0
  62. package/components/common/backup/storage/actions/add/temp/samba/configuration/serversList/lib/config/tableKeys.ts +3 -0
  63. package/components/common/backup/storage/actions/add/temp/samba/configuration/serversList/lib/models/interfaces.ts +13 -0
  64. package/components/common/backup/storage/actions/add/temp/samba/configuration/serversList/lib/models/types.ts +1 -0
  65. package/components/common/backup/storage/actions/add/temp/samba/kerberosAuthentication/KerberosAuthentication.vue +55 -0
  66. package/components/common/backup/storage/actions/add/temp/samba/kerberosAuthentication/lib/config/radioOptions.ts +27 -0
  67. package/components/common/backup/storage/actions/add/temp/sharedStorm/SharedStorm.vue +106 -0
  68. package/components/common/backup/storage/actions/add/temp/sharedStorm/storage/Storage.vue +71 -0
  69. package/components/common/backup/storage/actions/add/temp/sharedStorm/storage/lib/config/defaultForm.ts +15 -0
  70. package/components/common/backup/storage/actions/add/temp/types/Types.vue +79 -0
  71. package/components/common/backup/storage/actions/add/temp/types/lib/config/typeOptions.ts +62 -0
  72. package/components/common/backup/storage/actions/delete/Delete.vue +65 -0
  73. package/components/common/backup/storage/actions/delete/lib/models/interfaces.ts +5 -0
  74. package/components/common/browse/blocks/lib/models/types.ts +1 -1
  75. package/components/common/browse/lib/models/interfaces.ts +5 -5
  76. package/components/common/diagramMain/adapter/AdapterItems.vue +61 -61
  77. package/components/common/diagramMain/lib/config/initial.ts +50 -50
  78. package/components/common/diagramMain/lib/models/types.ts +21 -21
  79. package/components/common/diagramMain/lib/utils/utils.ts +331 -331
  80. package/components/common/diagramMain/modals/editSettings/ConfirmTeamingSettingsModal.vue +40 -40
  81. package/components/common/diagramMain/modals/editSettings/tabs/NetworkProperties.vue +214 -214
  82. package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +189 -189
  83. package/components/common/diagramMain/modals/editSettings/tabs/SwitchProperties.vue +163 -163
  84. package/components/common/diagramMain/modals/editSettings/tabs/TeamingFailover.vue +175 -175
  85. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +346 -346
  86. package/components/common/diagramMain/modals/lib/config/initial.ts +180 -180
  87. package/components/common/diagramMain/modals/lib/config/vmKernelAdapter.ts +90 -90
  88. package/components/common/diagramMain/modals/lib/mappers/mappers.ts +87 -87
  89. package/components/common/diagramMain/modals/lib/utils/index.ts +24 -24
  90. package/components/common/diagramMain/modals/migrateVmkernelAdapter/lib/config/steps.ts +114 -114
  91. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/ConnectionSettings.vue +169 -169
  92. package/components/common/diagramMain/modals/migrateVmkernelAdapter/steps/SelectVmkernelAdapter.vue +159 -159
  93. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/common.ts +14 -14
  94. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/connectionSettings.ts +137 -137
  95. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/selectVmkernelAdapter.ts +52 -52
  96. package/components/common/diagramMain/modals/migrateVmkernelAdapter/validations/validations.ts +19 -19
  97. package/components/common/diagramMain/port/Ports.vue +47 -47
  98. package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguage.vue +3 -3
  99. package/components/common/selectLanguage/lib/config/config.ts +6 -6
  100. package/package.json +2 -2
@@ -0,0 +1,29 @@
1
+ // В дереве бэкапов элементы соделжат в поле "id" все "id" родителей разделенной "_".
2
+ // Пример: 0_y3bxahpr_ngzjnhdm(hostId_storageId_bucketId) или 0_y3bxahpr(hostId_storageId)
3
+ export const getBackupTreeNodeIdByTypeFromRoute = (type: 'host' | 'backupStorage' | 'bucket' | 'last'): string => {
4
+ const idFromRoute = useRoute().params.id?.toString() || ''
5
+
6
+ let result = ''
7
+ // if typeFromRoute === 'bucket' ids === [hostId, storageId, bucketId|vmId]
8
+ // if typeFromRoute === 'backup' ids === [hostId, storageId]
9
+ // if typeFromRoute === 'vm' ids === [bucketId|vmId]
10
+ // vmId === bucketId
11
+
12
+ const ids = idFromRoute.split('_')
13
+ switch(type) {
14
+ case 'host':
15
+ result = ids[0]
16
+ break
17
+ case 'backupStorage':
18
+ result = ids[1] || ''
19
+ break
20
+ case 'bucket':
21
+ result = ids[2] || ids[0]
22
+ break
23
+ case 'last':
24
+ result = ids[2] || ids[1] || ids[0]
25
+ break
26
+ }
27
+
28
+ return result
29
+ }
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <div class="new-datastore">
3
+ <common-backup-storage-actions-add-temp-add
4
+ :mode="props.mode"
5
+ :finish-func="onFinish"
6
+ :hosts="props.hosts"
7
+ :datastore="props.datastore"
8
+ :get-datastore-table-func="props.getDatastoreTableFunc"
9
+ @hide="onHideModal"
10
+ />
11
+ </div>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import type {
16
+ // UI_T_DatastoreType,
17
+ UI_T_NfsType,
18
+ } from '~/components/common/wizards/datastore/add/lib/models/types'
19
+ import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
20
+ import type { UI_T_WizardDatastoreMode } from '~/components/common/backup/storage/actions/add/temp/lib/models/types'
21
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
22
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
23
+
24
+ const props = withDefaults(
25
+ defineProps<{
26
+ mode: UI_T_WizardDatastoreMode
27
+ datastore: UI_I_DatastoreTableItem[]
28
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
29
+ hosts?: any[]
30
+ }>(),
31
+ { hosts: [] }
32
+ )
33
+ const emits = defineEmits<{
34
+ (event: 'create', value: any): void
35
+ (event: 'hide'): void
36
+ }>()
37
+
38
+ const onFinish = async (
39
+ form: UI_I_CreateDatastoreForm,
40
+ mode: UI_T_DatastoreType,
41
+ version: UI_T_NfsType
42
+ ): Promise<void> => {
43
+ emits('create', { form, mode, version })
44
+ }
45
+
46
+ const onHideModal = (): void => {
47
+ emits('hide')
48
+ }
49
+ </script>
50
+
51
+ <style scoped lang="scss"></style>
@@ -0,0 +1,527 @@
1
+ <template>
2
+ <div class="new-datastore">
3
+ <atoms-modal-by-steps
4
+ 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"
14
+ @hide="onHideModal"
15
+ >
16
+ <template #modalBody>
17
+ <div class="new-datastore__body flex flex-col h-full pl-6">
18
+ <common-backup-storage-actions-add-temp-types
19
+ v-show="stepPosition === 0"
20
+ v-model:type="datastoreType"
21
+ />
22
+
23
+ <common-backup-storage-actions-add-temp-local
24
+ v-show="datastoreType === 'local' && !isShowCompleteBlock"
25
+ :mode="props.mode"
26
+ :step-position="stepPosition"
27
+ :local-create-name-submit="localCreateNameSubmit"
28
+ :host-accessibility-submit="hostAccessibilitySubmit"
29
+ :hosts="props.hosts"
30
+ @loading="(e) => (loading = e)"
31
+ @submit="onSaveNameAndNextLocal"
32
+ />
33
+
34
+ <common-backup-storage-actions-add-temp-nfs
35
+ v-show="datastoreType === 'nfs' && !isShowCompleteBlock"
36
+ :mode="props.mode"
37
+ :step-position="stepPosition"
38
+ :datastore-type="datastoreType"
39
+ :nfs-configuration-submit="nfsConfigurationSubmit"
40
+ :host-accessibility-submit="hostAccessibilitySubmit"
41
+ :hosts="props.hosts"
42
+ @loading="(e) => (loading = e)"
43
+ @change-nfs-version="updateNfsVersion"
44
+ @submit="saveChangesAndNextNfs"
45
+ />
46
+
47
+ <common-backup-storage-actions-add-temp-samba
48
+ v-show="datastoreType === 'samba' && !isShowCompleteBlock"
49
+ :mode="props.mode"
50
+ :step-position="stepPosition"
51
+ :datastore-type="datastoreType"
52
+ :nfs-configuration-submit="nfsConfigurationSubmit"
53
+ :host-accessibility-submit="hostAccessibilitySubmit"
54
+ :hosts="props.hosts"
55
+ @loading="(e) => (loading = e)"
56
+ @change-nfs-version="updateNfsVersion"
57
+ @submit="saveChangesAndNextSamba"
58
+ />
59
+
60
+ <common-backup-storage-actions-add-temp-shared-storm
61
+ v-show="datastoreType === 'shared-storm' && !isShowCompleteBlock"
62
+ :mode="props.mode"
63
+ :step-position="stepPosition"
64
+ :datastore-type="datastoreType"
65
+ :create-name-submit="sharedStormCreateNameSubmit"
66
+ :storage-submit="storageSubmit"
67
+ :host-accessibility-submit="hostAccessibilitySubmit"
68
+ :hosts="props.hosts"
69
+ :datastore="props.datastore"
70
+ :get-datastore-table-func="props.getDatastoreTableFunc"
71
+ @loading="(e) => (loading = e)"
72
+ @submit="saveChangesAndNextSharedStorm"
73
+ />
74
+
75
+ <common-backup-storage-actions-add-temp-ready-complete
76
+ v-show="isShowCompleteBlock"
77
+ :data-ready-view="dataReadyView"
78
+ />
79
+ </div>
80
+ </template>
81
+ </atoms-modal-by-steps>
82
+ </div>
83
+ </template>
84
+
85
+ <script setup lang="ts">
86
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
87
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
88
+ import type { UI_I_VerticalStepItem } from '~/components/atoms/lib/models/interfaces'
89
+ import type {
90
+ UI_T_DatastoreType,
91
+ UI_T_NfsType,
92
+ UI_T_WizardDatastoreMode,
93
+ } from '~/components/common/backup/storage/actions/add/temp/lib/models/types'
94
+ import type {
95
+ I_SharedStormData,
96
+ UI_I_CreateDatastoreForm,
97
+ } from '~/components/common/backup/storage/actions/add/temp/lib/models/interfaces'
98
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
99
+ import { stepItemsFunc } from '~/components/common/backup/storage/actions/add/temp/lib/config/stepItems'
100
+ import { constructDataReadyViewFunc } from '~/components/common/backup/storage/actions/add/temp/readyComplete/lib/config/propertiesDetails'
101
+
102
+ const props = defineProps<{
103
+ // TODO refactoring to project
104
+ mode: UI_T_WizardDatastoreMode
105
+ finishFunc: (
106
+ datastoreForm: UI_I_CreateDatastoreForm,
107
+ datastoreType: UI_T_DatastoreType,
108
+ version: UI_T_NfsType
109
+ ) => Promise<void>
110
+ datastore: UI_I_DatastoreTableItem[]
111
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
112
+ datacenterHosts?: any[]
113
+ nfsHosts?: any
114
+ hosts?: any
115
+ isMainFilter?: boolean
116
+ hostId?: string
117
+ }>()
118
+ const emits = defineEmits<{
119
+ (event: 'hide'): void
120
+ (event: 'global-refresh'): void
121
+ }>()
122
+
123
+ const localization = computed<UI_I_Localization>(() => useLocal())
124
+
125
+ const isWizardModeForSphere = computed<boolean>(() => props.mode === 'sphere')
126
+
127
+ const loading = ref<boolean>(false)
128
+ const datastoreType = ref<UI_T_DatastoreType>('local')
129
+ const nfsVersion = ref<UI_T_NfsType>('nfs-4.1')
130
+
131
+ const stepPosition = ref<number>(0)
132
+ const dataReadyView = ref<any>([])
133
+
134
+ // TODO move to config
135
+ const datastoreForm = ref<UI_I_CreateDatastoreForm>({
136
+ local: {
137
+ name: '',
138
+ hosts: [],
139
+ type_code: 1,
140
+ },
141
+ nfs: {
142
+ name: '',
143
+ server: '',
144
+ folder: '',
145
+ user: '',
146
+ password: '',
147
+ readonly: false,
148
+ version: nfsVersion.value,
149
+ type_code: 2,
150
+ hosts: [],
151
+ },
152
+ samba: {
153
+ name: '',
154
+ server: '',
155
+ folder: '',
156
+ user: '',
157
+ password: '',
158
+ readonly: false,
159
+ type_code: 3,
160
+ hosts: [],
161
+ },
162
+ sharedStorm: {
163
+ name: '',
164
+ storm_id: '',
165
+ type_code: 4,
166
+ hosts: [],
167
+ },
168
+ })
169
+
170
+ const stepItems = computed<UI_I_VerticalStepItem[]>(() =>
171
+ stepItemsFunc(localization.value, datastoreType.value, props.mode)
172
+ )
173
+
174
+ let cashStep = -1
175
+ const onNextStep = (force = false): void => {
176
+ const isValid = checkSubmit(force)
177
+
178
+ if (!isValid) {
179
+ return
180
+ }
181
+
182
+ const isDisabled = stepItems.value[cashStep]?.disabled
183
+ if (cashStep !== -1 && !isDisabled) {
184
+ stepPosition.value = cashStep
185
+ cashStep = -1
186
+ return
187
+ }
188
+
189
+ stepItems.value[stepPosition.value].complete = true
190
+ stepItems.value[stepPosition.value + 1].disabled = false
191
+ stepPosition.value++
192
+ }
193
+
194
+ const back = (): void => {
195
+ stepPosition.value--
196
+ }
197
+
198
+ const onChangeStep = (key: number): void => {
199
+ if (key < stepPosition.value) {
200
+ stepPosition.value = key
201
+ return
202
+ }
203
+
204
+ const isValid = checkSubmit()
205
+
206
+ if (!isValid) {
207
+ cashStep = key
208
+ return
209
+ }
210
+
211
+ stepPosition.value = key
212
+ }
213
+ const onHideModal = (): void => {
214
+ emits('hide')
215
+ }
216
+
217
+ const updateNfsVersion = (event: UI_T_NfsType): void => {
218
+ nfsVersion.value = event
219
+ const { name, server, folder, user, password, hosts } =
220
+ datastoreForm.value.nfs
221
+ saveChangesAndNextNfs({ name, server, folder, user, password, hosts }, false)
222
+ }
223
+
224
+ const localCreateNameSubmit = ref<number>(0)
225
+ const nfsConfigurationSubmit = ref<number>(0)
226
+ const hostAccessibilitySubmit = ref<number>(0)
227
+ const sharedStormCreateNameSubmit = ref<number>(0)
228
+ const storageSubmit = ref<number>(0)
229
+
230
+ const checkSubmit = (force = false): boolean => {
231
+ if (datastoreType.value === 'local') {
232
+ if (stepPosition.value === 1 && !force) {
233
+ localCreateNameSubmit.value++
234
+ return false
235
+ }
236
+ if (isWizardModeForSphere.value && stepPosition.value === 2 && !force) {
237
+ hostAccessibilitySubmit.value++
238
+ return false
239
+ }
240
+ }
241
+
242
+ if (datastoreType.value === 'nfs') {
243
+ if (stepPosition.value === 1 && !force) {
244
+ nfsConfigurationSubmit.value++
245
+ return false
246
+ }
247
+
248
+ if (isWizardModeForSphere.value && stepPosition.value === 2 && !force) {
249
+ hostAccessibilitySubmit.value++
250
+ return false
251
+ }
252
+ // if (
253
+ // ((stepPosition.value === 4 && nfsVersion.value === 'nfs-4.1') ||
254
+ // (stepPosition.value === 3 && nfsVersion.value === 'nfs-3')) &&
255
+ // !force
256
+ // ) {
257
+ // hostAccessibilitySubmit.value++
258
+ // return false
259
+ // }
260
+ }
261
+
262
+ if (datastoreType.value === 'samba') {
263
+ if (stepPosition.value === 1 && !force) {
264
+ nfsConfigurationSubmit.value++
265
+ return false
266
+ }
267
+
268
+ if (isWizardModeForSphere.value && stepPosition.value === 2 && !force) {
269
+ hostAccessibilitySubmit.value++
270
+ return false
271
+ }
272
+ }
273
+
274
+ if (datastoreType.value === 'shared-storm') {
275
+ if (stepPosition.value === 1 && !force) {
276
+ sharedStormCreateNameSubmit.value++
277
+ return false
278
+ }
279
+ if (stepPosition.value === 2 && !force) {
280
+ storageSubmit.value++
281
+ return false
282
+ }
283
+ if (isWizardModeForSphere.value && stepPosition.value === 3 && !force) {
284
+ hostAccessibilitySubmit.value++
285
+ return false
286
+ }
287
+ }
288
+
289
+ return true
290
+ }
291
+
292
+ const onSaveNameAndNextLocal = (event: any): void => {
293
+ const { local } = datastoreForm.value
294
+
295
+ if (isWizardModeForSphere.value) {
296
+ local.name = event.name
297
+ local.hosts = event.hosts
298
+ }
299
+
300
+ // if (!isWizardModeForSphere.value) {
301
+ // local.name = event
302
+ // }
303
+
304
+ dataReadyView.value = constructDataReadyViewFunc(
305
+ localization.value,
306
+ 'local',
307
+ event,
308
+ isWizardModeForSphere.value
309
+ )
310
+
311
+ onNextStep(true)
312
+ }
313
+
314
+ const saveChangesAndNextNfs = (event: any, next = true): void => {
315
+ const { nfs } = datastoreForm.value
316
+ nfs.name = event.name
317
+ nfs.folder = event.folder
318
+ nfs.server = event.server
319
+ nfs.user = event.user
320
+ nfs.password = event.password
321
+ nfs.hosts = event.hosts
322
+
323
+ // // TODO refactoring
324
+ // const hostsNames = props.nfsHosts
325
+ // ? props.nfsHosts.items
326
+ // .filter((host) => event.hosts.includes(host.id))
327
+ // .map((host) => host.host)
328
+ // : []
329
+
330
+ dataReadyView.value = constructDataReadyViewFunc(
331
+ localization.value,
332
+ 'nfs',
333
+ {
334
+ ...event,
335
+ // hosts: hostsNames,
336
+ version: nfsVersion.value,
337
+ },
338
+ isWizardModeForSphere.value
339
+ )
340
+
341
+ next && onNextStep(true)
342
+ }
343
+
344
+ const saveChangesAndNextSamba = (event: any, next = true): void => {
345
+ const { samba } = datastoreForm.value
346
+ samba.name = event.name
347
+ samba.folder = event.folder
348
+ samba.server = event.server
349
+ samba.user = event.user
350
+ samba.password = event.password
351
+ samba.hosts = event.hosts
352
+
353
+ // // TODO refactoring
354
+ // const hostsNames = props.nfsHosts
355
+ // ? props.nfsHosts.items
356
+ // .filter((host) => event.hosts.includes(host.id))
357
+ // .map((host) => host.host)
358
+ // : []
359
+
360
+ dataReadyView.value = constructDataReadyViewFunc(
361
+ localization.value,
362
+ 'samba',
363
+ {
364
+ ...event,
365
+ // hosts: hostsNames,
366
+ },
367
+ isWizardModeForSphere.value
368
+ )
369
+
370
+ next && onNextStep(true)
371
+ }
372
+
373
+ const saveChangesAndNextSharedStorm = (
374
+ event: I_SharedStormData,
375
+ next = true
376
+ ): void => {
377
+ const { sharedStorm } = datastoreForm.value
378
+ sharedStorm.name = event.name
379
+ sharedStorm.storm_id = event.storm_id
380
+ sharedStorm.hosts = event.hosts
381
+
382
+ dataReadyView.value = constructDataReadyViewFunc(
383
+ localization.value,
384
+ 'shared-storm',
385
+ {
386
+ ...event,
387
+ },
388
+ isWizardModeForSphere.value
389
+ )
390
+
391
+ next && onNextStep(true)
392
+ }
393
+
394
+ const isShowCompleteBlock = computed<boolean>(() => {
395
+ // TODO refactoring
396
+ // const localStep = datastoreType.value === 'local' && stepPosition.value === 2
397
+ let localStep
398
+ if (props.mode === 'procurator') {
399
+ localStep = datastoreType.value === 'local' && stepPosition.value === 2
400
+ } else {
401
+ localStep = datastoreType.value === 'local' && stepPosition.value === 3
402
+ }
403
+
404
+ let nfsFirst
405
+ if (props.mode === 'procurator') {
406
+ nfsFirst =
407
+ datastoreType.value === 'nfs' &&
408
+ nfsVersion.value === 'nfs-3' &&
409
+ stepPosition.value === 3
410
+ } else {
411
+ nfsFirst =
412
+ datastoreType.value === 'nfs' &&
413
+ nfsVersion.value === 'nfs-3' &&
414
+ stepPosition.value === 4
415
+ }
416
+
417
+ let nfsSecond
418
+ if (props.mode === 'procurator') {
419
+ nfsSecond =
420
+ datastoreType.value === 'nfs' &&
421
+ nfsVersion.value === 'nfs-4.1' &&
422
+ stepPosition.value === 2
423
+ } else {
424
+ nfsSecond =
425
+ datastoreType.value === 'nfs' &&
426
+ nfsVersion.value === 'nfs-4.1' &&
427
+ stepPosition.value === 3
428
+ }
429
+
430
+ let samba
431
+ if (props.mode === 'procurator') {
432
+ samba = datastoreType.value === 'samba' && stepPosition.value === 2
433
+ } else {
434
+ samba = datastoreType.value === 'samba' && stepPosition.value === 3
435
+ }
436
+
437
+ let sharedStorm
438
+ if (props.mode === 'procurator') {
439
+ sharedStorm =
440
+ datastoreType.value === 'shared-storm' && stepPosition.value === 3
441
+ } else {
442
+ sharedStorm =
443
+ datastoreType.value === 'shared-storm' && stepPosition.value === 4
444
+ }
445
+
446
+ return localStep || nfsFirst || nfsSecond || samba || sharedStorm
447
+ })
448
+
449
+ const onAddDatastore = async (): Promise<void> => {
450
+ loading.value = true
451
+
452
+ props
453
+ .finishFunc(datastoreForm.value, datastoreType.value, nfsVersion.value)
454
+ .then(() => {
455
+ emits('global-refresh')
456
+ loading.value = false
457
+ onHideModal()
458
+ })
459
+ }
460
+
461
+ // const createDatastoreFromLocal = async (): Promise<API_UI_I_Error> => {
462
+ // const { local } = datastoreForm.value
463
+ //
464
+ // return await createDatastore<Omit<UI_I_CreateDatastoreBodyRequest, 'pool_name'>>(
465
+ // local
466
+ // )
467
+ // }
468
+ // const createDatastoreFromSharedStorm = async (): Promise<API_UI_I_Error> => {
469
+ // const {
470
+ // sharedStorm: { dev_names: disks, ...sendData },
471
+ // } = datastoreForm.value
472
+ //
473
+ // const { data, msg } = await getStoragePoolName<{ dev_names: string[] }>(
474
+ // '/psm/api/v1/storage/lvm/create',
475
+ // { dev_names: disks }
476
+ // )
477
+ //
478
+ // if (!data && msg) return msg
479
+ //
480
+ // sendData.pool_name = data?.pool_name || ''
481
+ //
482
+ // return await createDatastore(sendData)
483
+ // }
484
+
485
+ // const createDatastoreFromNfs = async (): Promise<API_UI_I_Error> => {
486
+ // const {
487
+ // nfs: { server, folder, readonly, name, type_code: type },
488
+ // } = datastoreForm.value
489
+ //
490
+ // const sendDataOne = {
491
+ // server,
492
+ // folder,
493
+ // readonly,
494
+ // version: nfsVersion.value === 'nfs-4.1' ? 4.1 : 3.0,
495
+ // }
496
+ //
497
+ // const { data, msg } = await getStoragePoolName<UI_I_NfsPoolNameForm>(
498
+ // '/psm/api/v1/storage/cnfs',
499
+ // sendDataOne
500
+ // )
501
+ //
502
+ // if (!data && msg) return msg
503
+ //
504
+ // const sendDataTwo = {
505
+ // name,
506
+ // type_code: type,
507
+ // pool_name: data?.pool_name || '',
508
+ // }
509
+ //
510
+ // return await createDatastore(sendDataTwo)
511
+ // }
512
+ </script>
513
+
514
+ <style scoped lang="scss">
515
+ .finish-block {
516
+ padding: 18px 24px 24px 24px;
517
+
518
+ .add-hosts-ready-to-complete-mt-12 {
519
+ margin-top: 12px;
520
+
521
+ .add-hosts-ready-to-complete-bold {
522
+ line-height: 18px;
523
+ font-weight: 700;
524
+ }
525
+ }
526
+ }
527
+ </style>