bfg-common 1.5.92 → 1.5.94
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.
- package/assets/scss/common/normalize.scss +347 -347
- package/components/atoms/alert/Notification.vue +169 -169
- package/components/atoms/autocomplete/Autocomplete.vue +361 -362
- package/components/atoms/collapse/CollapseNav.vue +169 -169
- package/components/atoms/comboDropdownMenu/ComboDropdownMenu.vue +357 -357
- package/components/atoms/combobox/Combobox.vue +154 -154
- package/components/atoms/datepicker/Datepicker.vue +639 -639
- package/components/atoms/dropdown/Portlet.vue +113 -113
- package/components/atoms/dropdown/dropdown/Dropdown.vue +168 -168
- package/components/atoms/dropdown/tree/Tree.vue +137 -137
- package/components/atoms/list/SelectList.vue +63 -63
- package/components/atoms/list/dragDropList/DragDropList.vue +148 -148
- package/components/atoms/modal/Modal.vue +250 -250
- package/components/atoms/modal/bySteps/BySteps.vue +253 -253
- package/components/atoms/notificationBar/NotificationBar.vue +178 -178
- package/components/atoms/popover/Popover.vue +58 -58
- package/components/atoms/popover/lib/models/interfaces.ts +4 -4
- package/components/atoms/select/TheSelect.vue +187 -187
- package/components/atoms/stack/StackBlock.vue +185 -185
- package/components/atoms/stack/StackContent.vue +63 -63
- package/components/atoms/step/lib/models/verticalStepItem.ts +5 -5
- package/components/atoms/switch/Switch.vue +111 -111
- package/components/atoms/table/compact/Compact.vue +529 -529
- package/components/atoms/table/dataGrid/DataGrid.vue +1716 -1713
- package/components/atoms/table/dataGrid/DataGridPage.vue +195 -195
- package/components/atoms/table/info/Info.vue +2 -2
- package/components/atoms/table/simpleEvent/SimpleEvent.vue +98 -98
- package/components/atoms/table/simpleInfo/SimpleInfo.vue +73 -73
- package/components/atoms/tabs/Tabs.vue +217 -217
- package/components/atoms/wizard/Wizard.vue +341 -341
- package/components/common/accordion/Recursion.vue +222 -222
- package/components/common/adapterManager/AddAdapterModal.vue +561 -561
- package/components/common/adapterManager/ui/actions/AddAdapterButton.vue +30 -30
- package/components/common/adapterManager/ui/table/Table.vue +162 -162
- package/components/common/browse/BrowseNew.vue +237 -237
- package/components/common/browse/BrowseOld.vue +217 -217
- package/components/common/browse/blocks/TitleNew.vue +145 -145
- package/components/common/browse/blocks/TitleOld.vue +91 -91
- package/components/common/browse/blocks/contents/FilesOld.vue +72 -72
- package/components/common/chartOptionsModal/counters/timespan/form/FormNew.vue +262 -262
- package/components/common/context/Context.vue +111 -111
- package/components/common/context/recursion/RecursionOld.vue +228 -228
- package/components/common/details/DetailsItem.vue +109 -109
- package/components/common/feedback/Buttons.vue +229 -229
- package/components/common/feedback/Feedback.vue +270 -270
- package/components/common/feedback/Message.vue +519 -519
- package/components/common/graph/graphNew/GraphNew.vue +194 -194
- package/components/common/graph/lib/utils/renderGraph.ts +389 -389
- package/components/common/layout/theHeader/feedback/new/New.vue +227 -227
- package/components/common/layout/theHeader/feedback/new/additionalDetails/AdditionalDetails.vue +606 -606
- package/components/common/layout/theHeader/feedback/new/additionalDetails/Headline.vue +98 -98
- package/components/common/layout/theHeader/feedback/new/description/Description.vue +59 -59
- package/components/common/layout/theHeader/feedback/new/email/Email.vue +43 -43
- package/components/common/layout/theHeader/feedback/new/subtitle/Subtitle.vue +103 -103
- package/components/common/layout/theHeader/helpMenu/aboutNew/AboutNew.vue +112 -112
- package/components/common/layout/theHeader/helpMenu/aboutOld/AboutOld.vue +80 -80
- package/components/common/layout/theHeader/helpMenu/helpMenuOld/HelpMenuOld.vue +1 -1
- package/components/common/layout/theHeader/modals/Reconnect.vue +2 -2
- package/components/common/layout/theHeader/modals/RedirectLogin.vue +3 -3
- package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePassword.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordNew.vue +8 -8
- package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordOld.vue +3 -3
- package/components/common/layout/theHeader/userMenu/modals/preferences/PreferencesNew.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/preferences/PreferencesOld.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguage.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguageNew.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguageOld.vue +2 -5
- package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/DefaultConsoleOld.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/preferences/inventory/InventoryNew.vue +1 -1
- package/components/common/layout/theHeader/userMenu/userMenuNew/UserMenuNew.vue +2 -2
- package/components/common/layout/theHeader/userMenu/userMenuNew/lib/config/dropMenu.ts +1 -1
- package/components/common/layout/theHeader/userMenu/userMenuOld/UserMenuOld.vue +1 -1
- package/components/common/mainNavigationPanel/MainNavigationPanelOld.vue +2 -2
- package/components/common/modals/Rename.vue +2 -2
- package/components/common/modals/confirmByInput/ConfirmByInput.vue +2 -3
- package/components/common/modals/confirmByInput/ConfirmByInputOld.vue +3 -3
- package/components/common/modals/confirmation/ConfirmationOld.vue +1 -1
- package/components/common/modals/unsavedChanges/UnsavedChanges.vue +1 -1
- package/components/common/monitor/advanced/Advanced.vue +1 -1
- package/components/common/monitor/advanced/AdvancedNew.vue +1 -1
- package/components/common/monitor/advanced/AdvancedOld.vue +1 -1
- package/components/common/monitor/advanced/graphView/GraphViewNew.vue +1 -1
- package/components/common/monitor/advanced/graphView/GraphViewOld.vue +1 -1
- package/components/common/monitor/advanced/table/Table.vue +1 -1
- package/components/common/monitor/advanced/table/tableNew/TableNew.vue +2 -2
- package/components/common/monitor/advanced/table/tableOld/lib/config/performanceDatatable.ts +2 -2
- package/components/common/monitor/advanced/tools/ToolsOld.vue +2 -2
- package/components/common/monitor/advanced/tools/chartOptionsModal/ChartOptionsModalOld.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/NotificationOld.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/ActionsOld.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/saveOptionsModal/SaveOptionsModal.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/CountersNew.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/tableOld/lib/config/tableConfig.ts +2 -2
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/lib/config/objectTable.ts +10 -3
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/objectNew/ObjectNew.vue +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/objectOld/ObjectOld.vue +2 -2
- package/components/common/monitor/advanced/tools/lib/utils/countCores.ts +1 -1
- package/components/common/monitor/lib/models/interfaces.ts +1 -1
- package/components/common/monitor/overview/filters/customIntervalModal/CustomIntervalModalOld.vue +3 -3
- package/components/common/monitor/overview/filters/customIntervalModal/customIntervalModalNew/CustomIntervalModalNew.vue +4 -3
- package/components/common/monitor/resourceAllocation/lib/models/interfaces.ts +8 -8
- package/components/common/monitor/resourceAllocation/resourceAllocation.vue +2 -2
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/ChartOptionsModal.vue +1 -1
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/Notification.vue +1 -1
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/actions/SaveOptionsModal.vue +1 -1
- package/components/common/pages/hardwareHealth/tableView/lib/config/alertWarningTable.ts +1 -1
- package/components/common/pages/hardwareHealth/tableView/lib/config/historyTestimonyTable.ts +5 -5
- package/components/common/wizards/vm/migrate/Migrate.vue +39 -2
- package/components/common/wizards/vm/migrate/vmOrigin/VmOrigin.vue +92 -0
- package/components/common/wizards/vm/migrate/vmOrigin/lib/models/interfaces.ts +19 -0
- package/components/common/wizards/vm/migrate/vmOrigin/lib/utils/constructItems.ts +62 -0
- package/package.json +1 -1
|
@@ -1,389 +1,389 @@
|
|
|
1
|
-
import { format } from 'date-fns'
|
|
2
|
-
import { Ref } from 'vue'
|
|
3
|
-
import type {
|
|
4
|
-
I_CurrentColor,
|
|
5
|
-
I_LineGraph,
|
|
6
|
-
I_DiskGraph,
|
|
7
|
-
I_Title,
|
|
8
|
-
I_LineSeries,
|
|
9
|
-
I_SeriesLine,
|
|
10
|
-
I_SeriesDisk,
|
|
11
|
-
I_SeriesLineItem,
|
|
12
|
-
} from '~/node_modules/bfg-nuxt-3-graph/graph/lib/models/interfaces'
|
|
13
|
-
|
|
14
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
15
|
-
|
|
16
|
-
export const graphDataFunc = (
|
|
17
|
-
graphData: I_SeriesLine,
|
|
18
|
-
isDarkMode: boolean,
|
|
19
|
-
localization: UI_I_Localization,
|
|
20
|
-
isFullScreen: Ref<boolean>,
|
|
21
|
-
disabledTitle: boolean,
|
|
22
|
-
disabledExportButton: boolean,
|
|
23
|
-
disabledLegends: boolean,
|
|
24
|
-
graphType?: string,
|
|
25
|
-
dateTimeFormat?: string,
|
|
26
|
-
width?: number,
|
|
27
|
-
chart?: Ref<any>
|
|
28
|
-
): I_LineGraph => {
|
|
29
|
-
const currentColor: I_CurrentColor = {
|
|
30
|
-
backgroundColor: isDarkMode ? '#22343c' : 'white',
|
|
31
|
-
titleColor: isDarkMode ? 'white' : '#333333',
|
|
32
|
-
xAxisColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
33
|
-
textColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
34
|
-
legendItemColor: isDarkMode ? '#ADBBC4' : '#333333',
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const yAxisLength = graphData.yAxis.length
|
|
38
|
-
const yAxisHelper: string[] = []
|
|
39
|
-
const yAxis = graphData.yAxis
|
|
40
|
-
.filter((_: string, key: number) => key >= yAxisLength - 2)
|
|
41
|
-
.map((text: string, i: number) => {
|
|
42
|
-
const opposite = !!i
|
|
43
|
-
if (opposite) yAxisHelper.push(text)
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
title: {
|
|
47
|
-
text,
|
|
48
|
-
style: {
|
|
49
|
-
color: currentColor.textColor,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
labels: {
|
|
53
|
-
style: {
|
|
54
|
-
color: currentColor.textColor,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
min: text === '%' ? 0 : undefined,
|
|
58
|
-
max: text === '%' ? 100 : undefined,
|
|
59
|
-
opposite,
|
|
60
|
-
gridLineWidth: 0.5,
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
const { $formattedDatetime } = useNuxtApp()
|
|
65
|
-
const currentDateFunc = (data: number): string => {
|
|
66
|
-
if (dateTimeFormat === 'short')
|
|
67
|
-
return format(new Date(data), 'h:mm').toUpperCase()
|
|
68
|
-
else
|
|
69
|
-
return $formattedDatetime(new Date(data), '', true)
|
|
70
|
-
.replace(' ', ', ')
|
|
71
|
-
.toUpperCase()
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
let xAxisCategories: string[] = []
|
|
75
|
-
let xAxisLabelPositions: number[] | null = null
|
|
76
|
-
const intervalDate = Math.round(
|
|
77
|
-
(graphData.pointEnd - graphData.pointStart) / graphData.lines[0].data.length
|
|
78
|
-
)
|
|
79
|
-
const series = graphData.lines.map(
|
|
80
|
-
(line: I_SeriesLineItem, key: number): I_LineSeries => {
|
|
81
|
-
const data =
|
|
82
|
-
line.units === 'ms' ? line.data.map((item) => item / 100) : line.data
|
|
83
|
-
|
|
84
|
-
if (key === 0) {
|
|
85
|
-
xAxisCategories = data.map((_: number, key2: number): string => {
|
|
86
|
-
const currentInterval = key2 ? key2 + 1 : 0
|
|
87
|
-
return currentDateFunc(
|
|
88
|
-
graphData.pointStart + intervalDate * currentInterval
|
|
89
|
-
)
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
if (width) {
|
|
93
|
-
xAxisLabelPositions = []
|
|
94
|
-
const count = Math.round(width / 250)
|
|
95
|
-
const positionInterval = Math.round(xAxisCategories.length / count)
|
|
96
|
-
for (let i = 0; i <= xAxisCategories.length; i += positionInterval) {
|
|
97
|
-
const currentIndex =
|
|
98
|
-
i === xAxisCategories.length ? xAxisCategories.length - 1 : i
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
!xAxisLabelPositions?.length ||
|
|
102
|
-
currentIndex > xAxisLabelPositions[xAxisLabelPositions.length - 1]
|
|
103
|
-
) {
|
|
104
|
-
xAxisLabelPositions?.push(currentIndex)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (i + positionInterval === positionInterval * count) {
|
|
108
|
-
xAxisLabelPositions?.push(xAxisCategories.length - 1)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const visible = key < 10
|
|
114
|
-
return {
|
|
115
|
-
data,
|
|
116
|
-
visible,
|
|
117
|
-
name: `${line.measurement}`,
|
|
118
|
-
color: line.color,
|
|
119
|
-
lineWidth: line.lineWidth || 1.5,
|
|
120
|
-
yAxis: yAxisHelper.includes(line.units) ? 1 : 0,
|
|
121
|
-
marker: {
|
|
122
|
-
enabled: false,
|
|
123
|
-
},
|
|
124
|
-
tooltip: {
|
|
125
|
-
pointFormatter: function (): string {
|
|
126
|
-
const { x, y }: any = this
|
|
127
|
-
const currentDate = xAxisCategories.find((_, key) => key === x)
|
|
128
|
-
return `<b>${line.relatedDeviceName}<br>${currentDate}</b><br>${
|
|
129
|
-
line.name
|
|
130
|
-
}: ${new Intl.NumberFormat('en-US').format(y)}`
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
const title = (): I_Title => {
|
|
138
|
-
if (disabledTitle) {
|
|
139
|
-
return {
|
|
140
|
-
text: '',
|
|
141
|
-
}
|
|
142
|
-
} else {
|
|
143
|
-
return {
|
|
144
|
-
text: graphData.groupName,
|
|
145
|
-
style: {
|
|
146
|
-
color: currentColor.titleColor,
|
|
147
|
-
},
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return {
|
|
153
|
-
chart: {
|
|
154
|
-
type: graphType || 'spline',
|
|
155
|
-
zooming: {
|
|
156
|
-
type: 'xy',
|
|
157
|
-
},
|
|
158
|
-
animation: false,
|
|
159
|
-
backgroundColor: currentColor.backgroundColor,
|
|
160
|
-
events: {
|
|
161
|
-
fullscreenOpen(): void {
|
|
162
|
-
isFullScreen.value = true
|
|
163
|
-
},
|
|
164
|
-
fullscreenClose(): void {
|
|
165
|
-
isFullScreen.value = false
|
|
166
|
-
},
|
|
167
|
-
load: function () {
|
|
168
|
-
if (chart) chart.value = this
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
title: title(),
|
|
174
|
-
|
|
175
|
-
exporting: {
|
|
176
|
-
menuItemDefinitions: {
|
|
177
|
-
viewFullscreen: {
|
|
178
|
-
text: localization.common.viewFullScreen,
|
|
179
|
-
},
|
|
180
|
-
printChart: {
|
|
181
|
-
text: localization.common.printChart,
|
|
182
|
-
},
|
|
183
|
-
downloadPNG: {
|
|
184
|
-
text: localization.common.exportPng,
|
|
185
|
-
},
|
|
186
|
-
downloadJPEG: {
|
|
187
|
-
text: localization.common.exportJpeg,
|
|
188
|
-
},
|
|
189
|
-
downloadSVG: {
|
|
190
|
-
text: localization.common.exportSvg,
|
|
191
|
-
},
|
|
192
|
-
downloadCSV: {
|
|
193
|
-
text: localization.common.exportCsv,
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
csv: {
|
|
197
|
-
dateFormat: '%_ISO',
|
|
198
|
-
},
|
|
199
|
-
buttons: {
|
|
200
|
-
contextButton: {
|
|
201
|
-
enabled: disabledExportButton,
|
|
202
|
-
menuItems: [
|
|
203
|
-
'viewFullscreen',
|
|
204
|
-
'printChart',
|
|
205
|
-
'separator',
|
|
206
|
-
'downloadPNG',
|
|
207
|
-
'downloadJPEG',
|
|
208
|
-
'downloadSVG',
|
|
209
|
-
'downloadCSV',
|
|
210
|
-
],
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
accessibility: {
|
|
216
|
-
enabled: false,
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
credits: {
|
|
220
|
-
enabled: false,
|
|
221
|
-
},
|
|
222
|
-
|
|
223
|
-
tooltip: {
|
|
224
|
-
headerFormat: '',
|
|
225
|
-
style: {
|
|
226
|
-
width: '300px',
|
|
227
|
-
whiteSpace: 'normal',
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
legend: {
|
|
232
|
-
itemMarginBottom: 5,
|
|
233
|
-
maxHeight: 40,
|
|
234
|
-
itemStyle: {
|
|
235
|
-
color: currentColor.legendItemColor,
|
|
236
|
-
},
|
|
237
|
-
enabled: disabledLegends,
|
|
238
|
-
},
|
|
239
|
-
|
|
240
|
-
xAxis: {
|
|
241
|
-
type: 'datetime',
|
|
242
|
-
labels: {
|
|
243
|
-
autoRotationLimit: 0,
|
|
244
|
-
style: {
|
|
245
|
-
color: currentColor.textColor,
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
// tickInterval: 125,
|
|
249
|
-
tickPositions: xAxisLabelPositions,
|
|
250
|
-
categories: xAxisCategories,
|
|
251
|
-
gridLineWidth: 0.5,
|
|
252
|
-
},
|
|
253
|
-
|
|
254
|
-
yAxis,
|
|
255
|
-
|
|
256
|
-
plotOptions: {
|
|
257
|
-
series: {
|
|
258
|
-
animation: false,
|
|
259
|
-
},
|
|
260
|
-
line: {
|
|
261
|
-
animation: false,
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
|
|
265
|
-
series,
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
export const graphDiskDataFunc = (
|
|
270
|
-
graphData: I_SeriesDisk,
|
|
271
|
-
isDarkMode: boolean,
|
|
272
|
-
localization: UI_I_Localization,
|
|
273
|
-
isFullScreen: Ref<boolean>
|
|
274
|
-
): I_DiskGraph => {
|
|
275
|
-
const currentColor: I_CurrentColor = {
|
|
276
|
-
backgroundColor: isDarkMode ? '#22343c' : 'white',
|
|
277
|
-
titleColor: isDarkMode ? 'white' : '#333333',
|
|
278
|
-
xAxisColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
279
|
-
textColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
280
|
-
legendItemColor: isDarkMode ? '#ADBBC4' : '#333333',
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
return {
|
|
284
|
-
chart: {
|
|
285
|
-
plotBackgroundColor: null,
|
|
286
|
-
plotBorderWidth: null,
|
|
287
|
-
plotShadow: false,
|
|
288
|
-
type: 'pie',
|
|
289
|
-
backgroundColor: currentColor.backgroundColor,
|
|
290
|
-
events: {
|
|
291
|
-
fullscreenOpen(): void {
|
|
292
|
-
isFullScreen.value = true
|
|
293
|
-
},
|
|
294
|
-
fullscreenClose(): void {
|
|
295
|
-
isFullScreen.value = false
|
|
296
|
-
},
|
|
297
|
-
},
|
|
298
|
-
},
|
|
299
|
-
|
|
300
|
-
exporting: {
|
|
301
|
-
menuItemDefinitions: {
|
|
302
|
-
viewFullscreen: {
|
|
303
|
-
text: localization.common.viewFullScreen,
|
|
304
|
-
},
|
|
305
|
-
printChart: {
|
|
306
|
-
text: localization.common.printChart,
|
|
307
|
-
},
|
|
308
|
-
downloadPNG: {
|
|
309
|
-
text: localization.common.exportPng,
|
|
310
|
-
},
|
|
311
|
-
downloadJPEG: {
|
|
312
|
-
text: localization.common.exportJpeg,
|
|
313
|
-
},
|
|
314
|
-
downloadSVG: {
|
|
315
|
-
text: localization.common.exportSvg,
|
|
316
|
-
},
|
|
317
|
-
downloadCSV: {
|
|
318
|
-
text: localization.common.exportCsv,
|
|
319
|
-
},
|
|
320
|
-
},
|
|
321
|
-
csv: {
|
|
322
|
-
dateFormat: '%_ISO',
|
|
323
|
-
},
|
|
324
|
-
buttons: {
|
|
325
|
-
contextButton: {
|
|
326
|
-
enabled: true,
|
|
327
|
-
menuItems: [
|
|
328
|
-
'viewFullscreen',
|
|
329
|
-
'printChart',
|
|
330
|
-
'separator',
|
|
331
|
-
'downloadPNG',
|
|
332
|
-
'downloadJPEG',
|
|
333
|
-
'downloadSVG',
|
|
334
|
-
'downloadCSV',
|
|
335
|
-
],
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
},
|
|
339
|
-
|
|
340
|
-
title: {
|
|
341
|
-
text: graphData.title,
|
|
342
|
-
style: {
|
|
343
|
-
color: currentColor.titleColor,
|
|
344
|
-
},
|
|
345
|
-
},
|
|
346
|
-
|
|
347
|
-
accessibility: {
|
|
348
|
-
enabled: false,
|
|
349
|
-
},
|
|
350
|
-
|
|
351
|
-
credits: {
|
|
352
|
-
enabled: false,
|
|
353
|
-
},
|
|
354
|
-
|
|
355
|
-
tooltip: {
|
|
356
|
-
pointFormat: '{point.percentage:.1f}%',
|
|
357
|
-
},
|
|
358
|
-
|
|
359
|
-
plotOptions: {
|
|
360
|
-
pie: {
|
|
361
|
-
cursor: 'pointer',
|
|
362
|
-
dataLabels: {
|
|
363
|
-
enabled: false,
|
|
364
|
-
},
|
|
365
|
-
showInLegend: true,
|
|
366
|
-
},
|
|
367
|
-
},
|
|
368
|
-
|
|
369
|
-
legend: {
|
|
370
|
-
align: 'right',
|
|
371
|
-
layout: 'vertical',
|
|
372
|
-
itemStyle: {
|
|
373
|
-
color: currentColor.legendItemColor,
|
|
374
|
-
},
|
|
375
|
-
itemHoverStyle: {
|
|
376
|
-
color: currentColor.legendItemColor,
|
|
377
|
-
},
|
|
378
|
-
},
|
|
379
|
-
|
|
380
|
-
series: [
|
|
381
|
-
{
|
|
382
|
-
name: 'Brands',
|
|
383
|
-
colorByPoint: true,
|
|
384
|
-
data: graphData.data,
|
|
385
|
-
animation: false,
|
|
386
|
-
},
|
|
387
|
-
],
|
|
388
|
-
}
|
|
389
|
-
}
|
|
1
|
+
import { format } from 'date-fns'
|
|
2
|
+
import { Ref } from 'vue'
|
|
3
|
+
import type {
|
|
4
|
+
I_CurrentColor,
|
|
5
|
+
I_LineGraph,
|
|
6
|
+
I_DiskGraph,
|
|
7
|
+
I_Title,
|
|
8
|
+
I_LineSeries,
|
|
9
|
+
I_SeriesLine,
|
|
10
|
+
I_SeriesDisk,
|
|
11
|
+
I_SeriesLineItem,
|
|
12
|
+
} from '~/node_modules/bfg-nuxt-3-graph/graph/lib/models/interfaces'
|
|
13
|
+
|
|
14
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
15
|
+
|
|
16
|
+
export const graphDataFunc = (
|
|
17
|
+
graphData: I_SeriesLine,
|
|
18
|
+
isDarkMode: boolean,
|
|
19
|
+
localization: UI_I_Localization,
|
|
20
|
+
isFullScreen: Ref<boolean>,
|
|
21
|
+
disabledTitle: boolean,
|
|
22
|
+
disabledExportButton: boolean,
|
|
23
|
+
disabledLegends: boolean,
|
|
24
|
+
graphType?: string,
|
|
25
|
+
dateTimeFormat?: string,
|
|
26
|
+
width?: number,
|
|
27
|
+
chart?: Ref<any>
|
|
28
|
+
): I_LineGraph => {
|
|
29
|
+
const currentColor: I_CurrentColor = {
|
|
30
|
+
backgroundColor: isDarkMode ? '#22343c' : 'white',
|
|
31
|
+
titleColor: isDarkMode ? 'white' : '#333333',
|
|
32
|
+
xAxisColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
33
|
+
textColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
34
|
+
legendItemColor: isDarkMode ? '#ADBBC4' : '#333333',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const yAxisLength = graphData.yAxis.length
|
|
38
|
+
const yAxisHelper: string[] = []
|
|
39
|
+
const yAxis = graphData.yAxis
|
|
40
|
+
.filter((_: string, key: number) => key >= yAxisLength - 2)
|
|
41
|
+
.map((text: string, i: number) => {
|
|
42
|
+
const opposite = !!i
|
|
43
|
+
if (opposite) yAxisHelper.push(text)
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
title: {
|
|
47
|
+
text,
|
|
48
|
+
style: {
|
|
49
|
+
color: currentColor.textColor,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
labels: {
|
|
53
|
+
style: {
|
|
54
|
+
color: currentColor.textColor,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
min: text === '%' ? 0 : undefined,
|
|
58
|
+
max: text === '%' ? 100 : undefined,
|
|
59
|
+
opposite,
|
|
60
|
+
gridLineWidth: 0.5,
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
const { $formattedDatetime } = useNuxtApp()
|
|
65
|
+
const currentDateFunc = (data: number): string => {
|
|
66
|
+
if (dateTimeFormat === 'short')
|
|
67
|
+
return format(new Date(data), 'h:mm').toUpperCase()
|
|
68
|
+
else
|
|
69
|
+
return $formattedDatetime(new Date(data), '', true)
|
|
70
|
+
.replace(' ', ', ')
|
|
71
|
+
.toUpperCase()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let xAxisCategories: string[] = []
|
|
75
|
+
let xAxisLabelPositions: number[] | null = null
|
|
76
|
+
const intervalDate = Math.round(
|
|
77
|
+
(graphData.pointEnd - graphData.pointStart) / graphData.lines[0].data.length
|
|
78
|
+
)
|
|
79
|
+
const series = graphData.lines.map(
|
|
80
|
+
(line: I_SeriesLineItem, key: number): I_LineSeries => {
|
|
81
|
+
const data =
|
|
82
|
+
line.units === 'ms' ? line.data.map((item) => item / 100) : line.data
|
|
83
|
+
|
|
84
|
+
if (key === 0) {
|
|
85
|
+
xAxisCategories = data.map((_: number, key2: number): string => {
|
|
86
|
+
const currentInterval = key2 ? key2 + 1 : 0
|
|
87
|
+
return currentDateFunc(
|
|
88
|
+
graphData.pointStart + intervalDate * currentInterval
|
|
89
|
+
)
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
if (width) {
|
|
93
|
+
xAxisLabelPositions = []
|
|
94
|
+
const count = Math.round(width / 250)
|
|
95
|
+
const positionInterval = Math.round(xAxisCategories.length / count)
|
|
96
|
+
for (let i = 0; i <= xAxisCategories.length; i += positionInterval) {
|
|
97
|
+
const currentIndex =
|
|
98
|
+
i === xAxisCategories.length ? xAxisCategories.length - 1 : i
|
|
99
|
+
|
|
100
|
+
if (
|
|
101
|
+
!xAxisLabelPositions?.length ||
|
|
102
|
+
currentIndex > xAxisLabelPositions[xAxisLabelPositions.length - 1]
|
|
103
|
+
) {
|
|
104
|
+
xAxisLabelPositions?.push(currentIndex)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (i + positionInterval === positionInterval * count) {
|
|
108
|
+
xAxisLabelPositions?.push(xAxisCategories.length - 1)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const visible = key < 10
|
|
114
|
+
return {
|
|
115
|
+
data,
|
|
116
|
+
visible,
|
|
117
|
+
name: `${line.measurement}`,
|
|
118
|
+
color: line.color,
|
|
119
|
+
lineWidth: line.lineWidth || 1.5,
|
|
120
|
+
yAxis: yAxisHelper.includes(line.units) ? 1 : 0,
|
|
121
|
+
marker: {
|
|
122
|
+
enabled: false,
|
|
123
|
+
},
|
|
124
|
+
tooltip: {
|
|
125
|
+
pointFormatter: function (): string {
|
|
126
|
+
const { x, y }: any = this
|
|
127
|
+
const currentDate = xAxisCategories.find((_, key) => key === x)
|
|
128
|
+
return `<b>${line.relatedDeviceName}<br>${currentDate}</b><br>${
|
|
129
|
+
line.name
|
|
130
|
+
}: ${new Intl.NumberFormat('en-US').format(y)}`
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
const title = (): I_Title => {
|
|
138
|
+
if (disabledTitle) {
|
|
139
|
+
return {
|
|
140
|
+
text: '',
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
return {
|
|
144
|
+
text: graphData.groupName,
|
|
145
|
+
style: {
|
|
146
|
+
color: currentColor.titleColor,
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
chart: {
|
|
154
|
+
type: graphType || 'spline',
|
|
155
|
+
zooming: {
|
|
156
|
+
type: 'xy',
|
|
157
|
+
},
|
|
158
|
+
animation: false,
|
|
159
|
+
backgroundColor: currentColor.backgroundColor,
|
|
160
|
+
events: {
|
|
161
|
+
fullscreenOpen(): void {
|
|
162
|
+
isFullScreen.value = true
|
|
163
|
+
},
|
|
164
|
+
fullscreenClose(): void {
|
|
165
|
+
isFullScreen.value = false
|
|
166
|
+
},
|
|
167
|
+
load: function () {
|
|
168
|
+
if (chart) chart.value = this
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
title: title(),
|
|
174
|
+
|
|
175
|
+
exporting: {
|
|
176
|
+
menuItemDefinitions: {
|
|
177
|
+
viewFullscreen: {
|
|
178
|
+
text: localization.common.viewFullScreen,
|
|
179
|
+
},
|
|
180
|
+
printChart: {
|
|
181
|
+
text: localization.common.printChart,
|
|
182
|
+
},
|
|
183
|
+
downloadPNG: {
|
|
184
|
+
text: localization.common.exportPng,
|
|
185
|
+
},
|
|
186
|
+
downloadJPEG: {
|
|
187
|
+
text: localization.common.exportJpeg,
|
|
188
|
+
},
|
|
189
|
+
downloadSVG: {
|
|
190
|
+
text: localization.common.exportSvg,
|
|
191
|
+
},
|
|
192
|
+
downloadCSV: {
|
|
193
|
+
text: localization.common.exportCsv,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
csv: {
|
|
197
|
+
dateFormat: '%_ISO',
|
|
198
|
+
},
|
|
199
|
+
buttons: {
|
|
200
|
+
contextButton: {
|
|
201
|
+
enabled: disabledExportButton,
|
|
202
|
+
menuItems: [
|
|
203
|
+
'viewFullscreen',
|
|
204
|
+
'printChart',
|
|
205
|
+
'separator',
|
|
206
|
+
'downloadPNG',
|
|
207
|
+
'downloadJPEG',
|
|
208
|
+
'downloadSVG',
|
|
209
|
+
'downloadCSV',
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
accessibility: {
|
|
216
|
+
enabled: false,
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
credits: {
|
|
220
|
+
enabled: false,
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
tooltip: {
|
|
224
|
+
headerFormat: '',
|
|
225
|
+
style: {
|
|
226
|
+
width: '300px',
|
|
227
|
+
whiteSpace: 'normal',
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
legend: {
|
|
232
|
+
itemMarginBottom: 5,
|
|
233
|
+
maxHeight: 40,
|
|
234
|
+
itemStyle: {
|
|
235
|
+
color: currentColor.legendItemColor,
|
|
236
|
+
},
|
|
237
|
+
enabled: disabledLegends,
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
xAxis: {
|
|
241
|
+
type: 'datetime',
|
|
242
|
+
labels: {
|
|
243
|
+
autoRotationLimit: 0,
|
|
244
|
+
style: {
|
|
245
|
+
color: currentColor.textColor,
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
// tickInterval: 125,
|
|
249
|
+
tickPositions: xAxisLabelPositions,
|
|
250
|
+
categories: xAxisCategories,
|
|
251
|
+
gridLineWidth: 0.5,
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
yAxis,
|
|
255
|
+
|
|
256
|
+
plotOptions: {
|
|
257
|
+
series: {
|
|
258
|
+
animation: false,
|
|
259
|
+
},
|
|
260
|
+
line: {
|
|
261
|
+
animation: false,
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
series,
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export const graphDiskDataFunc = (
|
|
270
|
+
graphData: I_SeriesDisk,
|
|
271
|
+
isDarkMode: boolean,
|
|
272
|
+
localization: UI_I_Localization,
|
|
273
|
+
isFullScreen: Ref<boolean>
|
|
274
|
+
): I_DiskGraph => {
|
|
275
|
+
const currentColor: I_CurrentColor = {
|
|
276
|
+
backgroundColor: isDarkMode ? '#22343c' : 'white',
|
|
277
|
+
titleColor: isDarkMode ? 'white' : '#333333',
|
|
278
|
+
xAxisColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
279
|
+
textColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
280
|
+
legendItemColor: isDarkMode ? '#ADBBC4' : '#333333',
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return {
|
|
284
|
+
chart: {
|
|
285
|
+
plotBackgroundColor: null,
|
|
286
|
+
plotBorderWidth: null,
|
|
287
|
+
plotShadow: false,
|
|
288
|
+
type: 'pie',
|
|
289
|
+
backgroundColor: currentColor.backgroundColor,
|
|
290
|
+
events: {
|
|
291
|
+
fullscreenOpen(): void {
|
|
292
|
+
isFullScreen.value = true
|
|
293
|
+
},
|
|
294
|
+
fullscreenClose(): void {
|
|
295
|
+
isFullScreen.value = false
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
exporting: {
|
|
301
|
+
menuItemDefinitions: {
|
|
302
|
+
viewFullscreen: {
|
|
303
|
+
text: localization.common.viewFullScreen,
|
|
304
|
+
},
|
|
305
|
+
printChart: {
|
|
306
|
+
text: localization.common.printChart,
|
|
307
|
+
},
|
|
308
|
+
downloadPNG: {
|
|
309
|
+
text: localization.common.exportPng,
|
|
310
|
+
},
|
|
311
|
+
downloadJPEG: {
|
|
312
|
+
text: localization.common.exportJpeg,
|
|
313
|
+
},
|
|
314
|
+
downloadSVG: {
|
|
315
|
+
text: localization.common.exportSvg,
|
|
316
|
+
},
|
|
317
|
+
downloadCSV: {
|
|
318
|
+
text: localization.common.exportCsv,
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
csv: {
|
|
322
|
+
dateFormat: '%_ISO',
|
|
323
|
+
},
|
|
324
|
+
buttons: {
|
|
325
|
+
contextButton: {
|
|
326
|
+
enabled: true,
|
|
327
|
+
menuItems: [
|
|
328
|
+
'viewFullscreen',
|
|
329
|
+
'printChart',
|
|
330
|
+
'separator',
|
|
331
|
+
'downloadPNG',
|
|
332
|
+
'downloadJPEG',
|
|
333
|
+
'downloadSVG',
|
|
334
|
+
'downloadCSV',
|
|
335
|
+
],
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
|
|
340
|
+
title: {
|
|
341
|
+
text: graphData.title,
|
|
342
|
+
style: {
|
|
343
|
+
color: currentColor.titleColor,
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
|
|
347
|
+
accessibility: {
|
|
348
|
+
enabled: false,
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
credits: {
|
|
352
|
+
enabled: false,
|
|
353
|
+
},
|
|
354
|
+
|
|
355
|
+
tooltip: {
|
|
356
|
+
pointFormat: '{point.percentage:.1f}%',
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
plotOptions: {
|
|
360
|
+
pie: {
|
|
361
|
+
cursor: 'pointer',
|
|
362
|
+
dataLabels: {
|
|
363
|
+
enabled: false,
|
|
364
|
+
},
|
|
365
|
+
showInLegend: true,
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
legend: {
|
|
370
|
+
align: 'right',
|
|
371
|
+
layout: 'vertical',
|
|
372
|
+
itemStyle: {
|
|
373
|
+
color: currentColor.legendItemColor,
|
|
374
|
+
},
|
|
375
|
+
itemHoverStyle: {
|
|
376
|
+
color: currentColor.legendItemColor,
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
|
|
380
|
+
series: [
|
|
381
|
+
{
|
|
382
|
+
name: 'Brands',
|
|
383
|
+
colorByPoint: true,
|
|
384
|
+
data: graphData.data,
|
|
385
|
+
animation: false,
|
|
386
|
+
},
|
|
387
|
+
],
|
|
388
|
+
}
|
|
389
|
+
}
|