bfg-common 1.4.363 → 1.4.365

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.
@@ -0,0 +1,167 @@
1
+ import type { UI_I_DataTable } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
2
+ import type { UI_I_DataTableOptions } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
3
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
4
+
5
+ export const tableDataFunc = (
6
+ localization: UI_I_Localization
7
+ ): UI_I_DataTable => ({
8
+ id: '0',
9
+ header: [
10
+ {
11
+ col: 0,
12
+ colName: localization.common.name,
13
+ text: localization.common.name,
14
+ isSortable: true,
15
+ sort: 'asc',
16
+ sortColumn: true,
17
+ width: '30%',
18
+ show: true,
19
+ filter: true,
20
+ },
21
+ {
22
+ col: 1,
23
+ colName: localization.inventorySummary.state,
24
+ text: localization.inventorySummary.state,
25
+ isSortable: false,
26
+ sort: 'asc',
27
+ sortColumn: true,
28
+ width: '30%',
29
+ show: true,
30
+ filter: true,
31
+ },
32
+ {
33
+ col: 2,
34
+ colName: localization.common.capacity,
35
+ text: localization.common.capacity,
36
+ isSortable: false,
37
+ sort: 'asc',
38
+ sortColumn: true,
39
+ width: '30%',
40
+ show: true,
41
+ filter: true,
42
+ },
43
+ {
44
+ col: 3,
45
+ colName: localization.common.provisioned,
46
+ text: localization.common.provisioned,
47
+ isSortable: false,
48
+ sort: 'asc',
49
+ sortColumn: true,
50
+ width: '30%',
51
+ show: true,
52
+ filter: true,
53
+ },
54
+ {
55
+ col: 4,
56
+ colName: localization.common.free,
57
+ text: localization.common.free,
58
+ isSortable: false,
59
+ sort: 'asc',
60
+ sortColumn: true,
61
+ width: '30%',
62
+ show: true,
63
+ filter: true,
64
+ },
65
+ {
66
+ col: 5,
67
+ colName: localization.common.used,
68
+ text: localization.common.used,
69
+ isSortable: false,
70
+ sort: 'asc',
71
+ sortColumn: true,
72
+ width: '30%',
73
+ show: true,
74
+ filter: true,
75
+ },
76
+ {
77
+ col: 6,
78
+ colName: localization.common.type,
79
+ text: localization.common.type,
80
+ isSortable: false,
81
+ sort: 'asc',
82
+ sortColumn: true,
83
+ width: '30%',
84
+ show: true,
85
+ filter: true,
86
+ },
87
+ {
88
+ col: 7,
89
+ colName: localization.common.thinProvisioning,
90
+ text: localization.common.thinProvisioning,
91
+ isSortable: false,
92
+ sort: 'asc',
93
+ sortColumn: true,
94
+ width: '30%',
95
+ show: true,
96
+ filter: true,
97
+ },
98
+ {
99
+ col: 8,
100
+ colName: localization.common.access,
101
+ text: localization.common.access,
102
+ isSortable: false,
103
+ sort: 'asc',
104
+ sortColumn: true,
105
+ width: '30%',
106
+ show: true,
107
+ filter: true,
108
+ },
109
+ {
110
+ col: 9,
111
+ colName: localization.common.hardwareAcceleration,
112
+ text: localization.common.hardwareAcceleration,
113
+ isSortable: false,
114
+ sort: 'asc',
115
+ sortColumn: true,
116
+ width: '30%',
117
+ show: true,
118
+ filter: true,
119
+ },
120
+ {
121
+ col: 10,
122
+ colName: localization.common.driverType,
123
+ text: localization.common.driverType,
124
+ isSortable: false,
125
+ sort: 'asc',
126
+ sortColumn: true,
127
+ width: '30%',
128
+ show: true,
129
+ filter: true,
130
+ },
131
+ {
132
+ col: 11,
133
+ colName: localization.common.device,
134
+ text: localization.common.device,
135
+ isSortable: false,
136
+ sort: 'asc',
137
+ sortColumn: true,
138
+ width: '30%',
139
+ show: true,
140
+ filter: true,
141
+ },
142
+ {
143
+ col: 12,
144
+ colName: localization.common.storageIoControl,
145
+ text: localization.common.storageIoControl,
146
+ isSortable: false,
147
+ sort: 'asc',
148
+ sortColumn: true,
149
+ width: '30%',
150
+ show: true,
151
+ filter: true,
152
+ },
153
+ ],
154
+
155
+ body: [],
156
+ })
157
+
158
+ export const tableOptions: UI_I_DataTableOptions = {
159
+ isSelectable: true,
160
+ selectType: 'radio',
161
+ showPagination: true,
162
+ showPageInfo: false,
163
+ isSortable: true,
164
+ server: false,
165
+ isResizable: true,
166
+ showColumnManager: true,
167
+ }
@@ -1,198 +1,202 @@
1
- <template>
2
- <div class="select-storage">
3
- <atoms-alert
4
- v-show="errors.length"
5
- status="alert-danger"
6
- test-id="storage-alert"
7
- :items="errors"
8
- @remove="onRemoveValidationErrors"
9
- />
10
- <div class="table-wrap">
11
- <atoms-table-data-grid
12
- v-model:selected-row="selectedRow"
13
- v-model:column-keys="columnKeys"
14
- v-model:page-size="pagination.pageSize"
15
- v-model:page="pagination.page"
16
- type="radio"
17
- test-id="storage-table"
18
- :head-items="headItems"
19
- :body-items="bodyItems"
20
- :total-items="bodyItems.length"
21
- :total-pages="1"
22
- server-off
23
- hide-page-size
24
- @change="changeStorage"
25
- >
26
- <template #icon="{ item }">
27
- <span :class="['datagrid-cell-icon', item.data]" />
28
- <span class="text-ellipsis">
29
- {{ item.text }}
30
- </span>
31
- </template>
32
- </atoms-table-data-grid>
33
- </div>
34
-
35
- <div v-if="!hideCompatibility" class="compatibility-wrap">
36
- <p class="compatibility">
37
- {{ localization.inventorySummary.compatibility }}
38
- </p>
39
- <div class="compatibility-message flex-align-center">
40
- <template v-if="selectedStorage">
41
- <div class="icon-status-ok" />
42
- <span>{{ localization.common.compatibilityChecksSucceeded }}</span>
43
- </template>
44
- <div v-else>
45
- <br />
46
- </div>
47
- </div>
48
- </div>
49
- </div>
50
- </template>
51
-
52
- <script setup lang="ts">
53
- import type {
54
- UI_I_Pagination,
55
- UI_I_TablePayload,
56
- } from '~/lib/models/table/interfaces'
57
- import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
58
- import type { UI_I_Localization } from '~/lib/models/interfaces'
59
- import type {
60
- UI_I_ColumnKey,
61
- UI_I_HeadItem,
62
- UI_I_BodyItem,
63
- } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
64
- import * as table from '~/components/common/vm/actions/common/select/storage/lib/config/config'
65
-
66
- const props = defineProps<{
67
- storageSubmit: null | Function
68
- datastore: UI_I_DatastoreTableItem[]
69
- storage: UI_I_DatastoreTableItem
70
- hideCompatibility?: boolean
71
- getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
72
- }>()
73
- const emits = defineEmits<{
74
- (event: 'submit', value: UI_I_DatastoreTableItem): void
75
- }>()
76
-
77
- const localization = computed<UI_I_Localization>(() => useLocal())
78
-
79
- const headItems = ref<UI_I_HeadItem[]>(table.headItems(localization.value))
80
- const columnKeys = ref<UI_I_ColumnKey[]>(table.columnKeys(localization.value))
81
- watch(localization, () => {
82
- columnKeys.value = table.columnKeys(localization.value)
83
- })
84
-
85
- const bodyItems = computed<UI_I_BodyItem[][]>(() => {
86
- return table.bodyItems(props.datastore || [], localization.value)
87
- })
88
-
89
- const pagination = ref<UI_I_Pagination>({
90
- page: 1,
91
- pageSize: 100,
92
- })
93
-
94
- const getStorage = async (): Promise<void> => {
95
- const payload: UI_I_TablePayload = {
96
- pagination: pagination.value,
97
- sortBy: null,
98
- type: 'datastore',
99
- schema: 'full',
100
- }
101
-
102
- props.getDatastoreTableFunc(payload).then(() => {
103
- selectedRow.value = null
104
- setStorageFromProps()
105
- })
106
- }
107
- getStorage()
108
-
109
- const selectedStorage = ref<UI_I_DatastoreTableItem | null>(null)
110
- const selectedRow = ref<number | null>(null)
111
- const changeStorage = (index: number): void => {
112
- if (!props.datastore) return
113
- selectedStorage.value = props.datastore[index]
114
- selectedRow.value = index
115
- }
116
-
117
- const setStorageFromProps = (): void => {
118
- if (!props.storage) return
119
- props.datastore.forEach((item, index) => {
120
- if (item.id === props.storage.id) changeStorage(index)
121
- })
122
- }
123
- watch(
124
- () => props.storage,
125
- () => {
126
- setStorageFromProps()
127
- },
128
- { immediate: true }
129
- )
130
- watch(
131
- () => props.datastore,
132
- () => {
133
- selectedRow.value = null
134
- selectedStorage.value = null
135
- },
136
- { immediate: true }
137
- )
138
-
139
- watch(
140
- () => props.storageSubmit,
141
- (newValue) => {
142
- newValue && submit(newValue)
143
- }
144
- )
145
- const submit = (cb: Function): void => {
146
- if (!selectedStorage.value) {
147
- showValidationErrors([localization.value.common.selectValidDestinationStorage])
148
- cb(false)
149
- return
150
- }
151
-
152
- emits('submit', selectedStorage.value)
153
- cb(true)
154
- }
155
-
156
- const errors = ref<string[]>([])
157
- const showValidationErrors = (arr: string[]): void => {
158
- errors.value = arr
159
- }
160
- const onRemoveValidationErrors = (): void => {
161
- errors.value = []
162
- }
163
- </script>
164
-
165
- <style scoped lang="scss">
166
- .select-storage {
167
- flex: 1;
168
- display: flex;
169
- flex-direction: column;
170
-
171
- .table-wrap {
172
- flex: 1;
173
-
174
- .datagrid-cell-icon {
175
- margin-right: 6px;
176
- }
177
-
178
- :deep(.relative) {
179
- height: 100%;
180
-
181
- .datagrid-outer-wrapper {
182
- height: 100%;
183
- }
184
- }
185
- }
186
-
187
- .compatibility-wrap {
188
- padding-top: 10px;
189
-
190
- .compatibility-message {
191
- border: 1px solid #000;
192
- padding-top: 5px;
193
- padding-left: 5px;
194
- overflow: auto;
195
- }
196
- }
197
- }
198
- </style>
1
+ <template>
2
+ <div class="select-storage">
3
+ <atoms-alert
4
+ v-show="errors.length"
5
+ status="alert-danger"
6
+ test-id="storage-alert"
7
+ :items="errors"
8
+ @remove="onRemoveValidationErrors"
9
+ />
10
+ <div class="table-wrap">
11
+ <atoms-table-data-grid
12
+ v-model:selected-row="selectedRow"
13
+ v-model:column-keys="columnKeys"
14
+ v-model:page-size="pagination.pageSize"
15
+ v-model:page="pagination.page"
16
+ type="radio"
17
+ test-id="storage-table"
18
+ :head-items="headItems"
19
+ :body-items="bodyItems"
20
+ :total-items="bodyItems.length"
21
+ :total-pages="1"
22
+ server-off
23
+ hide-page-size
24
+ @change="changeStorage"
25
+ >
26
+ <template #icon="{ item }">
27
+ <span :class="['datagrid-cell-icon', item.data]" />
28
+ <span class="text-ellipsis">
29
+ {{ item.text }}
30
+ </span>
31
+ </template>
32
+ </atoms-table-data-grid>
33
+ </div>
34
+
35
+ <div v-if="!hideCompatibility" class="compatibility-wrap">
36
+ <p class="compatibility">
37
+ {{ localization.inventorySummary.compatibility }}
38
+ </p>
39
+ <div class="compatibility-message flex-align-center">
40
+ <template v-if="selectedStorage">
41
+ <div class="icon-status-ok" />
42
+ <span>{{ localization.common.compatibilityChecksSucceeded }}</span>
43
+ </template>
44
+ <div v-else>
45
+ <br />
46
+ </div>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ </template>
51
+
52
+ <script setup lang="ts">
53
+ import type {
54
+ UI_I_Pagination,
55
+ UI_I_TablePayload,
56
+ } from '~/lib/models/table/interfaces'
57
+ import type { UI_I_DatastoreTableItem } from '~/lib/models/store/storage/interfaces'
58
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
59
+ import type {
60
+ UI_I_ColumnKey,
61
+ UI_I_HeadItem,
62
+ UI_I_BodyItem,
63
+ } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
64
+ import * as table from '~/components/common/vm/actions/common/select/storage/lib/config/config'
65
+
66
+ const props = defineProps<{
67
+ storageSubmit: null | Function
68
+ datastore: UI_I_DatastoreTableItem[]
69
+ storage: UI_I_DatastoreTableItem
70
+ hideCompatibility?: boolean
71
+ getDatastoreTableFunc: (payload: UI_I_TablePayload) => Promise<void>
72
+ }>()
73
+ const emits = defineEmits<{
74
+ (event: 'submit', value: UI_I_DatastoreTableItem): void
75
+ }>()
76
+
77
+ const localization = computed<UI_I_Localization>(() => useLocal())
78
+
79
+ const headItems = ref<UI_I_HeadItem[]>(table.headItems(localization.value))
80
+ const columnKeys = ref<UI_I_ColumnKey[]>(table.columnKeys(localization.value))
81
+ watch(localization, () => {
82
+ columnKeys.value = table.columnKeys(localization.value)
83
+ })
84
+
85
+ const bodyItems = computed<UI_I_BodyItem[][]>(() => {
86
+ return table.bodyItems(props.datastore || [], localization.value)
87
+ })
88
+
89
+ const pagination = ref<UI_I_Pagination>({
90
+ page: 1,
91
+ pageSize: 100,
92
+ })
93
+
94
+ const getStorage = async (): Promise<void> => {
95
+ const payload: UI_I_TablePayload = {
96
+ pagination: pagination.value,
97
+ sortBy: null,
98
+ type: 'datastore',
99
+ schema: 'full',
100
+ }
101
+
102
+ props.getDatastoreTableFunc(payload).then(() => {
103
+ selectedRow.value = null
104
+ setStorageFromProps()
105
+ })
106
+ }
107
+ getStorage()
108
+
109
+ const selectedStorage = ref<UI_I_DatastoreTableItem | null>(null)
110
+ const selectedRow = ref<number | null>(null)
111
+ const changeStorage = (index: number): void => {
112
+ if (!props.datastore) return
113
+ selectedStorage.value = props.datastore[index]
114
+ selectedRow.value = index
115
+ }
116
+
117
+ const setStorageFromProps = (): void => {
118
+ if (!props.storage) return
119
+ props.datastore.forEach((item, index) => {
120
+ if (item.id === props.storage.id) changeStorage(index)
121
+ })
122
+ }
123
+ watch(
124
+ () => props.storage,
125
+ () => {
126
+ setStorageFromProps()
127
+ },
128
+ { immediate: true }
129
+ )
130
+ watch(
131
+ () => props.datastore,
132
+ () => {
133
+ selectedRow.value = null
134
+ selectedStorage.value = null
135
+ },
136
+ { immediate: true }
137
+ )
138
+
139
+ watch(
140
+ () => props.storageSubmit,
141
+ (newValue) => {
142
+ newValue && submit(newValue)
143
+ }
144
+ )
145
+ const submit = (cb: Function): void => {
146
+ if (!selectedStorage.value) {
147
+ showValidationErrors([
148
+ localization.value.common.selectValidDestinationStorage,
149
+ ])
150
+ // TODO удалять проверку по типу
151
+ typeof cb !== 'number' && cb(false)
152
+ return
153
+ }
154
+
155
+ emits('submit', selectedStorage.value)
156
+ // TODO удалять проверку по типу
157
+ typeof cb !== 'number' && cb(true)
158
+ }
159
+
160
+ const errors = ref<string[]>([])
161
+ const showValidationErrors = (arr: string[]): void => {
162
+ errors.value = arr
163
+ }
164
+ const onRemoveValidationErrors = (): void => {
165
+ errors.value = []
166
+ }
167
+ </script>
168
+
169
+ <style scoped lang="scss">
170
+ .select-storage {
171
+ flex: 1;
172
+ display: flex;
173
+ flex-direction: column;
174
+
175
+ .table-wrap {
176
+ flex: 1;
177
+
178
+ .datagrid-cell-icon {
179
+ margin-right: 6px;
180
+ }
181
+
182
+ :deep(.relative) {
183
+ height: 100%;
184
+
185
+ .datagrid-outer-wrapper {
186
+ height: 100%;
187
+ }
188
+ }
189
+ }
190
+
191
+ .compatibility-wrap {
192
+ padding-top: 10px;
193
+
194
+ .compatibility-message {
195
+ border: 1px solid #000;
196
+ padding-top: 5px;
197
+ padding-left: 5px;
198
+ overflow: auto;
199
+ }
200
+ }
201
+ }
202
+ </style>
@@ -71,7 +71,7 @@ import type { UI_T_Project } from '~/lib/models/types'
71
71
  import type { UI_I_FileTreeNode } from '~/components/lib/models/interfaces'
72
72
  import type { UI_I_NetworkTableItem } from '~/lib/models/store/network/interfaces'
73
73
  import type {
74
- UI_I_EditVmPayload,
74
+ // UI_I_EditVmPayload,
75
75
  UI_I_PciDevice,
76
76
  } from '~/lib/models/store/vm/interfaces'
77
77
  import type { UI_I_Localization } from '~/lib/models/interfaces'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.363",
4
+ "version": "1.4.365",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -35,7 +35,7 @@
35
35
  "@vueuse/components": "^10.1.2",
36
36
  "date-fns": "^2.29.3",
37
37
  "bfg-nuxt-3-graph": "1.0.15",
38
- "bfg-uikit": "1.0.158",
38
+ "bfg-uikit": "1.0.160",
39
39
  "html2canvas": "^1.4.1",
40
40
  "prettier-eslint": "^15.0.1"
41
41
  }