bfg-common 1.4.46 → 1.4.48

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 (52) hide show
  1. package/components/common/wizards/datastore/add/nfs/accessibility/lib/models/interfaces.ts +4 -0
  2. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/selectOptions.ts +15 -6
  3. package/components/common/wizards/datastoreNew/add/Add.vue +464 -0
  4. package/components/common/wizards/datastoreNew/add/lib/config/steps.ts +135 -0
  5. package/components/common/wizards/datastoreNew/add/lib/models/enums.ts +5 -0
  6. package/components/common/wizards/datastoreNew/add/lib/models/interfaces.ts +12 -0
  7. package/components/common/wizards/datastoreNew/add/lib/models/types.ts +7 -0
  8. package/components/common/wizards/datastoreNew/add/lib/utils.ts +31 -0
  9. package/components/common/wizards/datastoreNew/add/local/Local.vue +44 -0
  10. package/components/common/wizards/datastoreNew/add/local/createName/CreateName.vue +116 -0
  11. package/components/common/wizards/datastoreNew/add/nfs/Nfs.vue +62 -0
  12. package/components/common/wizards/datastoreNew/add/nfs/_kerberosAuthentication/KerberosAuthentication.vue +55 -0
  13. package/components/common/wizards/datastoreNew/add/nfs/_kerberosAuthentication/lib/config/radioOptions.ts +27 -0
  14. package/components/common/wizards/datastoreNew/add/nfs/accessibility/Accessibility.vue +63 -0
  15. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/config/tabsPannel.ts +24 -0
  16. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/interfaces.ts +9 -0
  17. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/types.ts +5 -0
  18. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/TablesView.vue +85 -0
  19. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -0
  20. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/incompatibleTable.ts +68 -0
  21. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/tableKeys.ts +15 -0
  22. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/models/interfaces.ts +11 -0
  23. package/components/common/wizards/datastoreNew/add/nfs/configuration/Configuration.vue +236 -0
  24. package/components/common/wizards/datastoreNew/add/nfs/configuration/_serversList/DeletePopover.vue +100 -0
  25. package/components/common/wizards/datastoreNew/add/nfs/configuration/_serversList/ServersList.vue +123 -0
  26. package/components/common/wizards/datastoreNew/add/nfs/configuration/_serversList/lib/config/serversListConfig.ts +40 -0
  27. package/components/common/wizards/datastoreNew/add/nfs/configuration/_serversList/lib/config/tableKeys.ts +3 -0
  28. package/components/common/wizards/datastoreNew/add/nfs/configuration/_serversList/lib/models/interfaces.ts +3 -0
  29. package/components/common/wizards/datastoreNew/add/nfs/configuration/_serversList/lib/models/types.ts +1 -0
  30. package/components/common/wizards/datastoreNew/add/nfs/configuration/lib/models/interfaces.ts +5 -0
  31. package/components/common/wizards/datastoreNew/add/nfs/version/Version.vue +26 -0
  32. package/components/common/wizards/datastoreNew/add/nfs/version/lib/config/versionOptions.ts +22 -0
  33. package/components/common/wizards/datastoreNew/add/readyComplete/ReadyComplete.vue +88 -0
  34. package/components/common/wizards/datastoreNew/add/readyComplete/lib/config/propertiesDetails.ts +140 -0
  35. package/components/common/wizards/datastoreNew/add/sharedStorm/SharedStorm.vue +83 -0
  36. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/DeviceSelection.vue +262 -0
  37. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/selectOptions.ts +23 -0
  38. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces.ts +48 -0
  39. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/types.ts +8 -0
  40. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/Table.vue +134 -0
  41. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/hostsTable.ts +87 -0
  42. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/tableKeys.ts +11 -0
  43. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +236 -0
  44. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/graphicTooltip/graphicTooltip.vue +64 -0
  45. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/lib/config/selectOptions.ts +46 -0
  46. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/sizeGraphic/sizeGraphic.vue +225 -0
  47. package/components/common/wizards/datastoreNew/add/sharedStorm/version/Version.vue +39 -0
  48. package/components/common/wizards/datastoreNew/add/sharedStorm/version/lib/config/versionOptions.ts +21 -0
  49. package/components/common/wizards/datastoreNew/add/types/Types.vue +78 -0
  50. package/components/common/wizards/datastoreNew/add/types/lib/config/typeOptions.ts +49 -0
  51. package/lib/models/interfaces.ts +1 -0
  52. package/package.json +1 -1
@@ -0,0 +1,140 @@
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type { UI_I_DetailsItem } from '~/components/common/details/lib/models/interfaces'
3
+ import type { UI_T_Project } from '~/lib/models/types'
4
+ import type { UI_I_CreateStorageLunDiskItem } from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces'
5
+ import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastoreNew/add/lib/models/interfaces'
6
+ import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/models/interfaces'
7
+ const constructLunDiskItems = (
8
+ disks: UI_I_CreateStorageLunDiskItem[]
9
+ ): string => {
10
+ const { $binary } = useNuxtApp() as any
11
+
12
+ let result = ''
13
+ disks.forEach((disk: UI_I_CreateStorageLunDiskItem) => {
14
+ const capacity = $binary.round(disk.capacity_mb)
15
+ result += `${disk.name} - ${capacity} \n`
16
+ })
17
+ return result
18
+ }
19
+
20
+ const nfsDetailsFunc = (
21
+ localization: UI_I_Localization,
22
+ data: UI_I_CreateDatastoreForm,
23
+ project: UI_T_Project,
24
+ nfsHosts: UI_I_CreateDatastoreHosts
25
+ ): UI_I_DetailsItem[] => {
26
+ const { name, server, folder, nfsVersion, hosts } = data
27
+ // const accessMode = readonly ? 'Read-only' : 'Read-write'
28
+
29
+ const details: UI_I_DetailsItem[] = [
30
+ {
31
+ label: localization.common.vmfsVersion,
32
+ value: '',
33
+ items: [
34
+ {
35
+ label: localization.common.version,
36
+ value: nfsVersion.toUpperCase(),
37
+ items: [],
38
+ testId: 'view-selected-nfs-version-in-complete',
39
+ },
40
+ ],
41
+ actions: [],
42
+ },
43
+ {
44
+ label: localization.common.nameAndConfiguration,
45
+ value: '',
46
+ items: [
47
+ {
48
+ label: localization.common.datastoreName,
49
+ value: name,
50
+ items: [],
51
+ testId: 'view-storage-name-in-complete',
52
+ },
53
+ {
54
+ label: localization.common.server,
55
+ value: server,
56
+ items: [],
57
+ testId: 'view-server-name-in-complete',
58
+ },
59
+ {
60
+ label: localization.common.folder,
61
+ value: folder,
62
+ items: [],
63
+ testId: 'view-folder-name-in-complete',
64
+ },
65
+ // {
66
+ // label: localization.accessMode,
67
+ // value: accessMode,
68
+ // items: [],
69
+ // },
70
+ ],
71
+ actions: [],
72
+ },
73
+ ]
74
+
75
+ if (project === 'sphere') {
76
+ const hostsNames = nfsHosts
77
+ ? nfsHosts.items
78
+ .filter((host) => data.hosts.includes(host.id))
79
+ .map((host) => host.host)
80
+ : []
81
+ details.push({
82
+ label: localization.common.hostsAccessibility,
83
+ value: '',
84
+ items: [
85
+ {
86
+ label: localization.common.hosts,
87
+ value: '',
88
+ data: hostsNames,
89
+ items: [],
90
+ testId: '',
91
+ },
92
+ ],
93
+ actions: [],
94
+ })
95
+ }
96
+
97
+ return details
98
+ }
99
+ const sharedStormDetailsFunc = (
100
+ localization: UI_I_Localization,
101
+ data: UI_I_CreateDatastoreForm
102
+ ): UI_I_DetailsItem[] => {
103
+ const { name, lunDisk } = data
104
+
105
+ return [
106
+ {
107
+ label: localization.common.nameAndDeviceSelection,
108
+ value: '',
109
+ items: [
110
+ {
111
+ label: localization.common.datastoreName,
112
+ value: name,
113
+ items: [],
114
+ testId: 'view-storage-name-in-complete',
115
+ },
116
+ {
117
+ label: localization.common.diskLun,
118
+ value: constructLunDiskItems(lunDisk),
119
+ items: [],
120
+ testId: 'view-selected-lun-disks-in-complete',
121
+ },
122
+ ],
123
+ actions: [],
124
+ },
125
+ ]
126
+ }
127
+
128
+ export const constructDataReadyViewFunc = (
129
+ localization: UI_I_Localization,
130
+ data: UI_I_CreateDatastoreForm,
131
+ project: UI_T_Project,
132
+ nfsHosts: UI_I_CreateDatastoreHosts
133
+ ): UI_I_DetailsItem[] => {
134
+ const details = {
135
+ 2: sharedStormDetailsFunc,
136
+ 4: nfsDetailsFunc,
137
+ }
138
+
139
+ return details[data.type_code](localization, data, project, nfsHosts)
140
+ }
@@ -0,0 +1,83 @@
1
+ <template>
2
+ <div class="shared-storm-container">
3
+ <common-wizards-datastore-new-add-shared-storm-device-selection
4
+ v-show="props.stepId === 2"
5
+ v-model="model"
6
+ :step-id="props.stepId"
7
+ :alert-messages="props.alertMessages"
8
+ :messages-fields="props.messagesFields"
9
+ :datastore-type="props.datastoreType"
10
+ :project="props.project"
11
+ :hosts="props.hosts"
12
+ :is-main-filter="props.isMainFilter"
13
+ :host-id="props.hostId"
14
+ @hide-alert="(e) => emits('hide-alert', e)"
15
+ @main-filter="emits('main-filter', $event)"
16
+ />
17
+
18
+ <!-- <templates-home-datastore-actions-add-vmfs-version-->
19
+ <!-- v-show="props.stepPosition === 2"-->
20
+ <!-- v-models:version="vmfsVersion"-->
21
+ <!-- />-->
22
+ <!-- TODO в shared-storm пока верси не будет -->
23
+
24
+ <common-wizards-datastore-add-shared-storm-partition-configuration
25
+ v-show="props.project === 'procurator' && props.stepId === 3"
26
+ :vmfs-version="vmfsVersion"
27
+ :selected-lun-disk-size="lunDiskTotalCapacity"
28
+ />
29
+ </div>
30
+ </template>
31
+
32
+ <script lang="ts" setup>
33
+ import {
34
+ UI_I_Localization,
35
+ UI_I_ArbitraryObject,
36
+ } from '~/lib/models/interfaces'
37
+ import { UI_T_Project } from '~/lib/models/types'
38
+ import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
39
+ import {
40
+ UI_T_DatastoreType,
41
+ UI_T_VmfsType,
42
+ } from '~/components/common/wizards/datastore/add/lib/models/types'
43
+ import type { UI_I_CreateStorageLunDiskItem } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
44
+ import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/models/interfaces'
45
+
46
+ const props = defineProps<{
47
+ project: UI_T_Project
48
+ stepId: number
49
+ datastoreType: UI_T_DatastoreType
50
+ alertMessages: string[]
51
+ messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
52
+ hosts?: UI_I_CreateDatastoreHosts
53
+ isMainFilter?: boolean
54
+ hostId?: string
55
+ }>()
56
+ const model = defineModel<any>()
57
+ const emits = defineEmits<{
58
+ (event: 'hide-alert', value: boolean): void
59
+ (event: 'main-filter', value: string): void
60
+ }>()
61
+
62
+ const localization = computed<UI_I_Localization>(() => useLocal())
63
+
64
+ const vmfsVersion = ref<UI_T_VmfsType>('vmfs-6')
65
+
66
+ const lunDiskTotalCapacity = computed<number>(() => {
67
+ if (!model.value.lunDisk.length) return 0
68
+
69
+ return +model.value.lunDisk
70
+ .map((disk: UI_I_CreateStorageLunDiskItem) => disk.capacity_mb)
71
+ .reduce((acc, cur) => acc + cur)
72
+ })
73
+ </script>
74
+
75
+ <style lang="scss" scoped>
76
+ .shared-storm-container {
77
+ display: flex;
78
+ flex-direction: column;
79
+ overflow-y: auto;
80
+ overflow-x: hidden;
81
+ height: inherit;
82
+ }
83
+ </style>
@@ -0,0 +1,262 @@
1
+ <template>
2
+ <div class="device-selection-step">
3
+ <atoms-alert
4
+ v-show="props.alertMessages?.length"
5
+ test-id="device-selection-alert-error"
6
+ status="alert-danger"
7
+ :items="props.alertMessages"
8
+ @remove="onHideAlert"
9
+ />
10
+
11
+ <div class="clr-form-control clr-row">
12
+ <label for="" class="clr-control-label clr-col-md-2">
13
+ {{ localization.common.name }}
14
+ </label>
15
+
16
+ <div class="clr-control-container" :class="nameErrorText && 'clr-error'">
17
+ <div class="flex-align-center">
18
+ <input
19
+ id="device-selection-input"
20
+ v-model="model.name"
21
+ data-id="device-selection-input"
22
+ type="text"
23
+ class="clr-input"
24
+ @blur="initValidation(true)"
25
+ @input="initValidation(false)"
26
+ />
27
+ <atoms-the-icon class="error-icon" name="info-circle" />
28
+ </div>
29
+
30
+ <div class="clr-subtext" data-id="storm-datastore-name-field-require">
31
+ {{ nameErrorText }}
32
+ </div>
33
+ </div>
34
+ </div>
35
+
36
+ <atoms-alert
37
+ v-show="alertInfo"
38
+ test-id="device-selection-information-alert"
39
+ class="device-selection-step__alert-info"
40
+ status="alert-info"
41
+ :items="[localization.common.nameAndDeviceSelectionAlertInfo]"
42
+ @remove="onHideAlertInfo"
43
+ />
44
+
45
+ <div
46
+ v-if="props.project === 'sphere' && !props.hostId"
47
+ class="clr-form-control clr-row"
48
+ >
49
+ <label class="clr-control-label clr-col-12 clr-col-md-2">
50
+ {{ localization.common.selectHost }}
51
+ </label>
52
+
53
+ <div>
54
+ <div class="clr-select-wrapper">
55
+ <select
56
+ id="device-host-select"
57
+ v-model="model.hosts"
58
+ data-id="device-host-select"
59
+ class="dropdown-toggle"
60
+ @change="onSelectHost"
61
+ >
62
+ <option
63
+ v-for="(item, index) in hostOptions"
64
+ :key="index"
65
+ :value="[item.value]"
66
+ :disabled="item.disabled"
67
+ >
68
+ {{ item.text }}
69
+ </option>
70
+ </select>
71
+ </div>
72
+ <div class="clr-subtext">
73
+ {{ localization.common.selectHostToViewAccessible }}
74
+ </div>
75
+ </div>
76
+ </div>
77
+
78
+ <div class="device-selection-step__disk-list">
79
+ <common-wizards-datastore-new-add-shared-storm-device-selection-table
80
+ v-model="model.lunDisk"
81
+ :data-table="dataTable?.items || []"
82
+ :total-items="dataTable?.total_items || 0"
83
+ :total-pages="dataTable?.total_pages || 1"
84
+ :pagination="pagination"
85
+ :loading="loading"
86
+ :is-main-filter="props.isMainFilter"
87
+ @pagination="updatePagination"
88
+ @sort="sortTable"
89
+ @main-filter="emits('main-filter', $event)"
90
+ />
91
+ </div>
92
+ </div>
93
+ </template>
94
+
95
+ <script lang="ts" setup>
96
+ import type { UI_T_Project } from '~/lib/models/types'
97
+ import type {
98
+ UI_I_Localization,
99
+ UI_I_ArbitraryObject,
100
+ } from '~/lib/models/interfaces'
101
+ import {
102
+ API_UI_I_DataTable,
103
+ UI_I_Pagination,
104
+ UI_I_DataTableQuery,
105
+ } from '~/lib/models/table/interfaces'
106
+ import type {
107
+ UI_I_CreateStorageLunDiskItem,
108
+ UI_I_LunDiskSpherePayload,
109
+ UI_I_SelectHostOptions,
110
+ } from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces'
111
+ import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
112
+ import type { UI_I_CreateDatastoreHosts } from '~/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/models/interfaces'
113
+ import { UI_T_DatastoreType } from '~/components/common/wizards/datastoreNew/add/lib/models/types'
114
+ import { hostsOptionsFunc } from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/selectOptions'
115
+
116
+ const props = defineProps<{
117
+ project: UI_T_Project
118
+ stepId: number
119
+ alertMessages: string[]
120
+ messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
121
+ datastoreType: UI_T_DatastoreType
122
+ hosts?: UI_I_CreateDatastoreHosts | undefined
123
+ isMainFilter?: boolean
124
+ hostId?: string
125
+ }>()
126
+ const model = defineModel<any>()
127
+ const emits = defineEmits<{
128
+ (event: 'hide-alert', value: number): void
129
+ (event: 'main-filter', value: string): void
130
+ }>()
131
+
132
+ const localization = computed<UI_I_Localization>(() => useLocal())
133
+ const { $store } = useNuxtApp()
134
+
135
+ const isInitDatastoreNameValidation = ref<boolean>(false)
136
+ const initValidation = (onlyBlur: boolean): void => {
137
+ onlyBlur && (isInitDatastoreNameValidation.value = true)
138
+ }
139
+
140
+ const nameErrorText = computed<string>(() => {
141
+ if (props.messagesFields?.datastoreName?.field && !model.value.name) {
142
+ return props.messagesFields.datastoreName.field
143
+ }
144
+
145
+ if (!isInitDatastoreNameValidation.value) return ''
146
+ return !model.value.name ? localization.value.common.specifyDatastoreName : ''
147
+ })
148
+
149
+ const alertInfo = ref<boolean>(true)
150
+ const onHideAlertInfo = (): void => {
151
+ alertInfo.value = false
152
+ }
153
+
154
+ /* Lun disk table */
155
+
156
+ const pagination = ref<UI_I_Pagination>({
157
+ page: 1,
158
+ pageSize: 35,
159
+ })
160
+ const sort = ref<string | null>(null)
161
+
162
+ const updatePagination = (event: UI_I_Pagination): void => {
163
+ pagination.value = event
164
+ }
165
+ const sortTable = (event: string): void => {
166
+ sort.value = event
167
+ initLunDisksDataTable()
168
+ }
169
+
170
+ const loading = computed<boolean>(() =>
171
+ $store.getters['storage/getLoading']('datastoreHosts')
172
+ )
173
+ const dataTable = computed<API_UI_I_DataTable<
174
+ UI_I_CreateStorageLunDiskItem[]
175
+ > | null>(() => {
176
+ return $store.getters['storage/getNewDatastoreHosts']
177
+ })
178
+
179
+ /* Select host */
180
+ const hostOptions = computed<UI_I_SelectHostOptions[]>(() =>
181
+ hostsOptionsFunc(localization.value, props.hosts?.items)
182
+ )
183
+
184
+ const onSelectHost = (): void => {
185
+ if (props.datastoreType !== 'shared-storm') return // TODO рефакторинг ( удалить проверку )
186
+
187
+ initLunDisksForSphere(model.value.hosts[0])
188
+ }
189
+
190
+ const initLunDisksForSphere = async (host: string): Promise<void> => {
191
+ await $store.dispatch('storage/A_GET_DISKS_LIST', {
192
+ host,
193
+ ...pagination.value,
194
+ sortBy: sort.value,
195
+ } as UI_I_LunDiskSpherePayload)
196
+ }
197
+ if (props.hostId) {
198
+ initLunDisksForSphere(props.hostId)
199
+ }
200
+ const initLunDisksDataTable = async (): Promise<void> => {
201
+ await $store.dispatch('storage/A_GET_LUN_DISK_LIST', {
202
+ ...pagination.value,
203
+ sortBy: sort.value,
204
+ } as UI_I_DataTableQuery)
205
+ }
206
+
207
+ if (props.project === 'procurator') {
208
+ // && props.stepId === 2
209
+ initLunDisksDataTable()
210
+ }
211
+
212
+ const onHideAlert = (): void => {
213
+ emits('hide-alert', props.stepId)
214
+ }
215
+ </script>
216
+
217
+ <style lang="scss" scoped>
218
+ .device-selection-step {
219
+ display: flex;
220
+ flex-direction: column;
221
+ height: inherit;
222
+ overflow-y: auto;
223
+ overflow-x: hidden;
224
+ &__alert-info {
225
+ :deep(.alert-text) {
226
+ font-size: 11px;
227
+ letter-spacing: normal;
228
+ }
229
+ }
230
+ .dropdown-toggle {
231
+ min-width: 160px;
232
+ }
233
+ .clr-form-control {
234
+ display: flex;
235
+ flex-direction: row;
236
+
237
+ .clr-control-container {
238
+ min-height: 48px;
239
+ &.clr-error {
240
+ .clr-subtext,
241
+ .error-icon {
242
+ display: block;
243
+ }
244
+ }
245
+ .clr-subtext,
246
+ .error-icon {
247
+ display: none;
248
+ }
249
+ .error-icon {
250
+ fill: #db2100;
251
+ width: 24px;
252
+ height: 24px;
253
+ }
254
+ }
255
+ }
256
+ &__disk-list {
257
+ display: flex;
258
+ flex-direction: column;
259
+ height: 100%;
260
+ }
261
+ }
262
+ </style>
@@ -0,0 +1,23 @@
1
+ import { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import { UI_I_SelectHostOptions } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
3
+
4
+ const constructHostListFunc = (
5
+ data: { host: string; id: string }[]
6
+ ): UI_I_SelectHostOptions[] => {
7
+ return data.map((item) => ({
8
+ text: item.host,
9
+ value: item.id,
10
+ disabled: false,
11
+ }))
12
+ }
13
+
14
+ export const hostsOptionsFunc = (
15
+ localization: UI_I_Localization,
16
+ hosts: { host: string; id: string }[] | undefined
17
+ ): UI_I_SelectHostOptions[] => {
18
+ if (!hosts) return []
19
+
20
+ const data = constructHostListFunc(hosts)
21
+
22
+ return [{ text: localization.common.selectHost, value: '', disabled: true }, ...data]
23
+ }
@@ -0,0 +1,48 @@
1
+ import { UI_I_DataTableQuery } from '~/lib/models/table/interfaces'
2
+
3
+ export interface UI_I_LunDiskSpherePayload extends UI_I_DataTableQuery {
4
+ host: string
5
+ }
6
+
7
+ export interface UI_I_LunDisk {
8
+ name: string
9
+ capacity: string
10
+ }
11
+
12
+ export interface UI_I_SelectHostOptions {
13
+ text: string
14
+ value: string
15
+ disabled?: boolean
16
+ }
17
+
18
+ export interface UI_I_CreateStorageLunDiskItem {
19
+ name: string
20
+ identifier: string
21
+ lun: number
22
+ capacity_mb: string
23
+ hardware_acceleration: string
24
+ drive_type: string
25
+ sector_format: string
26
+ }
27
+
28
+ export interface API_UI_I_DatastoreLunDiskItem {
29
+ id: string
30
+ adapter: string
31
+ capacity_mb: string
32
+ datastore: {
33
+ name: string
34
+ type: string
35
+ }
36
+ drive_type: string
37
+ hardware_acceleration: string
38
+ identifier: string
39
+ lun: number
40
+ name: string
41
+ operational_state: string
42
+ owner: string
43
+ perennially_reserved: string
44
+ physical_location: string
45
+ sector_format: string
46
+ transport: string
47
+ type: string
48
+ }
@@ -0,0 +1,8 @@
1
+ export type UI_T_HostTableItemsKey =
2
+ | 'name'
3
+ | 'identifier'
4
+ | 'lun'
5
+ | 'capacity_mb'
6
+ | 'hardware_acceleration'
7
+ | 'drive_type'
8
+ | 'sector_format'
@@ -0,0 +1,134 @@
1
+ <template>
2
+ <div class="data-table-view">
3
+ <atoms-table-data-grid
4
+ v-model:selected-row="selectedLunDiskLocal"
5
+ v-model:column-keys="columnKeys"
6
+ v-model:page-size="pagination.pageSize"
7
+ v-model:page="pagination.page"
8
+ type="checkbox"
9
+ class="data-table"
10
+ test-id="device-selection-lun-disk-table"
11
+ :head-items="headItems"
12
+ :body-items="bodyItems"
13
+ :total-items="props.totalItems"
14
+ :total-pages="props.totalPages"
15
+ :loading="loading"
16
+ :is-main-filter="props.isMainFilter"
17
+ :main-filter-placeholder="localization.filter"
18
+ hide-page-size
19
+ @main-filter="onMainFiltering"
20
+ @sorting="sorting"
21
+ >
22
+ <template #icon="{ item }">
23
+ <span :class="['datagrid-cell-icon', item.data.iconClassName]" />
24
+ <span class="text-ellipsis">
25
+ {{ item.text }}
26
+ </span>
27
+ </template>
28
+ </atoms-table-data-grid>
29
+ </div>
30
+ </template>
31
+
32
+ <script lang="ts" setup>
33
+ import { useDebounceFn } from '@vueuse/core'
34
+ import {
35
+ UI_I_HeadItem,
36
+ UI_I_ColumnKey,
37
+ UI_I_BodyItem,
38
+ } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
39
+ import { UI_I_Localization } from '~/lib/models/interfaces'
40
+ import { UI_I_Pagination } from '~/lib/models/table/interfaces'
41
+ // import { optionsDefault as itemsPerPage } from '~/node_modules/nuxt-3-uikit/components/atoms/table/dataGrid/config'
42
+ import { UI_I_CreateStorageLunDiskItem } from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces'
43
+ import * as lunDiskTable from '~/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/hostsTable'
44
+
45
+ const props = defineProps<{
46
+ dataTable: UI_I_CreateStorageLunDiskItem[]
47
+ loading: boolean
48
+ totalItems: number
49
+ totalPages: number
50
+ pagination: UI_I_Pagination
51
+ isMainFilter?: boolean
52
+ }>()
53
+ const modelLunDisk = defineModel<UI_I_CreateStorageLunDiskItem[]>()
54
+ const emits = defineEmits<{
55
+ (event: 'pagination', value: UI_I_Pagination): void
56
+ (event: 'sort', value: string): void
57
+ (event: 'main-filter', value: string): void
58
+ }>()
59
+
60
+ const localization = computed<UI_I_Localization>(() => useLocal())
61
+
62
+ const sorting = (e: [number, boolean]): void => {
63
+ const [column, status] = e
64
+ const direction = status ? 'desc' : 'asc'
65
+
66
+ const sort = `${column}.${direction}`
67
+
68
+ emits('sort', sort)
69
+ }
70
+ const sendFilter = useDebounceFn((searchText: string) => {
71
+ emits('main-filter', searchText)
72
+ }, 1000)
73
+ const onMainFiltering = (data: string): void => {
74
+ sendFilter(data)
75
+ }
76
+
77
+ const pagination = ref<UI_I_Pagination>({
78
+ page: 1,
79
+ pageSize: 1,
80
+ })
81
+ watch(
82
+ () => props.pagination,
83
+ (newValue) => {
84
+ pagination.value = newValue
85
+ },
86
+ { immediate: true }
87
+ )
88
+ watch(
89
+ pagination,
90
+ (newValue) => {
91
+ emits('pagination', newValue)
92
+ },
93
+ { deep: true, immediate: true }
94
+ )
95
+
96
+ const columnKeys = ref<UI_I_ColumnKey[]>(
97
+ lunDiskTable.columnKeys(localization.value)
98
+ )
99
+ const headItems = computed<UI_I_HeadItem[]>(() =>
100
+ lunDiskTable.headItems(localization.value)
101
+ )
102
+ const bodyItems = computed<UI_I_BodyItem[][]>(() => {
103
+ let result: UI_I_BodyItem[][] = []
104
+ if (props.dataTable?.length) {
105
+ result = lunDiskTable.bodyItems(props.dataTable)
106
+ }
107
+
108
+ return result
109
+ })
110
+
111
+ const selectedLunDiskLocal = ref<number[]>()
112
+ watch(
113
+ selectedLunDiskLocal,
114
+ (newValue: number[]) => {
115
+ modelLunDisk.value = props.dataTable.filter((_: any, key: number) =>
116
+ newValue.includes(key)
117
+ )
118
+ },
119
+ { deep: true, immediate: true }
120
+ )
121
+ </script>
122
+
123
+ <style lang="scss" scoped>
124
+ .data-table-view {
125
+ height: inherit;
126
+ overflow: hidden;
127
+ .data-table {
128
+ height: inherit;
129
+ :deep(.datagrid-outer-wrapper) {
130
+ height: 400px;
131
+ }
132
+ }
133
+ }
134
+ </style>