bfg-common 1.4.700 → 1.4.703

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.
@@ -6,6 +6,8 @@
6
6
 
7
7
  <common-pages-tasks-table
8
8
  :table-data="tasksList?.items || []"
9
+ :total-pages="tasksList?.total_pages || 1"
10
+ :total-items="tasksList?.total_items || 0"
9
11
  :loading="isLoading"
10
12
  :project="props.project"
11
13
  />
@@ -4,10 +4,12 @@
4
4
  :data="data"
5
5
  :options="options"
6
6
  :loading="props.loading"
7
- server-off
8
- show-selected-rows
7
+ :total-pages="props.totalPages"
8
+ :total-items="props.totalItems"
9
+ :texts="texts"
9
10
  class="task-table"
10
11
  @sorting="onSorting"
12
+ @pagination="onPagination"
11
13
  >
12
14
  <template #icon="{ item }">
13
15
  <span class="flex-align-center">
@@ -93,6 +95,8 @@ import type {
93
95
  UI_I_DataTable,
94
96
  UI_I_DataTableHeader,
95
97
  UI_I_DataTableBody,
98
+ UI_I_Pagination,
99
+ UI_I_TableTexts,
96
100
  } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
97
101
  import type { UI_T_Project, UI_T_ProcuratorTypeNodes } from '~/lib/models/types'
98
102
  import type { UI_I_Localization } from '~/lib/models/interfaces'
@@ -107,6 +111,8 @@ import {
107
111
  const props = defineProps<{
108
112
  project: UI_T_Project
109
113
  tableData: UI_I_TaskItem<UI_T_ProcuratorTypeNodes>[]
114
+ totalPages: number
115
+ totalItems: number
110
116
  loading: boolean
111
117
  }>()
112
118
  const emits = defineEmits<{
@@ -118,17 +124,30 @@ const { $store }: any = useNuxtApp()
118
124
 
119
125
  const actionsIsShow = ref<boolean[]>([])
120
126
 
121
- const data = computed<UI_I_DataTable>(() => ({
127
+ const data = ref<UI_I_DataTable>({
122
128
  id: 'tasks-table',
123
- header: taskHeadItems.value,
124
- body: taskBodyItems.value,
129
+ selectedRows: [],
130
+ header: [],
131
+ body: [],
132
+ })
133
+
134
+ const texts = computed<UI_I_TableTexts>(() => ({
135
+ searchHere: localization.value.common.searchHere,
136
+ rowsPerPage: localization.value.common.rowsPerPage,
137
+ of: localization.value.common.of,
138
+ selected: localization.value.common.selected,
139
+ columns: localization.value.common.columns,
140
+ previous: localization.value.common.previous,
141
+ next: localization.value.common.next,
142
+ noItemsFound: localization.value.common.noItemsFound,
125
143
  }))
126
144
 
127
- const taskHeadItems = computed<UI_I_DataTableHeader[]>(() =>
128
- getHeaderDataFunc(localization.value)
145
+ const taskHeadItems = computed<UI_I_DataTableHeader[]>(
146
+ () => getHeaderDataFunc(localization.value) || []
129
147
  )
130
148
 
131
149
  const taskBodyItems = ref<UI_I_DataTableBody[]>([])
150
+
132
151
  watch(
133
152
  () => props.tableData,
134
153
  (newValue: UI_I_TaskItem<UI_T_ProcuratorTypeNodes>[]) => {
@@ -137,13 +156,23 @@ watch(
137
156
  return
138
157
  }
139
158
 
140
- taskBodyItems.value = getBodyDataFunc(newValue, localization.value)
159
+ taskBodyItems.value = getBodyDataFunc(newValue, localization.value) || []
160
+
161
+ if (data.value.header.length === 0) {
162
+ data.value.header = taskHeadItems.value
163
+ }
164
+
165
+ data.value.body = taskBodyItems.value
166
+ console.log(data.value)
141
167
  },
142
168
  { deep: true, immediate: true }
143
169
  )
144
170
  const onSorting = (value: string): void => {
145
171
  emits('sort', value)
146
172
  }
173
+ const onPagination = (value: UI_I_Pagination): void => {
174
+ console.log(value, 'pagination')
175
+ }
147
176
 
148
177
  const actions = computed<UI_I_Dropdown[]>(() =>
149
178
  getTargetActionsFunc(localization.value, props.project)
@@ -245,3 +274,258 @@ const onSelectNodeOfTree = (data: any): void => {
245
274
  }
246
275
  }
247
276
  </style>
277
+
278
+ <!--<template>-->
279
+ <!-- <ui-data-table-->
280
+ <!-- test-id="task-table"-->
281
+ <!-- :data="data"-->
282
+ <!-- :options="options"-->
283
+ <!-- :loading="props.loading"-->
284
+ <!-- :total-pages="props.totalPages"-->
285
+ <!-- :total-items="props.totalItems"-->
286
+ <!-- class="task-table"-->
287
+ <!-- @sorting="onSorting"-->
288
+ <!-- @pagination="onPagination"-->
289
+ <!-- >-->
290
+ <!-- <template #icon="{ item }">-->
291
+ <!-- <span class="flex-align-center">-->
292
+ <!-- <span :class="['icon', item.data.icon]" />-->
293
+
294
+ <!-- <span-->
295
+ <!-- :data-id="`rtask-${item.data.testId}`"-->
296
+ <!-- :class="item.data.isLink && 'target-link'"-->
297
+ <!-- @click.stop="onSelectNodeOfTree(item.data)"-->
298
+ <!-- >-->
299
+ <!-- {{ item.text }}-->
300
+ <!-- </span>-->
301
+ <!-- </span>-->
302
+ <!-- </template>-->
303
+
304
+ <!-- <template #status="{ item }">-->
305
+ <!-- <ui-chip :test-id="item.data.testId" :color="item.data.chipColor" rounded>-->
306
+ <!-- <ui-icon-->
307
+ <!-- :name="item.data.icon"-->
308
+ <!-- width="14px"-->
309
+ <!-- height="14px"-->
310
+ <!-- class="chip-icon"-->
311
+ <!-- ></ui-icon>-->
312
+ <!-- {{ item.text }}-->
313
+ <!-- </ui-chip>-->
314
+
315
+ <!-- <common-pages-tasks-table-error-info-->
316
+ <!-- v-if="item.data.error"-->
317
+ <!-- :id="item.data.testId"-->
318
+ <!-- :error="item.data.error"-->
319
+ <!-- />-->
320
+ <!-- </template>-->
321
+
322
+ <!-- <template #default-actions="{ item }">-->
323
+ <!-- <div class="actions">-->
324
+ <!-- <ui-button-->
325
+ <!-- variant="text"-->
326
+ <!-- :test-id="`resent-task-item-${item.data.id}-action`"-->
327
+ <!-- is-without-height-->
328
+ <!-- is-without-sizes-->
329
+ <!-- @click.stop="onToggleActions(item.data.id)"-->
330
+ <!-- >-->
331
+ <!-- <span-->
332
+ <!-- :class="['action-icon', { active: actionsIsShow[item.data.id] }]"-->
333
+ <!-- >-->
334
+ <!-- <ui-icon name="vertical-dotes" width="20" height="20" />-->
335
+ <!-- </span>-->
336
+ <!-- </ui-button>-->
337
+ <!-- <ui-dropdown-->
338
+ <!-- :show="actionsIsShow[item.data.id]"-->
339
+ <!-- :test-id="`resent-task-item-action-${item.data.id}`"-->
340
+ <!-- :items="actions"-->
341
+ <!-- :elem-id="`resent-task-item-${item.data.id}-action`"-->
342
+ <!-- left-->
343
+ <!-- width="max-content"-->
344
+ <!-- @select="onSelectAction(item.data.target, $event, item.data.id)"-->
345
+ <!-- @hide="onHideActionsDropdown(item.data.id)"-->
346
+ <!-- >-->
347
+ <!-- <template #row="{ item: dropMenu }">-->
348
+ <!-- <ui-icon-->
349
+ <!-- v-if="dropMenu.iconName === 'hide'"-->
350
+ <!-- name="password-hide"-->
351
+ <!-- width="16"-->
352
+ <!-- height="16"-->
353
+ <!-- />-->
354
+ <!-- <span class="action-text">-->
355
+ <!-- {{ dropMenu.text }}-->
356
+ <!-- </span>-->
357
+ <!-- </template>-->
358
+ <!-- </ui-dropdown>-->
359
+ <!-- </div>-->
360
+ <!-- </template>-->
361
+
362
+ <!-- <template #expand="{ item }">-->
363
+ <!-- <common-pages-tasks-table-expand-details :data="item.data" />-->
364
+ <!-- </template>-->
365
+ <!-- </ui-data-table>-->
366
+ <!--</template>-->
367
+
368
+ <!--<script setup lang="ts">-->
369
+ <!--import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'-->
370
+ <!--import type {-->
371
+ <!-- UI_I_DataTable,-->
372
+ <!-- UI_I_DataTableHeader,-->
373
+ <!-- UI_I_DataTableBody,-->
374
+ <!-- UI_I_Pagination,-->
375
+ <!--} from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'-->
376
+ <!--import type { UI_T_Project, UI_T_ProcuratorTypeNodes } from '~/lib/models/types'-->
377
+ <!--import type { UI_I_Localization } from '~/lib/models/interfaces'-->
378
+ <!--import type { UI_I_TaskItem } from '~/lib/models/store/tasks/interfaces'-->
379
+ <!--import {-->
380
+ <!-- options,-->
381
+ <!-- getTargetActionsFunc,-->
382
+ <!-- getHeaderDataFunc,-->
383
+ <!-- getBodyDataFunc,-->
384
+ <!--} from '~/components/common/pages/tasks/table/lib/config/config'-->
385
+
386
+ <!--const props = defineProps<{-->
387
+ <!-- project: UI_T_Project-->
388
+ <!-- tableData: UI_I_TaskItem<UI_T_ProcuratorTypeNodes>[]-->
389
+ <!-- totalPages: number-->
390
+ <!-- totalItems: number-->
391
+ <!-- loading: boolean-->
392
+ <!--}>()-->
393
+ <!--const emits = defineEmits<{-->
394
+ <!-- (event: 'sort', value: string): void-->
395
+ <!--}>()-->
396
+
397
+ <!--const localization = computed<UI_I_Localization>(() => useLocal())-->
398
+ <!--const { $store }: any = useNuxtApp()-->
399
+
400
+ <!--const actionsIsShow = ref<boolean[]>([])-->
401
+
402
+ <!--const data = computed<UI_I_DataTable>(() => ({-->
403
+ <!-- id: 'tasks-table',-->
404
+ <!-- header: taskHeadItems.value,-->
405
+ <!-- body: taskBodyItems.value,-->
406
+ <!--}))-->
407
+
408
+ <!--const taskHeadItems = computed<UI_I_DataTableHeader[]>(() =>-->
409
+ <!-- getHeaderDataFunc(localization.value)-->
410
+ <!--)-->
411
+
412
+ <!--const taskBodyItems = ref<UI_I_DataTableBody[]>([])-->
413
+ <!--watch(-->
414
+ <!-- () => props.tableData,-->
415
+ <!-- (newValue: UI_I_TaskItem<UI_T_ProcuratorTypeNodes>[]) => {-->
416
+ <!-- if (!newValue?.length) {-->
417
+ <!-- taskBodyItems.value = []-->
418
+ <!-- return-->
419
+ <!-- }-->
420
+
421
+ <!-- taskBodyItems.value = getBodyDataFunc(newValue, localization.value)-->
422
+ <!-- },-->
423
+ <!-- { deep: true, immediate: true }-->
424
+ <!--)-->
425
+ <!--const onSorting = (value: string): void => {-->
426
+ <!-- emits('sort', value)-->
427
+ <!--}-->
428
+ <!--const onPagination = (value: UI_I_Pagination): void => {-->
429
+ <!-- console.log(value)-->
430
+ <!--}-->
431
+
432
+ <!--const actions = computed<UI_I_Dropdown[]>(() =>-->
433
+ <!-- getTargetActionsFunc(localization.value, props.project)-->
434
+ <!--)-->
435
+ <!--const onToggleActions = (id: number): void => {-->
436
+ <!-- actionsIsShow.value[id] = !actionsIsShow.value[id]-->
437
+ <!--}-->
438
+ <!--const onSelectAction = (-->
439
+ <!-- data: any,-->
440
+ <!-- action: 'view-target' | 'view-zone',-->
441
+ <!-- actionId: number-->
442
+ <!--): void => {-->
443
+ <!-- switch (action) {-->
444
+ <!-- case 'view-target':-->
445
+ <!-- onSelectNodeOfTree(data)-->
446
+ <!-- break-->
447
+ <!-- case 'view-zone':-->
448
+ <!-- onSelectNodeOfTree({ ...data, type: 'zone', nav: 'h' })-->
449
+ <!-- break-->
450
+ <!-- }-->
451
+ <!-- onHideActionsDropdown(actionId)-->
452
+ <!--}-->
453
+ <!--const onHideActionsDropdown = (id: number): void => {-->
454
+ <!-- actionsIsShow.value[id] = false-->
455
+ <!--}-->
456
+
457
+ <!--const onSelectNodeOfTree = (data: any): void => {-->
458
+ <!-- if (!data.isLink) return-->
459
+
460
+ <!-- const { type, id, nav } = data-->
461
+
462
+ <!-- const node = {-->
463
+ <!-- id,-->
464
+ <!-- type,-->
465
+ <!-- }-->
466
+
467
+ <!-- const path = `/inventory/type=${type};nav=${nav};id=${id}/summary`-->
468
+ <!-- navigateTo(path)-->
469
+
470
+ <!-- $store.dispatch('inventory/A_SELECT_NODE', { node, type })-->
471
+ <!--}-->
472
+ <!--</script>-->
473
+
474
+ <!--<style>-->
475
+ <!--/*TODO move up*/-->
476
+ <!--:root {-->
477
+ <!-- &#45;&#45;actions-icon-color: #4d5d69;-->
478
+ <!-- &#45;&#45;actions-icon-hover-color: #213444;-->
479
+ <!-- &#45;&#45;actions-icon-icative-color: #008fd6;-->
480
+ <!--}-->
481
+ <!--:root.dark-theme {-->
482
+ <!-- &#45;&#45;actions-icon-color: #e9eaec;-->
483
+ <!-- &#45;&#45;actions-icon-hover-color: #ffffff;-->
484
+ <!-- &#45;&#45;actions-icon-icative-color: #2ba2de;-->
485
+ <!--}-->
486
+ <!--</style>-->
487
+ <!--<style scoped lang="scss">-->
488
+ <!--.task-table {-->
489
+ <!-- height: inherit;-->
490
+
491
+ <!-- .target-link {-->
492
+ <!-- font-family: Inter, serif;-->
493
+ <!-- font-size: 13px;-->
494
+ <!-- color: var(&#45;&#45;bottom-pannel-rtask-link-text);-->
495
+ <!-- font-weight: 400;-->
496
+ <!-- line-height: 15.73px;-->
497
+ <!-- cursor: pointer;-->
498
+ <!-- &:hover {-->
499
+ <!-- color: var(&#45;&#45;bottom-pannel-rtask-link-hover-text);-->
500
+ <!-- }-->
501
+ <!-- }-->
502
+ <!-- .chip-icon {-->
503
+ <!-- min-width: 14px;-->
504
+ <!-- margin-right: 6px;-->
505
+ <!-- }-->
506
+ <!-- .icon {-->
507
+ <!-- margin-right: 4px;-->
508
+ <!-- }-->
509
+
510
+ <!-- .actions {-->
511
+ <!-- width: 100%;-->
512
+
513
+ <!-- .action-icon {-->
514
+ <!-- width: 16px;-->
515
+ <!-- height: 16px;-->
516
+ <!-- color: var(&#45;&#45;actions-icon-color);-->
517
+
518
+ <!-- &:hover {-->
519
+ <!-- color: var(&#45;&#45;actions-icon-hover-color);-->
520
+ <!-- }-->
521
+ <!-- &.active {-->
522
+ <!-- color: var(&#45;&#45;actions-icon-icative-color);-->
523
+ <!-- }-->
524
+ <!-- }-->
525
+
526
+ <!-- .action-text {-->
527
+ <!-- margin-left: 8px;-->
528
+ <!-- }-->
529
+ <!-- }-->
530
+ <!--}-->
531
+ <!--</style>-->
@@ -19,7 +19,7 @@ export const getHeaderDataFunc = (
19
19
  localization: UI_I_Localization
20
20
  ): UI_I_DataTableHeader[] => [
21
21
  {
22
- col: 0,
22
+ col: 'col0',
23
23
  colName: 'task_name',
24
24
  text: localization.tasks.taskName,
25
25
  isSortable: true,
@@ -30,7 +30,7 @@ export const getHeaderDataFunc = (
30
30
  filter: true,
31
31
  },
32
32
  {
33
- col: 1,
33
+ col: 'col1',
34
34
  colName: 'target',
35
35
  text: localization.common.target,
36
36
  isSortable: true,
@@ -40,7 +40,7 @@ export const getHeaderDataFunc = (
40
40
  filter: true,
41
41
  },
42
42
  {
43
- col: 2,
43
+ col: 'col2',
44
44
  colName: 'status',
45
45
  text: localization.common.status,
46
46
  isSortable: true,
@@ -50,7 +50,7 @@ export const getHeaderDataFunc = (
50
50
  filter: true,
51
51
  },
52
52
  {
53
- col: 3,
53
+ col: 'col3',
54
54
  colName: 'details',
55
55
  text: localization.common.details,
56
56
  isSortable: true,
@@ -60,7 +60,7 @@ export const getHeaderDataFunc = (
60
60
  filter: true,
61
61
  },
62
62
  {
63
- col: 4,
63
+ col: 'col4',
64
64
  colName: 'initiator',
65
65
  text: localization.common.initiator,
66
66
  isSortable: true,
@@ -70,7 +70,7 @@ export const getHeaderDataFunc = (
70
70
  filter: true,
71
71
  },
72
72
  {
73
- col: 5,
73
+ col: 'col5',
74
74
  colName: 'queued_for',
75
75
  text: localization.common.queuedFor,
76
76
  isSortable: true,
@@ -80,7 +80,7 @@ export const getHeaderDataFunc = (
80
80
  filter: true,
81
81
  },
82
82
  {
83
- col: 6,
83
+ col: 'col6',
84
84
  colName: 'start_time',
85
85
  text: localization.common.startTime,
86
86
  isSortable: true,
@@ -90,7 +90,7 @@ export const getHeaderDataFunc = (
90
90
  filter: true,
91
91
  },
92
92
  {
93
- col: 7,
93
+ col: 'col7',
94
94
  colName: 'completion_time',
95
95
  text: localization.common.completionTime,
96
96
  isSortable: true,
@@ -100,7 +100,7 @@ export const getHeaderDataFunc = (
100
100
  filter: true,
101
101
  },
102
102
  {
103
- col: 8,
103
+ col: 'col8',
104
104
  colName: 'execution_time',
105
105
  text: localization.common.executionTime,
106
106
  isSortable: true,
@@ -110,7 +110,7 @@ export const getHeaderDataFunc = (
110
110
  filter: true,
111
111
  },
112
112
  {
113
- col: 9,
113
+ col: 'col9',
114
114
  colName: 'server',
115
115
  text: localization.common.server,
116
116
  isSortable: true,
@@ -120,7 +120,7 @@ export const getHeaderDataFunc = (
120
120
  filter: true,
121
121
  },
122
122
  {
123
- col: 10,
123
+ col: 'col10',
124
124
  colName: 'zone',
125
125
  text: localization.common.zone,
126
126
  isSortable: true,
@@ -129,12 +129,6 @@ export const getHeaderDataFunc = (
129
129
  show: true,
130
130
  filter: true,
131
131
  },
132
- {
133
- col: 11,
134
- colName: 'default-actions',
135
- text: '',
136
- show: true,
137
- },
138
132
  ]
139
133
 
140
134
  export const getTargetActionsFunc = (
@@ -166,19 +160,20 @@ export const options: UI_I_DataTableOptions = {
166
160
  perPageOptions: [
167
161
  { text: '10', value: 10 },
168
162
  { text: '50', value: 50 },
169
- { text: '100', value: 100 },
163
+ { text: '100', value: 100, default: true },
170
164
  ],
171
165
  isSelectable: true,
172
166
  isFocusable: false,
173
167
  showPagination: true,
174
168
  showPageInfo: true,
175
169
  isSortable: true,
176
- server: false,
170
+ server: true,
177
171
  isResizable: true,
178
172
  showSearch: false,
173
+ showSelectedRows: true,
179
174
  showColumnManager: true,
180
175
  withActions: true,
181
- inBlockOnlyLightMode: true,
176
+ inBlockOnlyLightMode: false,
182
177
  }
183
178
 
184
179
  export const getBodyDataFunc = (
@@ -234,35 +229,35 @@ export const getBodyDataFunc = (
234
229
  isHiddenCollapse: false,
235
230
  collapseToggle: false,
236
231
  data: [
237
- { col: 0, text: task.taskName },
232
+ { col: 'col0', text: task.taskName },
238
233
  {
239
234
  key: 'icon',
240
- col: 1,
235
+ col: 'col1',
241
236
  text: task.target,
242
237
  data: targetData,
243
238
  },
244
239
  {
245
240
  key: 'status',
246
- col: 2,
241
+ col: 'col2',
247
242
  text: localization.common[UI_E_RecentTaskStatus[task.status]],
248
243
  data: statusData,
249
244
  },
250
- { col: 3, text: task.details || '--' },
251
- { col: 4, text: task.initiator },
252
- { col: 5, text: `${task.queuedFor} ms` },
253
- { col: 6, text: formattedStartTime },
254
- { col: 7, text: formattedCompletionTime },
255
- { col: 8, text: `${task.execution} ms` },
256
- { col: 9, text: task.server },
245
+ { col: 'col3', text: task.details || '--' },
246
+ { col: 'col4', text: task.initiator },
247
+ { col: 'col5', text: `${task.queuedFor} ms` },
248
+ { col: 'col6', text: formattedStartTime },
249
+ { col: 'col7', text: formattedCompletionTime },
250
+ { col: 'col8', text: `${task.execution} ms` },
251
+ { col: 'col9', text: task.server },
257
252
  {
258
253
  key: 'icon',
259
- col: 10,
254
+ col: 'col10',
260
255
  text: task.zone,
261
256
  data: zoneData,
262
257
  },
263
258
  {
264
259
  key: 'default-actions',
265
- col: 11,
260
+ col: 'default-actions',
266
261
  text: '',
267
262
  data: { id: index, target: targetData },
268
263
  },
@@ -270,3 +265,277 @@ export const getBodyDataFunc = (
270
265
  }
271
266
  })
272
267
  }
268
+
269
+ // import type {
270
+ // UI_I_DataTableBody,
271
+ // UI_I_DataTableOptions,
272
+ // UI_I_DataTableHeader,
273
+ // } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
274
+ // import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
275
+ // import type { UI_I_Localization } from '~/lib/models/interfaces'
276
+ // import type { UI_I_TaskItem } from '~/lib/models/store/tasks/interfaces'
277
+ // import { UI_E_RecentTaskStatus } from '~/lib/models/store/tasks/enums'
278
+ // import {
279
+ // UI_E_RTaskChipColor,
280
+ // UI_E_RTaskStatusIcon,
281
+ // } from '~/components/common/pages/tasks/table/lib/models/enums'
282
+ // import type { UI_T_Project } from '~/lib/models/types'
283
+ // import type { UI_T_ProcuratorTypeNodes } from '~/lib/models/types'
284
+ // import * as taskConfig from '~/components/templates/tasks/lib/config/taskConfig' // url из ( sphere, procurator )
285
+ //
286
+ // export const getHeaderDataFunc = (
287
+ // localization: UI_I_Localization
288
+ // ): UI_I_DataTableHeader[] => [
289
+ // {
290
+ // col: 0,
291
+ // colName: 'task_name',
292
+ // text: localization.tasks.taskName,
293
+ // isSortable: true,
294
+ // sort: 'asc',
295
+ // sortColumn: true,
296
+ // width: '180px',
297
+ // show: true,
298
+ // filter: true,
299
+ // },
300
+ // {
301
+ // col: 1,
302
+ // colName: 'target',
303
+ // text: localization.common.target,
304
+ // isSortable: true,
305
+ // sort: 'asc',
306
+ // width: '180px',
307
+ // show: true,
308
+ // filter: true,
309
+ // },
310
+ // {
311
+ // col: 2,
312
+ // colName: 'status',
313
+ // text: localization.common.status,
314
+ // isSortable: true,
315
+ // sort: 'asc',
316
+ // width: '180px',
317
+ // show: true,
318
+ // filter: true,
319
+ // },
320
+ // {
321
+ // col: 3,
322
+ // colName: 'details',
323
+ // text: localization.common.details,
324
+ // isSortable: true,
325
+ // sort: 'asc',
326
+ // width: '180px',
327
+ // show: true,
328
+ // filter: true,
329
+ // },
330
+ // {
331
+ // col: 4,
332
+ // colName: 'initiator',
333
+ // text: localization.common.initiator,
334
+ // isSortable: true,
335
+ // sort: 'asc',
336
+ // width: '180px',
337
+ // show: true,
338
+ // filter: true,
339
+ // },
340
+ // {
341
+ // col: 5,
342
+ // colName: 'queued_for',
343
+ // text: localization.common.queuedFor,
344
+ // isSortable: true,
345
+ // sort: 'asc',
346
+ // width: '180px',
347
+ // show: true,
348
+ // filter: true,
349
+ // },
350
+ // {
351
+ // col: 6,
352
+ // colName: 'start_time',
353
+ // text: localization.common.startTime,
354
+ // isSortable: true,
355
+ // sort: 'asc',
356
+ // width: '180px',
357
+ // show: true,
358
+ // filter: true,
359
+ // },
360
+ // {
361
+ // col: 7,
362
+ // colName: 'completion_time',
363
+ // text: localization.common.completionTime,
364
+ // isSortable: true,
365
+ // sort: 'asc',
366
+ // width: '180px',
367
+ // show: true,
368
+ // filter: true,
369
+ // },
370
+ // {
371
+ // col: 8,
372
+ // colName: 'execution_time',
373
+ // text: localization.common.executionTime,
374
+ // isSortable: true,
375
+ // sort: 'asc',
376
+ // width: '180px',
377
+ // show: true,
378
+ // filter: true,
379
+ // },
380
+ // {
381
+ // col: 9,
382
+ // colName: 'server',
383
+ // text: localization.common.server,
384
+ // isSortable: true,
385
+ // sort: 'asc',
386
+ // width: '180px',
387
+ // show: true,
388
+ // filter: true,
389
+ // },
390
+ // {
391
+ // col: 10,
392
+ // colName: 'zone',
393
+ // text: localization.common.zone,
394
+ // isSortable: true,
395
+ // sort: 'asc',
396
+ // width: '180px',
397
+ // show: true,
398
+ // filter: true,
399
+ // },
400
+ // {
401
+ // col: 11,
402
+ // colName: 'default-actions',
403
+ // text: '',
404
+ // show: true,
405
+ // },
406
+ // ]
407
+ //
408
+ // export const getTargetActionsFunc = (
409
+ // localization: UI_I_Localization,
410
+ // project: UI_T_Project
411
+ // ): UI_I_Dropdown[] => {
412
+ // const actions: UI_I_Dropdown[] = [
413
+ // {
414
+ // value: 'view-target',
415
+ // text: localization.common.viewTarget,
416
+ // iconName: 'hide',
417
+ // selected: false,
418
+ // },
419
+ // ]
420
+ //
421
+ // if (project === 'sphere') {
422
+ // actions.push({
423
+ // value: 'view-zone',
424
+ // text: localization.common.viewZone,
425
+ // iconName: 'hide',
426
+ // selected: false,
427
+ // })
428
+ // }
429
+ //
430
+ // return actions
431
+ // }
432
+ //
433
+ // export const options: UI_I_DataTableOptions = {
434
+ // perPageOptions: [
435
+ // { text: '10', value: 10 },
436
+ // { text: '50', value: 50 },
437
+ // { text: '100', value: 100 },
438
+ // ],
439
+ // isSelectable: true,
440
+ // isFocusable: false,
441
+ // showPagination: true,
442
+ // showPageInfo: true,
443
+ // isSortable: true,
444
+ // server: true,
445
+ // isResizable: true,
446
+ // showSearch: false,
447
+ // showSelectedRows: true,
448
+ // showColumnManager: true,
449
+ // withActions: true,
450
+ // inBlockOnlyLightMode: true,
451
+ // }
452
+ //
453
+ // export const getBodyDataFunc = (
454
+ // bodyData: UI_I_TaskItem<UI_T_ProcuratorTypeNodes>[],
455
+ // localization: UI_I_Localization
456
+ // ): UI_I_DataTableBody[] => {
457
+ // const { $formattedDatetime } = useNuxtApp() as any
458
+ //
459
+ // return bodyData.map((task, index: number) => {
460
+ // const iconClassName = taskConfig.iconFunc(task.targetType)
461
+ // const id = taskConfig.idFunc(task)
462
+ // const nav = taskConfig.navFunc(task.targetType)
463
+ // const type = taskConfig.typeFunc(task.targetType)
464
+ //
465
+ // const targetData = {
466
+ // id,
467
+ // nav,
468
+ // type,
469
+ // icon: iconClassName,
470
+ // isLink: !!iconClassName,
471
+ // testId: `${task.targetType}-item`,
472
+ // }
473
+ //
474
+ // const statusData = {
475
+ // icon: UI_E_RTaskStatusIcon[task.status],
476
+ // chipColor: UI_E_RTaskChipColor[task.status],
477
+ // error: task.error,
478
+ // testId: `${task.taskName}-progress`,
479
+ // }
480
+ //
481
+ // const zoneNodeParams = taskConfig.zoneNodeFunc(task, nav)
482
+ // const zoneData = {
483
+ // ...zoneNodeParams,
484
+ // nav,
485
+ // icon: 'vsphere-icon-vcenter',
486
+ // type: 'zone',
487
+ // testId: `${task.targetType}-zone`,
488
+ // }
489
+ //
490
+ // const formattedStartTime =
491
+ // task.startTime === '--'
492
+ // ? '--'
493
+ // : $formattedDatetime(+task.startTime * 1000, '', true)
494
+ //
495
+ // const formattedCompletionTime =
496
+ // task.completion === '--'
497
+ // ? '--'
498
+ // : $formattedDatetime(+task.completion * 1000, '', true)
499
+ //
500
+ // return {
501
+ // row: index,
502
+ // collapse: true,
503
+ // isHiddenCollapse: false,
504
+ // collapseToggle: false,
505
+ // data: [
506
+ // { col: 0, text: task.taskName },
507
+ // {
508
+ // key: 'icon',
509
+ // col: 1,
510
+ // text: task.target,
511
+ // data: targetData,
512
+ // },
513
+ // {
514
+ // key: 'status',
515
+ // col: 2,
516
+ // text: localization.common[UI_E_RecentTaskStatus[task.status]],
517
+ // data: statusData,
518
+ // },
519
+ // { col: 3, text: task.details || '--' },
520
+ // { col: 4, text: task.initiator },
521
+ // { col: 5, text: `${task.queuedFor} ms` },
522
+ // { col: 6, text: formattedStartTime },
523
+ // { col: 7, text: formattedCompletionTime },
524
+ // { col: 8, text: `${task.execution} ms` },
525
+ // { col: 9, text: task.server },
526
+ // {
527
+ // key: 'icon',
528
+ // col: 10,
529
+ // text: task.zone,
530
+ // data: zoneData,
531
+ // },
532
+ // {
533
+ // key: 'default-actions',
534
+ // col: 11,
535
+ // text: '',
536
+ // data: { id: index, target: targetData },
537
+ // },
538
+ // ],
539
+ // }
540
+ // })
541
+ // }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.700",
4
+ "version": "1.4.703",
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.275",
38
+ "bfg-uikit": "1.0.289",
39
39
  "html2canvas": "^1.4.1",
40
40
  "prettier-eslint": "^15.0.1"
41
41
  }
@@ -1,120 +0,0 @@
1
- <template>
2
- <div class="tasks">
3
- <common-headline
4
- :headline="localization.common.tasksConsole"
5
- class="tasks__headline"
6
- />
7
-
8
- <div class="btn-group">
9
- <button
10
- id="task-previous-button"
11
- data-id="task-previous-button"
12
- class="btn btn-sm btn-link nav-link"
13
- :disabled="pagination.page === 1"
14
- @click="onClickButton('previous')"
15
- >
16
- {{ localization.common.previous }}
17
- </button>
18
-
19
- <button
20
- id="task-next-button"
21
- data-id="task-next-button"
22
- class="btn btn-sm btn-link nav-link"
23
- :disabled="pagination.page === tasksList?.total_pages"
24
- @click="onClickButton('next')"
25
- >
26
- {{ localization.common.next }}
27
- </button>
28
- </div>
29
-
30
- <templates-tasks-table-view
31
- :data-table="tasksList?.items || []"
32
- :total-items="tasksList?.total_items || 0"
33
- :total-pages="tasksList?.total_pages || 1"
34
- :pagination="pagination"
35
- :loading="isLoading"
36
- @pagination="onUpdatePagination"
37
- @sort="onSortTable"
38
- />
39
- </div>
40
- </template>
41
-
42
- <script lang="ts" setup>
43
- import type { UI_I_Localization } from '~/lib/models/interfaces'
44
- import type {
45
- UI_I_Pagination,
46
- UI_I_DataTableQuery,
47
- } from '~/lib/models/table/interfaces'
48
- import type { UI_I_Task } from '~/lib/models/store/tasks/interfaces'
49
-
50
- definePageMeta({
51
- middleware: ['auth'],
52
- })
53
-
54
- const localization = computed<UI_I_Localization>(() => useLocal())
55
- const { $store }: any = useNuxtApp()
56
-
57
- const pagination = ref<UI_I_Pagination>({
58
- page: 1,
59
- pageSize: 100,
60
- })
61
- const sort = ref<string | null>(null)
62
-
63
- const tasksList = computed<UI_I_Task>(() => $store.getters['tasks/getTaskList'])
64
-
65
- const onClickButton = (status: string): void => {
66
- if (status === 'next') {
67
- pagination.value.page += 1
68
- return
69
- }
70
-
71
- pagination.value.page -= 1
72
- }
73
-
74
- const getTasks = async (): Promise<void> => {
75
- pauseGlobalRefresh()
76
-
77
- const payload: UI_I_DataTableQuery = {
78
- ...pagination.value,
79
- sortBy: sort.value || '',
80
- }
81
- await $store.dispatch('tasks/A_GET_TASKS', payload)
82
- }
83
-
84
- const onUpdatePagination = (event: UI_I_Pagination): void => {
85
- pagination.value = event
86
- getTasks()
87
- }
88
-
89
- const onSortTable = (event: string): void => {
90
- sort.value = event
91
- getTasks()
92
- }
93
-
94
- const isLoading = computed<boolean>(() =>
95
- $store.getters['tasks/getLoading']('tasks')
96
- )
97
- const pauseGlobalRefresh = (): void => {
98
- const tasksLastRequestType = $store.getters['tasks/getTasksLastRequestType']
99
- $store.dispatch('main/A_PAUSE_GLOBAL_REFRESH', tasksLastRequestType)
100
- }
101
- onUnmounted(() => {
102
- pauseGlobalRefresh()
103
- })
104
- </script>
105
-
106
- <style lang="scss">
107
- @import '~/node_modules/bfg-common/assets/scss/common/mixins';
108
- .tasks {
109
- @include flex($dir: column);
110
- height: 100%;
111
- padding-left: 10px;
112
- &__headline {
113
- padding-left: 10px;
114
- margin-bottom: 0.6rem;
115
- }
116
- .btn {
117
- text-transform: uppercase;
118
- }
119
- }
120
- </style>