bfg-common 1.5.882 → 1.5.883

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.
@@ -3245,8 +3245,8 @@
3245
3245
  "networkPackets": "Сетевые пакеты",
3246
3246
  "diskRate": "Скорость диска",
3247
3247
  "diskRequests": "Запросы к диску",
3248
- "nfsRate": "Ставка NFS",
3249
- "nfsRequests": "NFS запросы",
3248
+ "nfsRate": "Скорость операций NFS",
3249
+ "nfsRequests": "Количество запросов NFS",
3250
3250
  "priority": "Приоритет",
3251
3251
  "recommendation": "Рекомендация",
3252
3252
  "recommendationId": "Идентификатор рекомендации",
@@ -0,0 +1,4 @@
1
+ export enum UI_E_SchedulerRunStatus {
2
+ RUNNING = 'this task has been started',
3
+ SUCCESS = 'success',
4
+ }
@@ -4,50 +4,41 @@ import type {
4
4
  UI_I_DataTableOptions,
5
5
  } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
6
6
  import type { UI_I_Localization } from '~/lib/models/interfaces'
7
- // import { UI_E_TabsByType } from '~/lib/models/enums'
8
7
  import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
9
8
  import type { UI_I_ScheduledTasksTableItem } from '~/components/common/pages/scheduledTasks/lib/models/interfaces'
10
- // import {
11
- // E_StatusEnum,
12
- // E_TreeNodeKind,
13
- // } from '~/components/templates/inventory/treeView/lib/models/enums'
14
- // import {
15
- // E_EventsChipColor,
16
- // E_EventsChipIcon,
17
- // E_EventsType,
18
- // } from '~/components/common/pages/events/table/new/lib/models/enums'
9
+ import { UI_E_SchedulerRunStatus } from '~/components/common/pages/scheduledTasks/table/lib/models/enums'
10
+ import {
11
+ E_SchedulerStatus,
12
+ E_SchedulerChipColor,
13
+ E_SchedulerChipIcon,
14
+ } from '~/components/common/pages/scheduledTasks/table/new/lib/models/enums'
19
15
 
20
16
  // Маппинг для статусов
21
- // const STATUS_MAPPING = {
22
- // [E_EventsType.Information]: {
23
- // textKey: 'information',
24
- // icon: E_EventsChipIcon.Information,
25
- // chipColor: E_EventsChipColor.Primary,
26
- // },
27
- // [E_EventsType.Warning]: {
28
- // textKey: 'warning',
29
- // icon: E_EventsChipIcon.Warning,
30
- // chipColor: E_EventsChipColor.Yellow,
31
- // },
32
- // [E_EventsType.Error]: {
33
- // textKey: 'error',
34
- // icon: E_EventsChipIcon.Information,
35
- // chipColor: E_EventsChipColor.Red,
36
- // },
37
- // [E_EventsType.User]: {
38
- // textKey: 'user',
39
- // icon: E_EventsChipIcon.User,
40
- // chipColor: E_EventsChipColor.Primary,
41
- // },
42
- // }
17
+ const STATUS_MAPPING = {
18
+ [E_SchedulerStatus.Completed]: {
19
+ textKey: 'complete',
20
+ icon: E_SchedulerChipIcon.StatusCheck,
21
+ chipColor: E_SchedulerChipColor.Green,
22
+ },
23
+ [E_SchedulerStatus.Running]: {
24
+ textKey: 'running',
25
+ icon: E_SchedulerChipIcon.StatusCheck,
26
+ chipColor: E_SchedulerChipColor.Green,
27
+ },
28
+ [E_SchedulerStatus.Failed]: {
29
+ textKey: 'failed',
30
+ icon: E_SchedulerChipIcon.Information,
31
+ chipColor: E_SchedulerChipColor.Red,
32
+ },
33
+ }
43
34
 
44
35
  export const getHeaderDataFunc = (
45
36
  localization: UI_I_Localization
46
37
  ): UI_I_DataTableHeader[] => [
47
38
  {
48
39
  col: 'col0',
49
- colName: 'description',
50
- text: localization.common.description,
40
+ colName: 'name',
41
+ text: localization.common.scheduledTask,
51
42
  isSortable: true,
52
43
  sort: 'asc',
53
44
  width: '240px',
@@ -56,8 +47,8 @@ export const getHeaderDataFunc = (
56
47
  },
57
48
  {
58
49
  col: 'col1',
59
- colName: 'severity',
60
- text: localization.common.type,
50
+ colName: 'sheduler',
51
+ text: localization.common.schedule,
61
52
  isSortable: true,
62
53
  sort: 'asc',
63
54
  width: '180px',
@@ -66,8 +57,8 @@ export const getHeaderDataFunc = (
66
57
  },
67
58
  {
68
59
  col: 'col2',
69
- colName: 'created_time',
70
- text: localization.common.dateTime,
60
+ colName: 'last_modified',
61
+ text: localization.common.lastRun,
71
62
  isSortable: true,
72
63
  sort: 'asc',
73
64
  width: '180px',
@@ -76,54 +67,25 @@ export const getHeaderDataFunc = (
76
67
  },
77
68
  {
78
69
  col: 'col3',
79
- colName: 'task_id',
80
- text: localization.tasks.task,
70
+ colName: 'last_run_result',
71
+ text: localization.common.lastRunResult,
81
72
  isSortable: true,
82
73
  sort: 'asc',
83
74
  width: '110px',
84
75
  show: true,
85
76
  filter: true,
86
77
  },
78
+
87
79
  {
88
80
  col: 'col4',
89
- colName: 'object_name',
90
- text: localization.common.target,
81
+ colName: 'next_run',
82
+ text: localization.common.nextRun,
91
83
  isSortable: true,
92
84
  sort: 'asc',
93
85
  width: '160px',
94
86
  show: true,
95
87
  filter: true,
96
88
  },
97
- {
98
- col: 'col5',
99
- colName: 'user_name',
100
- text: localization.common.user,
101
- isSortable: false,
102
- sort: 'asc',
103
- width: '120px',
104
- show: true,
105
- filter: true,
106
- },
107
- {
108
- col: 'col6',
109
- colName: 'event_type_id',
110
- text: localization.common.eventTypeId,
111
- isSortable: false,
112
- sort: 'asc',
113
- width: '120px',
114
- show: true,
115
- filter: true,
116
- },
117
- {
118
- col: 'col7',
119
- colName: 'error_message',
120
- text: localization.events.errorMessage,
121
- isSortable: false,
122
- sort: 'asc',
123
- width: '120px',
124
- show: true,
125
- filter: true,
126
- },
127
89
  ]
128
90
 
129
91
  export const getTargetActionsFunc = (
@@ -179,40 +141,28 @@ export const getBodyDataFunc = (
179
141
  bodyData: UI_I_ScheduledTasksTableItem[],
180
142
  localization: UI_I_Localization
181
143
  ): UI_I_DataTableBody[] => {
144
+ const { $formattedDatetime }: any = useNuxtApp()
182
145
  return bodyData.map((scheduler, index: number) => {
183
- const date = new Date(scheduler.created_time)
184
- const formattedDateTime = date.toLocaleString('en-US', {
185
- month: '2-digit',
186
- day: '2-digit',
187
- year: 'numeric',
188
- hour: 'numeric',
189
- minute: '2-digit',
190
- second: '2-digit',
191
- hour12: true,
192
- })
146
+ const historyLastRun = scheduler?.last_5_run?.at(-1)
193
147
 
194
- // const statusKey = event.severity as E_EventsType
195
- // const statusData = {
196
- // ...STATUS_MAPPING[statusKey],
197
- // testId: `${event.id}-${index}-status`,
198
- // }
148
+ const lastRun = historyLastRun?.start
149
+ const formattedLastRun =
150
+ lastRun && $formattedDatetime(+lastRun * 1000, { hasSeconds: true })
199
151
 
200
- // const objectKind =
201
- // event.object_type ??
202
- // (event.object_id
203
- // ? parseInt(event.object_id.split('.')[0], 10)
204
- // : undefined)
205
- // const objectType = E_TreeNodeKind[objectKind]
206
- // const iconClassName =
207
- // E_StatusEnum[`${objectType}_Normal` as keyof typeof E_StatusEnum]
152
+ const nextRun = scheduler.next_run
153
+ const formattedNextRun =
154
+ nextRun && $formattedDatetime(+nextRun * 1000, { hasSeconds: true })
208
155
 
209
- // const dataTarget = {
210
- // id: event.object_id,
211
- // nav: UI_E_TabsByType[objectType as keyof typeof UI_E_TabsByType],
212
- // type: objectType,
213
- // isLink: !!event.object_id,
214
- // iconClassName,
215
- // }
156
+ const statusKey =
157
+ historyLastRun?.result.toLowerCase() === UI_E_SchedulerRunStatus.SUCCESS
158
+ ? E_SchedulerStatus.Completed
159
+ : historyLastRun?.result === UI_E_SchedulerRunStatus.RUNNING
160
+ ? E_SchedulerStatus.Running
161
+ : E_SchedulerStatus.Failed
162
+ const statusData = {
163
+ ...STATUS_MAPPING[statusKey],
164
+ testId: `${scheduler.rid}-${index}-status`,
165
+ }
216
166
 
217
167
  return {
218
168
  row: scheduler.rid,
@@ -223,53 +173,38 @@ export const getBodyDataFunc = (
223
173
  {
224
174
  key: 'icon',
225
175
  col: 'col0',
226
- text: scheduler.description,
176
+ text: scheduler.name,
227
177
  data: {
228
178
  iconClassName: 'icon-events',
229
- expandData: event,
179
+ expandData: scheduler,
230
180
  },
231
181
  testId: `table-item-${scheduler.rid}`,
232
182
  },
233
183
  {
234
- key: 'status',
235
184
  col: 'col1',
236
- text: 'localization.common[statusData.textKey]',
185
+ text: scheduler.sheduler || '--',
237
186
  data: 'statusData',
238
187
  testId: `table-item-${scheduler.rid}`,
239
188
  },
240
189
  {
241
190
  col: 'col2',
242
- text: formattedDateTime,
191
+ text: formattedLastRun,
243
192
  testId: `table-item-${scheduler.rid}`,
244
193
  },
245
194
  {
195
+ key: 'status',
246
196
  col: 'col3',
247
- text: scheduler.task_id || '--',
197
+ text: localization.common[statusData.textKey],
198
+ data: statusData,
248
199
  testId: `table-item-${scheduler.rid}`,
249
200
  },
250
201
  {
251
202
  key: 'icon',
252
203
  col: 'col4',
253
- text: scheduler.object_name || '--',
204
+ text: formattedNextRun,
254
205
  data: 'dataTarget',
255
206
  testId: `table-item-${scheduler.rid}`,
256
207
  },
257
-
258
- {
259
- col: 'col5',
260
- text: scheduler.user_name,
261
- testId: `table-item-${scheduler.rid}`,
262
- },
263
- {
264
- col: 'col6',
265
- text: scheduler.event_type_id,
266
- testId: `table-item-${scheduler.rid}`,
267
- },
268
- {
269
- col: 'col7',
270
- text: scheduler.error_message || '--',
271
- testId: `table-item-${scheduler.rid}`,
272
- },
273
208
  {
274
209
  key: 'default-actions',
275
210
  col: 'default-actions',
@@ -1,16 +1,14 @@
1
- export enum E_EventsType {
2
- Information = 1,
3
- Warning,
4
- Error,
5
- User,
1
+ export enum E_SchedulerStatus {
2
+ Completed = 'completed',
3
+ Running = 'running',
4
+ Failed = 'failed',
6
5
  }
7
- export enum E_EventsChipColor {
6
+
7
+ export enum E_SchedulerChipColor {
8
+ Green = 'green',
8
9
  Red = 'red',
9
- Primary = 'primary',
10
- Yellow = 'yellow',
11
10
  }
12
- export enum E_EventsChipIcon {
11
+ export enum E_SchedulerChipIcon {
12
+ StatusCheck = 'status-check',
13
13
  Information = 'info-stroke',
14
- User = 'user-icon',
15
- Warning = 'warning-outline',
16
14
  }
@@ -9,8 +9,8 @@ import {
9
9
  } from '~/lib/models/store/tasks/enums'
10
10
  import * as defaultSettings from '~/components/atoms/table/dataGrid/lib/config/settingsTable'
11
11
  import type { UI_I_ScheduledTasksTableItem } from '~/components/common/pages/scheduledTasks/lib/models/interfaces'
12
+ import { UI_E_SchedulerRunStatus } from '~/components/common/pages/scheduledTasks/table/lib/models/enums'
12
13
  import { scheduledTaskTableItemsKeys } from '~/components/common/pages/scheduledTasks/table/old/lib/config/tableKeys'
13
- import { schedulerRunStatus } from '~/components/common/pages/scheduledTasks/table/lib/config/schedulerStatus'
14
14
 
15
15
  const getItems = (
16
16
  localization: UI_I_Localization
@@ -67,16 +67,20 @@ export const bodyItems = (
67
67
  const statusText =
68
68
  historyLastRun &&
69
69
  UI_E_RecentTaskStatus[
70
- historyLastRun?.result?.toLowerCase() === 'success' ? 2 : -1
70
+ historyLastRun?.result?.toLowerCase() ===
71
+ UI_E_SchedulerRunStatus.SUCCESS
72
+ ? 2
73
+ : -1
71
74
  ]
72
75
 
73
76
  const statusData = {
74
77
  iconClassName:
75
78
  historyLastRun &&
76
79
  UI_E_IconNameByRecentTaskStatus[
77
- historyLastRun?.result.toLowerCase() === schedulerRunStatus.SUCCESS
80
+ historyLastRun?.result.toLowerCase() ===
81
+ UI_E_SchedulerRunStatus.SUCCESS
78
82
  ? 2
79
- : historyLastRun?.result === schedulerRunStatus.RUNNING
83
+ : historyLastRun?.result === UI_E_SchedulerRunStatus.RUNNING
80
84
  ? 1
81
85
  : 3
82
86
  ],
@@ -113,8 +117,8 @@ export const bodyItems = (
113
117
  id: task.rid,
114
118
  testId: `adapter-table-${key}-row-item`,
115
119
  data: {
116
- sortValue: lastRun || 0
117
- }
120
+ sortValue: lastRun || 0,
121
+ },
118
122
  },
119
123
  {
120
124
  key: 'icon',
@@ -129,8 +133,8 @@ export const bodyItems = (
129
133
  id: task.rid,
130
134
  testId: `adapter-table-${key}-row-item`,
131
135
  data: {
132
- sortValue: task[scheduledTaskTableItemsKeys[4]]
133
- }
136
+ sortValue: task[scheduledTaskTableItemsKeys[4]],
137
+ },
134
138
  },
135
139
  ])
136
140
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.882",
4
+ "version": "1.5.883",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -1,4 +0,0 @@
1
- export const schedulerRunStatus = {
2
- RUNNING: 'this task has been started',
3
- SUCCESS: 'success',
4
- }
@@ -1,11 +0,0 @@
1
- import { UI_I_TableRowDropDetails } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
2
- import type { UI_I_ScheduledTasksTableItem } from '~/components/common/pages/scheduledTasks/lib/models/interfaces'
3
-
4
- export interface UI_I_ScheduleTableRowDetails
5
- extends UI_I_TableRowDropDetails<
6
- string | UI_I_ScheduledTasksTableItem['last_5_run']
7
- > {}
8
-
9
- // export interface I_ScheduledTaskTableItem extends API_I_ScheduledTaskTableItem {
10
- // type: T_ScheduledTasksActionsType
11
- // }