bfg-common 1.2.52 → 1.2.54

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.
Files changed (81) hide show
  1. package/components/atoms/alert/Notification.vue +167 -167
  2. package/components/atoms/autocomplete/Autocomplete.vue +236 -236
  3. package/components/atoms/datepicker/Datepicker.vue +612 -612
  4. package/components/atoms/list/SelectList.vue +62 -62
  5. package/components/atoms/nav/NavBar.vue +116 -116
  6. package/components/atoms/nav/VerticalNavBar.vue +89 -89
  7. package/components/atoms/notificationBar/NotificationBar.vue +175 -175
  8. package/components/atoms/perPage/PerPage.vue +52 -52
  9. package/components/atoms/popup/SimplePopup.vue +90 -90
  10. package/components/atoms/step/VerticalStep.vue +104 -104
  11. package/components/atoms/switch/Switch.vue +107 -107
  12. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +206 -206
  13. package/components/atoms/table/dataGrid/DataGridPage.vue +189 -189
  14. package/components/atoms/tabs/Tabs.vue +189 -189
  15. package/components/atoms/tooltip/Signpost.vue +224 -224
  16. package/components/common/BadBrowser.vue +114 -114
  17. package/components/common/adapterManager/AddAdapterWarningModal.vue +82 -82
  18. package/components/common/adapterManager/NoActiveAdaptersModal.vue +62 -62
  19. package/components/common/adapterManager/NoConnectedActiveAdaptersModal.vue +62 -62
  20. package/components/common/browse/Browse.vue +182 -182
  21. package/components/common/browse/blocks/Title.vue +66 -66
  22. package/components/common/diagramMain/Diagram.vue +186 -186
  23. package/components/common/diagramMain/DiagramMain.vue +986 -986
  24. package/components/common/diagramMain/adapter/AdapterItem.vue +227 -227
  25. package/components/common/diagramMain/adapter/AdapterItems.vue +57 -57
  26. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +339 -339
  27. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +202 -202
  28. package/components/common/diagramMain/modals/remove/RemoveModal.vue +226 -226
  29. package/components/common/diagramMain/network/Contents.vue +238 -238
  30. package/components/common/feedback/Buttons.vue +232 -232
  31. package/components/common/feedback/Message.vue +468 -468
  32. package/components/common/feedback/VisitPortal.vue +54 -54
  33. package/components/common/help/navbar/left/Left.vue +159 -159
  34. package/components/common/help/navbar/left/utils/constructAccordion.ts +27 -27
  35. package/components/common/mainNavigationPanel/MainNavigationPanel.vue +3 -3
  36. package/components/common/modals/Rename.vue +165 -165
  37. package/components/common/monitor/overview/Overview.vue +470 -470
  38. package/components/common/monitor/overview/filters/Filters.vue +219 -219
  39. package/components/common/monitor/overview/filters/config/filterOptions.ts +80 -80
  40. package/components/common/perPage/PerPage.vue +51 -51
  41. package/components/common/recursionTree/RecursionTree.vue +201 -201
  42. package/components/common/vm/actions/clone/Clone.vue +545 -545
  43. package/components/common/vm/actions/clone/select/options/Options.vue +65 -65
  44. package/components/common/vm/actions/clone/utils.ts +43 -43
  45. package/components/common/vm/actions/common/config/capabilities.ts +338 -338
  46. package/components/common/vm/actions/common/customizeHardware/virtualHardware/VirtualHardware.vue +678 -678
  47. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/CoresPerSocket.vue +109 -109
  48. package/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/Cpu.vue +383 -383
  49. package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/Limit.vue +234 -234
  50. package/components/common/vm/actions/common/customizeHardware/virtualHardware/limit/config/options.ts +28 -28
  51. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/Memory.vue +316 -316
  52. package/components/common/vm/actions/common/customizeHardware/virtualHardware/memory/config/memoryOptions.ts +35 -35
  53. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +445 -445
  54. package/components/common/vm/actions/common/customizeHardware/virtualHardware/newNetwork/NewNetwork.vue +288 -288
  55. package/components/common/vm/actions/common/customizeHardware/virtualHardware/reservation/Reservation.vue +235 -235
  56. package/components/common/vm/actions/common/customizeHardware/virtualHardware/videoCard/VideoCard.vue +177 -177
  57. package/components/common/vm/actions/common/customizeHardware/vmoptions/bootOptions/order/Order.vue +197 -197
  58. package/components/common/vm/actions/common/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +181 -181
  59. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/CopyPaste.vue +51 -51
  60. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/RemoteConsoleOptions.vue +253 -253
  61. package/components/common/vm/actions/common/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +55 -55
  62. package/components/common/vm/actions/common/select/compatibility/Compatibility.vue +40 -40
  63. package/components/common/vm/actions/common/select/storage/Storage.vue +194 -194
  64. package/components/common/vm/actions/common/select/storage/config/config.ts +154 -154
  65. package/components/common/wizards/datastore/add/nfs/Nfs.vue +94 -94
  66. package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +377 -377
  67. package/components/common/wizards/datastore/add/nfs/configuration/serversList/ServersList.vue +123 -123
  68. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +54 -54
  69. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/HostTable.vue +131 -131
  70. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +230 -230
  71. package/composables/useLocal.ts +38 -38
  72. package/minify.js +146 -146
  73. package/models/store/interfaces.ts +37 -37
  74. package/models/store/storage/interfaces.ts +32 -32
  75. package/models/store/types.ts +32 -32
  76. package/modules/fixContentBuild/utils/methods.ts +114 -114
  77. package/package.json +1 -1
  78. package/public/spice-console/application/codec.js +257 -257
  79. package/public/spice-console/lib/rasterEngine.js +907 -907
  80. package/public/spice-console/network/spicechannel.js +369 -369
  81. package/utils/contentBuild.ts +34 -34
@@ -1,470 +1,470 @@
1
- <template>
2
- <div class="charts-view">
3
- <template v-if="oneSettingsLocal && !isMountedLoader">
4
- <div :class="['chart-container', `graph-${oneSettingsLocal.title}`]">
5
- <div v-if="oneSettingsLocal.loader" class="graphic-loader-block">
6
- <div class="spinner"></div>
7
- <p>{{ localization.retrievingData }}...</p>
8
- </div>
9
- <common-graph
10
- v-else-if="oneGraphData"
11
- :data="oneGraphData"
12
- :chart="chartOne"
13
- :update="oneUpdateHelper"
14
- />
15
- <div v-else class="graph-empty-block">
16
- <div class="title">{{ oneSettingsLocal.title }}</div>
17
- <div class="body-block">
18
- {{ localization.emptyGraphText }}
19
- </div>
20
- </div>
21
- </div>
22
- </template>
23
- <template v-if="twoSettingsLocal && !isMountedLoader">
24
- <div :class="['chart-container', `graph-${twoSettingsLocal.title}`]">
25
- <div v-if="twoSettingsLocal.loader" class="graphic-loader-block">
26
- <div class="spinner"></div>
27
- <p>{{ localization.retrievingData }}...</p>
28
- </div>
29
- <common-graph
30
- v-else-if="twoGraphData"
31
- :data="twoGraphData"
32
- :chart="chartTwo"
33
- :update="twoUpdateHelper"
34
- />
35
- <div v-else class="graph-empty-block">
36
- <div class="title">{{ twoSettingsLocal.title }}</div>
37
- <div class="body-block">
38
- {{ localization.emptyGraphText }}
39
- </div>
40
- </div>
41
- </div>
42
- </template>
43
- <template v-if="threeSettingsLocal && !isMountedLoader">
44
- <div :class="['chart-container', `graph-${threeSettingsLocal.title}`]">
45
- <div v-if="threeSettingsLocal.loader" class="graphic-loader-block">
46
- <div class="spinner"></div>
47
- <p>{{ localization.retrievingData }}...</p>
48
- </div>
49
- <common-graph
50
- v-else-if="threeGraphData"
51
- :data="threeGraphData"
52
- :chart="chartThree"
53
- :update="threeUpdateHelper"
54
- />
55
- <div v-else class="graph-empty-block">
56
- <div class="title">{{ threeSettingsLocal.title }}</div>
57
- <div class="body-block">
58
- {{ localization.emptyGraphText }}
59
- </div>
60
- </div>
61
- </div>
62
- </template>
63
- <template v-if="fourSettingsLocal && !isMountedLoader">
64
- <div :class="['chart-container', `graph-${fourSettingsLocal.title}`]">
65
- <div v-if="fourSettingsLocal.loader" class="graphic-loader-block">
66
- <div class="spinner"></div>
67
- <p>{{ localization.retrievingData }}...</p>
68
- </div>
69
- <common-graph
70
- v-else-if="fourGraphData"
71
- :data="fourGraphData"
72
- :chart="chartFour"
73
- :update="fourUpdateHelper"
74
- />
75
- <div v-else class="graph-empty-block">
76
- <div class="title">{{ fourSettingsLocal.title }}</div>
77
- <div class="body-block">
78
- {{ localization.emptyGraphText }}
79
- </div>
80
- </div>
81
- </div>
82
- </template>
83
- <div v-if="isMountedLoader" class="content-global-loading">
84
- {{ localization.loading }}...
85
- </div>
86
- </div>
87
- </template>
88
-
89
- <script setup lang="ts">
90
- import { format } from 'date-fns'
91
- import { UI_I_Localization } from '~/models/interfaces'
92
- import { UI_I_GraphDataSettingItem } from '~/components/common/monitor/models/interfaces'
93
- import {
94
- I_ColumnGraph,
95
- I_LineGraph,
96
- I_SeriesColumn,
97
- I_SeriesLine,
98
- } from 'bfg-nuxt-3-graph/graph/models/interfaces'
99
- import {
100
- columnGraphDataFunc,
101
- graphDataFunc,
102
- } from 'bfg-nuxt-3-graph/graph/utils/renderGraph'
103
-
104
- const props = defineProps<{
105
- oneChart?: UI_I_GraphDataSettingItem | null
106
- twoChart?: UI_I_GraphDataSettingItem | null
107
- threeChart?: UI_I_GraphDataSettingItem | null
108
- fourChart?: UI_I_GraphDataSettingItem | null
109
- themeMode?: string
110
- formatDate?: string
111
- formatTime?: string
112
- graphType: string
113
- }>()
114
-
115
- const { $formattedDatetime } = useNuxtApp()
116
-
117
- const localization = computed<UI_I_Localization>(() => useLocal())
118
-
119
- const isFullScreen = ref<boolean>(false)
120
-
121
- const fullScreenCallBack = (newValue: boolean): void => {
122
- newValue && (isFullScreen.value = newValue)
123
- }
124
-
125
- const oneUpdateHelper = ref<number>(0)
126
- const twoUpdateHelper = ref<number>(0)
127
- const threeUpdateHelper = ref<number>(0)
128
- const fourUpdateHelper = ref<number>(0)
129
-
130
- const chartOne = ref<any>(null)
131
- const chartTwo = ref<any>(null)
132
- const chartThree = ref<any>(null)
133
- const chartFour = ref<any>(null)
134
-
135
- const currentChartName = ref<string>('')
136
-
137
- const getCurrentChart = (chart: any): any => {
138
- switch (currentChartName.value) {
139
- case 'one':
140
- chartOne.value = chart
141
- break
142
- case 'two':
143
- chartTwo.value = chart
144
- break
145
- case 'three':
146
- chartThree.value = chart
147
- break
148
- case 'four':
149
- chartFour.value = chart
150
- break
151
- }
152
- }
153
-
154
- const oneSettingsLocal = ref<UI_I_GraphDataSettingItem | null>(null)
155
- const twoSettingsLocal = ref<UI_I_GraphDataSettingItem | null>(null)
156
- const threeSettingsLocal = ref<UI_I_GraphDataSettingItem | null>(null)
157
- const fourSettingsLocal = ref<UI_I_GraphDataSettingItem | null>(null)
158
-
159
- const isMountedLoader = ref<boolean>()
160
-
161
- const oneGraphData = ref<I_LineGraph | I_ColumnGraph | null>(null)
162
- const twoGraphData = ref<I_LineGraph | I_ColumnGraph | null>(null)
163
- const threeGraphData = ref<I_LineGraph | I_ColumnGraph | null>(null)
164
- const fourGraphData = ref<I_LineGraph | I_ColumnGraph | null>(null)
165
-
166
- const instanceOfSeriesLine = (
167
- object: I_SeriesLine | I_SeriesColumn
168
- ): object is I_SeriesLine => {
169
- return 'lines' in object
170
- }
171
-
172
- const setCurrentGraphData = (
173
- name: string,
174
- data: I_SeriesLine | I_SeriesColumn,
175
- isDarkMode: boolean,
176
- width: number,
177
- chartType?: string
178
- ): void => {
179
- currentChartName.value = name
180
-
181
- let graphData = null
182
- if (chartType === 'column' && !instanceOfSeriesLine(data)) {
183
- graphData = columnGraphDataFunc(data, localization.value)
184
- } else if (instanceOfSeriesLine(data)) {
185
- graphData = graphDataFunc(
186
- data,
187
- isDarkMode,
188
- localization.value,
189
- fullScreenCallBack,
190
- false,
191
- true,
192
- true,
193
- props.graphType,
194
- '',
195
- width,
196
- getCurrentChart,
197
- $formattedDatetime,
198
- format,
199
- props.formatDate,
200
- props.formatTime
201
- )
202
- }
203
-
204
- switch (name) {
205
- case 'one':
206
- oneGraphData.value = graphData
207
- break
208
- case 'two':
209
- twoGraphData.value = graphData
210
- break
211
- case 'three':
212
- threeGraphData.value = graphData
213
- break
214
- case 'four':
215
- fourGraphData.value = graphData
216
- break
217
- }
218
- }
219
-
220
- const outputSize = (): void => {
221
- setTimeout(() => {
222
- if (oneGraphData.value) oneUpdateHelper.value++
223
- if (twoGraphData.value) twoUpdateHelper.value++
224
- if (threeGraphData.value) threeUpdateHelper.value++
225
- if (fourGraphData.value) fourUpdateHelper.value++
226
-
227
- if (chartOne.value && chartOne.value?.hasLoaded) chartOne.value.reflow()
228
-
229
- if (chartTwo.value && chartTwo.value?.hasLoaded) chartTwo.value.reflow()
230
-
231
- if (chartThree.value && chartThree.value?.hasLoaded)
232
- chartThree.value.reflow()
233
-
234
- if (chartFour.value && chartFour.value?.hasLoaded) chartFour.value.reflow()
235
- }, 1000)
236
- }
237
- const updateGraph = (
238
- graphSetting: UI_I_GraphDataSettingItem | null,
239
- name: string
240
- ): void => {
241
- outputSize()
242
- updateGraphsData(graphSetting, name)
243
- }
244
-
245
- const updateGraphsData = (
246
- data: UI_I_GraphDataSettingItem | null,
247
- name: string
248
- ): void => {
249
- if (!data?.data) {
250
- switch (name) {
251
- case 'one':
252
- oneGraphData.value = null
253
- break
254
- case 'two':
255
- twoGraphData.value = null
256
- break
257
- case 'three':
258
- threeGraphData.value = null
259
- break
260
- case 'four':
261
- fourGraphData.value = null
262
- break
263
- }
264
- return
265
- }
266
-
267
- const themeMode = useLocalStorage('themeMode') || props.themeMode
268
- const isDarkMode = themeMode === 'dark-theme'
269
-
270
- const width =
271
- document
272
- .querySelector(`.graph-${name} .graph-content`)
273
- ?.getBoundingClientRect().width || 700
274
-
275
- setCurrentGraphData(name, data.data, isDarkMode, width, data.chartType)
276
- }
277
-
278
- const checkIsMountedError = (): void => {
279
- if (
280
- oneSettingsLocal.value ||
281
- twoSettingsLocal.value ||
282
- threeSettingsLocal.value ||
283
- fourSettingsLocal.value
284
- )
285
- isMountedLoader.value = false
286
- }
287
-
288
- watch(
289
- () => props.oneChart,
290
- (newValue) => {
291
- if (newValue === undefined) return
292
-
293
- oneSettingsLocal.value = newValue
294
-
295
- if (newValue) updateGraph(oneSettingsLocal.value, newValue.place)
296
-
297
- isMountedLoader.value && checkIsMountedError()
298
- },
299
- { deep: true, immediate: true }
300
- )
301
-
302
- watch(
303
- () => props.twoChart,
304
- (newValue) => {
305
- if (newValue === undefined) return
306
-
307
- twoSettingsLocal.value = newValue
308
-
309
- if (newValue) updateGraph(twoSettingsLocal.value, newValue.place)
310
-
311
- isMountedLoader.value && checkIsMountedError()
312
- },
313
- { deep: true, immediate: true }
314
- )
315
-
316
- watch(
317
- () => props.threeChart,
318
- (newValue) => {
319
- if (newValue === undefined) return
320
-
321
- threeSettingsLocal.value = newValue
322
-
323
- if (newValue) updateGraph(threeSettingsLocal.value, newValue.place)
324
-
325
- isMountedLoader.value && checkIsMountedError()
326
- },
327
- { deep: true, immediate: true }
328
- )
329
-
330
- watch(chartOne, (newValue) => {
331
- if (!newValue) return
332
-
333
- newValue.exportingGroup?.element?.children[0].children[0].remove()
334
- })
335
- watch(chartTwo, (newValue) => {
336
- if (!newValue) return
337
- newValue.exportingGroup?.element?.children[0].children[0].remove()
338
- })
339
- watch(chartFour, (newValue) => {
340
- if (!newValue) return
341
- newValue.exportingGroup?.element?.children[0].children[0].remove()
342
- })
343
- watch(chartThree, (newValue) => {
344
- if (!newValue) return
345
- newValue.exportingGroup?.element?.children[0].children[0].remove()
346
- })
347
-
348
- watch(
349
- () => props.fourChart,
350
- (newValue) => {
351
- if (newValue === undefined) return
352
-
353
- fourSettingsLocal.value = newValue
354
-
355
- if (newValue) updateGraph(fourSettingsLocal.value, newValue.place)
356
-
357
- isMountedLoader.value && checkIsMountedError()
358
- },
359
- { deep: true, immediate: true }
360
- )
361
-
362
- const setResizeObserve = (): void => {
363
- const el = document.getElementById('center-pane')
364
-
365
- if (!el) {
366
- setTimeout(setResizeObserve, 0)
367
- return
368
- }
369
- new ResizeObserver(outputSize).observe(el)
370
- }
371
-
372
- onMounted(() => {
373
- isMountedLoader.value = true
374
- setResizeObserve()
375
- })
376
- </script>
377
-
378
- <style>
379
- :root {
380
- --loader-bg-color: #ffffff;
381
- }
382
- :root.dark-theme {
383
- --loader-bg-color: #22343c;
384
- }
385
- </style>
386
-
387
- <style scoped lang="scss">
388
- .charts-view {
389
- position: relative;
390
- display: flex;
391
- flex-direction: row;
392
- flex-wrap: wrap;
393
- justify-content: space-between;
394
- overflow: auto;
395
- height: 100%;
396
-
397
- .graphic-loader-block {
398
- background-color: var(--loader-bg-color);
399
- height: 100%;
400
- display: flex;
401
- flex-direction: column;
402
- align-items: center;
403
- justify-content: center;
404
- }
405
-
406
- .graph-empty-block {
407
- display: flex;
408
- flex-direction: column;
409
- height: 100%;
410
- background-color: var(--loader-bg-color);
411
-
412
- .title {
413
- text-align: center;
414
- font-size: 18px;
415
- margin-top: 10px;
416
- color: var(--global-font-color);
417
- }
418
-
419
- .body-block {
420
- height: 100%;
421
- display: flex;
422
- justify-content: center;
423
- text-align: center;
424
- align-items: center;
425
- color: var(--global-font-color);
426
- }
427
- }
428
-
429
- .chart-container {
430
- box-sizing: border-box;
431
- flex-grow: 1;
432
- padding: 5px;
433
- min-height: 300px;
434
- height: 100%;
435
- min-width: 300px;
436
- width: 100%;
437
- position: relative;
438
-
439
- &:first-child:last-child {
440
- height: 100%;
441
- width: 100%;
442
- }
443
-
444
- &:first-child:nth-last-child(2),
445
- &:nth-child(2):last-child {
446
- width: 50%;
447
- height: 100%;
448
- }
449
- }
450
-
451
- .content-global-loading {
452
- width: 100%;
453
- height: 100%;
454
- display: flex;
455
- align-items: center;
456
- justify-content: center;
457
- color: var(--global-font-color);
458
- }
459
- }
460
- @media (min-width: 1280px) {
461
- .charts-view .chart-container {
462
- width: 50%;
463
- }
464
- }
465
- @media (min-height: 800px) {
466
- .charts-view .chart-container {
467
- height: 50%;
468
- }
469
- }
470
- </style>
1
+ <template>
2
+ <div class="charts-view">
3
+ <template v-if="oneSettingsLocal && !isMountedLoader">
4
+ <div :class="['chart-container', `graph-${oneSettingsLocal.title}`]">
5
+ <div v-if="oneSettingsLocal.loader" class="graphic-loader-block">
6
+ <div class="spinner"></div>
7
+ <p>{{ localization.retrievingData }}...</p>
8
+ </div>
9
+ <common-graph
10
+ v-else-if="oneGraphData"
11
+ :data="oneGraphData"
12
+ :chart="chartOne"
13
+ :update="oneUpdateHelper"
14
+ />
15
+ <div v-else class="graph-empty-block">
16
+ <div class="title">{{ oneSettingsLocal.title }}</div>
17
+ <div class="body-block">
18
+ {{ localization.emptyGraphText }}
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </template>
23
+ <template v-if="twoSettingsLocal && !isMountedLoader">
24
+ <div :class="['chart-container', `graph-${twoSettingsLocal.title}`]">
25
+ <div v-if="twoSettingsLocal.loader" class="graphic-loader-block">
26
+ <div class="spinner"></div>
27
+ <p>{{ localization.retrievingData }}...</p>
28
+ </div>
29
+ <common-graph
30
+ v-else-if="twoGraphData"
31
+ :data="twoGraphData"
32
+ :chart="chartTwo"
33
+ :update="twoUpdateHelper"
34
+ />
35
+ <div v-else class="graph-empty-block">
36
+ <div class="title">{{ twoSettingsLocal.title }}</div>
37
+ <div class="body-block">
38
+ {{ localization.emptyGraphText }}
39
+ </div>
40
+ </div>
41
+ </div>
42
+ </template>
43
+ <template v-if="threeSettingsLocal && !isMountedLoader">
44
+ <div :class="['chart-container', `graph-${threeSettingsLocal.title}`]">
45
+ <div v-if="threeSettingsLocal.loader" class="graphic-loader-block">
46
+ <div class="spinner"></div>
47
+ <p>{{ localization.retrievingData }}...</p>
48
+ </div>
49
+ <common-graph
50
+ v-else-if="threeGraphData"
51
+ :data="threeGraphData"
52
+ :chart="chartThree"
53
+ :update="threeUpdateHelper"
54
+ />
55
+ <div v-else class="graph-empty-block">
56
+ <div class="title">{{ threeSettingsLocal.title }}</div>
57
+ <div class="body-block">
58
+ {{ localization.emptyGraphText }}
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </template>
63
+ <template v-if="fourSettingsLocal && !isMountedLoader">
64
+ <div :class="['chart-container', `graph-${fourSettingsLocal.title}`]">
65
+ <div v-if="fourSettingsLocal.loader" class="graphic-loader-block">
66
+ <div class="spinner"></div>
67
+ <p>{{ localization.retrievingData }}...</p>
68
+ </div>
69
+ <common-graph
70
+ v-else-if="fourGraphData"
71
+ :data="fourGraphData"
72
+ :chart="chartFour"
73
+ :update="fourUpdateHelper"
74
+ />
75
+ <div v-else class="graph-empty-block">
76
+ <div class="title">{{ fourSettingsLocal.title }}</div>
77
+ <div class="body-block">
78
+ {{ localization.emptyGraphText }}
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </template>
83
+ <div v-if="isMountedLoader" class="content-global-loading">
84
+ {{ localization.loading }}...
85
+ </div>
86
+ </div>
87
+ </template>
88
+
89
+ <script setup lang="ts">
90
+ import { format } from 'date-fns'
91
+ import { UI_I_Localization } from '~/models/interfaces'
92
+ import { UI_I_GraphDataSettingItem } from '~/components/common/monitor/models/interfaces'
93
+ import {
94
+ I_ColumnGraph,
95
+ I_LineGraph,
96
+ I_SeriesColumn,
97
+ I_SeriesLine,
98
+ } from 'bfg-nuxt-3-graph/graph/models/interfaces'
99
+ import {
100
+ columnGraphDataFunc,
101
+ graphDataFunc,
102
+ } from 'bfg-nuxt-3-graph/graph/utils/renderGraph'
103
+
104
+ const props = defineProps<{
105
+ oneChart?: UI_I_GraphDataSettingItem | null
106
+ twoChart?: UI_I_GraphDataSettingItem | null
107
+ threeChart?: UI_I_GraphDataSettingItem | null
108
+ fourChart?: UI_I_GraphDataSettingItem | null
109
+ themeMode?: string
110
+ formatDate?: string
111
+ formatTime?: string
112
+ graphType: string
113
+ }>()
114
+
115
+ const { $formattedDatetime } = useNuxtApp()
116
+
117
+ const localization = computed<UI_I_Localization>(() => useLocal())
118
+
119
+ const isFullScreen = ref<boolean>(false)
120
+
121
+ const fullScreenCallBack = (newValue: boolean): void => {
122
+ newValue && (isFullScreen.value = newValue)
123
+ }
124
+
125
+ const oneUpdateHelper = ref<number>(0)
126
+ const twoUpdateHelper = ref<number>(0)
127
+ const threeUpdateHelper = ref<number>(0)
128
+ const fourUpdateHelper = ref<number>(0)
129
+
130
+ const chartOne = ref<any>(null)
131
+ const chartTwo = ref<any>(null)
132
+ const chartThree = ref<any>(null)
133
+ const chartFour = ref<any>(null)
134
+
135
+ const currentChartName = ref<string>('')
136
+
137
+ const getCurrentChart = (chart: any): any => {
138
+ switch (currentChartName.value) {
139
+ case 'one':
140
+ chartOne.value = chart
141
+ break
142
+ case 'two':
143
+ chartTwo.value = chart
144
+ break
145
+ case 'three':
146
+ chartThree.value = chart
147
+ break
148
+ case 'four':
149
+ chartFour.value = chart
150
+ break
151
+ }
152
+ }
153
+
154
+ const oneSettingsLocal = ref<UI_I_GraphDataSettingItem | null>(null)
155
+ const twoSettingsLocal = ref<UI_I_GraphDataSettingItem | null>(null)
156
+ const threeSettingsLocal = ref<UI_I_GraphDataSettingItem | null>(null)
157
+ const fourSettingsLocal = ref<UI_I_GraphDataSettingItem | null>(null)
158
+
159
+ const isMountedLoader = ref<boolean>()
160
+
161
+ const oneGraphData = ref<I_LineGraph | I_ColumnGraph | null>(null)
162
+ const twoGraphData = ref<I_LineGraph | I_ColumnGraph | null>(null)
163
+ const threeGraphData = ref<I_LineGraph | I_ColumnGraph | null>(null)
164
+ const fourGraphData = ref<I_LineGraph | I_ColumnGraph | null>(null)
165
+
166
+ const instanceOfSeriesLine = (
167
+ object: I_SeriesLine | I_SeriesColumn
168
+ ): object is I_SeriesLine => {
169
+ return 'lines' in object
170
+ }
171
+
172
+ const setCurrentGraphData = (
173
+ name: string,
174
+ data: I_SeriesLine | I_SeriesColumn,
175
+ isDarkMode: boolean,
176
+ width: number,
177
+ chartType?: string
178
+ ): void => {
179
+ currentChartName.value = name
180
+
181
+ let graphData = null
182
+ if (chartType === 'column' && !instanceOfSeriesLine(data)) {
183
+ graphData = columnGraphDataFunc(data, localization.value)
184
+ } else if (instanceOfSeriesLine(data)) {
185
+ graphData = graphDataFunc(
186
+ data,
187
+ isDarkMode,
188
+ localization.value,
189
+ fullScreenCallBack,
190
+ false,
191
+ true,
192
+ true,
193
+ props.graphType,
194
+ '',
195
+ width,
196
+ getCurrentChart,
197
+ $formattedDatetime,
198
+ format,
199
+ props.formatDate,
200
+ props.formatTime
201
+ )
202
+ }
203
+
204
+ switch (name) {
205
+ case 'one':
206
+ oneGraphData.value = graphData
207
+ break
208
+ case 'two':
209
+ twoGraphData.value = graphData
210
+ break
211
+ case 'three':
212
+ threeGraphData.value = graphData
213
+ break
214
+ case 'four':
215
+ fourGraphData.value = graphData
216
+ break
217
+ }
218
+ }
219
+
220
+ const outputSize = (): void => {
221
+ setTimeout(() => {
222
+ if (oneGraphData.value) oneUpdateHelper.value++
223
+ if (twoGraphData.value) twoUpdateHelper.value++
224
+ if (threeGraphData.value) threeUpdateHelper.value++
225
+ if (fourGraphData.value) fourUpdateHelper.value++
226
+
227
+ if (chartOne.value && chartOne.value?.hasLoaded) chartOne.value.reflow()
228
+
229
+ if (chartTwo.value && chartTwo.value?.hasLoaded) chartTwo.value.reflow()
230
+
231
+ if (chartThree.value && chartThree.value?.hasLoaded)
232
+ chartThree.value.reflow()
233
+
234
+ if (chartFour.value && chartFour.value?.hasLoaded) chartFour.value.reflow()
235
+ }, 1000)
236
+ }
237
+ const updateGraph = (
238
+ graphSetting: UI_I_GraphDataSettingItem | null,
239
+ name: string
240
+ ): void => {
241
+ outputSize()
242
+ updateGraphsData(graphSetting, name)
243
+ }
244
+
245
+ const updateGraphsData = (
246
+ data: UI_I_GraphDataSettingItem | null,
247
+ name: string
248
+ ): void => {
249
+ if (!data?.data) {
250
+ switch (name) {
251
+ case 'one':
252
+ oneGraphData.value = null
253
+ break
254
+ case 'two':
255
+ twoGraphData.value = null
256
+ break
257
+ case 'three':
258
+ threeGraphData.value = null
259
+ break
260
+ case 'four':
261
+ fourGraphData.value = null
262
+ break
263
+ }
264
+ return
265
+ }
266
+
267
+ const themeMode = useLocalStorage('themeMode') || props.themeMode
268
+ const isDarkMode = themeMode === 'dark-theme'
269
+
270
+ const width =
271
+ document
272
+ .querySelector(`.graph-${name} .graph-content`)
273
+ ?.getBoundingClientRect().width || 700
274
+
275
+ setCurrentGraphData(name, data.data, isDarkMode, width, data.chartType)
276
+ }
277
+
278
+ const checkIsMountedError = (): void => {
279
+ if (
280
+ oneSettingsLocal.value ||
281
+ twoSettingsLocal.value ||
282
+ threeSettingsLocal.value ||
283
+ fourSettingsLocal.value
284
+ )
285
+ isMountedLoader.value = false
286
+ }
287
+
288
+ watch(
289
+ () => props.oneChart,
290
+ (newValue) => {
291
+ if (newValue === undefined) return
292
+
293
+ oneSettingsLocal.value = newValue
294
+
295
+ if (newValue) updateGraph(oneSettingsLocal.value, newValue.place)
296
+
297
+ isMountedLoader.value && checkIsMountedError()
298
+ },
299
+ { deep: true, immediate: true }
300
+ )
301
+
302
+ watch(
303
+ () => props.twoChart,
304
+ (newValue) => {
305
+ if (newValue === undefined) return
306
+
307
+ twoSettingsLocal.value = newValue
308
+
309
+ if (newValue) updateGraph(twoSettingsLocal.value, newValue.place)
310
+
311
+ isMountedLoader.value && checkIsMountedError()
312
+ },
313
+ { deep: true, immediate: true }
314
+ )
315
+
316
+ watch(
317
+ () => props.threeChart,
318
+ (newValue) => {
319
+ if (newValue === undefined) return
320
+
321
+ threeSettingsLocal.value = newValue
322
+
323
+ if (newValue) updateGraph(threeSettingsLocal.value, newValue.place)
324
+
325
+ isMountedLoader.value && checkIsMountedError()
326
+ },
327
+ { deep: true, immediate: true }
328
+ )
329
+
330
+ watch(chartOne, (newValue) => {
331
+ if (!newValue) return
332
+
333
+ newValue.exportingGroup?.element?.children[0].children[0].remove()
334
+ })
335
+ watch(chartTwo, (newValue) => {
336
+ if (!newValue) return
337
+ newValue.exportingGroup?.element?.children[0].children[0].remove()
338
+ })
339
+ watch(chartFour, (newValue) => {
340
+ if (!newValue) return
341
+ newValue.exportingGroup?.element?.children[0].children[0].remove()
342
+ })
343
+ watch(chartThree, (newValue) => {
344
+ if (!newValue) return
345
+ newValue.exportingGroup?.element?.children[0].children[0].remove()
346
+ })
347
+
348
+ watch(
349
+ () => props.fourChart,
350
+ (newValue) => {
351
+ if (newValue === undefined) return
352
+
353
+ fourSettingsLocal.value = newValue
354
+
355
+ if (newValue) updateGraph(fourSettingsLocal.value, newValue.place)
356
+
357
+ isMountedLoader.value && checkIsMountedError()
358
+ },
359
+ { deep: true, immediate: true }
360
+ )
361
+
362
+ const setResizeObserve = (): void => {
363
+ const el = document.getElementById('center-pane')
364
+
365
+ if (!el) {
366
+ setTimeout(setResizeObserve, 0)
367
+ return
368
+ }
369
+ new ResizeObserver(outputSize).observe(el)
370
+ }
371
+
372
+ onMounted(() => {
373
+ isMountedLoader.value = true
374
+ setResizeObserve()
375
+ })
376
+ </script>
377
+
378
+ <style>
379
+ :root {
380
+ --loader-bg-color: #ffffff;
381
+ }
382
+ :root.dark-theme {
383
+ --loader-bg-color: #22343c;
384
+ }
385
+ </style>
386
+
387
+ <style scoped lang="scss">
388
+ .charts-view {
389
+ position: relative;
390
+ display: flex;
391
+ flex-direction: row;
392
+ flex-wrap: wrap;
393
+ justify-content: space-between;
394
+ overflow: auto;
395
+ height: 100%;
396
+
397
+ .graphic-loader-block {
398
+ background-color: var(--loader-bg-color);
399
+ height: 100%;
400
+ display: flex;
401
+ flex-direction: column;
402
+ align-items: center;
403
+ justify-content: center;
404
+ }
405
+
406
+ .graph-empty-block {
407
+ display: flex;
408
+ flex-direction: column;
409
+ height: 100%;
410
+ background-color: var(--loader-bg-color);
411
+
412
+ .title {
413
+ text-align: center;
414
+ font-size: 18px;
415
+ margin-top: 10px;
416
+ color: var(--global-font-color);
417
+ }
418
+
419
+ .body-block {
420
+ height: 100%;
421
+ display: flex;
422
+ justify-content: center;
423
+ text-align: center;
424
+ align-items: center;
425
+ color: var(--global-font-color);
426
+ }
427
+ }
428
+
429
+ .chart-container {
430
+ box-sizing: border-box;
431
+ flex-grow: 1;
432
+ padding: 5px;
433
+ min-height: 300px;
434
+ height: 100%;
435
+ min-width: 300px;
436
+ width: 100%;
437
+ position: relative;
438
+
439
+ &:first-child:last-child {
440
+ height: 100%;
441
+ width: 100%;
442
+ }
443
+
444
+ &:first-child:nth-last-child(2),
445
+ &:nth-child(2):last-child {
446
+ width: 50%;
447
+ height: 100%;
448
+ }
449
+ }
450
+
451
+ .content-global-loading {
452
+ width: 100%;
453
+ height: 100%;
454
+ display: flex;
455
+ align-items: center;
456
+ justify-content: center;
457
+ color: var(--global-font-color);
458
+ }
459
+ }
460
+ @media (min-width: 1280px) {
461
+ .charts-view .chart-container {
462
+ width: 50%;
463
+ }
464
+ }
465
+ @media (min-height: 800px) {
466
+ .charts-view .chart-container {
467
+ height: 50%;
468
+ }
469
+ }
470
+ </style>