bfg-common 1.3.440 → 1.3.442

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 (56) hide show
  1. package/components/common/vm/actions/editSettings/EditSettings.vue +30 -30
  2. package/components/common/wizards/datastoreNew/add/Add.vue +611 -0
  3. package/components/common/wizards/datastoreNew/add/lib/config/stepItems.ts +191 -0
  4. package/components/common/wizards/datastoreNew/add/lib/config/steps.ts +202 -0
  5. package/components/common/wizards/datastoreNew/add/lib/models/interfaces.ts +38 -0
  6. package/components/common/wizards/datastoreNew/add/lib/models/types.ts +14 -0
  7. package/components/common/wizards/datastoreNew/add/lib/utils.ts +72 -0
  8. package/components/common/wizards/datastoreNew/add/local/Local.vue +44 -0
  9. package/components/common/wizards/datastoreNew/add/local/createName/CreateName.vue +129 -0
  10. package/components/common/wizards/datastoreNew/add/local/createName/lib/config/defaultForm.ts +15 -0
  11. package/components/common/wizards/datastoreNew/add/nfs/Nfs.vue +99 -0
  12. package/components/common/wizards/datastoreNew/add/nfs/accessibility/Accessibility.vue +104 -0
  13. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/config/tabsPannel.ts +24 -0
  14. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/interfaces.ts +9 -0
  15. package/components/common/wizards/datastoreNew/add/nfs/accessibility/lib/models/types.ts +5 -0
  16. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/TablesView.vue +142 -0
  17. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/compatibleTable.ts +62 -0
  18. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/hostsTableItems.ts +53 -0
  19. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/incompatibleTable.ts +68 -0
  20. package/components/common/wizards/datastoreNew/add/nfs/accessibility/tablesView/lib/config/tableKeys.ts +15 -0
  21. package/components/common/wizards/datastoreNew/add/nfs/configuration/Configuration.vue +385 -0
  22. package/components/common/wizards/datastoreNew/add/nfs/configuration/lib/config/defaultForm.ts +33 -0
  23. package/components/common/wizards/datastoreNew/add/nfs/configuration/lib/models/interfaces.ts +12 -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 +124 -0
  26. package/components/common/wizards/datastoreNew/add/nfs/configuration/serversList/lib/config/serversListConfig.ts +41 -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 +11 -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/kerberosAuthentication/KerberosAuthentication.vue +55 -0
  31. package/components/common/wizards/datastoreNew/add/nfs/kerberosAuthentication/lib/config/radioOptions.ts +27 -0
  32. package/components/common/wizards/datastoreNew/add/nfs/version/Version.vue +42 -0
  33. package/components/common/wizards/datastoreNew/add/nfs/version/lib/config/versionOptions.ts +20 -0
  34. package/components/common/wizards/datastoreNew/add/readyComplete/ReadyComplete.vue +88 -0
  35. package/components/common/wizards/datastoreNew/add/readyComplete/lib/config/propertiesDetails.ts +175 -0
  36. package/components/common/wizards/datastoreNew/add/readyComplete/lib/models/interfaces.ts +4 -0
  37. package/components/common/wizards/datastoreNew/add/sharedStorm/SharedStorm.vue +90 -0
  38. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/DeviceSelection.vue +424 -0
  39. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/defaultForm.ts +18 -0
  40. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/config/selectOptions.ts +14 -0
  41. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/interfaces.ts +58 -0
  42. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/lib/models/types.ts +14 -0
  43. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/Table.vue +134 -0
  44. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/hostsTable.ts +87 -0
  45. package/components/common/wizards/datastoreNew/add/sharedStorm/deviceSelection/table/lib/config/tableKeys.ts +11 -0
  46. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +232 -0
  47. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/graphicTooltip/graphicTooltip.vue +64 -0
  48. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/lib/config/selectOptions.ts +46 -0
  49. package/components/common/wizards/datastoreNew/add/sharedStorm/partitionConfiguration/sizeGraphic/sizeGraphic.vue +225 -0
  50. package/components/common/wizards/datastoreNew/add/sharedStorm/version/Version.vue +39 -0
  51. package/components/common/wizards/datastoreNew/add/sharedStorm/version/lib/config/versionOptions.ts +21 -0
  52. package/components/common/wizards/datastoreNew/add/types/Types.vue +71 -0
  53. package/components/common/wizards/datastoreNew/add/types/lib/config/typeOptions.ts +49 -0
  54. package/lib/models/interfaces.ts +1 -0
  55. package/lib/utils/sendTask.ts +2 -1
  56. package/package.json +1 -1
@@ -0,0 +1,424 @@
1
+ <template>
2
+ <div class="device-selection">
3
+ {{ }}
4
+ <atoms-alert
5
+ v-show="props.alertMessages.length"
6
+ test-id="device-selection-errors"
7
+ status="alert-danger"
8
+ :items="props.alertMessages"
9
+ @remove="onHideAlert"
10
+ />
11
+
12
+ <div class="clr-form-control clr-row">
13
+ <label for="" class="clr-control-label clr-col-md-2">
14
+ {{ localization.name }}
15
+ </label>
16
+
17
+ <div
18
+ class="clr-control-container"
19
+ :class="formErrors.errors?.name?.length && 'clr-error'"
20
+ >
21
+ <div class="flex-align-center">
22
+ <input
23
+ id="device-selection-input"
24
+ v-model="model.name"
25
+ data-id="device-selection-input"
26
+ type="text"
27
+ class="clr-input"
28
+ @blur="initValidation"
29
+ @input="onInput"
30
+ />
31
+ <atoms-the-icon class="error-icon" name="info-circle" />
32
+ </div>
33
+
34
+ <div class="clr-subtext ng-star-inserted">
35
+ {{ formErrors?.errors?.name?.[0] || '' }}
36
+ </div>
37
+ </div>
38
+ </div>
39
+
40
+ <atoms-alert
41
+ v-show="alertInfo"
42
+ test-id="device-selection-info"
43
+ class="device-selection__alert-info"
44
+ status="alert-info"
45
+ :items="[localization.nameAndDeviceSelectionAlertInfo]"
46
+ @remove="onHideAlertInfo"
47
+ />
48
+
49
+ <div
50
+ v-if="props.project === 'sphere' && !props.hostId"
51
+ class="clr-form-control clr-row"
52
+ >
53
+ <label class="clr-control-label clr-col-12 clr-col-md-2">{{
54
+ localization.selectHost
55
+ }}</label>
56
+
57
+ <div>
58
+ <div class="clr-select-wrapper">
59
+ <select
60
+ id="device-host-select"
61
+ v-model="selectedHost"
62
+ data-id="device-host-select"
63
+ class="dropdown-toggle"
64
+ @change="onSelectHost"
65
+ >
66
+ <option
67
+ v-for="(item, index) in hostOptions"
68
+ :key="index"
69
+ :value="item.value"
70
+ :disabled="item.disabled"
71
+ >
72
+ {{ item.text }}
73
+ </option>
74
+ </select>
75
+ </div>
76
+ <div class="clr-subtext">
77
+ {{ localization.selectHostToViewAccessible }}
78
+ </div>
79
+ </div>
80
+ </div>
81
+
82
+ <div class="device-selection__disk-list">
83
+ <common-wizards-datastore-new-add-shared-storm-device-selection-table
84
+ v-model="model.lunDisk"
85
+ :data-table="dataTable?.items || []"
86
+ :total-items="dataTable?.total_items || 0"
87
+ :total-pages="dataTable?.total_pages || 1"
88
+ :pagination="pagination"
89
+ :loading="loading"
90
+ :is-main-filter="props.isMainFilter"
91
+ @pagination="updatePagination"
92
+ @sort="sortTable"
93
+ @main-filter="emits('main-filter', $event)"
94
+ />
95
+ </div>
96
+ </div>
97
+ </template>
98
+
99
+ <script lang="ts" setup>
100
+ import { UI_T_Project } from '~/lib/models/types'
101
+ import { UI_I_ValidationTouchResult } from '~/lib/models/plugins/validation/interfaces'
102
+ // import { UI_I_SchemaTablePayload } from '~/lib/models/store/interfaces'
103
+ import {
104
+ UI_I_Localization,
105
+ UI_I_ArbitraryObject,
106
+ } from '~/lib/models/interfaces'
107
+ import {
108
+ API_UI_I_DataTable,
109
+ UI_I_Pagination,
110
+ UI_I_DataTableQuery,
111
+ } from '~/lib/models/table/interfaces'
112
+ import {
113
+ UI_I_CreateStorageLunDiskItem,
114
+ UI_I_DeviceSelectionSendData,
115
+ UI_I_FormValidationDataStore,
116
+ UI_I_LunDiskSpherePayload,
117
+ UI_I_SelectHostOptions,
118
+ } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
119
+ import type { UI_I_ErrorFields } from '~/components/atoms/wizard/lib/models/interfaces'
120
+ // import { Ui_T_HostSelectedType } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/types'
121
+ import { UI_T_DatastoreType } from '~/components/common/wizards/datastoreNew/add/lib/models/types'
122
+ import { defaultFormFunc } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/defaultForm'
123
+ import { hostsOptionsFunc } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/config/selectOptions'
124
+ import { checkValidityName } from '~/components/common/wizards/datastoreNew/add/lib/utils'
125
+
126
+ const props = defineProps<{
127
+ project: UI_T_Project
128
+ stepId: number
129
+ alertMessages: string[]
130
+ messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
131
+ datastoreType: UI_T_DatastoreType
132
+ datacenterHosts?: UI_I_SelectHostOptions[] | undefined
133
+ isMainFilter?: boolean
134
+ hostId?: string
135
+ }>()
136
+ const model = defineModel<any>()
137
+ const emits = defineEmits<{
138
+ (event: 'loading', value: boolean): void
139
+ (event: 'hide-alert', value: number): void
140
+ (event: 'submit', value: UI_I_DeviceSelectionSendData): void
141
+ (event: 'main-filter', value: string): void
142
+ }>()
143
+
144
+ const localization = computed<UI_I_Localization>(() => useLocal())
145
+ const { $store } = useNuxtApp()
146
+ const { $validation } = useNuxtApp()
147
+
148
+ const isInitDatastoreNameValidation = ref<boolean>(false)
149
+ const initValidation = (): void => {
150
+ isInitDatastoreNameValidation.value = true
151
+ const valid = validation.touch()
152
+ if (!valid.isValid) {
153
+ showValidationErrors(valid)
154
+ }
155
+ }
156
+ const onInput = (): void => {
157
+ const valid = validation.touch()
158
+
159
+ if (!isInitDatastoreNameValidation.value) return
160
+
161
+ valid.isValid ? removeInputValidation() : showValidationErrors(valid)
162
+ }
163
+
164
+ const validation = $validation.call({})
165
+ const defaultForm: UI_I_FormValidationDataStore = defaultFormFunc(
166
+ localization.value
167
+ )
168
+ const form = ref<UI_I_FormValidationDataStore>(useDeepCopy(defaultForm))
169
+
170
+ const setForm = (): void => {
171
+ form.value = useDeepCopy(defaultForm)
172
+ validation.setForm(form)
173
+ }
174
+ setForm()
175
+
176
+ const alertInfo = ref<boolean>(true)
177
+ const onHideAlertInfo = (): void => {
178
+ alertInfo.value = false
179
+ }
180
+
181
+ const errors = ref<string[]>([])
182
+ const formErrors = ref<UI_I_ValidationTouchResult[]>([])
183
+
184
+ /* Lun disk table */
185
+
186
+ const pagination = ref<UI_I_Pagination>({
187
+ page: 1,
188
+ pageSize: 35,
189
+ })
190
+ const sort = ref<string | null>(null)
191
+
192
+ // const selectedLunDisk = ref<number[]>([])
193
+
194
+ const updatePagination = (event: UI_I_Pagination): void => {
195
+ pagination.value = event
196
+ }
197
+ const sortTable = (event: string): void => {
198
+ sort.value = event
199
+ initLunDisksDataTable()
200
+ }
201
+
202
+ const loading = computed<boolean>(() =>
203
+ $store.getters['storage/getLoading']('datastoreHosts')
204
+ )
205
+ const dataTable = computed<API_UI_I_DataTable<
206
+ UI_I_CreateStorageLunDiskItem[]
207
+ > | null>(() => {
208
+ // if (props.project === 'procurator')
209
+ return $store.getters['storage/getNewDatastoreHosts']
210
+
211
+ // if (props.datastoreType === 'local') return []
212
+ //
213
+ // if (props.datastoreType === 'shared-storm') return []
214
+ //
215
+ // if (props.datastoreType === 'nfs') return []
216
+ })
217
+
218
+ /* Select host */
219
+ // const hostData = ref<UI_I_SelectHostOptions[] | null>(null)
220
+ const selectedHost = ref<string>(props.hostId || '')
221
+ const hostOptions = computed<UI_I_SelectHostOptions[]>(() =>
222
+ hostsOptionsFunc(localization.value, props.datacenterHosts)
223
+ ) // <!-- TODO Нам сейчас он не нужен. Мы монтируем nfs только на один хост ( procurator )-->
224
+
225
+ const onSelectHost = (): void => {
226
+ if (props.datastoreType !== 'shared-storm') return
227
+
228
+ initLunDisksForSphere(selectedHost.value)
229
+ }
230
+
231
+ const showValidationErrors = (
232
+ data: UI_I_ValidationTouchResult[],
233
+ errorText = '',
234
+ alert = false
235
+ ): void => {
236
+ if (alert) errors.value = [errorText]
237
+ formErrors.value = data
238
+ }
239
+
240
+ const resetValidation = (): void => {
241
+ errors.value = []
242
+ formErrors.value = []
243
+ }
244
+ const removeInputValidation = (): void => {
245
+ formErrors.value = []
246
+ }
247
+ const validatePropertiesForSphere = (): boolean => {
248
+ if (props.datastoreType === 'local') {
249
+ return !selectedHost.value
250
+ }
251
+
252
+ if (props.datastoreType === 'shared-storm') {
253
+ return !selectedHost.value || !model.value.lunDisk.length
254
+ }
255
+
256
+ return false
257
+ }
258
+ const validationTextForSphere = (): string => {
259
+ if (props.datastoreType === 'local') {
260
+ return 'selectHostToContinueAlert'
261
+ }
262
+
263
+ if (props.datastoreType === 'shared-storm') {
264
+ return !selectedHost.value
265
+ ? 'selectHostToContinueAlert'
266
+ : 'selectDiskToContinueAlert'
267
+ }
268
+
269
+ return ''
270
+ }
271
+
272
+ const collectDataForReview = (
273
+ name: string,
274
+ mode: UI_T_Project
275
+ ): UI_I_DeviceSelectionSendData => {
276
+ const data: UI_I_DeviceSelectionSendData = {
277
+ name,
278
+ }
279
+
280
+ // if (mode === 'procurator') {
281
+ // data.lunDisk = props.lunDisk.map((lun) => {
282
+ // return { name: lun.name, capacity: lun.capacity_mb }
283
+ // })
284
+ // }
285
+
286
+ if (mode === 'sphere') {
287
+ if (props.datastoreType === 'local') {
288
+ data.host = selectedHost.value
289
+ }
290
+
291
+ if (props.datastoreType === 'shared-storm') {
292
+ data.host = selectedHost.value
293
+ data.lunDisk = model.value.lunDisk.map((lun) => {
294
+ return { name: lun.name, capacity: lun.capacity_mb }
295
+ })
296
+ }
297
+ }
298
+
299
+ return data
300
+ }
301
+
302
+ const submit = async (): Promise<void> => {
303
+ const name = form.value.name.value
304
+ const { project } = props
305
+
306
+ const valid = validation.touch()
307
+ const isShowAlertDanger =
308
+ project === 'procurator'
309
+ ? !model.value.lunDisk.length
310
+ : validatePropertiesForSphere()
311
+
312
+ if (!valid.isValid || isShowAlertDanger) {
313
+ const isModeSphere = project === 'sphere' && props.datastoreType === 'local'
314
+
315
+ const errorText =
316
+ localization.value[
317
+ isModeSphere ? 'selectHostToContinueAlert' : validationTextForSphere()
318
+ ]
319
+
320
+ showValidationErrors(valid, errorText, isShowAlertDanger)
321
+ return
322
+ }
323
+
324
+ if (!isShowAlertDanger) {
325
+ emits('loading', true)
326
+
327
+ const { valid: validName, msg } = await checkValidityName(
328
+ name,
329
+ props.project
330
+ )
331
+
332
+ emits('loading', false)
333
+
334
+ if (!validName) {
335
+ showValidationErrors(valid, msg, true)
336
+ return
337
+ }
338
+ }
339
+
340
+ resetValidation()
341
+
342
+ const eventData = collectDataForReview(name, project)
343
+ emits('submit', eventData)
344
+ }
345
+ submit()
346
+
347
+ // const initHostData = async (): Promise<void> => {
348
+ // hostData.value = await $store.dispatch('storage/A_GET_DATACENTER_HOSTS', {
349
+ // schema: 'short',
350
+ // } as UI_I_SchemaTablePayload)
351
+ // }
352
+ const initLunDisksForSphere = async (host: string): Promise<void> => {
353
+ await $store.dispatch('storage/A_GET_DISKS_LIST', {
354
+ host,
355
+ ...pagination.value,
356
+ sortBy: sort.value,
357
+ } as UI_I_LunDiskSpherePayload)
358
+ }
359
+ if (props.hostId) {
360
+ initLunDisksForSphere(props.hostId)
361
+ }
362
+ const initLunDisksDataTable = async (): Promise<void> => {
363
+ await $store.dispatch('storage/A_GET_LUN_DISK_LIST', {
364
+ ...pagination.value,
365
+ sortBy: sort.value,
366
+ } as UI_I_DataTableQuery)
367
+ }
368
+
369
+ if (props.project === 'procurator') {
370
+ // && props.stepId === 2
371
+ initLunDisksDataTable()
372
+ }
373
+
374
+ const onHideAlert = (): void => {
375
+ emits('hide-alert', props.stepId)
376
+ }
377
+ </script>
378
+
379
+ <style lang="scss" scoped>
380
+ .device-selection {
381
+ display: flex;
382
+ flex-direction: column;
383
+ height: inherit;
384
+ overflow-y: auto;
385
+ overflow-x: hidden;
386
+ &__alert-info {
387
+ :deep(.alert-text) {
388
+ font-size: 11px;
389
+ letter-spacing: normal;
390
+ }
391
+ }
392
+ .dropdown-toggle {
393
+ min-width: 160px;
394
+ }
395
+ .clr-form-control {
396
+ display: flex;
397
+ flex-direction: row;
398
+
399
+ .clr-control-container {
400
+ min-height: 48px;
401
+ &.clr-error {
402
+ .clr-subtext,
403
+ .error-icon {
404
+ display: block;
405
+ }
406
+ }
407
+ .clr-subtext,
408
+ .error-icon {
409
+ display: none;
410
+ }
411
+ .error-icon {
412
+ fill: #db2100;
413
+ width: 24px;
414
+ height: 24px;
415
+ }
416
+ }
417
+ }
418
+ &__disk-list {
419
+ display: flex;
420
+ flex-direction: column;
421
+ height: 100%;
422
+ }
423
+ }
424
+ </style>
@@ -0,0 +1,18 @@
1
+ import { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import { UI_I_FormValidationDataStore } from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
3
+
4
+ export const defaultFormFunc = (
5
+ localization: UI_I_Localization
6
+ ): UI_I_FormValidationDataStore => {
7
+ return {
8
+ name: {
9
+ value: 'Datastore',
10
+ validations: [
11
+ {
12
+ value: 'required',
13
+ errorText: localization.specifyDatastoreName,
14
+ },
15
+ ],
16
+ },
17
+ }
18
+ }
@@ -0,0 +1,14 @@
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
+ export const hostsOptionsFunc = (
5
+ localization: UI_I_Localization,
6
+ data: UI_I_SelectHostOptions[] | undefined
7
+ ): UI_I_SelectHostOptions[] => {
8
+ if(!data) return []
9
+
10
+ return [
11
+ { text: localization.selectHost, value: '', disabled: true },
12
+ ...data,
13
+ ]
14
+ }
@@ -0,0 +1,58 @@
1
+ import { UI_I_Validation } from '~/lib/models/plugins/validation/interfaces'
2
+ import { UI_I_DataTableQuery } from '~/lib/models/table/interfaces'
3
+
4
+ export interface UI_I_FormValidationDataStore {
5
+ name: UI_I_Validation
6
+ }
7
+
8
+ export interface UI_I_LunDiskSpherePayload extends UI_I_DataTableQuery {
9
+ host: string
10
+ }
11
+
12
+ export interface UI_I_LunDisk {
13
+ name: string
14
+ capacity: string
15
+ }
16
+ export interface UI_I_DeviceSelectionSendData {
17
+ name: string
18
+ lunDisk?: UI_I_LunDisk[]
19
+ host?: string
20
+ }
21
+
22
+ export interface UI_I_SelectHostOptions {
23
+ text: string
24
+ value: string
25
+ disabled?: boolean
26
+ }
27
+
28
+ export interface UI_I_CreateStorageLunDiskItem {
29
+ name: string
30
+ identifier: string
31
+ lun: number
32
+ capacity_mb: string
33
+ hardware_acceleration: string
34
+ drive_type: string
35
+ sector_format: string
36
+ }
37
+
38
+ export interface API_UI_I_DatastoreLunDiskItem {
39
+ id: string
40
+ adapter: string
41
+ capacity_mb: string
42
+ datastore: {
43
+ name: string
44
+ type: string
45
+ }
46
+ drive_type: string
47
+ hardware_acceleration: string
48
+ identifier: string
49
+ lun: number
50
+ name: string
51
+ operational_state: string
52
+ owner: string
53
+ perennially_reserved: string
54
+ physical_location: string
55
+ sector_format: string
56
+ transport: string
57
+ type: string
58
+ }
@@ -0,0 +1,14 @@
1
+ export type UI_T_HostTableItemsKey =
2
+ | 'name'
3
+ | 'identifier'
4
+ | 'lun'
5
+ | 'capacity_mb'
6
+ | 'hardware_acceleration'
7
+ | 'drive_type'
8
+ | 'sector_format'
9
+
10
+ // export type Ui_T_HostSelectedType = 'host-1' | 'host-2' | 'host-3' | 'host-4' | 'host-5'
11
+
12
+
13
+
14
+
@@ -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="host-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/datastore/add/sharedStorm/deviceSelection/lib/models/interfaces'
43
+ import * as lunDiskTable from '~/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/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: inherit;
131
+ }
132
+ }
133
+ }
134
+ </style>