bfg-common 1.5.76 → 1.5.77

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 (29) hide show
  1. package/components/common/wizards/datastore/add/Add.vue +1 -1
  2. package/components/common/wizards/datastore/add/New.vue +18 -35
  3. package/components/common/wizards/datastore/add/Old.vue +24 -10
  4. package/components/common/wizards/datastore/add/lib/config/steps.ts +11 -9
  5. package/components/common/wizards/datastore/add/nfs/Nfs.vue +0 -5
  6. package/components/common/wizards/datastore/add/{nfs/version/Version.vue → steps/_nfsVersion/NfsVersion.vue} +1 -0
  7. package/components/common/wizards/datastore/add/steps/hostAccessibility/HostAccessibility.vue +60 -0
  8. package/components/common/wizards/datastore/add/steps/hostAccessibility/HostAccessibilityNew.vue +27 -0
  9. package/components/common/wizards/datastore/add/steps/hostAccessibility/HostAccessibilityOld.vue +60 -0
  10. package/components/common/wizards/datastore/add/steps/hostAccessibility/lib/config/tabsPannel.ts +31 -0
  11. package/components/common/wizards/datastore/add/steps/hostAccessibility/lib/models/interfaces.ts +9 -0
  12. package/components/common/wizards/datastore/add/steps/hostAccessibility/lib/models/types.ts +5 -0
  13. package/components/common/wizards/datastore/add/steps/hostAccessibility/tablesView/TablesView.vue +85 -0
  14. package/components/common/wizards/datastore/add/steps/hostAccessibility/tablesView/lib/config/compatibleTable.ts +62 -0
  15. package/components/common/wizards/datastore/add/steps/hostAccessibility/tablesView/lib/config/incompatibleTable.ts +68 -0
  16. package/components/common/wizards/datastore/add/steps/hostAccessibility/tablesView/lib/config/tableKeys.ts +15 -0
  17. package/components/common/wizards/datastore/add/steps/hostAccessibility/tablesView/lib/models/interfaces.ts +11 -0
  18. package/components/common/wizards/datastore/add/steps/nameAndConfigure/NameAndConfigure.vue +237 -0
  19. package/components/common/wizards/datastore/add/steps/nameAndConfigure/NameAndConfigureNew.vue +30 -0
  20. package/components/common/wizards/datastore/add/steps/nameAndConfigure/NameAndConfigureOld.vue +237 -0
  21. package/components/common/wizards/datastore/add/steps/nameAndConfigure/_serversList/DeletePopover.vue +100 -0
  22. package/components/common/wizards/datastore/add/steps/nameAndConfigure/_serversList/ServersList.vue +123 -0
  23. package/components/common/wizards/datastore/add/steps/nameAndConfigure/_serversList/lib/config/serversListConfig.ts +40 -0
  24. package/components/common/wizards/datastore/add/steps/nameAndConfigure/_serversList/lib/config/tableKeys.ts +3 -0
  25. package/components/common/wizards/datastore/add/steps/nameAndConfigure/_serversList/lib/models/interfaces.ts +3 -0
  26. package/components/common/wizards/datastore/add/steps/nameAndConfigure/_serversList/lib/models/types.ts +1 -0
  27. package/components/common/wizards/datastore/add/steps/nameAndConfigure/lib/models/interfaces.ts +5 -0
  28. package/package.json +1 -1
  29. /package/components/common/wizards/datastore/add/{nfs/version → steps/_nfsVersion}/lib/config/versionOptions.ts +0 -0
@@ -72,7 +72,7 @@ const alertMessages = computed<string[][]>(() => wizard.alertMessages.value)
72
72
 
73
73
  const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
74
74
 
75
- const title = computed<string>(() => localization.value.common.addHost)
75
+ const title = computed<string>(() => localization.value.common.newDatastore)
76
76
 
77
77
  const form = ref<UI_I_CreateDatastoreForm>(
78
78
  useDeepCopy(datastoreDefaultFormFunc(props.hostId))
@@ -9,7 +9,7 @@
9
9
  test-id="add-datastore-wizard"
10
10
  @change-steps="onChangeSteps"
11
11
  @hide="onHideModal"
12
- @submit="onFinish"
12
+ @submit="onCreateDatastore"
13
13
  >
14
14
  <template #content="{ selectedStep, isLoading }">
15
15
  <ui-wizard-block
@@ -56,7 +56,6 @@
56
56
  v-if="selectedStep.id === dynamicSteps.nameAndDevice"
57
57
  v-model="formModelLocal"
58
58
  :project="props.project"
59
- :alert-messages="alertMessages[selectedStep.id]"
60
59
  :messages-fields="selectedStep.fields"
61
60
  :hosts="props.nfsHosts"
62
61
  :host-id="props.hostId"
@@ -66,20 +65,18 @@
66
65
  </ui-wizard-block>
67
66
 
68
67
  <ui-wizard-block
69
- v-if="selectedStep.id === dynamicSteps.hostSummary"
68
+ v-if="selectedStep.id === dynamicSteps.nameAndConfigure"
70
69
  :sub-title-height="height2"
71
70
  >
72
71
  <template #subTitle>
73
72
  <div ref="subTitleBlock2">
74
73
  <div class="subtitle-block">
75
74
  <ui-alert
76
- v-if="hostAssociated"
75
+ v-if="props.alertMessages[dynamicSteps.nameAndConfigure].length"
77
76
  test-id="add-host-connection-settings-error-alert"
78
77
  type="error"
79
78
  size="md"
80
- :messages="[
81
- localization.common.errorProcuratorHostAlreadyConnectedSphere,
82
- ]"
79
+ :messages="props.alertMessages[dynamicSteps.nameAndConfigure]"
83
80
  class="subtitle-block__alert"
84
81
  />
85
82
 
@@ -88,36 +85,29 @@
88
85
  </div>
89
86
  </template>
90
87
  <template #content>
91
- <common-wizards-datastore-add-shared-storm
92
- v-show="datastoreType === 'shared-storm'"
93
- v-model="form"
88
+ <common-wizards-datastore-add-steps-name-and-configure
89
+ v-if="selectedStep.id === dynamicSteps.nameAndConfigure"
90
+ v-model="formModelLocal"
94
91
  :project="props.project"
95
- :step-id="selectedStep.id"
96
- :datastore-type="datastoreType"
97
- :alert-messages="alertMessages[selectedStep.id]"
98
92
  :messages-fields="selectedStep.fields"
99
- :hosts="props.nfsHosts"
100
- :is-main-filter="props.isMainFilter"
101
- :host-id="props.hostId"
102
- @hide-alert="onHideAlert"
103
- @main-filter="emits('main-filter', $event)"
93
+ @hide-alert="(e) => emits('hide-alert', e)"
104
94
  />
105
95
  </template>
106
96
  </ui-wizard-block>
107
97
 
108
98
  <ui-wizard-block
109
- v-if="selectedStep.id === dynamicSteps.assignLicense"
99
+ v-if="selectedStep.id === dynamicSteps.hostAccessibility"
110
100
  :sub-title-height="height3"
111
101
  >
112
102
  <template #subTitle>
113
103
  <div ref="subTitleBlock3">
114
104
  <div class="subtitle-block">
115
105
  <ui-alert
116
- v-if="props.alertMessages[dynamicSteps.assignLicense].length"
106
+ v-if="props.alertMessages[dynamicSteps.hostAccessibility].length"
117
107
  test-id="add-host-assign-license-error-alert"
118
108
  type="error"
119
109
  size="md"
120
- :messages="props.alertMessages[dynamicSteps.assignLicense]"
110
+ :messages="props.alertMessages[dynamicSteps.hostAccessibility]"
121
111
  class="subtitle-block__alert"
122
112
  />
123
113
 
@@ -126,14 +116,12 @@
126
116
  </div>
127
117
  </template>
128
118
  <template #content>
129
- <common-wizards-datastore-add-nfs
130
- v-show="datastoreType === 'nfs'"
131
- v-model="form"
132
- :project="props.project"
133
- :step-id="selectedStep.id"
134
- :alert-messages="alertMessages[selectedStep.id]"
135
- :messages-fields="selectedStep.fields"
119
+ <common-wizards-datastore-add-steps-host-accessibility
120
+ v-if="selectedStep.id === dynamicSteps.hostAccessibility"
121
+ v-model="formModelLocal.hosts"
122
+ :alert-messages="props.alertMessages[dynamicSteps.nameAndDevice]"
136
123
  :hosts="props.nfsHosts"
124
+ @hide-alert="(e) => emits('hide-alert', e)"
137
125
  />
138
126
  </template>
139
127
  </ui-wizard-block>
@@ -230,7 +218,6 @@ const { height: height3 } = useElementSize(subTitleBlock3)
230
218
  const subTitleBlock4 = ref<HTMLElement | null>(null)
231
219
  const { height: height4 } = useElementSize(subTitleBlock4)
232
220
 
233
-
234
221
  const datastoreType = ref<UI_T_DatastoreTypeCode>(2)
235
222
  const form = ref<UI_I_CreateDatastoreForm>({
236
223
  name: 'Datastore',
@@ -257,12 +244,8 @@ const dataReadyView = computed<UI_I_DetailsItem>(() =>
257
244
  const onHideAlert = (stepId: number): void => {
258
245
  emits('hide-alert', stepId)
259
246
  }
260
- const onHideModal = (): void => {
261
- emits('hide')
262
- }
263
- const onFinish = (): void => {
264
- emits('submit')
265
- }
247
+ const onHideModal = (): void => emits('hide')
248
+ const onCreateDatastore = (): void => emits('submit')
266
249
  </script>
267
250
 
268
251
  <style scoped lang="scss">
@@ -10,7 +10,7 @@
10
10
  test-id="add-datastore-wizard"
11
11
  @change-steps="onChangeSteps"
12
12
  @hide="onHideModal"
13
- @submit="onFinish"
13
+ @submit="onCreateDatastore"
14
14
  >
15
15
  <template #modalBody="{ selectedStep }">
16
16
  <common-wizards-datastore-add-steps-type-mode
@@ -22,7 +22,7 @@
22
22
  v-if="selectedStep.id === dynamicSteps.nameAndDevice"
23
23
  v-model="formModelLocal"
24
24
  :project="props.project"
25
- :alert-messages="alertMessages[selectedStep.id]"
25
+ :alert-messages="props.alertMessages[dynamicSteps.nameAndDevice]"
26
26
  :messages-fields="selectedStep.fields"
27
27
  :hosts="props.nfsHosts"
28
28
  :host-id="props.hostId"
@@ -31,8 +31,26 @@
31
31
  @main-filter="emits('main-filter', $event)"
32
32
  />
33
33
 
34
+ <common-wizards-datastore-add-steps-name-and-configure
35
+ v-if="selectedStep.id === dynamicSteps.nameAndConfigure"
36
+ v-model="formModelLocal"
37
+ :project="props.project"
38
+ :alert-messages="props.alertMessages[dynamicSteps.nameAndConfigure]"
39
+ :messages-fields="selectedStep.fields"
40
+ @hide-alert="(e) => emits('hide-alert', e)"
41
+ />
42
+
43
+
44
+ <common-wizards-datastore-add-steps-host-accessibility
45
+ v-if="selectedStep.id === dynamicSteps.hostAccessibility"
46
+ v-model="formModelLocal.hosts"
47
+ :alert-messages="props.alertMessages[dynamicSteps.hostAccessibility]"
48
+ :hosts="props.nfsHosts"
49
+ @hide-alert="(e) => emits('hide-alert', e)"
50
+ />
51
+
34
52
  <common-wizards-datastore-add-shared-storm
35
- v-show="datastoreType === 'shared-storm'"
53
+ v-if="datastoreType === 'shared-storm'"
36
54
  v-model="formModelLocal"
37
55
  :project="props.project"
38
56
  :step-id="selectedStep.id"
@@ -47,7 +65,7 @@
47
65
  />
48
66
 
49
67
  <common-wizards-datastore-add-nfs
50
- v-show="datastoreType === 'nfs'"
68
+ v-if="datastoreType === 'nfs'"
51
69
  v-model="formModelLocal"
52
70
  :project="props.project"
53
71
  :step-id="selectedStep.id"
@@ -114,12 +132,8 @@ const dataReadyView = computed<UI_I_DetailsItem>(() =>
114
132
  const onHideAlert = (stepId: number): void => {
115
133
  emits('hide-alert', stepId)
116
134
  }
117
- const onHideModal = (): void => {
118
- emits('hide')
119
- }
120
- const onFinish = (): void => {
121
- emits('submit')
122
- }
135
+ const onHideModal = (): void => emits('hide')
136
+ const onCreateDatastore = (): void => emits('submit')
123
137
  </script>
124
138
 
125
139
  <style scoped lang="scss">
@@ -8,8 +8,8 @@ import type { UI_T_DatastoreTypeCode } from '~/components/common/wizards/datasto
8
8
  export const dynamicSteps = {
9
9
  type: 0,
10
10
  nameAndDevice: 1,
11
- hostSummary: 2,
12
- assignLicense: 3,
11
+ nameAndConfigure: 2,
12
+ hostAccessibility: 3,
13
13
  lockdownMode: 4,
14
14
  vmLocation: 5,
15
15
  readyComplete: 6,
@@ -81,7 +81,7 @@ export const stepsFunc = (
81
81
  // testId: 'create-datastore-select-nfs-version',
82
82
  // },
83
83
  {
84
- id: 4,
84
+ id: dynamicSteps.nameAndConfigure,
85
85
  title: localization.common.nameAndConfiguration,
86
86
  subTitle: localization.common.nameAndConfigurationDesc,
87
87
  status: UI_E_WIZARD_STATUS.INACTIVE,
@@ -104,7 +104,7 @@ export const stepsFunc = (
104
104
  },
105
105
 
106
106
  {
107
- id: 5,
107
+ id: dynamicSteps.hostAccessibility,
108
108
  title: localization.common.hostsAccessibility,
109
109
  subTitle: localization.common.hostsAccessibilityDesc,
110
110
  status: UI_E_WIZARD_STATUS.INACTIVE,
@@ -138,17 +138,19 @@ export const stepsFunc = (
138
138
  fields: {},
139
139
  isValid: true,
140
140
  testId: 'create-datastore-ready-complete',
141
- // testId: 'create-datastore-storm-ready-complete',
142
- // testId: 'create-datastore-nfs-ready-complete',
143
- // testId: 'create-datastore-local-ready-complete',
144
141
  },
145
142
  ]
146
143
 
147
144
  export const stepsSchemeInitial: number[][] = [
148
145
  [dynamicSteps.type, dynamicSteps.nameAndDevice, 11], // Procurator Scheme for "shared-storm" type
149
- [dynamicSteps.type, 4, 11], // Procurator Scheme for "nfs" type
146
+ [dynamicSteps.type, dynamicSteps.nameAndConfigure, 11], // Procurator Scheme for "nfs" type
150
147
  [dynamicSteps.type, dynamicSteps.nameAndDevice, 11], // Sphere Scheme for "shared-storm" type
151
- [dynamicSteps.type, 4, 5, 11], // Sphere Scheme for "nfs" type
148
+ [
149
+ dynamicSteps.type,
150
+ dynamicSteps.nameAndConfigure,
151
+ dynamicSteps.hostAccessibility,
152
+ 11,
153
+ ], // Sphere Scheme for "nfs" type (not used from <host Context Menu>)
152
154
  ]
153
155
 
154
156
  export const getStepScheme = (
@@ -1,10 +1,5 @@
1
1
  <template>
2
2
  <div class="nfs-container">
3
- <!-- <common-wizards-datastore-add-nfs-version-->
4
- <!-- v-if="props.stepId === 4"-->
5
- <!-- v-model="model.nfsVersion"-->
6
- <!-- />-->
7
-
8
3
  <common-wizards-datastore-add-nfs-configuration
9
4
  v-show="props.stepId === 4"
10
5
  v-model="model"
@@ -1,4 +1,5 @@
1
1
  <template>
2
+ <!-- TODO: если использовать этот компонент, нужно отрефакторить весь код — сейчас всё по-старому -->
2
3
  <section class="nfs-version">
3
4
  <common-select-radio-group
4
5
  v-model="selectedNfsVersionLocal"
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <div class="host-accessibility">
3
+ <atoms-alert
4
+ v-show="props.alertMessages?.length"
5
+ test-id="accessibility"
6
+ status="alert-danger"
7
+ :items="props.alertMessages"
8
+ @remove="onHideAlert"
9
+ />
10
+
11
+ <atoms-tabs
12
+ v-model="activeTab"
13
+ test-id="accessibility"
14
+ :items="tabs"
15
+ size="small"
16
+ class="w-100"
17
+ />
18
+ <common-wizards-datastore-add-nfs-accessibility-tables-view
19
+ v-model="modelHosts"
20
+ :data-table="dataTable?.items || []"
21
+ :total-items="dataTable?.total_items || 0"
22
+ :total-pages="dataTable?.total_pages || 1"
23
+ :table-type="activeTab"
24
+ />
25
+ </div>
26
+ </template>
27
+
28
+ <script lang="ts" setup>
29
+ import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
30
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
31
+ import type { T_HostsAccessibilityTab } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/models/types'
32
+ import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/models/interfaces'
33
+ import { hostAccessibilityTabsFunc } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/config/tabsPannel'
34
+
35
+ const props = defineProps<{
36
+ alertMessages: string[]
37
+ hosts?: UI_I_CreateDatastoreHosts
38
+ }>()
39
+ const modelHosts = defineModel<string[]>()
40
+ const emits = defineEmits<{
41
+ (event: 'hide-alert', value: number): void
42
+ }>()
43
+
44
+ const localization = computed<UI_I_Localization>(() => useLocal())
45
+
46
+ const activeTab = ref<T_HostsAccessibilityTab>('compatible-hosts')
47
+ const tabs = computed<UI_I_CollapseNavItem[]>(() =>
48
+ hostAccessibilityTabsFunc(localization.value, [
49
+ (props.hosts?.items?.length || 0) + '',
50
+ '0',
51
+ ])
52
+ )
53
+
54
+ const dataTable = computed<UI_I_CreateDatastoreHosts>(() => props.hosts)
55
+ const onHideAlert = (): void => {
56
+ emits('hide-alert', 6)
57
+ }
58
+ </script>
59
+
60
+ <style lang="scss" scoped></style>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div class="host-accessibility">
3
+ {{ props }}
4
+ {{ modelHosts }}
5
+ </div>
6
+ </template>
7
+
8
+ <script lang="ts" setup>
9
+ import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
10
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
11
+ import type { T_HostsAccessibilityTab } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/models/types'
12
+ import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/models/interfaces'
13
+ import { hostAccessibilityTabsFunc } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/config/tabsPannel'
14
+
15
+ const props = defineProps<{
16
+ alertMessages: string[]
17
+ hosts?: UI_I_CreateDatastoreHosts
18
+ }>()
19
+ const modelHosts = defineModel<string[]>()
20
+ // const emits = defineEmits<{
21
+ // (event: 'hide-alert', value: number): void
22
+ // }>()
23
+
24
+ // const localization = computed<UI_I_Localization>(() => useLocal())
25
+ </script>
26
+
27
+ <style lang="scss" scoped></style>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <div class="host-accessibility">
3
+ <atoms-alert
4
+ v-show="props.alertMessages?.length"
5
+ test-id="accessibility"
6
+ status="alert-danger"
7
+ :items="props.alertMessages"
8
+ @remove="onHideAlert"
9
+ />
10
+
11
+ <atoms-tabs
12
+ v-model="activeTab"
13
+ test-id="accessibility"
14
+ :items="tabs"
15
+ size="small"
16
+ class="w-100"
17
+ />
18
+ <common-wizards-datastore-add-nfs-accessibility-tables-view
19
+ v-model="modelHosts"
20
+ :data-table="dataTable?.items || []"
21
+ :total-items="dataTable?.total_items || 0"
22
+ :total-pages="dataTable?.total_pages || 1"
23
+ :table-type="activeTab"
24
+ />
25
+ </div>
26
+ </template>
27
+
28
+ <script lang="ts" setup>
29
+ import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
30
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
31
+ import type { T_HostsAccessibilityTab } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/models/types'
32
+ import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/models/interfaces'
33
+ import { hostAccessibilityTabsFunc } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/config/tabsPannel'
34
+
35
+ const props = defineProps<{
36
+ alertMessages: string[]
37
+ hosts?: UI_I_CreateDatastoreHosts
38
+ }>()
39
+ const modelHosts = defineModel<string[]>()
40
+ const emits = defineEmits<{
41
+ (event: 'hide-alert', value: number): void
42
+ }>()
43
+
44
+ const localization = computed<UI_I_Localization>(() => useLocal())
45
+
46
+ const activeTab = ref<T_HostsAccessibilityTab>('compatible-hosts')
47
+ const tabs = computed<UI_I_CollapseNavItem[]>(() =>
48
+ hostAccessibilityTabsFunc(localization.value, [
49
+ (props.hosts?.items?.length || 0) + '',
50
+ '0',
51
+ ])
52
+ )
53
+
54
+ const dataTable = computed<UI_I_CreateDatastoreHosts>(() => props.hosts)
55
+ const onHideAlert = (): void => {
56
+ emits('hide-alert', 6)
57
+ }
58
+ </script>
59
+
60
+ <style lang="scss" scoped></style>
@@ -0,0 +1,31 @@
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
3
+
4
+ export const hostAccessibilityTabsFunc = (
5
+ localization: UI_I_Localization,
6
+ hosts: string[]
7
+ ) => {
8
+ const [compatibleHosts, incompatibleHost] = hosts
9
+
10
+ const tabs: UI_I_CollapseNavItem[] = [
11
+ {
12
+ text: localization.common.compatibleHosts.replace(
13
+ '{0}',
14
+ compatibleHosts || ''
15
+ ),
16
+ value: 'compatible-hosts',
17
+ disabled: false,
18
+ testId: 'host-accessibility-compatible',
19
+ },
20
+ {
21
+ text: localization.common.incompatibleHosts.replace(
22
+ '{0}',
23
+ incompatibleHost || ''
24
+ ),
25
+ value: 'incompatible-hosts',
26
+ disabled: true,
27
+ testId: 'host-accessibility-incompatible',
28
+ },
29
+ ]
30
+ return tabs
31
+ }
@@ -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 = 'host' | 'cluster'
4
+
5
+ export type T_IncompatibleHostsTableKeys = 'host' | 'cluster' | 'host_incompatibility_reason'
@@ -0,0 +1,85 @@
1
+ <template>
2
+ <div class="data-table-view">
3
+ <div>
4
+ <atoms-table-data-grid
5
+ v-model:selected-row="selectedHostsIdLocal"
6
+ v-model:page-size="pagination.pageSize"
7
+ v-model:page="pagination.page"
8
+ type="checkbox"
9
+ class="data-table"
10
+ test-id="accessibility-table"
11
+ :head-items="headItems"
12
+ :body-items="bodyItems"
13
+ :total-items="props.totalItems"
14
+ :total-pages="props.totalPages"
15
+ hide-page-size
16
+ :loading="loading"
17
+ server-off
18
+ >
19
+ <template #icon="{ item }">
20
+ <span :class="['datagrid-cell-icon', item.data.iconClassName]" />
21
+ <span class="text-ellipsis">
22
+ {{ item.text }}
23
+ </span>
24
+ </template>
25
+ </atoms-table-data-grid>
26
+ </div>
27
+ </div>
28
+ </template>
29
+
30
+ <script lang="ts" setup>
31
+ import type {
32
+ UI_I_HeadItem,
33
+ UI_I_BodyItem,
34
+ } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
35
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
36
+ import type { UI_I_Pagination } from '~/lib/models/table/interfaces'
37
+ import type { T_HostsAccessibilityTab } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/models/types'
38
+ import {
39
+ I_CompatibleHostsTable,
40
+ I_IncompatibleHostsTable,
41
+ } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/models/interfaces'
42
+ import * as compatibleTable from '~/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/compatibleTable'
43
+ import * as incompatibleTable from '~/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/incompatibleTable'
44
+
45
+ const props = defineProps<{
46
+ dataTable: I_CompatibleHostsTable[] | I_IncompatibleHostsTable[]
47
+ tableType: T_HostsAccessibilityTab
48
+ totalItems: number
49
+ totalPages: number
50
+ }>()
51
+ const selectedHostsIdLocal = defineModel<string[]>()
52
+
53
+ const localization = computed<UI_I_Localization>(() => useLocal())
54
+
55
+ const loading = computed<boolean>(() => false)
56
+
57
+ const pagination = ref<UI_I_Pagination>({
58
+ page: 1,
59
+ pageSize: 1,
60
+ })
61
+
62
+ const tables: any = {
63
+ 'compatible-hosts': compatibleTable,
64
+ 'incompatible-hosts': incompatibleTable,
65
+ }
66
+
67
+ const headItems = computed<UI_I_HeadItem[]>(() =>
68
+ tables[props.tableType].headItems(localization.value)
69
+ )
70
+ const bodyItems = computed<UI_I_BodyItem[][]>(() => {
71
+ return tables[props.tableType].bodyItems(props.dataTable)
72
+ })
73
+ </script>
74
+
75
+ <style lang="scss" scoped>
76
+ .data-table-view {
77
+ height: inherit;
78
+ .data-table {
79
+ height: inherit;
80
+ :deep(.datagrid-outer-wrapper) {
81
+ height: inherit;
82
+ }
83
+ }
84
+ }
85
+ </style>
@@ -0,0 +1,62 @@
1
+ import type {
2
+ UI_I_HeadItem,
3
+ UI_I_BodyItem,
4
+ } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
5
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
6
+ import { constructHeadItem } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
7
+ import type { I_CompatibleHostsTable } from '~/components/common/wizards/datastore/add/nfs/accessibility/lib/models/interfaces'
8
+ import { compatibleHostsTableKeys } from '~/components/common/wizards/datastore/add/nfs/accessibility/tablesView/lib/config/tableKeys'
9
+ import {
10
+ hostIconByState,
11
+ clusterIconByState,
12
+ } from '~/components/common/lib/config/states'
13
+
14
+ const getItems = (
15
+ localization: UI_I_Localization
16
+ ): [string, boolean, string, string][] => {
17
+ return [
18
+ [localization.common.host, true, '300px', compatibleHostsTableKeys[0]],
19
+ [localization.common.cluster, true, '300px', compatibleHostsTableKeys[1]],
20
+ ]
21
+ }
22
+
23
+ export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
24
+ const result: UI_I_HeadItem[] = []
25
+ getItems(localization).forEach((item) => {
26
+ result.push(constructHeadItem('icon', item[0], item[3], false, item[2]))
27
+ })
28
+ return result
29
+ }
30
+
31
+ export const bodyItems = (
32
+ data: I_CompatibleHostsTable[]
33
+ ): UI_I_BodyItem[][] => {
34
+ const bodyItems: UI_I_BodyItem[][] = []
35
+ data.forEach((item: I_CompatibleHostsTable, key) => {
36
+ const hostData = {
37
+ // @ts-ignore
38
+ iconClassName: `vsphere-icon-${hostIconByState[item.state]}`,
39
+ }
40
+ const clusterData = {
41
+ iconClassName: `vsphere-icon-${clusterIconByState[1]}`,
42
+ }
43
+
44
+ bodyItems.push([
45
+ {
46
+ key: 'icon',
47
+ text: item[compatibleHostsTableKeys[0]],
48
+ data: hostData,
49
+ id: item.id,
50
+ testId: `host-table-item-${item.host}`,
51
+ },
52
+ {
53
+ key: 'icon',
54
+ text: item[compatibleHostsTableKeys[1]],
55
+ data: clusterData,
56
+ id: item.id,
57
+ testId: `host-table-item-${item.host}`,
58
+ },
59
+ ])
60
+ })
61
+ return bodyItems
62
+ }