bfg-common 1.5.677 → 1.5.679

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.
@@ -1,193 +0,0 @@
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_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
7
- import type { UI_I_Localization } from '~/lib/models/interfaces'
8
- import type { UI_I_AlarmItem } from '~/components/common/layout/bottomPanel/alarms/new/lib/models/interfaces'
9
- import {
10
- UI_E_RTaskChipColor,
11
- UI_E_RTaskStatusIcon,
12
- } from '~/components/common/pages/tasks/table/lib/models/enums'
13
- import { UI_E_TaskTypeToCorrectType } from '~/components/common/layout/bottomPanel/alarms/new/lib/models/enums'
14
- import { UI_E_NodeIconsByState } from '~/lib/models/enums'
15
-
16
- export const getHeaderDataFunc = (
17
- localization: UI_I_Localization
18
- ): UI_I_DataTableHeader[] => [
19
- {
20
- col: 0,
21
- colName: 'object',
22
- text: localization.common.object,
23
- isSortable: true,
24
- sort: 'asc',
25
- sortColumn: true,
26
- width: '180px',
27
- show: true,
28
- filter: true,
29
- },
30
- {
31
- col: 1,
32
- colName: 'status',
33
- text: localization.common.status,
34
- isSortable: true,
35
- sort: 'asc',
36
- width: '180px',
37
- show: true,
38
- filter: true,
39
- },
40
- {
41
- col: 2,
42
- colName: 'name',
43
- text: localization.common.name,
44
- isSortable: true,
45
- sort: 'asc',
46
- width: '180px',
47
- show: true,
48
- filter: true,
49
- },
50
- {
51
- col: 3,
52
- colName: 'triggered',
53
- text: localization.layout.triggered,
54
- isSortable: true,
55
- sort: 'asc',
56
- width: '180px',
57
- show: true,
58
- filter: true,
59
- },
60
- {
61
- col: 4,
62
- colName: 'acknowledged',
63
- text: localization.layout.acknowledged,
64
- isSortable: true,
65
- sort: 'asc',
66
- width: '180px',
67
- show: true,
68
- filter: true,
69
- },
70
- {
71
- col: 5,
72
- colName: 'acknowledgedBy',
73
- text: localization.layout.acknowledgedBy,
74
- isSortable: true,
75
- sort: 'asc',
76
- width: '180px',
77
- show: true,
78
- filter: true,
79
- },
80
- {
81
- col: 6,
82
- colName: 'triggeringEvent',
83
- text: localization.layout.triggeringEvent,
84
- isSortable: true,
85
- sort: 'asc',
86
- width: '180px',
87
- show: true,
88
- filter: true,
89
- },
90
- {
91
- col: 7,
92
- colName: 'default-actions',
93
- text: '',
94
- show: true,
95
- },
96
- ]
97
- export const getAlarmRowQuickActionsFunc = (
98
- localization: UI_I_Localization
99
- ): UI_I_Dropdown[] => [
100
- {
101
- value: 'view-object',
102
- text: localization.common.viewObject,
103
- iconName: 'hide',
104
- selected: false,
105
- },
106
- {
107
- value: 'alarm-details',
108
- text: localization.common.alarmDetails,
109
- iconName: 'icon-policies-profiles',
110
- selected: false,
111
- },
112
- {
113
- value: 'event-details',
114
- text: localization.common.eventDetails,
115
- iconName: 'icon-policies-profiles',
116
- selected: false,
117
- },
118
- ]
119
-
120
- export const options: UI_I_DataTableOptions = {
121
- perPageOptions: [
122
- { text: '10', value: 10 },
123
- { text: '50', value: 50 },
124
- { text: '100', value: 100 },
125
- ],
126
- isSelectable: false,
127
- isFocusable: false,
128
- showPagination: true,
129
- showPageInfo: true,
130
- isSortable: true,
131
- server: false,
132
- isResizable: true,
133
- showSearch: false,
134
- showColumnManager: true,
135
- withActions: true,
136
- inBlock: true,
137
- inBlockOnlyLightMode: true,
138
- }
139
-
140
- export const getBodyDataFunc = (
141
- bodyData: UI_I_AlarmItem[]
142
- ): UI_I_DataTableBody[] => {
143
- return bodyData.map((alarm: UI_I_AlarmItem, index: number) => {
144
- const correctType =
145
- UI_E_TaskTypeToCorrectType[
146
- alarm?.targetType as keyof typeof UI_E_TaskTypeToCorrectType
147
- ]
148
- const iconClassName = UI_E_NodeIconsByState[`${correctType}_Normal`]
149
-
150
- const objectData = {
151
- id: alarm.id,
152
- icon: iconClassName,
153
- }
154
-
155
- const statusData = {
156
- icon: UI_E_RTaskStatusIcon[alarm.statusIcon],
157
- chipColor: UI_E_RTaskChipColor[alarm.status],
158
- testId: `${alarm.name}-progress`,
159
- }
160
-
161
- return {
162
- row: index,
163
- collapse: false,
164
- isHiddenCollapse: false,
165
- collapseToggle: false,
166
- data: [
167
- {
168
- key: 'icon',
169
- col: 0,
170
- text: alarm.object,
171
- data: objectData,
172
- },
173
- {
174
- key: 'status',
175
- col: 1,
176
- text: alarm.status,
177
- data: statusData,
178
- },
179
- { key: 'icon', col: 2, text: alarm.name },
180
- { col: 3, text: alarm.triggered },
181
- { col: 4, text: alarm.acknowledged },
182
- { col: 5, text: alarm.acknowledged_by },
183
- { key: 'icon', col: 6, text: alarm.triggering_event },
184
- {
185
- key: 'default-actions',
186
- col: 7,
187
- text: '',
188
- data: { id: index },
189
- },
190
- ],
191
- }
192
- })
193
- }
@@ -1,10 +0,0 @@
1
- export enum UI_E_TaskTypeToCorrectType {
2
- 'Zones' = 'zone',
3
- 'Datacenters' = 'datacenter',
4
- 'Clusters' = 'cluster',
5
- 'Hosts' = 'host',
6
- 'VirtualMachines' = 'vm',
7
- 'Datastores' = 'datastore',
8
- 'Networks' = 'network',
9
- }
10
-
@@ -1,12 +0,0 @@
1
- export interface UI_API_I_AlarmItem {
2
- id: number
3
- object: string
4
- status: string
5
- name: string
6
- triggered: string
7
- acknowledged: string
8
- acknowledged_by: string
9
- triggering_event: string
10
- statusIcon: string
11
- }
12
- export interface UI_I_AlarmItem extends UI_API_I_AlarmItem {}
@@ -1,191 +0,0 @@
1
- <template>
2
- <div class="data-table-view">
3
- <atoms-table-data-grid
4
- v-model:selected-row="selectedRow"
5
- v-model:column-keys="columnKeys"
6
- v-model:page-size="pagination.pageSize"
7
- v-model:page="pagination.page"
8
- :head-items="headItems"
9
- :body-items="bodyItems"
10
- :total-items="props.totalItems"
11
- :total-pages="props.totalPages"
12
- :items-per-page="itemsPerPage"
13
- :loading="props.loading"
14
- test-id="bottom-panel-table"
15
- class="data-table"
16
- row-attribute-id-name="data-recent-tasks-id"
17
- hide-pagination
18
- server-off
19
- @sorting="onSorting"
20
- >
21
- <template #icon="{ item }">
22
- <div v-if="item.data.isIconSvg" class="data-table-view__col-icon">
23
- <atoms-the-icon :name="item.data.iconClassName" />
24
- </div>
25
- <span v-else :class="['datagrid-cell-icon', item.data.iconClassName]" />
26
- <a
27
- v-if="item.data.isLink"
28
- :id="item.data.id"
29
- :data-id="`rtask-${item.data.testId}`"
30
- :title="item.text"
31
- href="javascript:void(0)"
32
- class="text-ellipsis"
33
- @click="onSelectNodeOfTree(item.data)"
34
- >{{ item.text }}</a
35
- >
36
- <span v-else :title="item.text" class="text-ellipsis">
37
- {{ item.text }}
38
- </span>
39
- </template>
40
-
41
- <template #action>
42
- <div class="flex-space-between flex-align-center">
43
- <div class="flex-align-center"></div>
44
- </div>
45
- </template>
46
- </atoms-table-data-grid>
47
- </div>
48
- </template>
49
-
50
- <script lang="ts" setup>
51
- import type { UI_T_TimeValue } from '~/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/models/types'
52
- import type {
53
- UI_I_ColumnKey,
54
- UI_I_HeadItem,
55
- UI_I_BodyItem,
56
- } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
57
- import type { UI_I_Localization } from '~/lib/models/interfaces'
58
- import type { UI_I_Pagination } from '~/lib/models/table/interfaces'
59
- import type { UI_I_DataTargetForTable } from '~/components/common/layout/bottomPanel/recentTasks/lib/models/interfaces'
60
- import type { UI_T_SelectedRow } from '~/components/atoms/table/dataGrid/lib/models/types'
61
- import type { UI_I_RecentTaskItem } from '~/lib/models/store/tasks/interfaces'
62
- import type { UI_T_LangValue } from '~/lib/models/types'
63
- import type { UI_T_NodeType } from '~/components/common/pages/home/lib/models/types'
64
- import { UI_E_TaskTypeToCorrectType } from '~/components/common/layout/bottomPanel/alarms/new/lib/models/enums'
65
- import { itemsPerPage } from '~/components/atoms/table/dataGrid/lib/config/itemsPerPage'
66
- import * as alarmTables from '~/components/common/layout/bottomPanel/alarms/old/lib/config/alarmTables'
67
-
68
- const props = defineProps<{
69
- dataTable: UI_I_RecentTaskItem<UI_T_NodeType>[]
70
- totalItems: number
71
- totalPages: number
72
- pagination: UI_I_Pagination
73
- loading: boolean
74
- }>()
75
- const emits = defineEmits<{
76
- (event: 'pagination', value: UI_I_Pagination | null): void
77
- (event: 'sort', value: string): void
78
- }>()
79
-
80
- const { $store }: any = useNuxtApp()
81
-
82
- const localization = computed<UI_I_Localization>(() => useLocal())
83
-
84
- const selectedRow = ref<UI_T_SelectedRow>([])
85
-
86
- const onSorting = (event: [number, boolean]): void => {
87
- const [column, status] = event
88
- const direction = status ? 'desc' : 'asc'
89
-
90
- const sort = `${column}.${direction}`
91
-
92
- emits('sort', sort)
93
- }
94
-
95
- const pagination = ref<UI_I_Pagination | null>(null)
96
- watch(
97
- () => props.pagination,
98
- (newValue) => {
99
- pagination.value = newValue
100
- },
101
- { immediate: true }
102
- )
103
- watch(
104
- pagination,
105
- (newValue) => {
106
- emits('pagination', newValue)
107
- },
108
- { deep: true, immediate: true }
109
- )
110
-
111
- const columnKeys = ref<UI_I_ColumnKey[]>(
112
- alarmTables.columnKeys(localization.value)
113
- )
114
- const headItems = computed<UI_I_HeadItem[]>(() =>
115
- alarmTables.headItems(localization.value)
116
- )
117
- const timeFormat = computed<UI_T_TimeValue>(
118
- () => $store.getters['main/getTimeFormat']
119
- )
120
-
121
- const interfaceLang = computed<UI_T_LangValue>(
122
- () => $store.getters['main/getInterfaceLang']
123
- )
124
-
125
- const bodyItems = ref<UI_I_BodyItem[][]>([])
126
- watch(
127
- [
128
- (): UI_I_RecentTaskItem<UI_T_NodeType>[] => props.dataTable,
129
- timeFormat,
130
- interfaceLang,
131
- ],
132
- ([newValue1]) => {
133
- if (!newValue1?.length) {
134
- bodyItems.value = []
135
- return
136
- }
137
-
138
- bodyItems.value = alarmTables.bodyItems(newValue1)
139
- },
140
- { deep: true, immediate: true }
141
- )
142
-
143
- const onSelectNodeOfTree = (item: UI_I_DataTargetForTable): void => {
144
- const id = item.id
145
- const type = UI_E_TaskTypeToCorrectType[item.type]
146
- let nav = item.nav
147
- switch (type) {
148
- case 'zone':
149
- case 'datacenter':
150
- case 'folder':
151
- nav = useRoute().params.nav || nav
152
- break
153
- }
154
-
155
- const params = `type=${type};nav=${nav};id=${id}`
156
- const path = `/inventory/${params}`
157
-
158
- // Переход в inventory
159
- navigateTo({
160
- path,
161
- })
162
- }
163
- </script>
164
-
165
- <style lang="scss" scoped>
166
- .data-table-view {
167
- height: inherit;
168
- .data-table {
169
- height: inherit;
170
- :deep(.datagrid-outer-wrapper) {
171
- height: inherit;
172
-
173
- .datagrid-footer__action {
174
- width: 100%;
175
-
176
- .select {
177
- margin-left: 10px;
178
- }
179
- }
180
- }
181
- }
182
- &__col-icon {
183
- min-width: 16px;
184
- height: 16px;
185
- margin-right: 2px;
186
- }
187
- &__action {
188
- padding-left: 0.3rem;
189
- }
190
- }
191
- </style>
@@ -1,89 +0,0 @@
1
- import type { UI_I_Localization } from '~/lib/models/interfaces'
2
- import type {
3
- UI_I_ColumnKey,
4
- UI_I_HeadItem,
5
- UI_I_BodyItem,
6
- } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
7
- import type { UI_I_AlarmItem } from '~/components/common/layout/bottomPanel/alarms/new/lib/models/interfaces'
8
- import {
9
- constructColumnKey,
10
- constructHeadItem,
11
- } from '~/components/atoms/table/dataGrid/lib/utils/constructDataTable'
12
- import { alarmsTableKeys } from '~/components/common/layout/bottomPanel/alarms/old/lib/config/tableKeys'
13
-
14
- const getItems = (
15
- localization: UI_I_Localization
16
- ): [string, boolean, string, string][] => {
17
- return [
18
- [localization.common.object, true, '96px', alarmsTableKeys[0]],
19
- [localization.common.status, true, '180px', alarmsTableKeys[1]],
20
- [localization.common.name, true, '250px', alarmsTableKeys[2]],
21
- [localization.layout.triggered, true, '180px', alarmsTableKeys[3]],
22
- [localization.layout.acknowledged, true, '180px', alarmsTableKeys[4]],
23
- [localization.layout.acknowledgedBy, true, '180px', alarmsTableKeys[5]],
24
- [localization.layout.triggeringEvent, true, '180px', alarmsTableKeys[6]],
25
- ]
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
- const col = i === 0 ? 'icon' : `col${i}`
34
- result.push(constructColumnKey(col, item[0], item[1]))
35
- })
36
- return result
37
- }
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
- const col = i === 0 ? 'icon' : `col${i}`
43
- result.push(constructHeadItem(col, item[0], item[3], true, item[2]))
44
- })
45
- return result
46
- }
47
-
48
- export const bodyItems = (data: UI_I_AlarmItem[]): UI_I_BodyItem[][] => {
49
- const bodyItems: UI_I_BodyItem[][] = []
50
- data.forEach((alarm: UI_I_AlarmItem, key) => {
51
- const objectData = {
52
- isLink: true,
53
- }
54
- const data = {
55
- iconClassName: 'vsphere-icon-status-warning',
56
- }
57
- const nameData = {
58
- isLink: true,
59
- }
60
- const triggeringData = {
61
- isLink: true,
62
- }
63
- bodyItems.push([
64
- {
65
- key: 'icon',
66
- text: alarm[alarmsTableKeys[0]],
67
- data: objectData,
68
- id: key,
69
- },
70
- { key: 'col1', text: alarm[alarmsTableKeys[1]], data, id: key },
71
- {
72
- key: 'col2',
73
- text: alarm[alarmsTableKeys[2]],
74
- data: nameData,
75
- id: key,
76
- },
77
- { key: 'col3', text: alarm[alarmsTableKeys[3]], id: key },
78
- { key: 'col4', text: alarm[alarmsTableKeys[4]], id: key },
79
- { key: 'col5', text: alarm[alarmsTableKeys[5]], id: key },
80
- {
81
- key: 'col6',
82
- text: alarm[alarmsTableKeys[6]],
83
- data: triggeringData,
84
- id: key,
85
- },
86
- ])
87
- })
88
- return bodyItems
89
- }
@@ -1,11 +0,0 @@
1
- import type { UI_T_AlarmsTableKeys } from '~/components/common/layout/bottomPanel/alarms/old/lib/models/types'
2
-
3
- export const alarmsTableKeys: UI_T_AlarmsTableKeys[] = [
4
- 'object',
5
- 'status',
6
- 'name',
7
- 'triggered',
8
- 'acknowledged',
9
- 'acknowledged_by',
10
- 'triggering_event',
11
- ]
@@ -1,8 +0,0 @@
1
- export type UI_T_AlarmsTableKeys =
2
- | 'object'
3
- | 'status'
4
- | 'name'
5
- | 'triggered'
6
- | 'acknowledged'
7
- | 'acknowledged_by'
8
- | 'triggering_event'