bfg-common 1.6.111 → 1.6.113
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/img/icons/icons-sprite-dark-4.svg +17 -38
- package/assets/img/icons/icons-sprite-light-4.svg +17 -49
- package/assets/localization/local_be.json +4 -33
- package/assets/localization/local_en.json +4 -33
- package/assets/localization/local_hy.json +4 -33
- package/assets/localization/local_kk.json +4 -33
- package/assets/localization/local_ru.json +7 -36
- package/assets/localization/local_zh.json +4 -33
- package/components/common/configure/advancedSystemSettings/AdvancedSystemSettings.vue +17 -25
- package/components/common/configure/advancedSystemSettings/modals/edit/Edit.vue +4 -4
- package/components/common/configure/advancedSystemSettings/modals/edit/New.vue +23 -42
- package/components/common/configure/advancedSystemSettings/modals/edit/Old.vue +3 -5
- package/components/common/configure/advancedSystemSettings/tableView/TableView.vue +2 -27
- package/components/common/configure/advancedSystemSettings/tableView/new/New.vue +130 -60
- package/components/common/configure/advancedSystemSettings/tableView/new/lib/config/hostTable.ts +308 -0
- package/components/common/configure/advancedSystemSettings/tableView/old/Old.vue +41 -14
- package/components/common/configure/advancedSystemSettings/tableView/{field → old/field}/Field.vue +50 -20
- package/components/common/configure/advancedSystemSettings/tableView/old/field/lib/models/enums.ts +14 -0
- package/components/common/configure/advancedSystemSettings/tools/New.vue +3 -64
- package/components/common/configure/advancedSystemSettings/tools/Old.vue +2 -2
- package/components/common/configure/advancedSystemSettings/tools/Tools.vue +2 -2
- package/components/common/graph/Graph.vue +8 -19
- package/components/common/graph/{new/New.vue → graphNew/GraphNew.vue} +3 -3
- package/components/common/graph/lib/utils/renderGraph.ts +393 -0
- package/components/common/modals/confirmation/Confirmation.vue +0 -1
- package/components/common/monitor/advanced/Advanced.vue +49 -9
- package/components/common/monitor/advanced/graphView/GraphView.vue +12 -8
- package/components/common/monitor/advanced/graphView/{New.vue → GraphViewNew.vue} +1 -1
- package/components/common/monitor/advanced/table/Table.vue +8 -9
- package/components/common/monitor/advanced/table/{new/New.vue → tableNew/TableNew.vue} +5 -6
- package/components/common/monitor/advanced/table/{new → tableNew}/lib/config/options.ts +1 -1
- package/components/common/monitor/advanced/table/{old/Old.vue → tableOld/TableOld.vue} +3 -6
- package/components/common/monitor/advanced/tools/Tools.vue +53 -11
- package/components/common/monitor/advanced/tools/{New.vue → ToolsNew.vue} +0 -4
- package/components/common/monitor/advanced/tools/{Old.vue → ToolsOld.vue} +0 -2
- package/components/common/monitor/advanced/tools/chartOptionsModal/ChartOptionsModal.vue +569 -569
- package/components/common/monitor/advanced/tools/chartOptionsModal/{notification/Notification.vue → Notification.vue} +6 -8
- package/components/common/monitor/advanced/tools/chartOptionsModal/{notification/New.vue → NotificationNew.vue} +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/{notification/Old.vue → NotificationOld.vue} +5 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/Actions.vue +13 -9
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/{New.vue → ActionsNew.vue} +3 -6
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/Counters.vue +44 -12
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/Table.vue +7 -8
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/{new/New.vue → tableNew/TableNew.vue} +2 -2
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/{new → tableNew}/config/tableData.ts +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/{old/Old.vue → tableOld/TableOld.vue} +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/{old → tableOld}/lib/config/tableConfig.ts +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/Timespan.vue +36 -9
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/Object.vue +9 -8
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/{new/New.vue → objectNew/ObjectNew.vue} +2 -2
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/{new → objectNew}/lib/config/tableData.ts +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/{old/Old.vue → objectOld/ObjectOld.vue} +2 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/metrics/Metrics.vue +7 -8
- package/components/common/monitor/overview/OverviewNew.vue +1 -1
- package/components/common/monitor/overview/OverviewOld.vue +1 -1
- package/components/common/monitor/overview/filters/FiltersNew.vue +0 -1
- package/components/common/monitor/overview/filters/FiltersOld.vue +0 -1
- package/components/common/pages/hardwareHealth/historyTestimony/GraphNew.vue +2 -2
- package/lib/models/interfaces.ts +0 -1
- package/package.json +1 -1
- package/components/common/configure/advancedSystemSettings/New.vue +0 -37
- package/components/common/configure/advancedSystemSettings/Old.vue +0 -36
- package/components/common/configure/advancedSystemSettings/tableView/field/New.vue +0 -88
- package/components/common/configure/advancedSystemSettings/tableView/field/Old.vue +0 -73
- package/components/common/configure/advancedSystemSettings/tableView/field/lib/config/index.ts +0 -10
- package/components/common/configure/advancedSystemSettings/tableView/field/lib/models/enums.ts +0 -14
- package/components/common/configure/advancedSystemSettings/tableView/new/lib/config/index.ts +0 -112
- /package/components/common/graph/{Old.vue → GraphOld.vue} +0 -0
- /package/components/common/graph/{new → graphNew}/EmptyBlock.vue +0 -0
- /package/components/common/graph/{new → graphNew}/lib/models/enums.ts +0 -0
- /package/components/common/monitor/advanced/{New.vue → AdvancedNew.vue} +0 -0
- /package/components/common/monitor/advanced/{Old.vue → AdvancedOld.vue} +0 -0
- /package/components/common/monitor/advanced/graphView/{Old.vue → GraphViewOld.vue} +0 -0
- /package/components/common/monitor/advanced/table/{new → tableNew}/lib/utils/constructBody.ts +0 -0
- /package/components/common/monitor/advanced/table/{old → tableOld}/lib/config/performanceDatatable.ts +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/{New.vue → ChartOptionsModalNew.vue} +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/{Old.vue → ChartOptionsModalOld.vue} +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/actions/{Old.vue → ActionsOld.vue} +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/counters/{New.vue → CountersNew.vue} +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/counters/{Old.vue → CountersOld.vue} +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/{new → tableNew}/config/options.ts +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/{new → tableNew}/utils/constructTable.ts +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/{old → tableOld}/lib/models/types.ts +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/{New.vue → TimespanNew.vue} +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/{Old.vue → TimespanOld.vue} +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/{new → objectNew}/lib/config/options.ts +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/{new → objectNew}/lib/utils/constructTable.ts +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/metrics/{New.vue → MetricsNew.vue} +0 -0
- /package/components/common/monitor/advanced/tools/chartOptionsModal/metrics/{Old.vue → MetricsOld.vue} +0 -0
package/components/common/configure/advancedSystemSettings/tableView/{field → old/field}/Field.vue
RENAMED
|
@@ -1,37 +1,67 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
<atoms-tooltip-error :has-error="invalid">
|
|
3
|
+
<template #elem>
|
|
4
|
+
<div v-if="props.data.type === 'number'">
|
|
5
|
+
<input
|
|
6
|
+
v-model="valueLocal"
|
|
7
|
+
type="number"
|
|
8
|
+
:class="{ 'has-error': invalid }"
|
|
9
|
+
@input="onChangeSetting($event)"
|
|
10
|
+
/>
|
|
11
|
+
</div>
|
|
12
|
+
<div v-if="props.data.type === 'string'">
|
|
13
|
+
<input
|
|
14
|
+
v-model="valueLocal"
|
|
15
|
+
type="text"
|
|
16
|
+
:class="{ 'has-error': invalid }"
|
|
17
|
+
@input="onChangeSetting($event)"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
<div v-if="props.data.type === 'boolean'" class="select">
|
|
21
|
+
<select
|
|
22
|
+
v-model="valueLocal"
|
|
23
|
+
@change="onChangeSetting($event)"
|
|
24
|
+
:class="{ 'has-error': invalid }"
|
|
25
|
+
>
|
|
26
|
+
<option value="false">false</option>
|
|
27
|
+
<option value="true">true</option>
|
|
28
|
+
</select>
|
|
29
|
+
</div>
|
|
30
|
+
<!-- <div v-if="props.data.type === 'select'" class="select">-->
|
|
31
|
+
<!-- <select-->
|
|
32
|
+
<!-- v-model="valueLocal"-->
|
|
33
|
+
<!-- @change="onChangeSetting($event)"-->
|
|
34
|
+
<!-- :class="{ 'has-error': invalid }"-->
|
|
35
|
+
<!-- >-->
|
|
36
|
+
<!-- <option-->
|
|
37
|
+
<!-- v-for="item2 in props.data.options"-->
|
|
38
|
+
<!-- :key="item2.key"-->
|
|
39
|
+
<!-- :value="item2.key"-->
|
|
40
|
+
<!-- >-->
|
|
41
|
+
<!-- {{ item2.value }}-->
|
|
42
|
+
<!-- </option>-->
|
|
43
|
+
<!-- </select>-->
|
|
44
|
+
<!-- </div>-->
|
|
45
|
+
</template>
|
|
46
|
+
<template #content>
|
|
47
|
+
{{ errorMessage }}
|
|
48
|
+
</template>
|
|
49
|
+
</atoms-tooltip-error>
|
|
10
50
|
</template>
|
|
11
51
|
|
|
12
52
|
<script setup lang="ts">
|
|
13
53
|
import type { UI_I_AdvancedSystemSettingsEditData } from '~/components/common/configure/advancedSystemSettings/tableView/old/lib/models/interfaces'
|
|
14
|
-
import {
|
|
54
|
+
import { E_Format } from '~/components/common/configure/advancedSystemSettings/tableView/old/field/lib/models/enums'
|
|
15
55
|
import { allRegExp } from '~/lib/config/regExp'
|
|
16
56
|
|
|
17
57
|
const props = defineProps<{
|
|
18
58
|
data: UI_I_AdvancedSystemSettingsEditData
|
|
19
59
|
}>()
|
|
20
|
-
|
|
21
60
|
const emits = defineEmits<{
|
|
22
61
|
(event: 'change', value: UI_I_AdvancedSystemSettingsEditData['value']): void
|
|
23
62
|
(event: 'error-message', value: string): void
|
|
24
63
|
}>()
|
|
25
64
|
|
|
26
|
-
const { $store }: any = useNuxtApp()
|
|
27
|
-
|
|
28
|
-
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
29
|
-
const currentComponent = computed(() =>
|
|
30
|
-
isNewView.value
|
|
31
|
-
? defineAsyncComponent(() => import('./New.vue'))
|
|
32
|
-
: defineAsyncComponent(() => import('./Old.vue'))
|
|
33
|
-
)
|
|
34
|
-
|
|
35
65
|
const valueLocal = ref<UI_I_AdvancedSystemSettingsEditData['value']>(
|
|
36
66
|
props.data.value
|
|
37
67
|
)
|
|
@@ -88,7 +118,7 @@ const onChangeSetting = (event: Event): void => {
|
|
|
88
118
|
if (invalid.value) return
|
|
89
119
|
|
|
90
120
|
if (validation.Format) {
|
|
91
|
-
const format =
|
|
121
|
+
const format = E_Format[validation.Format]
|
|
92
122
|
invalid.value = !allRegExp[format].test(value)
|
|
93
123
|
errorMessage.value = invalid.value ? `Value must be ${format}` : ''
|
|
94
124
|
}
|
package/components/common/configure/advancedSystemSettings/tableView/old/field/lib/models/enums.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export enum E_Format {
|
|
2
|
+
'unix path' = 'unixPath',
|
|
3
|
+
'win path' = 'winPath',
|
|
4
|
+
'mac' = 'mac',
|
|
5
|
+
'ip4' = 'ip4',
|
|
6
|
+
'ip6' = 'ip6',
|
|
7
|
+
'url' = 'url',
|
|
8
|
+
'uuid' = 'uuid',
|
|
9
|
+
'semver' = 'semver',
|
|
10
|
+
'domain' = 'domain',
|
|
11
|
+
'base64' = 'base64',
|
|
12
|
+
'regex' = 'regex',
|
|
13
|
+
'hex color' = 'hexColor',
|
|
14
|
+
}
|
|
@@ -1,66 +1,5 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex flex-wrap justify-between gap-4 mb-4">
|
|
3
|
-
<h3 class="advanced-system-settings-title text-[18px] font-[500]">
|
|
4
|
-
{{ props.title }}
|
|
5
|
-
</h3>
|
|
1
|
+
<template>New</template>
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
test-id="advanced-system-settings-edit-toggle"
|
|
9
|
-
variant="text"
|
|
10
|
-
is-without-sizes
|
|
11
|
-
is-without-height
|
|
12
|
-
@click="emits('show-edit-modal')"
|
|
13
|
-
>
|
|
14
|
-
<ui-icon name="settings" width="18px" height="18px" />
|
|
15
|
-
</ui-button>
|
|
16
|
-
</div>
|
|
17
|
-
</template>
|
|
3
|
+
<script setup lang="ts"></script>
|
|
18
4
|
|
|
19
|
-
<
|
|
20
|
-
const props = defineProps<{
|
|
21
|
-
title: string
|
|
22
|
-
}>()
|
|
23
|
-
|
|
24
|
-
const emits = defineEmits<{
|
|
25
|
-
(event: 'show-edit-modal'): void
|
|
26
|
-
}>()
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<style>
|
|
30
|
-
:root {
|
|
31
|
-
--advanced-system-settings-title: #4d5d69;
|
|
32
|
-
--advanced-system-settings-edit-border: #e9ebed;
|
|
33
|
-
--advanced-system-settings-edit-bg: #ffffff;
|
|
34
|
-
--advanced-system-settings-edit-color: #213444;
|
|
35
|
-
--advanced-system-settings-edit-hover-bg: #f6f7f8;
|
|
36
|
-
--advanced-system-settings-edit-hover-color: #1b2a37;
|
|
37
|
-
}
|
|
38
|
-
:root.dark-theme {
|
|
39
|
-
--advanced-system-settings-title: #e9eaec;
|
|
40
|
-
--advanced-system-settings-edit-border: #e9ebed1f;
|
|
41
|
-
--advanced-system-settings-edit-bg: #1b2a373d;
|
|
42
|
-
--advanced-system-settings-edit-color: #e9eaec;
|
|
43
|
-
--advanced-system-settings-edit-hover-bg: #283948;
|
|
44
|
-
--advanced-system-settings-edit-hover-color: #ffffff;
|
|
45
|
-
}
|
|
46
|
-
</style>
|
|
47
|
-
|
|
48
|
-
<style scoped lang="scss">
|
|
49
|
-
.advanced-system-settings-title {
|
|
50
|
-
color: var(--advanced-system-settings-title);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
#advanced-system-settings-edit-toggle {
|
|
54
|
-
padding: 8px;
|
|
55
|
-
width: 34px;
|
|
56
|
-
height: 34px;
|
|
57
|
-
border: 1px solid var(--advanced-system-settings-edit-border);
|
|
58
|
-
color: var(--advanced-system-settings-edit-color);
|
|
59
|
-
background-color: var(--advanced-system-settings-edit-bg);
|
|
60
|
-
|
|
61
|
-
&:hover {
|
|
62
|
-
background-color: var(--advanced-system-settings-edit-hover-bg);
|
|
63
|
-
color: var(--advanced-system-settings-edit-hover-color);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
</style>
|
|
5
|
+
<style scoped lang="scss"></style>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<template #action>
|
|
4
4
|
<button
|
|
5
5
|
class="btn btn-sm btn-secondary ng-star-inserted"
|
|
6
|
-
@click="emits('show-edit
|
|
6
|
+
@click="emits('show-edit')"
|
|
7
7
|
>
|
|
8
8
|
{{ localization.common.edit }}...
|
|
9
9
|
</button>
|
|
@@ -19,7 +19,7 @@ const props = defineProps<{
|
|
|
19
19
|
}>()
|
|
20
20
|
|
|
21
21
|
const emits = defineEmits<{
|
|
22
|
-
(event: 'show-edit
|
|
22
|
+
(event: 'show-edit'): void
|
|
23
23
|
}>()
|
|
24
24
|
|
|
25
25
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<component
|
|
3
3
|
:is="currentComponent"
|
|
4
4
|
:title="localization.common.advancedSystemSettings"
|
|
5
|
-
@show-edit
|
|
5
|
+
@show-edit="emits('show-edit')"
|
|
6
6
|
/>
|
|
7
7
|
</template>
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
11
11
|
|
|
12
12
|
const emits = defineEmits<{
|
|
13
|
-
(event: 'show-edit
|
|
13
|
+
(event: 'show-edit'): void
|
|
14
14
|
}>()
|
|
15
15
|
|
|
16
16
|
const { $store }: any = useNuxtApp()
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</div>
|
|
2
|
+
<common-graph-graph-new
|
|
3
|
+
v-if="isNewView"
|
|
4
|
+
:chart-options="chartOptions"
|
|
5
|
+
@select-item="onSelectNewViewExportItem"
|
|
6
|
+
/>
|
|
7
|
+
<common-graph-old v-else :chart-options="chartOptions" />
|
|
9
8
|
</template>
|
|
10
9
|
|
|
11
10
|
<script setup lang="ts">
|
|
@@ -25,19 +24,13 @@ const props = withDefaults(
|
|
|
25
24
|
{
|
|
26
25
|
chart: undefined,
|
|
27
26
|
exportType: undefined,
|
|
28
|
-
selectedRow:
|
|
27
|
+
selectedRow: [],
|
|
29
28
|
}
|
|
30
29
|
)
|
|
31
30
|
|
|
32
31
|
const { $store }: any = useNuxtApp()
|
|
33
32
|
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
34
33
|
|
|
35
|
-
const currentComponent = computed(() =>
|
|
36
|
-
isNewView.value
|
|
37
|
-
? defineAsyncComponent(() => import('./new/New.vue'))
|
|
38
|
-
: defineAsyncComponent(() => import('./Old.vue'))
|
|
39
|
-
)
|
|
40
|
-
|
|
41
34
|
let localChart: any = null
|
|
42
35
|
const exportChart = (type: string): void => {
|
|
43
36
|
if (type === 'png') {
|
|
@@ -131,8 +124,4 @@ watch(
|
|
|
131
124
|
)
|
|
132
125
|
</script>
|
|
133
126
|
|
|
134
|
-
<style scoped lang="scss">
|
|
135
|
-
.common-graph-block {
|
|
136
|
-
display: contents;
|
|
137
|
-
}
|
|
138
|
-
</style>
|
|
127
|
+
<style scoped lang="scss"></style>
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
<ui-button
|
|
16
16
|
:test-id="`button-metric-${uniqueId}`"
|
|
17
17
|
:class="['metric-export-button', { active: isShowDropdown }]"
|
|
18
|
-
variant="text"
|
|
19
18
|
is-without-sizes
|
|
20
19
|
is-without-height
|
|
20
|
+
variant="text"
|
|
21
21
|
@click="isShowDropdown = !isShowDropdown"
|
|
22
22
|
>
|
|
23
23
|
<ui-icon name="burger" width="20" height="20" />
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
:show="isShowDropdown"
|
|
28
28
|
:items="dropdownItems"
|
|
29
29
|
:elem-id="`button-metric-${uniqueId}`"
|
|
30
|
-
width="max-content"
|
|
31
30
|
left
|
|
31
|
+
width="max-content"
|
|
32
32
|
@select="onSelect($event)"
|
|
33
33
|
@hide="isShowDropdown = false"
|
|
34
34
|
/>
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
import { useFullscreen } from '@vueuse/core'
|
|
49
49
|
import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
|
|
50
50
|
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
51
|
-
import { UI_E_ChartExportIconByKey } from '~/components/common/graph/
|
|
51
|
+
import { UI_E_ChartExportIconByKey } from '~/components/common/graph/graphNew/lib/models/enums'
|
|
52
52
|
|
|
53
53
|
const props = withDefaults(
|
|
54
54
|
defineProps<{
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { Ref } from 'vue'
|
|
2
|
+
import type {
|
|
3
|
+
I_CurrentColor,
|
|
4
|
+
I_LineGraph,
|
|
5
|
+
I_DiskGraph,
|
|
6
|
+
I_Title,
|
|
7
|
+
I_LineSeries,
|
|
8
|
+
I_SeriesLine,
|
|
9
|
+
I_SeriesDisk,
|
|
10
|
+
I_SeriesLineItem,
|
|
11
|
+
} from '~/node_modules/bfg-nuxt-3-graph/graph/lib/models/interfaces'
|
|
12
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
13
|
+
|
|
14
|
+
export const graphDataFunc = (
|
|
15
|
+
graphData: I_SeriesLine,
|
|
16
|
+
isDarkMode: boolean,
|
|
17
|
+
localization: UI_I_Localization,
|
|
18
|
+
isFullScreen: Ref<boolean>,
|
|
19
|
+
disabledTitle: boolean,
|
|
20
|
+
disabledExportButton: boolean,
|
|
21
|
+
disabledLegends: boolean,
|
|
22
|
+
graphType?: string,
|
|
23
|
+
dateTimeFormat?: string,
|
|
24
|
+
width?: number,
|
|
25
|
+
chart?: Ref<any>
|
|
26
|
+
): I_LineGraph => {
|
|
27
|
+
const currentColor: I_CurrentColor = {
|
|
28
|
+
backgroundColor: isDarkMode ? '#22343c' : 'white',
|
|
29
|
+
titleColor: isDarkMode ? 'white' : '#333333',
|
|
30
|
+
xAxisColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
31
|
+
textColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
32
|
+
legendItemColor: isDarkMode ? '#ADBBC4' : '#333333',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const yAxisLength = graphData.yAxis.length
|
|
36
|
+
const yAxisHelper: string[] = []
|
|
37
|
+
const yAxis = graphData.yAxis
|
|
38
|
+
.filter((_: string, key: number) => key >= yAxisLength - 2)
|
|
39
|
+
.map((text: string, i: number) => {
|
|
40
|
+
const opposite = !!i
|
|
41
|
+
if (opposite) yAxisHelper.push(text)
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
title: {
|
|
45
|
+
text,
|
|
46
|
+
style: {
|
|
47
|
+
color: currentColor.textColor,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
labels: {
|
|
51
|
+
style: {
|
|
52
|
+
color: currentColor.textColor,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
min: text === '%' ? 0 : undefined,
|
|
56
|
+
max: text === '%' ? 100 : undefined,
|
|
57
|
+
opposite,
|
|
58
|
+
gridLineWidth: 0.5,
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const { $formattedDatetime } = useNuxtApp()
|
|
63
|
+
|
|
64
|
+
const currentDateFunc = (data: number): string => {
|
|
65
|
+
if (dateTimeFormat === 'short')
|
|
66
|
+
return $formattedDatetime(new Date(data), {
|
|
67
|
+
hasSeconds: true,
|
|
68
|
+
separator: ', ',
|
|
69
|
+
formatTime: 'h:mm',
|
|
70
|
+
})
|
|
71
|
+
else
|
|
72
|
+
return $formattedDatetime(new Date(data), {
|
|
73
|
+
hasSeconds: true,
|
|
74
|
+
separator: ', ',
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let xAxisCategories: string[] = []
|
|
79
|
+
let xAxisLabelPositions: number[] | null = null
|
|
80
|
+
const intervalDate = Math.round(
|
|
81
|
+
(graphData.pointEnd - graphData.pointStart) / graphData.lines[0].data.length
|
|
82
|
+
)
|
|
83
|
+
const series = graphData.lines.map(
|
|
84
|
+
(line: I_SeriesLineItem, key: number): I_LineSeries => {
|
|
85
|
+
const data =
|
|
86
|
+
line.units === 'ms' ? line.data.map((item) => item / 100) : line.data
|
|
87
|
+
|
|
88
|
+
if (key === 0) {
|
|
89
|
+
xAxisCategories = data.map((_: number, key2: number): string => {
|
|
90
|
+
const currentInterval = key2 ? key2 + 1 : 0
|
|
91
|
+
return currentDateFunc(
|
|
92
|
+
graphData.pointStart + intervalDate * currentInterval
|
|
93
|
+
)
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
if (width) {
|
|
97
|
+
xAxisLabelPositions = []
|
|
98
|
+
const count = Math.round(width / 250)
|
|
99
|
+
const positionInterval = Math.round(xAxisCategories.length / count)
|
|
100
|
+
for (let i = 0; i <= xAxisCategories.length; i += positionInterval) {
|
|
101
|
+
const currentIndex =
|
|
102
|
+
i === xAxisCategories.length ? xAxisCategories.length - 1 : i
|
|
103
|
+
|
|
104
|
+
if (
|
|
105
|
+
!xAxisLabelPositions?.length ||
|
|
106
|
+
currentIndex > xAxisLabelPositions[xAxisLabelPositions.length - 1]
|
|
107
|
+
) {
|
|
108
|
+
xAxisLabelPositions?.push(currentIndex)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (i + positionInterval === positionInterval * count) {
|
|
112
|
+
xAxisLabelPositions?.push(xAxisCategories.length - 1)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const visible = key < 10
|
|
118
|
+
return {
|
|
119
|
+
data,
|
|
120
|
+
visible,
|
|
121
|
+
name: `${line.measurement}`,
|
|
122
|
+
color: line.color,
|
|
123
|
+
lineWidth: line.lineWidth || 1.5,
|
|
124
|
+
yAxis: yAxisHelper.includes(line.units) ? 1 : 0,
|
|
125
|
+
marker: {
|
|
126
|
+
enabled: false,
|
|
127
|
+
},
|
|
128
|
+
tooltip: {
|
|
129
|
+
pointFormatter: function (): string {
|
|
130
|
+
const { x, y }: any = this
|
|
131
|
+
const currentDate = xAxisCategories.find((_, key) => key === x)
|
|
132
|
+
return `<b>${line.relatedDeviceName}<br>${currentDate}</b><br>${
|
|
133
|
+
line.name
|
|
134
|
+
}: ${new Intl.NumberFormat('en-US').format(y)}`
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
const title = (): I_Title => {
|
|
142
|
+
if (disabledTitle) {
|
|
143
|
+
return {
|
|
144
|
+
text: '',
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
return {
|
|
148
|
+
text: graphData.groupName,
|
|
149
|
+
style: {
|
|
150
|
+
color: currentColor.titleColor,
|
|
151
|
+
},
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return {
|
|
157
|
+
chart: {
|
|
158
|
+
type: graphType || 'spline',
|
|
159
|
+
zooming: {
|
|
160
|
+
type: 'xy',
|
|
161
|
+
},
|
|
162
|
+
animation: false,
|
|
163
|
+
backgroundColor: currentColor.backgroundColor,
|
|
164
|
+
events: {
|
|
165
|
+
fullscreenOpen(): void {
|
|
166
|
+
isFullScreen.value = true
|
|
167
|
+
},
|
|
168
|
+
fullscreenClose(): void {
|
|
169
|
+
isFullScreen.value = false
|
|
170
|
+
},
|
|
171
|
+
load: function () {
|
|
172
|
+
if (chart) chart.value = this
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
title: title(),
|
|
178
|
+
|
|
179
|
+
exporting: {
|
|
180
|
+
menuItemDefinitions: {
|
|
181
|
+
viewFullscreen: {
|
|
182
|
+
text: localization.common.viewFullScreen,
|
|
183
|
+
},
|
|
184
|
+
printChart: {
|
|
185
|
+
text: localization.common.printChart,
|
|
186
|
+
},
|
|
187
|
+
downloadPNG: {
|
|
188
|
+
text: localization.common.exportPng,
|
|
189
|
+
},
|
|
190
|
+
downloadJPEG: {
|
|
191
|
+
text: localization.common.exportJpeg,
|
|
192
|
+
},
|
|
193
|
+
downloadSVG: {
|
|
194
|
+
text: localization.common.exportSvg,
|
|
195
|
+
},
|
|
196
|
+
downloadCSV: {
|
|
197
|
+
text: localization.common.exportCsv,
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
csv: {
|
|
201
|
+
dateFormat: '%_ISO',
|
|
202
|
+
},
|
|
203
|
+
buttons: {
|
|
204
|
+
contextButton: {
|
|
205
|
+
enabled: disabledExportButton,
|
|
206
|
+
menuItems: [
|
|
207
|
+
'viewFullscreen',
|
|
208
|
+
'printChart',
|
|
209
|
+
'separator',
|
|
210
|
+
'downloadPNG',
|
|
211
|
+
'downloadJPEG',
|
|
212
|
+
'downloadSVG',
|
|
213
|
+
'downloadCSV',
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
accessibility: {
|
|
220
|
+
enabled: false,
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
credits: {
|
|
224
|
+
enabled: false,
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
tooltip: {
|
|
228
|
+
headerFormat: '',
|
|
229
|
+
style: {
|
|
230
|
+
width: '300px',
|
|
231
|
+
whiteSpace: 'normal',
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
legend: {
|
|
236
|
+
itemMarginBottom: 5,
|
|
237
|
+
maxHeight: 40,
|
|
238
|
+
itemStyle: {
|
|
239
|
+
color: currentColor.legendItemColor,
|
|
240
|
+
},
|
|
241
|
+
enabled: disabledLegends,
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
xAxis: {
|
|
245
|
+
type: 'datetime',
|
|
246
|
+
labels: {
|
|
247
|
+
autoRotationLimit: 0,
|
|
248
|
+
style: {
|
|
249
|
+
color: currentColor.textColor,
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
// tickInterval: 125,
|
|
253
|
+
tickPositions: xAxisLabelPositions,
|
|
254
|
+
categories: xAxisCategories,
|
|
255
|
+
gridLineWidth: 0.5,
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
yAxis,
|
|
259
|
+
|
|
260
|
+
plotOptions: {
|
|
261
|
+
series: {
|
|
262
|
+
animation: false,
|
|
263
|
+
},
|
|
264
|
+
line: {
|
|
265
|
+
animation: false,
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
series,
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export const graphDiskDataFunc = (
|
|
274
|
+
graphData: I_SeriesDisk,
|
|
275
|
+
isDarkMode: boolean,
|
|
276
|
+
localization: UI_I_Localization,
|
|
277
|
+
isFullScreen: Ref<boolean>
|
|
278
|
+
): I_DiskGraph => {
|
|
279
|
+
const currentColor: I_CurrentColor = {
|
|
280
|
+
backgroundColor: isDarkMode ? '#22343c' : 'white',
|
|
281
|
+
titleColor: isDarkMode ? 'white' : '#333333',
|
|
282
|
+
xAxisColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
283
|
+
textColor: isDarkMode ? '#ADBBC4' : '#707070',
|
|
284
|
+
legendItemColor: isDarkMode ? '#ADBBC4' : '#333333',
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return {
|
|
288
|
+
chart: {
|
|
289
|
+
plotBackgroundColor: null,
|
|
290
|
+
plotBorderWidth: null,
|
|
291
|
+
plotShadow: false,
|
|
292
|
+
type: 'pie',
|
|
293
|
+
backgroundColor: currentColor.backgroundColor,
|
|
294
|
+
events: {
|
|
295
|
+
fullscreenOpen(): void {
|
|
296
|
+
isFullScreen.value = true
|
|
297
|
+
},
|
|
298
|
+
fullscreenClose(): void {
|
|
299
|
+
isFullScreen.value = false
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
exporting: {
|
|
305
|
+
menuItemDefinitions: {
|
|
306
|
+
viewFullscreen: {
|
|
307
|
+
text: localization.common.viewFullScreen,
|
|
308
|
+
},
|
|
309
|
+
printChart: {
|
|
310
|
+
text: localization.common.printChart,
|
|
311
|
+
},
|
|
312
|
+
downloadPNG: {
|
|
313
|
+
text: localization.common.exportPng,
|
|
314
|
+
},
|
|
315
|
+
downloadJPEG: {
|
|
316
|
+
text: localization.common.exportJpeg,
|
|
317
|
+
},
|
|
318
|
+
downloadSVG: {
|
|
319
|
+
text: localization.common.exportSvg,
|
|
320
|
+
},
|
|
321
|
+
downloadCSV: {
|
|
322
|
+
text: localization.common.exportCsv,
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
csv: {
|
|
326
|
+
dateFormat: '%_ISO',
|
|
327
|
+
},
|
|
328
|
+
buttons: {
|
|
329
|
+
contextButton: {
|
|
330
|
+
enabled: true,
|
|
331
|
+
menuItems: [
|
|
332
|
+
'viewFullscreen',
|
|
333
|
+
'printChart',
|
|
334
|
+
'separator',
|
|
335
|
+
'downloadPNG',
|
|
336
|
+
'downloadJPEG',
|
|
337
|
+
'downloadSVG',
|
|
338
|
+
'downloadCSV',
|
|
339
|
+
],
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
title: {
|
|
345
|
+
text: graphData.title,
|
|
346
|
+
style: {
|
|
347
|
+
color: currentColor.titleColor,
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
accessibility: {
|
|
352
|
+
enabled: false,
|
|
353
|
+
},
|
|
354
|
+
|
|
355
|
+
credits: {
|
|
356
|
+
enabled: false,
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
tooltip: {
|
|
360
|
+
pointFormat: '{point.percentage:.1f}%',
|
|
361
|
+
},
|
|
362
|
+
|
|
363
|
+
plotOptions: {
|
|
364
|
+
pie: {
|
|
365
|
+
cursor: 'pointer',
|
|
366
|
+
dataLabels: {
|
|
367
|
+
enabled: false,
|
|
368
|
+
},
|
|
369
|
+
showInLegend: true,
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
|
|
373
|
+
legend: {
|
|
374
|
+
align: 'right',
|
|
375
|
+
layout: 'vertical',
|
|
376
|
+
itemStyle: {
|
|
377
|
+
color: currentColor.legendItemColor,
|
|
378
|
+
},
|
|
379
|
+
itemHoverStyle: {
|
|
380
|
+
color: currentColor.legendItemColor,
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
|
|
384
|
+
series: [
|
|
385
|
+
{
|
|
386
|
+
name: 'Brands',
|
|
387
|
+
colorByPoint: true,
|
|
388
|
+
data: graphData.data,
|
|
389
|
+
animation: false,
|
|
390
|
+
},
|
|
391
|
+
],
|
|
392
|
+
}
|
|
393
|
+
}
|