bfg-common 1.5.514 → 1.5.516

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/assets/localization/local_be.json +5 -3
  2. package/assets/localization/local_en.json +6 -4
  3. package/assets/localization/local_hy.json +5 -3
  4. package/assets/localization/local_kk.json +5 -3
  5. package/assets/localization/local_ru.json +5 -3
  6. package/assets/localization/local_zh.json +5 -3
  7. package/components/atoms/sortableView/SortableView.vue +2 -2
  8. package/components/common/browse/blocks/lib/models/types.ts +1 -1
  9. package/components/common/browse/lib/models/interfaces.ts +5 -5
  10. package/components/common/diagramMain/modals/lib/config/portModal.ts +251 -251
  11. package/components/common/diagramMain/modals/lib/config/vCenterModal.ts +48 -48
  12. package/components/common/diagramMain/network/Contents.vue +497 -497
  13. package/components/common/diagramMain/port/Port.vue +580 -580
  14. package/components/common/pages/backups/modals/createBackup/CreateBackup.vue +196 -379
  15. package/components/common/pages/backups/modals/createBackup/New.vue +267 -0
  16. package/components/common/pages/backups/modals/createBackup/Old.vue +142 -0
  17. package/components/common/pages/backups/modals/createBackup/configuration/Configuration.vue +29 -29
  18. package/components/common/pages/backups/modals/createBackup/configuration/ConfigurationNew.vue +218 -0
  19. package/components/common/pages/backups/modals/createBackup/configuration/ConfigurationOld.vue +29 -0
  20. package/components/common/pages/backups/modals/createBackup/configuration/backupWindow/BackupWindow.vue +29 -29
  21. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/MaxBandwidth.vue +69 -69
  22. package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -6
  23. package/components/common/pages/backups/modals/createBackup/configuration/strategy/Strategy.vue +38 -38
  24. package/components/common/pages/backups/modals/createBackup/datastores/Datastores.vue +34 -59
  25. package/components/common/pages/backups/modals/createBackup/datastores/DatastoresNew.vue +23 -0
  26. package/components/common/pages/backups/modals/createBackup/datastores/DatastoresOld.vue +33 -0
  27. package/components/common/pages/backups/modals/createBackup/datastores/tableView/new/TableView.vue +134 -0
  28. package/components/common/pages/backups/modals/createBackup/datastores/tableView/new/lib/config/table.ts +219 -0
  29. package/components/common/pages/backups/modals/createBackup/datastores/tableView/new/lib/models/enums.ts +15 -0
  30. package/components/common/pages/backups/modals/createBackup/datastores/tableView/new/lib/models/interfaces.ts +5 -0
  31. package/components/common/pages/backups/modals/createBackup/datastores/tableView/{TableView.vue → old/TableView.vue} +95 -95
  32. package/components/common/pages/backups/modals/createBackup/datastores/tableView/{lib → old/lib}/config/keys.ts +14 -14
  33. package/components/common/pages/backups/modals/createBackup/datastores/tableView/{lib → old/lib}/config/table.ts +127 -127
  34. package/components/common/pages/backups/modals/createBackup/datastores/tableView/{lib → old/lib}/models/types.ts +10 -10
  35. package/components/common/pages/backups/modals/createBackup/disks/Disks.vue +34 -28
  36. package/components/common/pages/backups/modals/createBackup/disks/DisksNew.vue +22 -0
  37. package/components/common/pages/backups/modals/createBackup/disks/DisksOld.vue +28 -0
  38. package/components/common/pages/backups/modals/createBackup/disks/tableView/new/TableView.vue +131 -0
  39. package/components/common/pages/backups/modals/createBackup/disks/tableView/new/lib/config/table.ts +178 -0
  40. package/components/common/pages/backups/modals/createBackup/disks/tableView/{TableView.vue → old/TableView.vue} +119 -108
  41. package/components/common/pages/backups/modals/createBackup/disks/tableView/{lib → old/lib}/config/keys.ts +12 -12
  42. package/components/common/pages/backups/modals/createBackup/disks/tableView/{lib → old/lib}/config/table.ts +125 -125
  43. package/components/common/pages/backups/modals/createBackup/disks/tableView/{lib → old/lib}/models/types.ts +10 -10
  44. package/components/common/pages/backups/modals/createBackup/general/General.vue +33 -141
  45. package/components/common/pages/backups/modals/createBackup/general/GeneralNew.vue +128 -0
  46. package/components/common/pages/backups/modals/createBackup/general/GeneralOld.vue +66 -0
  47. package/components/common/pages/backups/modals/createBackup/lib/config/readyToCompleteOptions.ts +59 -0
  48. package/components/common/pages/backups/modals/createBackup/lib/config/steps.ts +123 -117
  49. package/components/common/pages/backups/modals/createBackup/lib/config/strategyOptions.ts +13 -12
  50. package/components/common/pages/backups/modals/createBackup/lib/models/interfaces.ts +8 -8
  51. package/components/common/pages/backups/modals/createBackup/lib/validation/validations.ts +145 -0
  52. package/package.json +1 -1
@@ -0,0 +1,178 @@
1
+ import type {
2
+ UI_I_DataTableBody,
3
+ UI_I_DataTableOptions,
4
+ UI_I_DataTableHeader
5
+ } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
6
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
7
+ import type { UI_I_Pvm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
8
+ import type {
9
+ UI_I_CreateBackupFormDiskDevice
10
+ } from '~/components/common/pages/backups/modals/lib/models/interfaces'
11
+
12
+
13
+ export const getHeaderDataFunc = (
14
+ localization: UI_I_Localization
15
+ ): UI_I_DataTableHeader[] => [
16
+ {
17
+ col: 'col0',
18
+ colName: 'source',
19
+ text: localization.common.source,
20
+ isSortable: true,
21
+ sort: 'asc',
22
+ width: '368px',
23
+ show: true,
24
+ filter: true
25
+ },
26
+ {
27
+ col: 'col1',
28
+ colName: 'deviceType',
29
+ text: localization.common.deviceType,
30
+ isSortable: true,
31
+ sort: 'asc',
32
+ width: '136px',
33
+ show: true,
34
+ filter: true
35
+ },
36
+ {
37
+ col: 'col2',
38
+ colName: 'bus',
39
+ text: localization.common.bus,
40
+ isSortable: true,
41
+ sort: 'asc',
42
+ width: '112px',
43
+ show: true,
44
+ filter: true
45
+ },
46
+ {
47
+ col: 'col3',
48
+ colName: 'target',
49
+ text: localization.common.target,
50
+ isSortable: true,
51
+ sort: 'asc',
52
+ width: '112px',
53
+ show: true,
54
+ filter: true
55
+ },
56
+ {
57
+ col: 'col4',
58
+ colName: 'capacity',
59
+ text: localization.common.capacity,
60
+ isSortable: true,
61
+ sort: 'asc',
62
+ width: '112px',
63
+ show: true,
64
+ filter: true
65
+ },
66
+ {
67
+ col: 'col5',
68
+ colName: 'used',
69
+ text: localization.common.used,
70
+ isSortable: true,
71
+ sort: 'asc',
72
+ width: '112px',
73
+ show: true,
74
+ filter: true
75
+ },
76
+ {
77
+ col: 'col6',
78
+ colName: 'free',
79
+ text: localization.common.free,
80
+ isSortable: true,
81
+ sort: 'asc',
82
+ width: '112px',
83
+ show: true,
84
+ filter: true
85
+ },
86
+ {
87
+ col: 'col7',
88
+ colName: 'volumePath',
89
+ text: localization.common.volumePath,
90
+ isSortable: true,
91
+ sort: 'asc',
92
+ width: '240px',
93
+ show: true,
94
+ filter: true
95
+ }
96
+ ]
97
+
98
+
99
+ export const options: UI_I_DataTableOptions = {
100
+ perPageOptions: [{ text: '10', value: 100, default: true }],
101
+ isSelectable: true,
102
+ isFocusable: false,
103
+ showPagination: false,
104
+ showPaginationOnTop: false,
105
+ selectType: 'checkbox',
106
+ showPageInfo: false,
107
+ isSortable: true,
108
+ server: false,
109
+ isResizable: true,
110
+ showSearch: false,
111
+ showSelectedRows: false,
112
+ showColumnManager: true,
113
+ withActions: false,
114
+ inBlock: false,
115
+ inModal: true,
116
+ showExport: false,
117
+ withCollapse: false
118
+ }
119
+
120
+ export const getBodyDataFunc = (
121
+ bodyData: UI_I_Pvm['disk_devices'],
122
+ selectedDisks: UI_I_CreateBackupFormDiskDevice[]
123
+ ): UI_I_DataTableBody[] => {
124
+ const { $binary } = useNuxtApp()
125
+ const lang = useLocalStorage('lang') === 'ru_RU' ? 'ru' : 'en'
126
+
127
+ return bodyData.map((disk, index: number) => {
128
+ return {
129
+ row: index,
130
+ collapse: false,
131
+ isHiddenCollapse: false,
132
+ collapseToggle: false,
133
+ isSelected: !!selectedDisks.find(item => item.location === disk.source),
134
+ data: [
135
+ {
136
+ key: 'icon',
137
+ col: 'col0',
138
+ text: disk.source,
139
+ data: {
140
+ iconClassName: 'icon-vSphere-dsVmDisk',
141
+ data: {
142
+ location: disk.source,
143
+ target: disk.target
144
+ }
145
+ }
146
+ },
147
+ {
148
+ col: 'col1',
149
+ text: disk.device_type
150
+ },
151
+ {
152
+ col: 'col2',
153
+ text: disk.bus
154
+ },
155
+ {
156
+ col: 'col3',
157
+ text: disk.target
158
+ },
159
+ {
160
+ col: 'col4',
161
+ text: $binary.round(disk.capacity_mb, false, lang)
162
+ },
163
+ {
164
+ col: 'col5',
165
+ text: $binary.round(disk.used_mb, false, lang)
166
+ },
167
+ {
168
+ col: 'col7',
169
+ text: $binary.round(disk.free_mb, false, lang)
170
+ },
171
+ {
172
+ col: 'col6',
173
+ text: disk.volume_path || '--'
174
+ }
175
+ ]
176
+ }
177
+ })
178
+ }
@@ -1,108 +1,119 @@
1
- <template>
2
- <div class="data-table-view overflow-hidden">
3
- <div class="data-table-view__inner">
4
- <atoms-table-data-grid
5
- v-model:selected-row="selectedRowsLocal"
6
- v-model:column-keys="columnKeys"
7
- class="data-table"
8
- type="checkbox"
9
- test-id="disks-table"
10
- :head-items="headItems"
11
- :body-items="bodyItems"
12
- :total-items="props.totalItems"
13
- :total-pages="props.totalPages"
14
- :items-per-page="itemsPerPage"
15
- :loading="loading"
16
- hide-pagination
17
- server-off
18
- />
19
- </div>
20
- </div>
21
- </template>
22
-
23
- <script lang="ts" setup>
24
- import type {
25
- UI_I_HeadItem,
26
- UI_I_ColumnKey,
27
- UI_I_BodyItem,
28
- } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
29
- import type { UI_I_Localization } from '~/lib/models/interfaces'
30
- import type {
31
- UI_I_CreateBackupFormDiskDevice,
32
- UI_I_Pvm
33
- } from "~/components/common/pages/backups/modals/lib/models/interfaces";
34
- import { itemsPerPage } from '~/components/atoms/table/dataGrid/lib/config/itemsPerPage'
35
- import * as table from '~/components/common/pages/backups/modals/createBackup/disks/tableView/lib/config/table'
36
-
37
- const props = defineProps<{
38
- dataTable: UI_I_Pvm['disk_devices']
39
- loading: boolean
40
- totalItems: number
41
- totalPages: number
42
- }>()
43
- const localization = computed<UI_I_Localization>(() => useLocal())
44
-
45
- const selectedRows = defineModel<UI_I_CreateBackupFormDiskDevice[]>('selected', { required: true })
46
-
47
- const selectedRowsLocal = ref<string[]>(
48
- selectedRows.value?.map((item) => item.location) || []
49
- )
50
- watch(
51
- selectedRowsLocal,
52
- (newValue) => {
53
- const selected: UI_I_CreateBackupFormDiskDevice[] = []
54
- bodyItems.value.forEach((row) => {
55
- if (newValue.includes(row[0].id + '')) {
56
- selected.push(row[0].data)
57
- }
58
- })
59
- selectedRows.value = selected
60
- },
61
- { deep: true }
62
- )
63
-
64
- const columnKeys = ref<UI_I_ColumnKey[]>(table.columnKeys(localization.value))
65
-
66
- const headItems = computed<UI_I_HeadItem[]>(() =>
67
- table.headItems(localization.value)
68
- )
69
-
70
- const bodyItems = computed<UI_I_BodyItem[][]>(() => {
71
- let result: UI_I_BodyItem[][] = []
72
- if (props.dataTable.length) {
73
- result = table.bodyItems(props.dataTable)
74
- }
75
-
76
- return result
77
- })
78
- watch(
79
- bodyItems,
80
- () => {
81
- setTimeout(() => {
82
- selectedRows.value = []
83
- }, 0)
84
- },
85
- { deep: true, immediate: true }
86
- )
87
- </script>
88
-
89
- <style lang="scss" scoped>
90
- .data-table-view {
91
- height: inherit;
92
- margin-bottom: 10px;
93
- margin-right: 10px;
94
-
95
- &__inner {
96
- height: inherit;
97
- }
98
- :deep(.data-table) {
99
- height: inherit;
100
- .datagrid-outer-wrapper {
101
- height: inherit;
102
- }
103
- }
104
- }
105
- .vm-icon {
106
- margin-right: 5px;
107
- }
108
- </style>
1
+ <template>
2
+ <div class="data-table-view overflow-hidden">
3
+ <div class="data-table-view__inner">
4
+ <atoms-table-data-grid
5
+ v-model:selected-row="selectedRowsLocal"
6
+ v-model:column-keys="columnKeys"
7
+ v-model:page-size="pagination.pageSize"
8
+ v-model:page="pagination.page"
9
+ class="data-table"
10
+ type="checkbox"
11
+ test-id="disks-table"
12
+ :head-items="headItems"
13
+ :body-items="bodyItems"
14
+ :total-items="props.totalItems"
15
+ :total-pages="props.totalPages"
16
+ :items-per-page="itemsPerPage"
17
+ :loading="loading"
18
+ hide-pagination
19
+ server-off
20
+ />
21
+ </div>
22
+ </div>
23
+ </template>
24
+
25
+ <script lang="ts" setup>
26
+ import type {
27
+ UI_I_HeadItem,
28
+ UI_I_ColumnKey,
29
+ UI_I_BodyItem,
30
+ } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
31
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
32
+ import type {
33
+ UI_I_CreateBackupFormDiskDevice,
34
+ UI_I_Pvm
35
+ } from "~/components/common/pages/backups/modals/lib/models/interfaces";
36
+ import { itemsPerPage } from '~/components/atoms/table/dataGrid/lib/config/itemsPerPage'
37
+ import * as table from '~/components/common/pages/backups/modals/createBackup/disks/tableView/old/lib/config/table'
38
+ import type {UI_I_Pagination} from "~/lib/models/table/interfaces";
39
+
40
+ const props = defineProps<{
41
+ dataTable: UI_I_Pvm['disk_devices']
42
+ loading: boolean
43
+ totalItems: number
44
+ totalPages: number
45
+ }>()
46
+ const localization = computed<UI_I_Localization>(() => useLocal())
47
+
48
+ const selectedRows = defineModel<UI_I_CreateBackupFormDiskDevice[]>('selected', { required: true })
49
+
50
+ const pagination = ref<UI_I_Pagination>({
51
+ page: 1,
52
+ pageSize: 100,
53
+ })
54
+
55
+ const selectedRowsLocal = ref<string[]>(
56
+ selectedRows.value?.map((item) => item.location) || []
57
+ )
58
+ watch(
59
+ selectedRowsLocal,
60
+ (newValue) => {
61
+ const selected: UI_I_CreateBackupFormDiskDevice[] = []
62
+ bodyItems.value.forEach((row) => {
63
+ if (newValue.includes(row[0].id + '')) {
64
+ selected.push(row[0].data)
65
+ }
66
+ })
67
+ selectedRows.value = selected
68
+ },
69
+ { deep: true }
70
+ )
71
+
72
+ const columnKeys = ref<UI_I_ColumnKey[]>(table.columnKeys(localization.value))
73
+
74
+ const headItems = computed<UI_I_HeadItem[]>(() =>
75
+ table.headItems(localization.value)
76
+ )
77
+
78
+ const bodyItems = computed<UI_I_BodyItem[][]>(() => {
79
+ let result: UI_I_BodyItem[][] = []
80
+ if (props.dataTable.length) {
81
+ result = table.bodyItems(props.dataTable)
82
+ }
83
+
84
+ return result
85
+ })
86
+
87
+ // ToDo проверить почему опусташает selectedRows
88
+
89
+ // watch(
90
+ // bodyItems,
91
+ // () => {
92
+ // setTimeout(() => {
93
+ // selectedRows.value = []
94
+ // }, 0)
95
+ // },
96
+ // { deep: true, immediate: true }
97
+ // )
98
+ </script>
99
+
100
+ <style lang="scss" scoped>
101
+ .data-table-view {
102
+ height: inherit;
103
+ margin-bottom: 10px;
104
+ margin-right: 10px;
105
+
106
+ &__inner {
107
+ height: inherit;
108
+ }
109
+ :deep(.data-table) {
110
+ height: inherit;
111
+ .datagrid-outer-wrapper {
112
+ height: inherit;
113
+ }
114
+ }
115
+ }
116
+ .vm-icon {
117
+ margin-right: 5px;
118
+ }
119
+ </style>
@@ -1,12 +1,12 @@
1
- import type { UI_T_DiskTableKeysTuple } from '~/components/common/pages/backups/modals/createBackup/disks/tableView/lib/models/types'
2
-
3
- export const tableKeys: UI_T_DiskTableKeysTuple = [
4
- 'source',
5
- 'device_type',
6
- 'bus',
7
- 'target',
8
- 'capacity_mb',
9
- 'used_mb',
10
- 'free_mb',
11
- 'volume_path',
12
- ]
1
+ import type { UI_T_DiskTableKeysTuple } from '~/components/common/pages/backups/modals/createBackup/disks/tableView/old/lib/models/types'
2
+
3
+ export const tableKeys: UI_T_DiskTableKeysTuple = [
4
+ 'source',
5
+ 'device_type',
6
+ 'bus',
7
+ 'target',
8
+ 'capacity_mb',
9
+ 'used_mb',
10
+ 'free_mb',
11
+ 'volume_path',
12
+ ]
@@ -1,125 +1,125 @@
1
- import type { UI_I_Localization } from '~/lib/models/interfaces'
2
- import type {
3
- UI_I_HeadItem,
4
- UI_I_ColumnKey,
5
- UI_I_BodyItem,
6
- } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
7
- import type { UI_I_Pvm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
8
- import {
9
- constructHeadItem,
10
- constructColumnKey,
11
- } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
12
- import { tableKeys } from '~/components/common/pages/backups/modals/createBackup/disks/tableView/lib/config/keys'
13
-
14
- const getItems = (
15
- localization: UI_I_Localization
16
- ): [string, boolean, string, string][] => {
17
- return [
18
- [localization.common.source, true, '180px', tableKeys[0]],
19
- [localization.common.deviceType, true, '180px', tableKeys[1]],
20
- [localization.common.bus, true, '180px', tableKeys[2]],
21
- [localization.common.target, true, '180px', tableKeys[3]],
22
- [localization.common.capacity, true, '180px', tableKeys[4]],
23
- [localization.common.used, true, '180px', tableKeys[5]],
24
- [localization.common.free, true, '180px', tableKeys[6]],
25
- [localization.common.volumePath, true, '180px', tableKeys[7]],
26
- ]
27
- }
28
- export const columnKeys = (
29
- localization: UI_I_Localization
30
- ): UI_I_ColumnKey[] => {
31
- const result: UI_I_ColumnKey[] = []
32
- getItems(localization).forEach((item, i) => {
33
- result.push(
34
- constructColumnKey(`col${i}`, item[0], item[1], `show-column-${item[3]}`)
35
- )
36
- })
37
- return result
38
- }
39
- export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
40
- const result: UI_I_HeadItem[] = []
41
- getItems(localization).forEach((item, i) => {
42
- result.push(
43
- constructHeadItem(
44
- `col${i}`,
45
- item[0],
46
- item[3],
47
- true,
48
- item[2],
49
- undefined,
50
- item[3]
51
- )
52
- )
53
- })
54
- return result
55
- }
56
-
57
- export const bodyItems = (
58
- data: UI_I_Pvm['disk_devices']
59
- ): UI_I_BodyItem[][] => {
60
- const { $binary }: any = useNuxtApp()
61
- const lang = useLocalStorage('lang') === 'ru_RU' ? 'ru' : 'en'
62
-
63
- const bodyItems: UI_I_BodyItem[][] = []
64
- data.forEach((disk: UI_I_Pvm['disk_devices'][0], key) => {
65
- bodyItems.push([
66
- {
67
- key: 'col0',
68
- text: disk[tableKeys[0]],
69
- id: disk.source,
70
- data: {
71
- location: disk.source,
72
- target: disk.target,
73
- },
74
- testId: `disk-table-item-${key}`,
75
- },
76
- {
77
- key: 'col1',
78
- text: disk[tableKeys[1]],
79
- id: disk.source,
80
- testId: `disk-table-item-${key}`,
81
- },
82
- {
83
- key: 'col2',
84
- text: disk[tableKeys[2]],
85
- id: disk.source,
86
- testId: `disk-table-item-${key}`,
87
- },
88
- {
89
- key: 'col3',
90
- text: disk[tableKeys[3]],
91
- id: disk.source,
92
- testId: `disk-table-item-${key}`,
93
- },
94
- {
95
- key: 'col4',
96
- text: $binary.round(disk[tableKeys[4]], false, lang),
97
- id: disk.source,
98
- testId: `disk-table-item-${key}`,
99
- },
100
- {
101
- key: 'col5',
102
- text: $binary.round(
103
- disk[tableKeys[4]] - disk[tableKeys[6]],
104
- false,
105
- lang
106
- ),
107
- id: disk.source,
108
- testId: `disk-table-item-${key}`,
109
- },
110
- {
111
- key: 'col6',
112
- text: $binary.round(disk[tableKeys[6]], false, lang),
113
- id: disk.source,
114
- testId: `disk-table-item-${key}`,
115
- },
116
- {
117
- key: 'col7',
118
- text: disk[tableKeys[7]],
119
- id: disk.source,
120
- testId: `disk-table-item-${key}`,
121
- },
122
- ])
123
- })
124
- return bodyItems
125
- }
1
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
2
+ import type {
3
+ UI_I_HeadItem,
4
+ UI_I_ColumnKey,
5
+ UI_I_BodyItem,
6
+ } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
7
+ import type { UI_I_Pvm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
8
+ import {
9
+ constructHeadItem,
10
+ constructColumnKey,
11
+ } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
12
+ import { tableKeys } from '~/components/common/pages/backups/modals/createBackup/disks/tableView/old/lib/config/keys'
13
+
14
+ const getItems = (
15
+ localization: UI_I_Localization
16
+ ): [string, boolean, string, string][] => {
17
+ return [
18
+ [localization.common.source, true, '180px', tableKeys[0]],
19
+ [localization.common.deviceType, true, '180px', tableKeys[1]],
20
+ [localization.common.bus, true, '180px', tableKeys[2]],
21
+ [localization.common.target, true, '180px', tableKeys[3]],
22
+ [localization.common.capacity, true, '180px', tableKeys[4]],
23
+ [localization.common.used, true, '180px', tableKeys[5]],
24
+ [localization.common.free, true, '180px', tableKeys[6]],
25
+ [localization.common.volumePath, true, '180px', tableKeys[7]],
26
+ ]
27
+ }
28
+ export const columnKeys = (
29
+ localization: UI_I_Localization
30
+ ): UI_I_ColumnKey[] => {
31
+ const result: UI_I_ColumnKey[] = []
32
+ getItems(localization).forEach((item, i) => {
33
+ result.push(
34
+ constructColumnKey(`col${i}`, item[0], item[1], `show-column-${item[3]}`)
35
+ )
36
+ })
37
+ return result
38
+ }
39
+ export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
40
+ const result: UI_I_HeadItem[] = []
41
+ getItems(localization).forEach((item, i) => {
42
+ result.push(
43
+ constructHeadItem(
44
+ `col${i}`,
45
+ item[0],
46
+ item[3],
47
+ true,
48
+ item[2],
49
+ undefined,
50
+ item[3]
51
+ )
52
+ )
53
+ })
54
+ return result
55
+ }
56
+
57
+ export const bodyItems = (
58
+ data: UI_I_Pvm['disk_devices']
59
+ ): UI_I_BodyItem[][] => {
60
+ const { $binary }: any = useNuxtApp()
61
+ const lang = useLocalStorage('lang') === 'ru_RU' ? 'ru' : 'en'
62
+
63
+ const bodyItems: UI_I_BodyItem[][] = []
64
+ data.forEach((disk: UI_I_Pvm['disk_devices'][0], key) => {
65
+ bodyItems.push([
66
+ {
67
+ key: 'col0',
68
+ text: disk[tableKeys[0]],
69
+ id: disk.source,
70
+ data: {
71
+ location: disk.source,
72
+ target: disk.target,
73
+ },
74
+ testId: `disk-table-item-${key}`,
75
+ },
76
+ {
77
+ key: 'col1',
78
+ text: disk[tableKeys[1]],
79
+ id: disk.source,
80
+ testId: `disk-table-item-${key}`,
81
+ },
82
+ {
83
+ key: 'col2',
84
+ text: disk[tableKeys[2]],
85
+ id: disk.source,
86
+ testId: `disk-table-item-${key}`,
87
+ },
88
+ {
89
+ key: 'col3',
90
+ text: disk[tableKeys[3]],
91
+ id: disk.source,
92
+ testId: `disk-table-item-${key}`,
93
+ },
94
+ {
95
+ key: 'col4',
96
+ text: $binary.round(disk[tableKeys[4]], false, lang),
97
+ id: disk.source,
98
+ testId: `disk-table-item-${key}`,
99
+ },
100
+ {
101
+ key: 'col5',
102
+ text: $binary.round(
103
+ disk[tableKeys[4]] - disk[tableKeys[6]],
104
+ false,
105
+ lang
106
+ ),
107
+ id: disk.source,
108
+ testId: `disk-table-item-${key}`,
109
+ },
110
+ {
111
+ key: 'col6',
112
+ text: $binary.round(disk[tableKeys[6]], false, lang),
113
+ id: disk.source,
114
+ testId: `disk-table-item-${key}`,
115
+ },
116
+ {
117
+ key: 'col7',
118
+ text: disk[tableKeys[7]],
119
+ id: disk.source,
120
+ testId: `disk-table-item-${key}`,
121
+ },
122
+ ])
123
+ })
124
+ return bodyItems
125
+ }