bfg-common 1.3.97 → 1.3.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { I_SeriesLine } from 'bfg-nuxt-3-graph/graph/lib/models/interfaces'
|
|
2
|
-
import { UI_T_OverviewRequestType } from '~/components/common/monitor/overview/filters/lib/models/types'
|
|
3
|
-
|
|
4
|
-
export interface UI_I_GraphDataSettingItem {
|
|
5
|
-
title: string
|
|
6
|
-
loader: boolean
|
|
7
|
-
data: I_SeriesLine | null
|
|
8
|
-
chartType: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface UI_I_MonitorGraphPayload {
|
|
12
|
-
period: number[]
|
|
13
|
-
view: string
|
|
14
|
-
periodType?: string
|
|
15
|
-
id?: string
|
|
16
|
-
requestType?: UI_T_OverviewRequestType
|
|
17
|
-
storageId?: string
|
|
18
|
-
hostName?: string
|
|
19
|
-
fields?: string
|
|
20
|
-
metricType?: string
|
|
21
|
-
place?: number
|
|
22
|
-
periodName?: string
|
|
23
|
-
}
|
|
1
|
+
import { I_SeriesLine } from 'bfg-nuxt-3-graph/graph/lib/models/interfaces'
|
|
2
|
+
import { UI_T_OverviewRequestType } from '~/components/common/monitor/overview/filters/lib/models/types'
|
|
3
|
+
|
|
4
|
+
export interface UI_I_GraphDataSettingItem {
|
|
5
|
+
title: string
|
|
6
|
+
loader: boolean
|
|
7
|
+
data: I_SeriesLine | null
|
|
8
|
+
chartType: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface UI_I_MonitorGraphPayload {
|
|
12
|
+
period: number[]
|
|
13
|
+
view: string
|
|
14
|
+
periodType?: string
|
|
15
|
+
id?: string
|
|
16
|
+
requestType?: UI_T_OverviewRequestType
|
|
17
|
+
storageId?: string
|
|
18
|
+
hostName?: string
|
|
19
|
+
fields?: string
|
|
20
|
+
metricType?: string
|
|
21
|
+
place?: number
|
|
22
|
+
periodName?: string
|
|
23
|
+
}
|
|
@@ -1,228 +1,228 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="charts-view">
|
|
3
|
-
<div v-if="!allData.length" class="content-global-loading">
|
|
4
|
-
{{ localization.loading }}...
|
|
5
|
-
</div>
|
|
6
|
-
<template v-else>
|
|
7
|
-
<template v-for="(chartData, key) in allData" :key="chartData.title">
|
|
8
|
-
<div :class="['chart-container', `graph-${chartData.title}`]">
|
|
9
|
-
<div v-if="chartData.loader" class="graphic-loader-block">
|
|
10
|
-
<div class="spinner"></div>
|
|
11
|
-
<p>{{ localization.retrievingData }}...</p>
|
|
12
|
-
</div>
|
|
13
|
-
<common-graph
|
|
14
|
-
v-else-if="chartData.data"
|
|
15
|
-
:data="chartData.data"
|
|
16
|
-
:chart="charts[key]"
|
|
17
|
-
:update="updateHelper"
|
|
18
|
-
/>
|
|
19
|
-
<div v-else class="graph-empty-block">
|
|
20
|
-
<div class="title">{{ chartData.title }}</div>
|
|
21
|
-
<div class="body-block">
|
|
22
|
-
{{ localization.emptyGraphText }}
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</template>
|
|
27
|
-
</template>
|
|
28
|
-
</div>
|
|
29
|
-
</template>
|
|
30
|
-
|
|
31
|
-
<script setup lang="ts">
|
|
32
|
-
import { format } from 'date-fns'
|
|
33
|
-
import type {
|
|
34
|
-
I_SeriesColumn,
|
|
35
|
-
I_SeriesLine,
|
|
36
|
-
I_ColumnGraph,
|
|
37
|
-
I_LineGraph,
|
|
38
|
-
} from '~/node_modules/bfg-nuxt-3-graph/graph/lib/models/interfaces'
|
|
39
|
-
import {
|
|
40
|
-
columnGraphDataFunc,
|
|
41
|
-
graphDataFunc,
|
|
42
|
-
} from '~/node_modules/bfg-nuxt-3-graph/graph/lib/utils/renderGraph'
|
|
43
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
44
|
-
import type { UI_I_GraphDataSettingItem } from '~/components/common/monitor/lib/models/interfaces'
|
|
45
|
-
|
|
46
|
-
const props = defineProps<{
|
|
47
|
-
|
|
48
|
-
themeMode?: string
|
|
49
|
-
formatDate?: string
|
|
50
|
-
formatTime?: string
|
|
51
|
-
graphType: string
|
|
52
|
-
}>()
|
|
53
|
-
|
|
54
|
-
const { $formattedDatetime } = useNuxtApp()
|
|
55
|
-
|
|
56
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
57
|
-
|
|
58
|
-
const allData = ref<UI_I_GraphDataSettingItem[]>([])
|
|
59
|
-
|
|
60
|
-
const charts = ref<any>([])
|
|
61
|
-
|
|
62
|
-
const getCurrentChart = (chart: any): void => {
|
|
63
|
-
charts.value = chart
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const instanceOfSeriesLine = (
|
|
67
|
-
object: I_SeriesLine | I_SeriesColumn
|
|
68
|
-
): object is I_SeriesLine => {
|
|
69
|
-
return 'lines' in object
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const getCurrentData = (
|
|
73
|
-
chart: UI_I_GraphDataSettingItem,
|
|
74
|
-
chartType: string
|
|
75
|
-
): I_LineGraph | I_ColumnGraph | null => {
|
|
76
|
-
if (!chart || !chart.data) return null
|
|
77
|
-
|
|
78
|
-
const themeMode = useLocalStorage('themeMode') || props.themeMode
|
|
79
|
-
const isDarkMode = themeMode === 'dark-theme'
|
|
80
|
-
|
|
81
|
-
let graphData = null
|
|
82
|
-
|
|
83
|
-
if (chartType === 'column' && !instanceOfSeriesLine(chart.data)) {
|
|
84
|
-
graphData = columnGraphDataFunc(chart, localization.value)
|
|
85
|
-
} else if (instanceOfSeriesLine(chart.data)) {
|
|
86
|
-
graphData = graphDataFunc(
|
|
87
|
-
chart.data,
|
|
88
|
-
isDarkMode,
|
|
89
|
-
localization.value,
|
|
90
|
-
() => {},
|
|
91
|
-
false,
|
|
92
|
-
true,
|
|
93
|
-
true,
|
|
94
|
-
props.graphType,
|
|
95
|
-
'',
|
|
96
|
-
700,
|
|
97
|
-
getCurrentChart,
|
|
98
|
-
$formattedDatetime,
|
|
99
|
-
format,
|
|
100
|
-
props.formatDate,
|
|
101
|
-
props.formatTime
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return graphData
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const updateHelper = ref<number>(0)
|
|
109
|
-
|
|
110
|
-
const updateGraph = (charts: Array<UI_I_GraphDataSettingItem | null>): void => {
|
|
111
|
-
allData.value = []
|
|
112
|
-
charts.forEach((chart) => {
|
|
113
|
-
if (chart && chart.data) {
|
|
114
|
-
const constructedData = getCurrentData(chart, chart.chartType)
|
|
115
|
-
if (constructedData)
|
|
116
|
-
allData.value.push({
|
|
117
|
-
title: chart.title,
|
|
118
|
-
loader: chart.loader,
|
|
119
|
-
data: constructedData,
|
|
120
|
-
chartType: 'column',
|
|
121
|
-
})
|
|
122
|
-
}
|
|
123
|
-
})
|
|
124
|
-
updateHelper.value++
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
watch(
|
|
128
|
-
() => props.
|
|
129
|
-
(newValue) => {
|
|
130
|
-
updateGraph(newValue)
|
|
131
|
-
},
|
|
132
|
-
{ deep: true, immediate: true }
|
|
133
|
-
)
|
|
134
|
-
</script>
|
|
135
|
-
|
|
136
|
-
<style>
|
|
137
|
-
:root {
|
|
138
|
-
--loader-bg-color: #ffffff;
|
|
139
|
-
}
|
|
140
|
-
:root.dark-theme {
|
|
141
|
-
--loader-bg-color: #22343c;
|
|
142
|
-
}
|
|
143
|
-
</style>
|
|
144
|
-
|
|
145
|
-
<style scoped lang="scss">
|
|
146
|
-
.charts-view {
|
|
147
|
-
position: relative;
|
|
148
|
-
display: flex;
|
|
149
|
-
flex-direction: row;
|
|
150
|
-
flex-wrap: wrap;
|
|
151
|
-
justify-content: space-between;
|
|
152
|
-
overflow: auto;
|
|
153
|
-
height: 100%;
|
|
154
|
-
|
|
155
|
-
.graphic-loader-block {
|
|
156
|
-
background-color: var(--loader-bg-color);
|
|
157
|
-
height: 100%;
|
|
158
|
-
display: flex;
|
|
159
|
-
flex-direction: column;
|
|
160
|
-
align-items: center;
|
|
161
|
-
justify-content: center;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.graph-empty-block {
|
|
165
|
-
display: flex;
|
|
166
|
-
flex-direction: column;
|
|
167
|
-
height: 100%;
|
|
168
|
-
background-color: var(--loader-bg-color);
|
|
169
|
-
|
|
170
|
-
.title {
|
|
171
|
-
text-align: center;
|
|
172
|
-
font-size: 18px;
|
|
173
|
-
margin-top: 10px;
|
|
174
|
-
color: var(--global-font-color);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.body-block {
|
|
178
|
-
height: 100%;
|
|
179
|
-
display: flex;
|
|
180
|
-
justify-content: center;
|
|
181
|
-
text-align: center;
|
|
182
|
-
align-items: center;
|
|
183
|
-
color: var(--global-font-color);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.chart-container {
|
|
188
|
-
box-sizing: border-box;
|
|
189
|
-
flex-grow: 1;
|
|
190
|
-
padding: 5px;
|
|
191
|
-
min-height: 300px;
|
|
192
|
-
height: 100%;
|
|
193
|
-
min-width: 300px;
|
|
194
|
-
width: 100%;
|
|
195
|
-
position: relative;
|
|
196
|
-
|
|
197
|
-
&:first-child:last-child {
|
|
198
|
-
height: 100%;
|
|
199
|
-
width: 100%;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
&:first-child:nth-last-child(2),
|
|
203
|
-
&:nth-child(2):last-child {
|
|
204
|
-
width: 50%;
|
|
205
|
-
height: 100%;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.content-global-loading {
|
|
210
|
-
width: 100%;
|
|
211
|
-
height: 100%;
|
|
212
|
-
display: flex;
|
|
213
|
-
align-items: center;
|
|
214
|
-
justify-content: center;
|
|
215
|
-
color: var(--global-font-color);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
@media (min-width: 1280px) {
|
|
219
|
-
.charts-view .chart-container {
|
|
220
|
-
width: 50%;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
@media (min-height: 800px) {
|
|
224
|
-
.charts-view .chart-container {
|
|
225
|
-
height: 50%;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="charts-view">
|
|
3
|
+
<div v-if="!allData.length" class="content-global-loading">
|
|
4
|
+
{{ localization.loading }}...
|
|
5
|
+
</div>
|
|
6
|
+
<template v-else>
|
|
7
|
+
<template v-for="(chartData, key) in allData" :key="chartData.title">
|
|
8
|
+
<div :class="['chart-container', `graph-${chartData.title}`]">
|
|
9
|
+
<div v-if="chartData.loader" class="graphic-loader-block">
|
|
10
|
+
<div class="spinner"></div>
|
|
11
|
+
<p>{{ localization.retrievingData }}...</p>
|
|
12
|
+
</div>
|
|
13
|
+
<common-graph
|
|
14
|
+
v-else-if="chartData.data"
|
|
15
|
+
:data="chartData.data"
|
|
16
|
+
:chart="charts[key]"
|
|
17
|
+
:update="updateHelper"
|
|
18
|
+
/>
|
|
19
|
+
<div v-else class="graph-empty-block">
|
|
20
|
+
<div class="title">{{ chartData.title }}</div>
|
|
21
|
+
<div class="body-block">
|
|
22
|
+
{{ localization.emptyGraphText }}
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
</template>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script setup lang="ts">
|
|
32
|
+
import { format } from 'date-fns'
|
|
33
|
+
import type {
|
|
34
|
+
I_SeriesColumn,
|
|
35
|
+
I_SeriesLine,
|
|
36
|
+
I_ColumnGraph,
|
|
37
|
+
I_LineGraph,
|
|
38
|
+
} from '~/node_modules/bfg-nuxt-3-graph/graph/lib/models/interfaces'
|
|
39
|
+
import {
|
|
40
|
+
columnGraphDataFunc,
|
|
41
|
+
graphDataFunc,
|
|
42
|
+
} from '~/node_modules/bfg-nuxt-3-graph/graph/lib/utils/renderGraph'
|
|
43
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
44
|
+
import type { UI_I_GraphDataSettingItem } from '~/components/common/monitor/lib/models/interfaces'
|
|
45
|
+
|
|
46
|
+
const props = defineProps<{
|
|
47
|
+
charts: Array<UI_I_GraphDataSettingItem | null>
|
|
48
|
+
themeMode?: string
|
|
49
|
+
formatDate?: string
|
|
50
|
+
formatTime?: string
|
|
51
|
+
graphType: string
|
|
52
|
+
}>()
|
|
53
|
+
|
|
54
|
+
const { $formattedDatetime } = useNuxtApp()
|
|
55
|
+
|
|
56
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
57
|
+
|
|
58
|
+
const allData = ref<UI_I_GraphDataSettingItem[]>([])
|
|
59
|
+
|
|
60
|
+
const charts = ref<any>([])
|
|
61
|
+
|
|
62
|
+
const getCurrentChart = (chart: any): void => {
|
|
63
|
+
charts.value = chart
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const instanceOfSeriesLine = (
|
|
67
|
+
object: I_SeriesLine | I_SeriesColumn
|
|
68
|
+
): object is I_SeriesLine => {
|
|
69
|
+
return 'lines' in object
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const getCurrentData = (
|
|
73
|
+
chart: UI_I_GraphDataSettingItem,
|
|
74
|
+
chartType: string
|
|
75
|
+
): I_LineGraph | I_ColumnGraph | null => {
|
|
76
|
+
if (!chart || !chart.data) return null
|
|
77
|
+
|
|
78
|
+
const themeMode = useLocalStorage('themeMode') || props.themeMode
|
|
79
|
+
const isDarkMode = themeMode === 'dark-theme'
|
|
80
|
+
|
|
81
|
+
let graphData = null
|
|
82
|
+
|
|
83
|
+
if (chartType === 'column' && !instanceOfSeriesLine(chart.data)) {
|
|
84
|
+
graphData = columnGraphDataFunc(chart, localization.value, isDarkMode)
|
|
85
|
+
} else if (instanceOfSeriesLine(chart.data)) {
|
|
86
|
+
graphData = graphDataFunc(
|
|
87
|
+
chart.data,
|
|
88
|
+
isDarkMode,
|
|
89
|
+
localization.value,
|
|
90
|
+
() => {},
|
|
91
|
+
false,
|
|
92
|
+
true,
|
|
93
|
+
true,
|
|
94
|
+
props.graphType,
|
|
95
|
+
'',
|
|
96
|
+
700,
|
|
97
|
+
getCurrentChart,
|
|
98
|
+
$formattedDatetime,
|
|
99
|
+
format,
|
|
100
|
+
props.formatDate,
|
|
101
|
+
props.formatTime
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return graphData
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const updateHelper = ref<number>(0)
|
|
109
|
+
|
|
110
|
+
const updateGraph = (charts: Array<UI_I_GraphDataSettingItem | null>): void => {
|
|
111
|
+
allData.value = []
|
|
112
|
+
charts.forEach((chart) => {
|
|
113
|
+
if (chart && chart.data) {
|
|
114
|
+
const constructedData = getCurrentData(chart, chart.chartType)
|
|
115
|
+
if (constructedData)
|
|
116
|
+
allData.value.push({
|
|
117
|
+
title: chart.title,
|
|
118
|
+
loader: chart.loader,
|
|
119
|
+
data: constructedData,
|
|
120
|
+
chartType: 'column',
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
updateHelper.value++
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
watch(
|
|
128
|
+
() => props.charts,
|
|
129
|
+
(newValue) => {
|
|
130
|
+
updateGraph(newValue)
|
|
131
|
+
},
|
|
132
|
+
{ deep: true, immediate: true }
|
|
133
|
+
)
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<style>
|
|
137
|
+
:root {
|
|
138
|
+
--loader-bg-color: #ffffff;
|
|
139
|
+
}
|
|
140
|
+
:root.dark-theme {
|
|
141
|
+
--loader-bg-color: #22343c;
|
|
142
|
+
}
|
|
143
|
+
</style>
|
|
144
|
+
|
|
145
|
+
<style scoped lang="scss">
|
|
146
|
+
.charts-view {
|
|
147
|
+
position: relative;
|
|
148
|
+
display: flex;
|
|
149
|
+
flex-direction: row;
|
|
150
|
+
flex-wrap: wrap;
|
|
151
|
+
justify-content: space-between;
|
|
152
|
+
overflow: auto;
|
|
153
|
+
height: 100%;
|
|
154
|
+
|
|
155
|
+
.graphic-loader-block {
|
|
156
|
+
background-color: var(--loader-bg-color);
|
|
157
|
+
height: 100%;
|
|
158
|
+
display: flex;
|
|
159
|
+
flex-direction: column;
|
|
160
|
+
align-items: center;
|
|
161
|
+
justify-content: center;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.graph-empty-block {
|
|
165
|
+
display: flex;
|
|
166
|
+
flex-direction: column;
|
|
167
|
+
height: 100%;
|
|
168
|
+
background-color: var(--loader-bg-color);
|
|
169
|
+
|
|
170
|
+
.title {
|
|
171
|
+
text-align: center;
|
|
172
|
+
font-size: 18px;
|
|
173
|
+
margin-top: 10px;
|
|
174
|
+
color: var(--global-font-color);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.body-block {
|
|
178
|
+
height: 100%;
|
|
179
|
+
display: flex;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
text-align: center;
|
|
182
|
+
align-items: center;
|
|
183
|
+
color: var(--global-font-color);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.chart-container {
|
|
188
|
+
box-sizing: border-box;
|
|
189
|
+
flex-grow: 1;
|
|
190
|
+
padding: 5px;
|
|
191
|
+
min-height: 300px;
|
|
192
|
+
height: 100%;
|
|
193
|
+
min-width: 300px;
|
|
194
|
+
width: 100%;
|
|
195
|
+
position: relative;
|
|
196
|
+
|
|
197
|
+
&:first-child:last-child {
|
|
198
|
+
height: 100%;
|
|
199
|
+
width: 100%;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&:first-child:nth-last-child(2),
|
|
203
|
+
&:nth-child(2):last-child {
|
|
204
|
+
width: 50%;
|
|
205
|
+
height: 100%;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.content-global-loading {
|
|
210
|
+
width: 100%;
|
|
211
|
+
height: 100%;
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
justify-content: center;
|
|
215
|
+
color: var(--global-font-color);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
@media (min-width: 1280px) {
|
|
219
|
+
.charts-view .chart-container {
|
|
220
|
+
width: 50%;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
@media (min-height: 800px) {
|
|
224
|
+
.charts-view .chart-container {
|
|
225
|
+
height: 50%;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
</style>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bfg-common",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.99",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "nuxt build",
|
|
7
7
|
"dev": "nuxt dev --port=3002",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@nuxtjs/eslint-config-typescript": "^12.0.0",
|
|
35
35
|
"@vueuse/components": "^10.1.2",
|
|
36
36
|
"date-fns": "^2.29.3",
|
|
37
|
-
"bfg-nuxt-3-graph": "^1.0.
|
|
37
|
+
"bfg-nuxt-3-graph": "^1.0.15",
|
|
38
38
|
"html2canvas": "^1.4.1",
|
|
39
39
|
"prettier-eslint": "^15.0.1"
|
|
40
40
|
}
|