bfg-common 1.4.485 → 1.4.487

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.
@@ -2,9 +2,7 @@
2
2
  <common-pages-home-widgets-new
3
3
  v-if="isNewView"
4
4
  :vms="vms"
5
- :vms-all="vmsAll"
6
5
  :hosts="hosts"
7
- :hosts-all="hostsAll"
8
6
  :alerts="alerts || []"
9
7
  :services="services || []"
10
8
  ></common-pages-home-widgets-new>
@@ -12,9 +10,7 @@
12
10
  <common-pages-home-widgets-old
13
11
  v-else
14
12
  :vms="vms"
15
- :vms-all="vmsAll"
16
13
  :hosts="hosts"
17
- :hosts-all="hostsAll"
18
14
  :alerts="alerts || []"
19
15
  :services="services || []"
20
16
  ></common-pages-home-widgets-old>
@@ -38,17 +34,8 @@ const { $store }: any = useNuxtApp()
38
34
  const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
39
35
 
40
36
  const vms = computed<UI_I_Vms>(() => props.homeInfo.vms || {})
41
-
42
37
  const hosts = computed<UI_I_Hosts>(() => props.homeInfo.hosts || {})
43
- const vmsAll = computed<number>(
44
- () => vms.value.powered_on + vms.value.powered_off + vms.value.suspended || 0
45
- )
46
- const hostsAll = computed<number>(
47
- () =>
48
- hosts.value.connected +
49
- hosts.value.maintenance +
50
- hosts.value.disconnected || 0
51
- )
38
+
52
39
  const alerts = computed<UI_I_Alert[]>(() => props.homeInfo.alerts || 0)
53
40
  const services = computed<UI_I_Service[]>(() => props.homeInfo.services || 0)
54
41
  </script>
@@ -5,9 +5,9 @@
5
5
  </h1>
6
6
 
7
7
  <div class="grid-container">
8
- <common-pages-home-widgets-vms :vms="vms" :vms-all="vmsAll" />
8
+ <common-pages-home-widgets-vms :vms="vms" />
9
9
 
10
- <common-pages-home-widgets-hosts :hosts="hosts" :hosts-all="hostsAll" />
10
+ <common-pages-home-widgets-hosts :hosts="hosts" />
11
11
  </div>
12
12
  </div>
13
13
 
@@ -36,8 +36,6 @@ import type {
36
36
  const props = defineProps<{
37
37
  vms: UI_I_Vms
38
38
  hosts: UI_I_Hosts
39
- vmsAll: number
40
- hostsAll: number
41
39
  alerts: UI_I_Alert[]
42
40
  services: UI_I_Service[]
43
41
  }>()
@@ -1,11 +1,8 @@
1
1
  <template>
2
2
  <div class="clr-row">
3
- <common-pages-home-widgets-vms :vms="props.vms" :vms-all="props.vmsAll" />
3
+ <common-pages-home-widgets-vms :vms="props.vms" />
4
4
 
5
- <common-pages-home-widgets-hosts
6
- :hosts="props.hosts"
7
- :hosts-all="props.hostsAll"
8
- />
5
+ <common-pages-home-widgets-hosts :hosts="props.hosts" />
9
6
 
10
7
  <common-pages-home-widgets-warnings :alerts="props.alerts" />
11
8
 
@@ -24,8 +21,6 @@ import type {
24
21
  const props = defineProps<{
25
22
  vms: UI_I_Vms
26
23
  hosts: UI_I_Hosts
27
- vmsAll: number
28
- hostsAll: number
29
24
  alerts: UI_I_Alert[]
30
25
  services: UI_I_Service[]
31
26
  }>()
@@ -7,7 +7,7 @@
7
7
  <common-pages-home-widgets-hosts-old
8
8
  v-else
9
9
  :hosts="props.hosts"
10
- :hosts-all="props.hostsAll"
10
+ :total-hosts="totalHosts"
11
11
  ></common-pages-home-widgets-hosts-old>
12
12
  </template>
13
13
 
@@ -16,12 +16,18 @@ import type { UI_I_Hosts } from '~/components/common/home/lib/models/interfaces'
16
16
 
17
17
  const props = defineProps<{
18
18
  hosts: UI_I_Hosts
19
- hostsAll: number
20
19
  }>()
21
20
 
22
21
  const { $store }: any = useNuxtApp()
23
22
 
24
23
  const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
24
+
25
+ const totalHosts = computed<number>(
26
+ () =>
27
+ props.hosts.connected +
28
+ props.hosts.maintenance +
29
+ props.hosts.disconnected || 0
30
+ )
25
31
  </script>
26
32
 
27
33
  <style lang="scss" scoped></style>
@@ -3,7 +3,7 @@
3
3
  <div class="entity-status">
4
4
  <common-pages-home-card
5
5
  :title="localization.common.hosts"
6
- :count="props.hostsAll"
6
+ :count="props.totalHosts"
7
7
  icon-name="vsphere-icon-host"
8
8
  >
9
9
  <common-home-status-content :items="props.hosts" />
@@ -17,7 +17,7 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
17
17
  import type { UI_I_Hosts } from '~/components/common/home/lib/models/interfaces'
18
18
  const props = defineProps<{
19
19
  hosts: UI_I_Hosts
20
- hostsAll: number
20
+ totalHosts: number
21
21
  }>()
22
22
 
23
23
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <common-pages-home-widgets-services-new
3
3
  v-if="isNewView"
4
+ :services="props.services"
4
5
  :loading="false"
5
6
  ></common-pages-home-widgets-services-new>
6
7
 
@@ -3,14 +3,19 @@
3
3
  <template v-if="props.loading">
4
4
  <!-- skeleton -->
5
5
  </template>
6
- <div v-else>
6
+ <div v-else class="services-table">
7
+ <div class="services-table__title">
8
+ <h1>{{ localization.home.services }}</h1>
9
+ <span>({{ props.services.length }})</span>
10
+ </div>
11
+
7
12
  <ui-data-table
8
- test-id="data-table-main"
13
+ test-id="home-services-table-main"
9
14
  :data="data"
10
15
  :options="options"
11
16
  :loading="props.loading"
17
+ size="sm"
12
18
  server-off
13
- class="resent-task-table"
14
19
  >
15
20
  <template #icon="{ item }">
16
21
  <span class="flex-align-center">
@@ -36,6 +41,7 @@ import type {
36
41
  UI_I_DataTableHeader,
37
42
  UI_I_DataTableBody,
38
43
  } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
44
+ import type { UI_I_Service } from '~/components/common/home/lib/models/interfaces'
39
45
  import {
40
46
  options,
41
47
  getHeaderDataFunc,
@@ -43,7 +49,7 @@ import {
43
49
  } from '~/components/common/pages/home/widgets/services/lib/config/config'
44
50
 
45
51
  const props = defineProps<{
46
- tableData: any
52
+ services: UI_I_Service[]
47
53
  loading: boolean
48
54
  }>()
49
55
 
@@ -61,8 +67,8 @@ const resentTaskHeadItems = computed<UI_I_DataTableHeader[]>(() =>
61
67
 
62
68
  const resentTaskBodyItems = ref<UI_I_DataTableBody[]>([])
63
69
  watch(
64
- () => props.tableData,
65
- (newValue) => {
70
+ () => props.services,
71
+ (newValue: UI_I_Service[]) => {
66
72
  if (!newValue?.length) return
67
73
 
68
74
  resentTaskBodyItems.value = getBodyDataFunc(newValue, localization.value)
@@ -72,6 +78,26 @@ watch(
72
78
  </script>
73
79
 
74
80
  <style lang="scss" scoped>
81
+ @import 'assets/scss/common/mixins.scss';
82
+ .services-table {
83
+ :deep(.default-layout) {
84
+ box-shadow: none;
85
+ padding: 0;
86
+ }
87
+
88
+ &__title {
89
+ @include flex($align: center);
90
+ color: var(--widget-text-first);
91
+ font-size: 16px;
92
+ font-weight: 500;
93
+ line-height: 19.36px;
94
+ & > span {
95
+ margin-left: 5px;
96
+ font-size: 16px;
97
+ }
98
+ }
99
+ }
100
+
75
101
  .target-link {
76
102
  font-family: Inter, serif;
77
103
  font-size: 13px;
@@ -5,8 +5,7 @@ import type {
5
5
  UI_I_DataTableHeader,
6
6
  } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
7
7
  import { UI_E_RecentTaskStatus } from '~/lib/models/store/tasks/enums'
8
- import { E_NodeIconsByState } from '~/lib/models/enums'
9
- // import { E_TabsByType } from '~/components/templates/inventory/lib/models/enums'
8
+ import type { UI_I_Service } from '~/components/common/home/lib/models/interfaces'
10
9
  import {
11
10
  E_RTaskChipColor,
12
11
  E_RTaskStatusIcon,
@@ -62,26 +61,24 @@ export const options: UI_I_DataTableOptions = {
62
61
  }
63
62
 
64
63
  export const getBodyDataFunc = (
65
- bodyData: any,
64
+ bodyData: UI_I_Service[],
66
65
  localization: UI_I_Localization
67
66
  ): UI_I_DataTableBody[] => {
68
- return bodyData.map((task, index: number) => {
69
- const iconClassName = E_NodeIconsByState[`${task.targetType}_Normal`]
70
- const id = task.extra?.created_id || task.target
67
+ return bodyData.map((service, index: number) => {
71
68
  const targetData = {
72
- id,
73
- icon: iconClassName,
74
- // nav: E_TabsByType[task.targetType],
75
- type: task.targetType,
69
+ icon: `vsphere-icon-status-${service.statusIcon}`,
76
70
  isLink: true,
77
- testId: `${task.targetType}-item`,
71
+ testId: `${service.item}-item`,
72
+ // id,
73
+ // nav: E_TabsByType[task.targetType],
74
+ // type,
78
75
  }
79
76
 
80
77
  const statusData = {
81
- icon: E_RTaskStatusIcon[task.status],
82
- chipColor: E_RTaskChipColor[task.status],
83
- error: task.error,
84
- testId: `${task.taskName}-progress`,
78
+ icon: E_RTaskStatusIcon[service.statusText],
79
+ chipColor: E_RTaskChipColor[service.statusText],
80
+ error: service.statusText,
81
+ testId: `${service.statusText}-progress`,
85
82
  }
86
83
 
87
84
  return {
@@ -93,16 +90,16 @@ export const getBodyDataFunc = (
93
90
  {
94
91
  key: 'icon',
95
92
  col: 0,
96
- text: task.target,
93
+ text: service.item,
97
94
  data: targetData,
98
95
  },
99
96
  {
100
97
  key: 'status',
101
98
  col: 1,
102
- text: localization.common[UI_E_RecentTaskStatus[task.status]],
99
+ text: localization.common[UI_E_RecentTaskStatus[service.statusText]],
103
100
  data: statusData,
104
101
  },
105
- { col: 2, text: task.taskName },
102
+ { col: 2, text: service.version },
106
103
  ],
107
104
  }
108
105
  })
@@ -7,7 +7,7 @@
7
7
  <common-pages-home-widgets-vms-old
8
8
  v-else
9
9
  :vms="props.vms"
10
- :vms-all="props.vmsAll"
10
+ :total-vms="totalVms"
11
11
  ></common-pages-home-widgets-vms-old>
12
12
  </template>
13
13
 
@@ -16,12 +16,15 @@ import type { UI_I_Vms } from '~/components/common/home/lib/models/interfaces'
16
16
 
17
17
  const props = defineProps<{
18
18
  vms: UI_I_Vms
19
- vmsAll: number
20
19
  }>()
21
20
 
22
21
  const { $store }: any = useNuxtApp()
23
22
 
24
23
  const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
24
+
25
+ const totalVms = computed<number>(
26
+ () => props.vms.powered_on + props.vms.powered_off + props.vms.suspended || 0
27
+ )
25
28
  </script>
26
29
 
27
30
  <style lang="scss" scoped></style>
@@ -3,7 +3,7 @@
3
3
  <div class="entity-status">
4
4
  <common-pages-home-card
5
5
  :title="localization.common.vms"
6
- :count="props.vmsAll"
6
+ :count="props.totalVms"
7
7
  icon-name="vsphere-icon-vm"
8
8
  >
9
9
  <common-home-status-content :items="props.vms" />
@@ -17,7 +17,7 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
17
17
  import type { UI_I_Vms } from '~/components/common/home/lib/models/interfaces'
18
18
  const props = defineProps<{
19
19
  vms: UI_I_Vms
20
- vmsAll: number
20
+ totalVms: number
21
21
  }>()
22
22
 
23
23
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <common-pages-home-widgets-warnings-new
3
3
  v-if="isNewView"
4
+ :alerts="props.alerts"
4
5
  :loading="false"
5
6
  ></common-pages-home-widgets-warnings-new>
6
7
 
@@ -3,14 +3,19 @@
3
3
  <template v-if="props.loading">
4
4
  <!-- skeleton -->
5
5
  </template>
6
- <div v-else>
6
+ <div v-else class="warnings-table">
7
+ <div class="warnings-table__title">
8
+ <h1>{{ localization.home.objectsWithMostAlerts }}</h1>
9
+ <span>({{ props.alerts.length }})</span>
10
+ </div>
11
+
7
12
  <ui-data-table
8
- test-id="data-table-main"
13
+ test-id="home-warnings-table-main"
9
14
  :data="data"
10
15
  :options="options"
11
16
  :loading="props.loading"
17
+ size="sm"
12
18
  server-off
13
- class="resent-task-table"
14
19
  >
15
20
  <template #icon="{ item }">
16
21
  <span class="flex-align-center">
@@ -36,6 +41,7 @@ import type {
36
41
  UI_I_DataTableHeader,
37
42
  UI_I_DataTableBody,
38
43
  } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
44
+ import type { UI_I_Alert } from '~/components/common/home/lib/models/interfaces'
39
45
  import {
40
46
  options,
41
47
  getHeaderDataFunc,
@@ -43,6 +49,7 @@ import {
43
49
  } from '~/components/common/pages/home/widgets/warnings/lib/config/config'
44
50
 
45
51
  const props = defineProps<{
52
+ alerts: UI_I_Alert[]
46
53
  loading: boolean
47
54
  }>()
48
55
 
@@ -60,8 +67,8 @@ const resentTaskHeadItems = computed<UI_I_DataTableHeader[]>(() =>
60
67
 
61
68
  const resentTaskBodyItems = ref<UI_I_DataTableBody[]>([])
62
69
  watch(
63
- () => props.tableData,
64
- (newValue) => {
70
+ () => props.alerts,
71
+ (newValue: UI_I_Alert[]) => {
65
72
  if (!newValue?.length) return
66
73
 
67
74
  resentTaskBodyItems.value = getBodyDataFunc(newValue, localization.value)
@@ -70,4 +77,24 @@ watch(
70
77
  )
71
78
  </script>
72
79
 
73
- <style lang="scss" scoped></style>
80
+ <style lang="scss" scoped>
81
+ @import 'assets/scss/common/mixins.scss';
82
+ .warnings-table {
83
+ :deep(.default-layout) {
84
+ box-shadow: none;
85
+ padding: 0;
86
+ }
87
+
88
+ &__title {
89
+ @include flex($align: center);
90
+ color: var(--widget-text-first);
91
+ font-size: 16px;
92
+ font-weight: 500;
93
+ line-height: 19.36px;
94
+ & > span {
95
+ margin-left: 5px;
96
+ font-size: 16px;
97
+ }
98
+ }
99
+ }
100
+ </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.485",
4
+ "version": "1.4.487",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",