bfg-common 1.5.220 → 1.5.222

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 (32) hide show
  1. package/components/atoms/table/info/Info.vue +4 -0
  2. package/components/common/backup/storage/actions/add/Add.vue +16 -1
  3. package/components/common/backup/storage/actions/add/temp/Add.vue +53 -34
  4. package/components/common/backup/storage/actions/add/temp/lib/config/stepItems.ts +46 -13
  5. package/components/common/backup/storage/actions/add/temp/lib/utils.ts +6 -5
  6. package/components/common/backup/storage/actions/add/temp/local/Local.vue +49 -31
  7. package/components/common/backup/storage/actions/add/temp/local/accessibility/Accessibility.vue +104 -0
  8. package/components/common/backup/storage/actions/add/temp/local/accessibility/lib/config/tabsPannel.ts +25 -0
  9. package/components/common/backup/storage/actions/add/temp/local/accessibility/lib/models/interfaces.ts +9 -0
  10. package/components/common/backup/storage/actions/add/temp/local/accessibility/lib/models/types.ts +5 -0
  11. package/components/common/backup/storage/actions/add/temp/local/accessibility/tablesView/TablesView.vue +141 -0
  12. package/components/common/backup/storage/actions/add/temp/local/accessibility/tablesView/lib/config/compatibleTable.ts +62 -0
  13. package/components/common/backup/storage/actions/add/temp/local/accessibility/tablesView/lib/config/hostsTableItems.ts +27 -0
  14. package/components/common/backup/storage/actions/add/temp/local/accessibility/tablesView/lib/config/incompatibleTable.ts +68 -0
  15. package/components/common/backup/storage/actions/add/temp/local/accessibility/tablesView/lib/config/tableKeys.ts +15 -0
  16. package/components/common/backup/storage/actions/add/temp/local/createName/CreateName.vue +5 -3
  17. package/components/common/backup/storage/actions/add/temp/nfs/Nfs.vue +5 -5
  18. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/lib/models/types.ts +2 -2
  19. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +1 -27
  20. package/components/common/backup/storage/actions/add/temp/nfs/accessibility/tablesView/lib/config/tableKeys.ts +2 -2
  21. package/components/common/backup/storage/actions/add/temp/nfs/configuration/Configuration.vue +4 -4
  22. package/components/common/backup/storage/actions/add/temp/readyComplete/ReadyComplete.vue +1 -1
  23. package/components/common/backup/storage/actions/add/temp/readyComplete/lib/config/propertiesDetails.ts +33 -7
  24. package/components/common/backup/storage/actions/add/temp/samba/accessibility/lib/models/types.ts +2 -2
  25. package/components/common/backup/storage/actions/add/temp/samba/accessibility/tablesView/lib/config/tableKeys.ts +2 -2
  26. package/components/common/backup/storage/actions/add/temp/samba/configuration/Configuration.vue +1 -1
  27. package/components/common/backup/storage/actions/add/temp/sharedStorm/SharedStorm.vue +47 -21
  28. package/components/common/backup/storage/actions/add/temp/types/Types.vue +3 -2
  29. package/components/common/backup/storage/actions/add/temp/types/lib/config/typeOptions.ts +25 -15
  30. package/package.json +2 -2
  31. package/components/common/backup/storage/actions/add/temp/sharedStorm/createName/CreateName.vue +0 -156
  32. package/components/common/backup/storage/actions/add/temp/sharedStorm/createName/lib/config/defaultForm.ts +0 -15
@@ -59,6 +59,10 @@ table {
59
59
  .vm-name-label {
60
60
  width: 20%;
61
61
 
62
+ &::first-letter {
63
+ text-transform: uppercase;
64
+ }
65
+
62
66
  &.hard-disk-properties {
63
67
  padding-left: 25px;
64
68
  }
@@ -1,8 +1,11 @@
1
1
  <template>
2
2
  <div class="new-datastore">
3
3
  <common-backup-storage-actions-add-temp-add
4
- mode="procurator"
4
+ :mode="props.mode"
5
5
  :finish-func="onFinish"
6
+ :hosts="props.hosts"
7
+ :datastore="props.datastore"
8
+ :get-datastore-table-func="props.getDatastoreTableFunc"
6
9
  @hide="onHideModal"
7
10
  />
8
11
  </div>
@@ -14,7 +17,19 @@ import type {
14
17
  UI_T_NfsType,
15
18
  } from '~/components/common/wizards/datastore/add/lib/models/types'
16
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'
17
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
+ )
18
33
  const emits = defineEmits<{
19
34
  (event: 'create', value: any): void
20
35
  (event: 'hide'): void
@@ -18,20 +18,17 @@
18
18
  <common-backup-storage-actions-add-temp-types
19
19
  v-show="stepPosition === 0"
20
20
  v-model:type="datastoreType"
21
- :project="props.mode"
22
21
  />
23
22
 
24
23
  <common-backup-storage-actions-add-temp-local
25
24
  v-show="datastoreType === 'local' && !isShowCompleteBlock"
26
25
  :mode="props.mode"
27
26
  :step-position="stepPosition"
28
- :datastore-type="datastoreType"
29
27
  :local-create-name-submit="localCreateNameSubmit"
30
- :datacenter-hosts="props.datacenterHosts"
31
- :is-main-filter="props.isMainFilter"
28
+ :host-accessibility-submit="hostAccessibilitySubmit"
29
+ :hosts="props.hosts"
32
30
  @loading="(e) => (loading = e)"
33
31
  @submit="onSaveNameAndNextLocal"
34
- @main-filter="emits('main-filter', $event)"
35
32
  />
36
33
 
37
34
  <common-backup-storage-actions-add-temp-nfs
@@ -41,7 +38,7 @@
41
38
  :datastore-type="datastoreType"
42
39
  :nfs-configuration-submit="nfsConfigurationSubmit"
43
40
  :host-accessibility-submit="hostAccessibilitySubmit"
44
- :hosts="props.nfsHosts"
41
+ :hosts="props.hosts"
45
42
  @loading="(e) => (loading = e)"
46
43
  @change-nfs-version="updateNfsVersion"
47
44
  @submit="saveChangesAndNextNfs"
@@ -54,7 +51,7 @@
54
51
  :datastore-type="datastoreType"
55
52
  :nfs-configuration-submit="nfsConfigurationSubmit"
56
53
  :host-accessibility-submit="hostAccessibilitySubmit"
57
- :hosts="props.nfsHosts"
54
+ :hosts="props.hosts"
58
55
  @loading="(e) => (loading = e)"
59
56
  @change-nfs-version="updateNfsVersion"
60
57
  @submit="saveChangesAndNextSamba"
@@ -67,6 +64,10 @@
67
64
  :datastore-type="datastoreType"
68
65
  :create-name-submit="sharedStormCreateNameSubmit"
69
66
  :storage-submit="storageSubmit"
67
+ :host-accessibility-submit="hostAccessibilitySubmit"
68
+ :hosts="props.hosts"
69
+ :datastore="props.datastore"
70
+ :get-datastore-table-func="props.getDatastoreTableFunc"
70
71
  @loading="(e) => (loading = e)"
71
72
  @submit="saveChangesAndNextSharedStorm"
72
73
  />
@@ -83,6 +84,7 @@
83
84
 
84
85
  <script setup lang="ts">
85
86
  import type { UI_I_Localization } from '~/lib/models/interfaces'
87
+ import type { UI_I_TablePayload } from '~/lib/models/table/interfaces'
86
88
  import type { UI_I_VerticalStepItem } from '~/components/atoms/lib/models/interfaces'
87
89
  import type {
88
90
  UI_T_DatastoreType,
@@ -93,6 +95,7 @@ import type {
93
95
  I_SharedStormData,
94
96
  UI_I_CreateDatastoreForm,
95
97
  } from '~/components/common/backup/storage/actions/add/temp/lib/models/interfaces'
98
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
96
99
  import { stepItemsFunc } from '~/components/common/backup/storage/actions/add/temp/lib/config/stepItems'
97
100
  import { constructDataReadyViewFunc } from '~/components/common/backup/storage/actions/add/temp/readyComplete/lib/config/propertiesDetails'
98
101
 
@@ -104,23 +107,25 @@ const props = defineProps<{
104
107
  datastoreType: UI_T_DatastoreType,
105
108
  version: UI_T_NfsType
106
109
  ) => Promise<void>
110
+ datastore: UI_I_DatastoreTableItem[]
111
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
107
112
  datacenterHosts?: any[]
108
113
  nfsHosts?: any
114
+ hosts?: any
109
115
  isMainFilter?: boolean
110
116
  hostId?: string
111
117
  }>()
112
118
  const emits = defineEmits<{
113
119
  (event: 'hide'): void
114
120
  (event: 'global-refresh'): void
115
- (event: 'main-filter', value: string): void
116
121
  }>()
117
122
 
118
123
  const localization = computed<UI_I_Localization>(() => useLocal())
119
124
 
125
+ const isWizardModeForSphere = computed<boolean>(() => props.mode === 'sphere')
126
+
120
127
  const loading = ref<boolean>(false)
121
- const datastoreType = ref<UI_T_DatastoreType>(
122
- props.mode === 'procurator' ? 'local' : 'shared-storm'
123
- )
128
+ const datastoreType = ref<UI_T_DatastoreType>('local')
124
129
  const nfsVersion = ref<UI_T_NfsType>('nfs-4.1')
125
130
 
126
131
  const stepPosition = ref<number>(0)
@@ -158,6 +163,7 @@ const datastoreForm = ref<UI_I_CreateDatastoreForm>({
158
163
  name: '',
159
164
  storm_id: '',
160
165
  type_code: 4,
166
+ hosts: [],
161
167
  },
162
168
  })
163
169
 
@@ -227,6 +233,10 @@ const checkSubmit = (force = false): boolean => {
227
233
  localCreateNameSubmit.value++
228
234
  return false
229
235
  }
236
+ if (isWizardModeForSphere.value && stepPosition.value === 2 && !force) {
237
+ hostAccessibilitySubmit.value++
238
+ return false
239
+ }
230
240
  }
231
241
 
232
242
  if (datastoreType.value === 'nfs') {
@@ -235,7 +245,7 @@ const checkSubmit = (force = false): boolean => {
235
245
  return false
236
246
  }
237
247
 
238
- if (props.mode === 'sphere' && stepPosition.value === 2 && !force) {
248
+ if (isWizardModeForSphere.value && stepPosition.value === 2 && !force) {
239
249
  hostAccessibilitySubmit.value++
240
250
  return false
241
251
  }
@@ -255,7 +265,7 @@ const checkSubmit = (force = false): boolean => {
255
265
  return false
256
266
  }
257
267
 
258
- if (props.mode === 'sphere' && stepPosition.value === 2 && !force) {
268
+ if (isWizardModeForSphere.value && stepPosition.value === 2 && !force) {
259
269
  hostAccessibilitySubmit.value++
260
270
  return false
261
271
  }
@@ -270,24 +280,26 @@ const checkSubmit = (force = false): boolean => {
270
280
  storageSubmit.value++
271
281
  return false
272
282
  }
283
+ if (isWizardModeForSphere.value && stepPosition.value === 3 && !force) {
284
+ hostAccessibilitySubmit.value++
285
+ return false
286
+ }
273
287
  }
274
288
 
275
289
  return true
276
290
  }
277
291
 
278
- const isWizardModeForSphere = computed<boolean>(() => props.mode === 'sphere')
279
-
280
292
  const onSaveNameAndNextLocal = (event: any): void => {
281
293
  const { local } = datastoreForm.value
282
294
 
283
295
  if (isWizardModeForSphere.value) {
284
296
  local.name = event.name
285
- local.hosts.push(event.host)
297
+ local.hosts = event.hosts
286
298
  }
287
299
 
288
- if (!isWizardModeForSphere.value) {
289
- local.name = event
290
- }
300
+ // if (!isWizardModeForSphere.value) {
301
+ // local.name = event
302
+ // }
291
303
 
292
304
  dataReadyView.value = constructDataReadyViewFunc(
293
305
  localization.value,
@@ -308,19 +320,19 @@ const saveChangesAndNextNfs = (event: any, next = true): void => {
308
320
  nfs.password = event.password
309
321
  nfs.hosts = event.hosts
310
322
 
311
- // TODO refactoring
312
- const hostsNames = props.nfsHosts
313
- ? props.nfsHosts.items
314
- .filter((host) => event.hosts.includes(host.id))
315
- .map((host) => host.host)
316
- : []
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
+ // : []
317
329
 
318
330
  dataReadyView.value = constructDataReadyViewFunc(
319
331
  localization.value,
320
332
  'nfs',
321
333
  {
322
334
  ...event,
323
- hosts: hostsNames,
335
+ // hosts: hostsNames,
324
336
  version: nfsVersion.value,
325
337
  },
326
338
  isWizardModeForSphere.value
@@ -338,19 +350,19 @@ const saveChangesAndNextSamba = (event: any, next = true): void => {
338
350
  samba.password = event.password
339
351
  samba.hosts = event.hosts
340
352
 
341
- // TODO refactoring
342
- const hostsNames = props.nfsHosts
343
- ? props.nfsHosts.items
344
- .filter((host) => event.hosts.includes(host.id))
345
- .map((host) => host.host)
346
- : []
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
+ // : []
347
359
 
348
360
  dataReadyView.value = constructDataReadyViewFunc(
349
361
  localization.value,
350
362
  'samba',
351
363
  {
352
364
  ...event,
353
- hosts: hostsNames,
365
+ // hosts: hostsNames,
354
366
  },
355
367
  isWizardModeForSphere.value
356
368
  )
@@ -365,6 +377,7 @@ const saveChangesAndNextSharedStorm = (
365
377
  const { sharedStorm } = datastoreForm.value
366
378
  sharedStorm.name = event.name
367
379
  sharedStorm.storm_id = event.storm_id
380
+ sharedStorm.hosts = event.hosts
368
381
 
369
382
  dataReadyView.value = constructDataReadyViewFunc(
370
383
  localization.value,
@@ -380,7 +393,13 @@ const saveChangesAndNextSharedStorm = (
380
393
 
381
394
  const isShowCompleteBlock = computed<boolean>(() => {
382
395
  // TODO refactoring
383
- const localStep = datastoreType.value === 'local' && stepPosition.value === 2
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
+ }
384
403
 
385
404
  let nfsFirst
386
405
  if (props.mode === 'procurator') {
@@ -61,7 +61,7 @@ const stepFromNfs = (
61
61
  text: localization.common.nameAndConfiguration,
62
62
  disabled: true,
63
63
  complete: false,
64
- testId: 'name-and-configuration'
64
+ testId: 'name-and-configuration',
65
65
  },
66
66
  ]
67
67
 
@@ -70,7 +70,7 @@ const stepFromNfs = (
70
70
  text: localization.common.hostsAccessibility,
71
71
  disabled: true,
72
72
  complete: false,
73
- testId: 'hosts-accessibility'
73
+ testId: 'hosts-accessibility',
74
74
  })
75
75
  }
76
76
 
@@ -78,7 +78,7 @@ const stepFromNfs = (
78
78
  text: localization.common.readyComplete,
79
79
  disabled: true,
80
80
  complete: false,
81
- testId: 'ready-complete'
81
+ testId: 'ready-complete',
82
82
  })
83
83
 
84
84
  return steps
@@ -100,13 +100,18 @@ const stemFromLocal = (
100
100
  localization: UI_I_Localization,
101
101
  mode: UI_T_WizardDatastoreMode
102
102
  ): UI_I_VerticalStepItem[] => {
103
- const isModeProcurator = mode === 'procurator'
104
- return [
105
- { text: localization.common.type, disabled: false, complete: false, testId: 'type', },
103
+ const steps = [
104
+ {
105
+ text: localization.common.type,
106
+ disabled: false,
107
+ complete: false,
108
+ testId: 'type',
109
+ },
106
110
  {
107
- text: localization.common[
108
- isModeProcurator ? 'selectDatastoreName' : 'nameAndDeviceSelection'
109
- ],
111
+ // text: localization.common[
112
+ // isModeProcurator ? 'selectDatastoreName' : 'nameAndDeviceSelection'
113
+ // ],
114
+ text: localization.common.selectDatastoreName,
110
115
  disabled: true,
111
116
  complete: false,
112
117
  testId: 'datastore-name',
@@ -115,15 +120,32 @@ const stemFromLocal = (
115
120
  text: localization.common.readyComplete,
116
121
  disabled: true,
117
122
  complete: false,
118
- testId: 'ready-complete'
123
+ testId: 'ready-complete',
119
124
  },
120
125
  ]
126
+
127
+ if (mode === 'sphere') {
128
+ steps.splice(2, 0, {
129
+ text: localization.common.hostsAccessibility,
130
+ disabled: true,
131
+ complete: false,
132
+ testId: 'hosts-accessibility',
133
+ })
134
+ }
135
+
136
+ return steps
121
137
  }
122
138
  const stemFromSharedStorm = (
123
139
  localization: UI_I_Localization,
140
+ mode: UI_T_WizardDatastoreMode
124
141
  ): UI_I_VerticalStepItem[] => {
125
- return [
126
- { text: localization.common.type, disabled: false, complete: false, testId: 'type', },
142
+ const steps = [
143
+ {
144
+ text: localization.common.type,
145
+ disabled: false,
146
+ complete: false,
147
+ testId: 'type',
148
+ },
127
149
  {
128
150
  text: localization.common.selectDatastoreName,
129
151
  disabled: true,
@@ -140,9 +162,20 @@ const stemFromSharedStorm = (
140
162
  text: localization.common.readyComplete,
141
163
  disabled: true,
142
164
  complete: false,
143
- testId: 'ready-complete'
165
+ testId: 'ready-complete',
144
166
  },
145
167
  ]
168
+
169
+ if (mode === 'sphere') {
170
+ steps.splice(3, 0, {
171
+ text: localization.common.hostsAccessibility,
172
+ disabled: true,
173
+ complete: false,
174
+ testId: 'hosts-accessibility',
175
+ })
176
+ }
177
+
178
+ return steps
146
179
  }
147
180
 
148
181
  export const stepItemsFunc = (
@@ -23,11 +23,12 @@ export const checkValidityName = async (
23
23
  ): Promise<UI_I_DatastoreValidityName> => {
24
24
  // TODO move to projects!!!
25
25
 
26
- const kind = 10 // TODO move in global space
27
- const url =
28
- mode === 'procurator'
29
- ? `/ui/ds/validate?name=${encodeURIComponent(name)}`
30
- : `/ui/object/validate_name?name=${encodeURIComponent(name)}&kind=${kind}`
26
+ let kind = 10 // TODO move in global space
27
+ let url = `/ui/ds/validate?name=${encodeURIComponent(name)}`
28
+ if (mode === 'sphere') {
29
+ kind = 17 // TODO move in global space
30
+ url = `/ui/object/validate_name?name=${encodeURIComponent(name)}&kind=${kind}`
31
+ }
31
32
  // @ts-ignore
32
33
  const { error } = await useMyFetch<null, API_UI_I_Error>(url, {
33
34
  method: 'GET',
@@ -1,60 +1,78 @@
1
1
  <template>
2
2
  <div class="local-step flex flex-col h-full">
3
- <span
4
- v-if="mode === 'sphere' && props.stepPosition === 1"
5
- class="vmfs-container__desc"
6
- >
7
- {{ localization.common.nameAndDeviceSelectionDesc }}
8
- </span>
3
+ <!-- <span-->
4
+ <!-- v-if="mode === 'sphere' && props.stepPosition === 1"-->
5
+ <!-- class="vmfs-container__desc"-->
6
+ <!-- >-->
7
+ <!-- {{ localization.common.nameAndDeviceSelectionDesc }}-->
8
+ <!-- </span>-->
9
9
 
10
10
  <common-backup-storage-actions-add-temp-local-create-name
11
- v-show="mode === 'procurator' && props.stepPosition === 1"
11
+ v-show="props.stepPosition === 1"
12
+ :mode="props.mode"
12
13
  :local-create-name-submit="props.localCreateNameSubmit"
13
14
  test-id="local"
14
15
  @loading="(e) => emits('loading', e)"
15
- @submit="(e) => emits('submit', e)"
16
+ @submit="onChangeName($event)"
16
17
  />
17
18
 
18
- <common-backup-storage-actions-add-temp-shared-storm-device-selection
19
- v-show="mode === 'sphere' && props.stepPosition === 1"
20
- v-model:lun-disk="selectedLunDisk"
21
- mode="sphere"
22
- :device-selection-submit="props.localCreateNameSubmit"
23
- :step-position="props.stepPosition"
24
- :datastore-type="props.datastoreType"
25
- :datacenter-hosts="props.datacenterHosts"
26
- :is-main-filter="props.isMainFilter"
27
- @loading="(e) => emits('loading', e)"
28
- @submit="(e) => emits('submit', e)"
29
- @main-filter="emits('main-filter', $event)"
19
+ <templates-inventory-actions-backup-storage-add-temp-nfs-accessibility
20
+ v-if="mode === 'sphere' && props.stepPosition === 2"
21
+ :host-accessibility-submit="props.hostAccessibilitySubmit"
22
+ :hosts="props.hosts"
23
+ @next="onChangeAccessibilityAndNext"
30
24
  />
25
+ <!-- <common-backup-storage-actions-add-temp-shared-storm-device-selection-->
26
+ <!-- v-show="mode === 'sphere' && props.stepPosition === 1"-->
27
+ <!-- v-model:lun-disk="selectedLunDisk"-->
28
+ <!-- mode="sphere"-->
29
+ <!-- :device-selection-submit="props.localCreateNameSubmit"-->
30
+ <!-- :step-position="props.stepPosition"-->
31
+ <!-- :datastore-type="props.datastoreType"-->
32
+ <!-- :datacenter-hosts="props.datacenterHosts"-->
33
+ <!-- :is-main-filter="props.isMainFilter"-->
34
+ <!-- @loading="(e) => emits('loading', e)"-->
35
+ <!-- @submit="(e) => emits('submit', e)"-->
36
+ <!-- @main-filter="emits('main-filter', $event)"-->
37
+ <!-- />-->
31
38
  </div>
32
39
  </template>
33
40
 
34
41
  <script lang="ts" setup>
35
42
  import type { UI_T_Project } from '~/lib/models/types'
36
- import type { UI_I_CreateStorageLunDiskItem } from '~/components/common/wizards/datastore/add/steps/nameAndDevice/table/lib/models/interfaces'
37
- import type { UI_I_SelectHostOptions } from '~/components/common/wizards/datastore/add/steps/nameAndDevice/lib/models/interfaces'
38
- import type { UI_T_DatastoreTypeCode } from '~/components/common/wizards/datastore/add/lib/models/types'
39
- import type { UI_I_Localization } from '~/lib/models/interfaces'
43
+ // import type { UI_I_CreateStorageLunDiskItem } from '~/components/common/wizards/datastore/add/steps/nameAndDevice/table/lib/models/interfaces'
44
+ // import type { UI_I_SelectHostOptions } from '~/components/common/wizards/datastore/add/steps/nameAndDevice/lib/models/interfaces'
45
+ // import type { UI_T_DatastoreTypeCode } from '~/components/common/wizards/datastore/add/lib/models/types'
46
+ // import type { UI_I_Localization } from '~/lib/models/interfaces'
40
47
 
41
48
  const props = defineProps<{
49
+ mode: UI_T_Project
50
+ hosts: any
42
51
  stepPosition: number
43
52
  localCreateNameSubmit: number
44
- datastoreType: UI_T_DatastoreTypeCode
45
- mode: UI_T_Project
46
- datacenterHosts?: UI_I_SelectHostOptions[]
47
- isMainFilter?: boolean
53
+ hostAccessibilitySubmit: number
48
54
  }>()
49
55
  const emits = defineEmits<{
50
56
  (event: 'loading', value: boolean): void
51
57
  (event: 'submit', value: string): void
52
- (event: 'main-filter', value: string): void
53
58
  }>()
54
59
 
55
- const localization = computed<UI_I_Localization>(() => useLocal())
60
+ const sendData: any = {
61
+ name: '',
62
+ hosts: []
63
+ }
64
+ const onChangeName = (name: string): void => {
65
+ sendData.name = name
66
+
67
+ emits('submit', sendData)
68
+ }
69
+ const onChangeAccessibilityAndNext = (hosts: string[]): void => {
70
+ sendData.hosts = hosts
71
+ emits('submit', sendData)
72
+ }
73
+ // const localization = computed<UI_I_Localization>(() => useLocal())
56
74
 
57
- const selectedLunDisk = ref<UI_I_CreateStorageLunDiskItem[]>([])
75
+ // const selectedLunDisk = ref<UI_I_CreateStorageLunDiskItem[]>([])
58
76
  </script>
59
77
 
60
78
  <style lang="scss" scoped>
@@ -0,0 +1,104 @@
1
+ <template>
2
+ <div>
3
+ <atoms-alert
4
+ v-show="errors.length"
5
+ test-id="accessibility"
6
+ status="alert-danger"
7
+ :items="errors"
8
+ @remove="removeValidationErrors"
9
+ />
10
+
11
+ <div>
12
+ <atoms-tabs
13
+ v-model="activeTab"
14
+ test-id="accessibility"
15
+ :items="tabs"
16
+ size="small"
17
+ />
18
+ </div>
19
+ <div>
20
+ <templates-inventory-actions-backup-storage-add-temp-nfs-accessibility-tables-view
21
+ v-model:selected-row="selectedHosts"
22
+ :data-table="dataTable?.items || []"
23
+ :total-items="dataTable?.total_items || 0"
24
+ :total-pages="dataTable?.total_pages || 1"
25
+ :pagination="pagination"
26
+ :table-type="activeTab"
27
+ @pagination="updatePagination"
28
+ @sort="sortTable"
29
+ />
30
+ </div>
31
+ </div>
32
+ </template>
33
+
34
+ <script lang="ts" setup>
35
+ import type { UI_I_CollapseNavItem } from '~/node_modules/bfg-common/components/atoms/collapse/lib/models/interfaces'
36
+ import type { UI_I_Localization } from '~/node_modules/bfg-common/lib/models/interfaces'
37
+ import type { UI_I_Pagination } from '~/node_modules/bfg-common/lib/models/table/interfaces'
38
+ import type { T_HostsAccessibilityTab } from '~/components/templates/inventory/actions/backup/storage/add/temp/nfs/accessibility/lib/models/types'
39
+ import { hostAccessibilityTabsFunc } from '~/components/templates/inventory/actions/backup/storage/add/temp/nfs/accessibility/lib/config/tabsPannel'
40
+ // import { hostsAccessibilityTablesFunc } from '~/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/hostsTableItems'
41
+
42
+ const props = defineProps<{
43
+ hostAccessibilitySubmit: number
44
+ hosts?: any
45
+ }>()
46
+ const localization = computed<UI_I_Localization>(() => useLocal())
47
+ const emits = defineEmits<{
48
+ (event: 'next', value: string[]): void
49
+ }>()
50
+
51
+ const activeTab = ref<T_HostsAccessibilityTab>('compatible-hosts')
52
+ const tabs = computed<UI_I_CollapseNavItem[]>(() =>
53
+ hostAccessibilityTabsFunc(localization.value, [
54
+ (props.hosts?.items?.length || 0) + '',
55
+ '0',
56
+ ])
57
+ )
58
+
59
+ // const dataTable = computed(() => hostsAccessibilityTablesFunc(activeTab.value))
60
+ // TODO refactoring
61
+ const dataTable = computed<any>(() => props.hosts)
62
+
63
+ const pagination = ref<UI_I_Pagination>({
64
+ page: 1,
65
+ pageSize: 35,
66
+ })
67
+ const sort = ref<string | null>(null)
68
+
69
+ const selectedHosts = ref<string[]>([])
70
+
71
+ const updatePagination = (event: UI_I_Pagination): void => {
72
+ pagination.value = event
73
+ }
74
+ const sortTable = (event: string): void => {
75
+ sort.value = event
76
+ }
77
+
78
+ const errors = ref<string[]>([])
79
+
80
+ const showValidationErrors = (text: string): void => {
81
+ errors.value = [text]
82
+ }
83
+ const removeValidationErrors = (): void => {
84
+ errors.value = []
85
+ }
86
+ const submit = async (): Promise<void> => {
87
+ if (!selectedHosts.value.length) {
88
+ const text = localization.value.common.selectLeastEntityContinue
89
+ showValidationErrors(text)
90
+ return
91
+ }
92
+
93
+ removeValidationErrors()
94
+ emits('next', selectedHosts.value)
95
+ }
96
+ watch(
97
+ () => props.hostAccessibilitySubmit,
98
+ () => {
99
+ submit()
100
+ }
101
+ )
102
+ </script>
103
+
104
+ <style lang="scss" scoped></style>
@@ -0,0 +1,25 @@
1
+ import type { UI_I_Localization } from '~/node_modules/bfg-common/lib/models/interfaces'
2
+ import type { UI_I_CollapseNavItem } from '~/node_modules/bfg-common/components/atoms/collapse/lib/models/interfaces'
3
+
4
+ export const hostAccessibilityTabsFunc = (
5
+ localization: UI_I_Localization,
6
+ hosts: string[]
7
+ ): UI_I_CollapseNavItem[] => {
8
+ const [compatibleHosts, incompatibleHost] = hosts
9
+
10
+ return [
11
+ {
12
+ text: localization.common.compatibleHosts.replace('{0}', compatibleHosts || ''),
13
+ value: 'compatible-hosts',
14
+ disabled: false,
15
+ },
16
+ {
17
+ text: localization.common.incompatibleHosts.replace(
18
+ '{0}',
19
+ incompatibleHost || ''
20
+ ),
21
+ value: 'incompatible-hosts',
22
+ disabled: true,
23
+ },
24
+ ]
25
+ }
@@ -0,0 +1,9 @@
1
+ export interface I_CompatibleHostsTable {
2
+ id: number
3
+ host: string
4
+ cluster: string
5
+ }
6
+
7
+ export interface I_IncompatibleHostsTable extends I_CompatibleHostsTable {
8
+ host_incompatibility_reason: string
9
+ }
@@ -0,0 +1,5 @@
1
+ export type T_HostsAccessibilityTab = 'compatible-hosts' | 'incompatible-hosts'
2
+
3
+ export type T_CompatibleHostsTableKeys = 'name' | 'cluster'
4
+
5
+ export type T_IncompatibleHostsTableKeys = 'name' | 'cluster' | 'host_incompatibility_reason'