bfg-common 1.4.722 → 1.4.723

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,206 +1,213 @@
1
- <template>
2
- <div class="hardware-health">
3
- <common-headline :headline="localization.common.hardwareHealth" />
4
-
5
- <div class="hardware-health__description">
6
- {{ hardwareHealthDescription }}
7
- </div>
8
-
9
- <atoms-tabs
10
- v-model="activeTab"
11
- test-id="hardware-health-tabs"
12
- :items="hardwareHealthTabs"
13
- size="small"
14
- class="hardware-health__tabs"
15
- />
16
-
17
- <atoms-alert
18
- v-if="activeTab === 'storage-sensor'"
19
- :items="['content text']"
20
- status="alert-warning"
21
- test-id="select-storage-sensor-alert"
22
- hide-close-icon
23
- >
24
- <template #default="">
25
- <p>
26
- {{ generateAlertTextWithLink.before }}
27
- <a
28
- :href="generateAlertTextWithLink.link"
29
- data-id="general-alert-text-link"
30
- >
31
- {{ generateAlertTextWithLink.linkText }}
32
- </a>
33
- {{ generateAlertTextWithLink.after }}
34
- </p>
35
- </template>
36
- </atoms-alert>
37
-
38
- <common-pages-hardware-health-tools-panel :selected-tab="activeTab" />
39
-
40
- <div :class="['hardware-health__content', activeTab]">
41
- <common-pages-hardware-health-history-testimony-graph
42
- v-if="activeTab === 'history-testimony'"
43
- v-model:selected-view="selectedGraphView"
44
- :power-data="props.historyTestimonyPower"
45
- :temperature-data="props.historyTestimonyTemperature"
46
- :counters-table-data="hardwareHealth"
47
- :language="props.language"
48
- :power-loading="props.loadingPowerData"
49
- :temperature-loading="props.loadingTemperatureData"
50
- :formatted-datetime="props.formattedDatetime"
51
- :is-dark-mode="props.isDarkMode"
52
- :get-date-format="props.getDateFormat"
53
- :main-selected-row="selectedRow"
54
- @update-tools="onUpdateHistoryTestimonyTools"
55
- />
56
-
57
- <common-pages-hardware-health-table-view
58
- :key="uniqueKey"
59
- v-model:selected-row="selectedRow"
60
- :selected-graph-view="selectedGraphView"
61
- :data-table="hardwareHealth"
62
- :total-items="hardwareHealth.length"
63
- :total-pages="1"
64
- :table-mode="activeTab"
65
- :loading="props.loading"
66
- />
67
- </div>
68
- </div>
69
- </template>
70
-
71
- <script lang="ts" setup>
72
- import type { I_SeriesLine } from '~/node_modules/bfg-nuxt-3-graph/graph/lib/models/interfaces'
73
- import type { UI_I_Localization } from '~/lib/models/interfaces'
74
- import type { UI_I_HardwareHealthSensors } from '~/components/common/pages/hardwareHealth/tableView/lib/models/interfaces'
75
- import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
76
- import type { UI_I_StorageSensorsAlert } from '~/components/common/pages/hardwareHealth/lib/models/interfaces'
77
- import type { UI_T_HardwareHealthTabMode } from '~/components/common/pages/hardwareHealth/lib/models/types'
78
- import { hardwareHealthTabsFunc } from '~/components/common/pages/hardwareHealth/lib/config/tabsPannel'
79
- import type {
80
- UI_I_HardwareHealthHistoryTestimonyTools
81
- } from "~/components/common/pages/hardwareHealth/historyTestimony/lib/models/interfaces";
82
-
83
- const emits = defineEmits<{
84
- (event: 'update-history-testimony-tools', value: UI_I_HardwareHealthHistoryTestimonyTools): void
85
- }>()
86
- const props = defineProps<{
87
- data: UI_I_HardwareHealthSensors[]
88
- loading: boolean
89
- historyTestimonyPower: I_SeriesLine | null
90
- historyTestimonyTemperature: I_SeriesLine | null
91
- loadingPowerData: boolean
92
- loadingTemperatureData: boolean
93
- isDarkMode: boolean
94
- formattedDatetime: any
95
- getDateFormat: any
96
- language: string
97
- }>()
98
-
99
- const localization = computed<UI_I_Localization>(() => useLocal())
100
- const { $store }: any = useNuxtApp()
101
-
102
- const activeTab = ref<UI_T_HardwareHealthTabMode>('sensor')
103
- const selectedGraphView = ref<string>('all')
104
- const uniqueKey = ref<number>(0)
105
-
106
- const selectedRow = ref<number[]>([])
107
-
108
- const hardwareHealthTabs = computed<UI_I_CollapseNavItem[]>(() =>
109
- hardwareHealthTabsFunc(localization.value)
110
- )
111
-
112
- const hardwareHealth = computed<UI_I_HardwareHealthSensors[]>(
113
- () => props.data || []
114
- )
115
-
116
- const hardwareHealthDescription = computed<string>(() => {
117
- const { thereIsAlertAndWarningOutOfSensors, noAlertsOrWarningsOutOfSensors } =
118
- localization.value.common
119
-
120
- let alertCount = 0
121
- let warningCount = 0
122
-
123
- hardwareHealth.value.forEach((sensor: UI_I_HardwareHealthSensors) => {
124
- if (sensor.status === 3) alertCount++
125
- if (sensor.status === 2) warningCount++
126
- })
127
-
128
- // const hasStatusTwoOrThree = hardwareHealth.value.some((sensor) =>
129
- // ['warning', 'alert'].includes(sensor.status)
130
- // )
131
-
132
- type Replacements = {
133
- alert: number
134
- warning: number
135
- sensors: number
136
- }
137
-
138
- const hasStatusTwoOrThree = alertCount > 0 || warningCount > 0
139
- const replacements: Replacements = {
140
- alert: alertCount,
141
- warning: warningCount,
142
- sensors: hardwareHealth.value.length || 0,
143
- }
144
- const text = hasStatusTwoOrThree
145
- ? thereIsAlertAndWarningOutOfSensors
146
- : noAlertsOrWarningsOutOfSensors
147
-
148
- return text?.replace(
149
- /{(\w+)}/g,
150
- (_, key: keyof Replacements) => replacements[key]
151
- )
152
- })
153
-
154
- const generateAlertTextWithLink = computed<UI_I_StorageSensorsAlert>(() => {
155
- const { storageSensorsAlert, thisKbArticle } = localization.value.common
156
-
157
- const [before, after] = storageSensorsAlert.split('{ link }')
158
-
159
- return {
160
- before,
161
- after,
162
- link: 'javascript:void(0)',
163
- linkText: thisKbArticle,
164
- }
165
- })
166
-
167
- watch(activeTab, () => {
168
- uniqueKey.value++
169
- })
170
-
171
- const onUpdateHistoryTestimonyTools = (tools: UI_I_HardwareHealthHistoryTestimonyTools): void => {
172
- emits('update-history-testimony-tools', tools)
173
- }
174
-
175
- onMounted(() => {
176
- $store.dispatch('main/A_CONTINUE_GLOBAL_REFRESH', 'hardwareHealth')
177
- })
178
- onUnmounted(() => {
179
- $store.dispatch('main/A_PAUSE_GLOBAL_REFRESH', 'hardwareHealth')
180
- })
181
- </script>
182
-
183
- <style lang="scss" scoped>
184
- @import 'bfg-common/assets/scss/common/global.scss';
185
- .hardware-health {
186
- @extend %block-property;
187
- &__description {
188
- }
189
- &__tabs {
190
- :deep(.nav) {
191
- margin-top: 0;
192
- }
193
- }
194
- &__content {
195
- display: flex;
196
- flex-direction: column;
197
- height: inherit;
198
- overflow: hidden;
199
-
200
- &.history-testimony {
201
- overflow-y: auto;
202
- display: block;
203
- }
204
- }
205
- }
206
- </style>
1
+ <template>
2
+ <div class="hardware-health">
3
+ <common-headline :headline="localization.common.hardwareHealth" />
4
+
5
+ <div class="hardware-health__description">
6
+ {{ hardwareHealthDescription }}
7
+ </div>
8
+
9
+ <atoms-tabs
10
+ v-model="activeTab"
11
+ test-id="hardware-health-tabs"
12
+ :items="hardwareHealthTabs"
13
+ size="small"
14
+ class="hardware-health__tabs"
15
+ />
16
+
17
+ <atoms-alert
18
+ v-if="activeTab === 'storage-sensor'"
19
+ :items="['content text']"
20
+ status="alert-warning"
21
+ test-id="select-storage-sensor-alert"
22
+ hide-close-icon
23
+ >
24
+ <template #default="">
25
+ <p>
26
+ {{ generateAlertTextWithLink.before }}
27
+ <a
28
+ :href="generateAlertTextWithLink.link"
29
+ data-id="general-alert-text-link"
30
+ >
31
+ {{ generateAlertTextWithLink.linkText }}
32
+ </a>
33
+ {{ generateAlertTextWithLink.after }}
34
+ </p>
35
+ </template>
36
+ </atoms-alert>
37
+
38
+ <common-pages-hardware-health-tools-panel :selected-tab="activeTab" />
39
+
40
+ <div :class="['hardware-health__content', activeTab]">
41
+ <common-pages-hardware-health-history-testimony-graph
42
+ v-if="activeTab === 'history-testimony'"
43
+ v-model:selected-view="selectedGraphView"
44
+ :power-data="props.historyTestimonyPower"
45
+ :temperature-data="props.historyTestimonyTemperature"
46
+ :counters-table-data="hardwareHealth"
47
+ :language="props.language"
48
+ :power-loading="props.loadingPowerData"
49
+ :temperature-loading="props.loadingTemperatureData"
50
+ :formatted-datetime="props.formattedDatetime"
51
+ :is-dark-mode="props.isDarkMode"
52
+ :get-date-format="props.getDateFormat"
53
+ :main-selected-row="selectedRow"
54
+ :valid-date-end="props.validDateEnd"
55
+ :format-date="props.formatDate"
56
+ @update-tools="onUpdateHistoryTestimonyTools"
57
+ />
58
+
59
+ <common-pages-hardware-health-table-view
60
+ :key="uniqueKey"
61
+ v-model:selected-row="selectedRow"
62
+ :selected-graph-view="selectedGraphView"
63
+ :data-table="hardwareHealth"
64
+ :total-items="hardwareHealth.length"
65
+ :total-pages="1"
66
+ :table-mode="activeTab"
67
+ :loading="props.loading"
68
+ />
69
+ </div>
70
+ </div>
71
+ </template>
72
+
73
+ <script lang="ts" setup>
74
+ import type { I_SeriesLine } from '~/node_modules/bfg-nuxt-3-graph/graph/lib/models/interfaces'
75
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
76
+ import type { UI_I_HardwareHealthSensors } from '~/components/common/pages/hardwareHealth/tableView/lib/models/interfaces'
77
+ import type { UI_I_CollapseNavItem } from '~/components/atoms/collapse/lib/models/interfaces'
78
+ import type { UI_I_StorageSensorsAlert } from '~/components/common/pages/hardwareHealth/lib/models/interfaces'
79
+ import type { UI_T_HardwareHealthTabMode } from '~/components/common/pages/hardwareHealth/lib/models/types'
80
+ import { hardwareHealthTabsFunc } from '~/components/common/pages/hardwareHealth/lib/config/tabsPannel'
81
+ import type { UI_I_HardwareHealthHistoryTestimonyTools } from '~/components/common/pages/hardwareHealth/historyTestimony/lib/models/interfaces'
82
+
83
+ const emits = defineEmits<{
84
+ (
85
+ event: 'update-history-testimony-tools',
86
+ value: UI_I_HardwareHealthHistoryTestimonyTools
87
+ ): void
88
+ }>()
89
+ const props = defineProps<{
90
+ data: UI_I_HardwareHealthSensors[]
91
+ loading: boolean
92
+ historyTestimonyPower: I_SeriesLine | null
93
+ historyTestimonyTemperature: I_SeriesLine | null
94
+ loadingPowerData: boolean
95
+ loadingTemperatureData: boolean
96
+ isDarkMode: boolean
97
+ formattedDatetime: any
98
+ getDateFormat: any
99
+ language: string
100
+ validDateEnd: number
101
+ formatDate: string
102
+ }>()
103
+
104
+ const localization = computed<UI_I_Localization>(() => useLocal())
105
+ const { $store }: any = useNuxtApp()
106
+
107
+ const activeTab = ref<UI_T_HardwareHealthTabMode>('sensor')
108
+ const selectedGraphView = ref<string>('all')
109
+ const uniqueKey = ref<number>(0)
110
+
111
+ const selectedRow = ref<number[]>([])
112
+
113
+ const hardwareHealthTabs = computed<UI_I_CollapseNavItem[]>(() =>
114
+ hardwareHealthTabsFunc(localization.value)
115
+ )
116
+
117
+ const hardwareHealth = computed<UI_I_HardwareHealthSensors[]>(
118
+ () => props.data || []
119
+ )
120
+
121
+ const hardwareHealthDescription = computed<string>(() => {
122
+ const { thereIsAlertAndWarningOutOfSensors, noAlertsOrWarningsOutOfSensors } =
123
+ localization.value.common
124
+
125
+ let alertCount = 0
126
+ let warningCount = 0
127
+
128
+ hardwareHealth.value.forEach((sensor: UI_I_HardwareHealthSensors) => {
129
+ if (sensor.status === 3) alertCount++
130
+ if (sensor.status === 2) warningCount++
131
+ })
132
+
133
+ // const hasStatusTwoOrThree = hardwareHealth.value.some((sensor) =>
134
+ // ['warning', 'alert'].includes(sensor.status)
135
+ // )
136
+
137
+ type Replacements = {
138
+ alert: number
139
+ warning: number
140
+ sensors: number
141
+ }
142
+
143
+ const hasStatusTwoOrThree = alertCount > 0 || warningCount > 0
144
+ const replacements: Replacements = {
145
+ alert: alertCount,
146
+ warning: warningCount,
147
+ sensors: hardwareHealth.value.length || 0,
148
+ }
149
+ const text = hasStatusTwoOrThree
150
+ ? thereIsAlertAndWarningOutOfSensors
151
+ : noAlertsOrWarningsOutOfSensors
152
+
153
+ return text?.replace(
154
+ /{(\w+)}/g,
155
+ (_, key: keyof Replacements) => replacements[key]
156
+ )
157
+ })
158
+
159
+ const generateAlertTextWithLink = computed<UI_I_StorageSensorsAlert>(() => {
160
+ const { storageSensorsAlert, thisKbArticle } = localization.value.common
161
+
162
+ const [before, after] = storageSensorsAlert.split('{ link }')
163
+
164
+ return {
165
+ before,
166
+ after,
167
+ link: 'javascript:void(0)',
168
+ linkText: thisKbArticle,
169
+ }
170
+ })
171
+
172
+ watch(activeTab, () => {
173
+ uniqueKey.value++
174
+ })
175
+
176
+ const onUpdateHistoryTestimonyTools = (
177
+ tools: UI_I_HardwareHealthHistoryTestimonyTools
178
+ ): void => {
179
+ emits('update-history-testimony-tools', tools)
180
+ }
181
+
182
+ onMounted(() => {
183
+ $store.dispatch('main/A_CONTINUE_GLOBAL_REFRESH', 'hardwareHealth')
184
+ })
185
+ onUnmounted(() => {
186
+ $store.dispatch('main/A_PAUSE_GLOBAL_REFRESH', 'hardwareHealth')
187
+ })
188
+ </script>
189
+
190
+ <style lang="scss" scoped>
191
+ @import 'bfg-common/assets/scss/common/global.scss';
192
+ .hardware-health {
193
+ @extend %block-property;
194
+ &__description {
195
+ }
196
+ &__tabs {
197
+ :deep(.nav) {
198
+ margin-top: 0;
199
+ }
200
+ }
201
+ &__content {
202
+ display: flex;
203
+ flex-direction: column;
204
+ height: inherit;
205
+ overflow: hidden;
206
+
207
+ &.history-testimony {
208
+ overflow-y: auto;
209
+ display: block;
210
+ }
211
+ }
212
+ }
213
+ </style>