bfg-common 1.6.90 → 1.6.92

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.
@@ -13,6 +13,7 @@ import type {
13
13
  UI_I_UtilizationDataItem,
14
14
  } from '~/components/common/monitor/utilization/lib/models/interfaces'
15
15
  import type { UI_I_Localization } from '~/lib/models/interfaces'
16
+ import type { T_NodeType } from '~/components/templates/inventory/lib/models/types'
16
17
  import { constructApiData } from '~/components/common/monitor/utilization/lib/utils'
17
18
 
18
19
  const props = defineProps<{
@@ -22,6 +23,10 @@ const props = defineProps<{
22
23
 
23
24
  const { $store }: any = useNuxtApp()
24
25
 
26
+ const routeType = computed<T_NodeType>(
27
+ () => useRoute().params.type.toString() as T_NodeType
28
+ )
29
+
25
30
  const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
26
31
 
27
32
  const currentComponent = computed(() =>
@@ -40,7 +45,8 @@ watch(
40
45
  if (props.apiData) {
41
46
  constructedData.value = constructApiData(
42
47
  props.apiData,
43
- localization.value
48
+ localization.value,
49
+ routeType.value
44
50
  )
45
51
  }
46
52
  },
@@ -3,7 +3,7 @@ import type {
3
3
  UI_I_UtilizationDataItem,
4
4
  } from '~/components/common/monitor/utilization/lib/models/interfaces'
5
5
  import type { UI_I_Localization } from '~/lib/models/interfaces'
6
- import { UI_E_UtilizationBlockCurrentKeys } from '~/components/common/monitor/utilization/lib/models/enums'
6
+ import type { T_NodeType } from '~/components/templates/inventory/lib/models/types'
7
7
  import { getMetricsLocalizationByKey } from '~/components/common/monitor/lib/utils/localization'
8
8
 
9
9
  const currentColorKey = (value: string): string => {
@@ -29,9 +29,30 @@ const currentColorKey = (value: string): string => {
29
29
  return result
30
30
  }
31
31
 
32
+ const currentTitle = (
33
+ routeType: T_NodeType,
34
+ currentType: string,
35
+ localization: UI_I_Localization
36
+ ): string => {
37
+ let result: string = ''
38
+
39
+ if (routeType === 'host') {
40
+ if (currentType === 'cpu') result = localization.common.hostCpu
41
+ if (currentType === 'memory') result = localization.common.hostMem
42
+ } else if (routeType === 'vm') {
43
+ if (currentType === 'cpu')
44
+ result = localization.inventoryMonitor.virtualMachineCpu
45
+ if (currentType === 'memory')
46
+ result = localization.inventoryMonitor.virtualMachineMemory
47
+ }
48
+
49
+ return result
50
+ }
51
+
32
52
  export const constructApiData = (
33
53
  apiData: API_UI_I_UtilizationData | null,
34
- localization: UI_I_Localization
54
+ localization: UI_I_Localization,
55
+ routeType: T_NodeType
35
56
  ): UI_I_UtilizationDataItem[] => {
36
57
  if (!apiData) return []
37
58
 
@@ -49,7 +70,7 @@ export const constructApiData = (
49
70
  result.push({
50
71
  isShow,
51
72
  id: key,
52
- title: localization.common[UI_E_UtilizationBlockCurrentKeys[key]] || key,
73
+ title: currentTitle(routeType, currentType, localization) || key,
53
74
  type: currentType,
54
75
  data: apiData[key].items.map((item) => {
55
76
  const color = ![
@@ -68,6 +68,7 @@ export interface UI_I_Localization {
68
68
  packages: UI_I_ArbitraryObject<string>
69
69
  dhcpServer: UI_I_ArbitraryObject<string>
70
70
  logs: UI_I_ArbitraryObject<string>
71
+ timeConfiguration: UI_I_ArbitraryObject<string>
71
72
  }
72
73
  export interface UI_I_SendTaskParams {
73
74
  method: string
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.6.90",
4
+ "version": "1.6.92",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -1,4 +0,0 @@
1
- export enum UI_E_UtilizationBlockCurrentKeys {
2
- cpuUtilization = 'hostCpu',
3
- hostMemoryUtilization = 'hostMem',
4
- }