bfg-common 1.1.32 → 1.1.33
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/localization/local_be.json +4 -1
- package/assets/localization/local_en.json +4 -1
- package/assets/localization/local_hy.json +4 -1
- package/assets/localization/local_kk.json +4 -1
- package/assets/localization/local_ru.json +4 -1
- package/assets/localization/local_zh.json +4 -1
- package/components/common/modals/Confirmation.vue +18 -4
- package/components/common/monitor/advanced/Advanced.vue +22 -0
- package/components/common/monitor/advanced/tools/Tools.vue +78 -7
- package/components/common/monitor/advanced/tools/chartOptionsModal/ChartOptionsModal.vue +218 -9
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/Actions.vue +81 -10
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/saveOptionsModal/SaveOptionsModal.vue +27 -4
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/utils/optionsActions.ts +25 -0
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/Counters.vue +16 -0
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/Timespan.vue +16 -0
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue +100 -29
- package/components/common/monitor/advanced/tools/config/advancedToolbar.ts +29 -3
- package/package.json +1 -1
- package/components/common/monitor/advanced/tools/chartOptionsModal/actions/config/optionsActions.ts +0 -13
|
@@ -2059,5 +2059,8 @@
|
|
|
2059
2059
|
"autoNegotiate": "Аўтаматычнае ўзгадненне",
|
|
2060
2060
|
"fullDuplex": "Поўны дуплекс",
|
|
2061
2061
|
"halfDuplex": "Паўдуплексны",
|
|
2062
|
-
"srIovDescription": "SR-IOV-гэта тэхналогія, якая дазваляе некалькім віртуальным машынам выкарыстоўваць тую ж прыладу PCI як віртуальную скразную прыладу."
|
|
2062
|
+
"srIovDescription": "SR-IOV-гэта тэхналогія, якая дазваляе некалькім віртуальным машынам выкарыстоўваць тую ж прыладу PCI як віртуальную скразную прыладу.",
|
|
2063
|
+
"settingsNameErrorDesc": "Імя параметру не можа быць пустым.",
|
|
2064
|
+
"deletingSavedSettings": "Пацвердзіце выдаленне захаваных налад",
|
|
2065
|
+
"deletingSavedSettingsDesc": "Захаваныя налады \"{0}\" будуць выдаленыя. Працягнуць?"
|
|
2063
2066
|
}
|
|
@@ -2062,5 +2062,8 @@
|
|
|
2062
2062
|
"autoNegotiate": "Auto negotiate",
|
|
2063
2063
|
"fullDuplex": "Full Duplex",
|
|
2064
2064
|
"halfDuplex": "Half Duplex",
|
|
2065
|
-
"srIovDescription": "SR-IOV is a technology that allows multiple virtual machines to use the same PCI device as a virtual pass-through device."
|
|
2065
|
+
"srIovDescription": "SR-IOV is a technology that allows multiple virtual machines to use the same PCI device as a virtual pass-through device.",
|
|
2066
|
+
"settingsNameErrorDesc": "The Setting Name cannot be blank.",
|
|
2067
|
+
"deletingSavedSettings": "Confirm deleting of saved settings",
|
|
2068
|
+
"deletingSavedSettingsDesc": "Saved settings \"{0}\" will be deleted. Continue?"
|
|
2066
2069
|
}
|
|
@@ -2062,5 +2062,8 @@
|
|
|
2062
2062
|
"autoNegotiate": "Ավտոմատ համակարգում",
|
|
2063
2063
|
"fullDuplex": "Ամբողջական Դուպլեքս",
|
|
2064
2064
|
"halfDuplex": "Կես Դուպլեքս",
|
|
2065
|
-
"srIovDescription": "SR-IOV-ը տեխնոլոգիա է, որը թույլ է տալիս բազմաթիվ վիրտուալ մեքենաներ օգտագործել նույն PCI սարքը որպես վիրտուալ վերջավոր սարք: Այս տեխնոլոգիան թույլ է տալիս բազմաթիվ վիրտուալ մեքենաներ օգտագործել նույն PCI սարքը որպես վիրտուալ վերջավոր սարք:"
|
|
2065
|
+
"srIovDescription": "SR-IOV-ը տեխնոլոգիա է, որը թույլ է տալիս բազմաթիվ վիրտուալ մեքենաներ օգտագործել նույն PCI սարքը որպես վիրտուալ վերջավոր սարք: Այս տեխնոլոգիան թույլ է տալիս բազմաթիվ վիրտուալ մեքենաներ օգտագործել նույն PCI սարքը որպես վիրտուալ վերջավոր սարք:",
|
|
2066
|
+
"settingsNameErrorDesc": "Պարամետրի անունը չի կարող դատարկ լինել:",
|
|
2067
|
+
"deletingSavedSettings": "Հաստատեք պահպանված պարամետրերի ջնջումը",
|
|
2068
|
+
"deletingSavedSettingsDesc": "Պահված \"{0}\" կարգավորումները կջնջվեն: Շարունակել?"
|
|
2066
2069
|
}
|
|
@@ -2062,5 +2062,8 @@
|
|
|
2062
2062
|
"autoNegotiate": "Автоматты сәйкестендіру",
|
|
2063
2063
|
"fullDuplex": "Толық дуплекс",
|
|
2064
2064
|
"halfDuplex": "Жартылай дуплексті",
|
|
2065
|
-
"srIovDescription": "SR-IOV-бұл бірнеше виртуалды машиналарға бірдей PCI құрылғысын виртуалды құрылғы ретінде пайдалануға мүмкіндік беретін технология."
|
|
2065
|
+
"srIovDescription": "SR-IOV-бұл бірнеше виртуалды машиналарға бірдей PCI құрылғысын виртуалды құрылғы ретінде пайдалануға мүмкіндік беретін технология.",
|
|
2066
|
+
"settingsNameErrorDesc": "Параметр атауы бос болуы мүмкін емес.",
|
|
2067
|
+
"deletingSavedSettings": "Сақталған параметрлерді жоюды растаңыз",
|
|
2068
|
+
"deletingSavedSettingsDesc": "Сақталған \"{0}\" параметрлері жойылады. Жалғастыру?"
|
|
2066
2069
|
}
|
|
@@ -2062,5 +2062,8 @@
|
|
|
2062
2062
|
"autoNegotiate": "Автоматическое согласование",
|
|
2063
2063
|
"fullDuplex": "Полный дуплекс",
|
|
2064
2064
|
"halfDuplex": "Полудуплексный",
|
|
2065
|
-
"srIovDescription": "SR-IOV - это технология, которая позволяет нескольким виртуальным машинам использовать одно и то же устройство PCI в качестве виртуального сквозного устройства."
|
|
2065
|
+
"srIovDescription": "SR-IOV - это технология, которая позволяет нескольким виртуальным машинам использовать одно и то же устройство PCI в качестве виртуального сквозного устройства.",
|
|
2066
|
+
"settingsNameErrorDesc": "Имя параметра не может быть пустым.",
|
|
2067
|
+
"deletingSavedSettings": "Подтвердите удаление сохраненных настроек",
|
|
2068
|
+
"deletingSavedSettingsDesc": "Сохраненные настройки \"{0}\" будут удалены. Продолжить?"
|
|
2066
2069
|
}
|
|
@@ -2062,5 +2062,8 @@
|
|
|
2062
2062
|
"autoNegotiate": "汽车谈判",
|
|
2063
2063
|
"fullDuplex": "全双工",
|
|
2064
2064
|
"halfDuplex": "半双工",
|
|
2065
|
-
"srIovDescription": "SR-IOV是一种允许多个虚拟机使用同一PCI设备作为虚拟直通设备的技术。"
|
|
2065
|
+
"srIovDescription": "SR-IOV是一种允许多个虚拟机使用同一PCI设备作为虚拟直通设备的技术。",
|
|
2066
|
+
"settingsNameErrorDesc": "设置名称不能为空。",
|
|
2067
|
+
"deletingSavedSettings": "确认删除已保存的设置",
|
|
2068
|
+
"deletingSavedSettingsDesc": "保存的设置“{0}”将被删除。 继续?"
|
|
2066
2069
|
}
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
<button class="btn btn-outline" @click="onHideModal">
|
|
24
24
|
{{ localization.cancel }}
|
|
25
25
|
</button>
|
|
26
|
-
<button class="
|
|
27
|
-
{{
|
|
26
|
+
<button :class="currentClasses" @click="onApply">
|
|
27
|
+
{{ currentText }}
|
|
28
28
|
</button>
|
|
29
29
|
</template>
|
|
30
30
|
</atoms-modal>
|
|
@@ -38,8 +38,9 @@ const props = withDefaults(
|
|
|
38
38
|
description: string
|
|
39
39
|
headline?: string
|
|
40
40
|
testId?: string
|
|
41
|
+
type?: 'confirm' | 'remove'
|
|
41
42
|
}>(),
|
|
42
|
-
{ testId: 'common-confirmation', headline: '' }
|
|
43
|
+
{ testId: 'common-confirmation', headline: '', type: 'confirm' }
|
|
43
44
|
)
|
|
44
45
|
const emits = defineEmits<{
|
|
45
46
|
(event: 'hide-modal'): void
|
|
@@ -48,7 +49,20 @@ const emits = defineEmits<{
|
|
|
48
49
|
|
|
49
50
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
50
51
|
|
|
51
|
-
const
|
|
52
|
+
const currentClasses = computed<string>(() => {
|
|
53
|
+
let result = 'btn '
|
|
54
|
+
if (props.type === 'confirm') result += 'btn-primary'
|
|
55
|
+
else if (props.type === 'remove') result += 'btn-warning'
|
|
56
|
+
return result
|
|
57
|
+
})
|
|
58
|
+
const currentText = computed<string>(() => {
|
|
59
|
+
if (props.type === 'confirm') return localization.value.ok
|
|
60
|
+
else if (props.type === 'remove') return localization.value.remove
|
|
61
|
+
|
|
62
|
+
return ''
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const onApply = (): void => emits('confirm')
|
|
52
66
|
const onHideModal = (): void => emits('hide-modal')
|
|
53
67
|
</script>
|
|
54
68
|
|
|
@@ -21,12 +21,23 @@
|
|
|
21
21
|
:disabled-period="props.disabledPeriod"
|
|
22
22
|
:disabled-view="props.disabledView"
|
|
23
23
|
:selected-chart-type="props.selectedChartType"
|
|
24
|
+
:selected-timespan-type="props.selectedTimespanType"
|
|
25
|
+
:units-count="props.unitsCount"
|
|
26
|
+
:period-type="props.periodType"
|
|
27
|
+
:selected-custom-time="props.selectedCustomTime"
|
|
28
|
+
:selected-chart-option-name="props.selectedChartOptionName"
|
|
24
29
|
@update-tools="onUpdateTools"
|
|
25
30
|
@exporting="onExporting"
|
|
26
31
|
@open-advanced-page="onGetEmptyPage"
|
|
27
32
|
@select-row="emits('select-row', $event)"
|
|
28
33
|
@select-metric="emits('select-metric', $event)"
|
|
29
34
|
@update-chart-type="emits('update-chart-type', $event)"
|
|
35
|
+
@update-timespan-type="emits('update-timespan-type', $event)"
|
|
36
|
+
@update-unit-count="emits('update-unit-count', $event)"
|
|
37
|
+
@update-period-type="emits('update-period-type', $event)"
|
|
38
|
+
@update-custom-time="emits('update-custom-time', $event)"
|
|
39
|
+
@select-chart-name="emits('select-chart-name', $event)"
|
|
40
|
+
@delete-option="emits('delete-option')"
|
|
30
41
|
/>
|
|
31
42
|
|
|
32
43
|
<div v-show="!props.data" class="empty-container">
|
|
@@ -87,6 +98,11 @@ const props = defineProps<{
|
|
|
87
98
|
selectedCountersKeys: number[]
|
|
88
99
|
selectedMetric: T_ChartHost | T_ChartVm
|
|
89
100
|
selectedChartType: string
|
|
101
|
+
selectedTimespanType: string
|
|
102
|
+
unitsCount: number
|
|
103
|
+
periodType: string
|
|
104
|
+
selectedCustomTime: string
|
|
105
|
+
selectedChartOptionName: string
|
|
90
106
|
disabledPeriod?: boolean
|
|
91
107
|
disabledView?: boolean
|
|
92
108
|
}>()
|
|
@@ -98,6 +114,12 @@ const emits = defineEmits<{
|
|
|
98
114
|
(event: 'select-row', value: UI_I_AdvancedCounterItem[]): void
|
|
99
115
|
(event: 'select-metric', value: string): void
|
|
100
116
|
(event: 'update-chart-type', value: string): void
|
|
117
|
+
(event: 'update-timespan-type', value: string): void
|
|
118
|
+
(event: 'update-unit-count', value: number): void
|
|
119
|
+
(event: 'update-period-type', value: string): void
|
|
120
|
+
(event: 'update-custom-time', value: string): void
|
|
121
|
+
(event: 'select-chart-name', value: string): void
|
|
122
|
+
(event: 'delete-option'): void
|
|
101
123
|
}>()
|
|
102
124
|
|
|
103
125
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
@@ -88,10 +88,22 @@
|
|
|
88
88
|
:selected-counters-keys="props.selectedCountersKeys"
|
|
89
89
|
:selected-metric="props.selectedMetric"
|
|
90
90
|
:selected-chart-type="props.selectedChartType"
|
|
91
|
+
:selected-timespan-type="props.selectedTimespanType"
|
|
92
|
+
:units-count="props.unitsCount"
|
|
93
|
+
:period-type="props.periodType"
|
|
94
|
+
:selected-custom-time="props.selectedCustomTime"
|
|
95
|
+
:selected-chart-option-name="props.selectedChartOptionName"
|
|
91
96
|
@hide="isShowModal = false"
|
|
92
97
|
@select-row="emits('select-row', $event)"
|
|
93
98
|
@select-metric="emits('select-metric', $event)"
|
|
94
99
|
@update-chart-type="emits('update-chart-type', $event)"
|
|
100
|
+
@update-timespan-type="emits('update-timespan-type', $event)"
|
|
101
|
+
@update-unit-count="emits('update-unit-count', $event)"
|
|
102
|
+
@update-period-type="emits('update-period-type', $event)"
|
|
103
|
+
@update-custom-time="emits('update-custom-time', $event)"
|
|
104
|
+
@select-chart-name="onSelectChartName"
|
|
105
|
+
@delete-option="onDeleteOption"
|
|
106
|
+
@save-option-name="onSaveOptionName"
|
|
95
107
|
/>
|
|
96
108
|
</template>
|
|
97
109
|
|
|
@@ -111,6 +123,7 @@ import {
|
|
|
111
123
|
periodFunc,
|
|
112
124
|
viewFunc,
|
|
113
125
|
exportFunc,
|
|
126
|
+
getCurrentOptionsStorageFunc,
|
|
114
127
|
} from '~/components/common/monitor/advanced/tools/config/advancedToolbar'
|
|
115
128
|
|
|
116
129
|
const props = defineProps<{
|
|
@@ -121,6 +134,11 @@ const props = defineProps<{
|
|
|
121
134
|
selectedCountersKeys: number[]
|
|
122
135
|
selectedMetric: T_ChartHost | T_ChartVm
|
|
123
136
|
selectedChartType: string
|
|
137
|
+
selectedTimespanType: string
|
|
138
|
+
unitsCount: number
|
|
139
|
+
periodType: string
|
|
140
|
+
selectedCustomTime: string
|
|
141
|
+
selectedChartOptionName: string
|
|
124
142
|
disabledPeriod?: boolean
|
|
125
143
|
disabledView?: boolean
|
|
126
144
|
}>()
|
|
@@ -132,38 +150,83 @@ const emits = defineEmits<{
|
|
|
132
150
|
(event: 'select-row', value: UI_I_AdvancedCounterItem[]): void
|
|
133
151
|
(event: 'select-metric', value: string): void
|
|
134
152
|
(event: 'update-chart-type', value: string): void
|
|
153
|
+
(event: 'update-timespan-type', value: string): void
|
|
154
|
+
(event: 'update-unit-count', value: number): void
|
|
155
|
+
(event: 'update-period-type', value: string): void
|
|
156
|
+
(event: 'update-custom-time', value: string): void
|
|
157
|
+
(event: 'select-chart-name', value: string): void
|
|
158
|
+
(event: 'delete-option'): void
|
|
135
159
|
}>()
|
|
136
160
|
|
|
161
|
+
const routeType = '' + useRoute().params.type
|
|
162
|
+
|
|
137
163
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
138
164
|
const { $formattedDatetime } = useNuxtApp()
|
|
139
165
|
|
|
140
166
|
const selectedView = ref<string>('')
|
|
167
|
+
const optionsNames = ref<string[]>([])
|
|
141
168
|
const viewOptions = computed<UI_I_OptionItem[]>(() =>
|
|
142
|
-
viewFunc(localization.value, props.type)
|
|
169
|
+
viewFunc(localization.value, props.type, optionsNames.value)
|
|
143
170
|
)
|
|
171
|
+
|
|
144
172
|
watch(
|
|
145
|
-
() =>
|
|
146
|
-
(
|
|
147
|
-
|
|
173
|
+
() => props.selectedChartOptionName,
|
|
174
|
+
(newValue) => {
|
|
175
|
+
let currentValue = ''
|
|
176
|
+
|
|
177
|
+
if (newValue) currentValue = newValue
|
|
178
|
+
else if (
|
|
179
|
+
selectedView.value &&
|
|
180
|
+
optionsNames.value.includes(selectedView.value)
|
|
181
|
+
)
|
|
182
|
+
currentValue = selectedView.value
|
|
183
|
+
else currentValue = viewOptions.value[0].value
|
|
184
|
+
|
|
185
|
+
selectedView.value = currentValue
|
|
148
186
|
},
|
|
149
187
|
{ immediate: true }
|
|
150
188
|
)
|
|
151
189
|
|
|
190
|
+
const onSelectChartName = (name: string): void => {
|
|
191
|
+
emits('select-chart-name', name)
|
|
192
|
+
optionsNames.value = getCurrentOptionsStorageFunc(routeType)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const onDeleteOption = (): void => {
|
|
196
|
+
emits('delete-option')
|
|
197
|
+
optionsNames.value = getCurrentOptionsStorageFunc(routeType)
|
|
198
|
+
}
|
|
199
|
+
|
|
152
200
|
const selectedPeriod = ref<string>('')
|
|
153
201
|
const periodOptions = computed<UI_I_OptionItem[]>(() =>
|
|
154
202
|
periodFunc(localization.value)
|
|
155
203
|
)
|
|
156
204
|
watch(
|
|
157
205
|
() => periodOptions.value,
|
|
158
|
-
(
|
|
159
|
-
if (
|
|
206
|
+
(newValue: UI_I_OptionItem[]) => {
|
|
207
|
+
if (newValue) selectedPeriod.value = newValue[0].value
|
|
160
208
|
},
|
|
161
209
|
{ immediate: true }
|
|
162
210
|
)
|
|
163
211
|
|
|
212
|
+
const isShowModal = ref<boolean>(false)
|
|
213
|
+
watch(isShowModal, (newValue) => {
|
|
214
|
+
if (!newValue && !selectedView.value)
|
|
215
|
+
selectedView.value = viewOptions.value[0].value
|
|
216
|
+
})
|
|
217
|
+
|
|
164
218
|
watch(
|
|
165
219
|
() => [selectedPeriod.value, selectedView.value],
|
|
166
220
|
(newValue: string[]) => {
|
|
221
|
+
const selectedValue = useLocalStorage(
|
|
222
|
+
newValue[1] + 'ChartOptions',
|
|
223
|
+
undefined,
|
|
224
|
+
false
|
|
225
|
+
)
|
|
226
|
+
const fields = selectedValue
|
|
227
|
+
? selectedValue.counters.map((item) => item.name).join(', ')
|
|
228
|
+
: ''
|
|
229
|
+
|
|
167
230
|
const validPeriodData = getValidDateByOptionFunc(newValue[0])
|
|
168
231
|
|
|
169
232
|
const period = [
|
|
@@ -171,6 +234,7 @@ watch(
|
|
|
171
234
|
Math.round(validPeriodData[1] / 1000),
|
|
172
235
|
]
|
|
173
236
|
const tools: UI_I_MonitorGraphPayload = {
|
|
237
|
+
fields,
|
|
174
238
|
period,
|
|
175
239
|
periodType: newValue[0],
|
|
176
240
|
view: newValue[1],
|
|
@@ -195,10 +259,17 @@ const exportMenu = ref<UI_I_DropMenu<string>[]>(exportFunc(localization.value))
|
|
|
195
259
|
const onExportMenuItem = (item: UI_I_DropMenu<any>): void =>
|
|
196
260
|
emits('exporting', item.action)
|
|
197
261
|
|
|
198
|
-
const isShowModal = ref<boolean>(false)
|
|
199
262
|
const onShowChartOptions = (): void => {
|
|
200
263
|
isShowModal.value = true
|
|
201
264
|
}
|
|
265
|
+
|
|
266
|
+
const onSaveOptionName = (): void => {
|
|
267
|
+
optionsNames.value = getCurrentOptionsStorageFunc(routeType)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
onMounted(() => {
|
|
271
|
+
optionsNames.value = getCurrentOptionsStorageFunc(routeType)
|
|
272
|
+
})
|
|
202
273
|
</script>
|
|
203
274
|
|
|
204
275
|
<style scoped lang="scss">
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:show="true"
|
|
6
6
|
:title="localization.chartOptions"
|
|
7
7
|
@hide="onHide"
|
|
8
|
-
@submit="
|
|
8
|
+
@submit="onSubmit"
|
|
9
9
|
>
|
|
10
10
|
<template #modalBody>
|
|
11
11
|
<common-monitor-advanced-tools-chart-options-modal-notification
|
|
@@ -14,7 +14,15 @@
|
|
|
14
14
|
@remove="onRemoveAlerts"
|
|
15
15
|
/>
|
|
16
16
|
<div>
|
|
17
|
-
<common-monitor-advanced-tools-chart-options-modal-actions
|
|
17
|
+
<common-monitor-advanced-tools-chart-options-modal-actions
|
|
18
|
+
:is-disabled-save="!selectedRows.length"
|
|
19
|
+
:options-names="optionsNames"
|
|
20
|
+
:selected-chart-option-name="localSelectedChartOptionName"
|
|
21
|
+
@save="onSaveOptions"
|
|
22
|
+
@check-validation="checkValidations"
|
|
23
|
+
@select-local-option-name="onSelectLocalOptionName"
|
|
24
|
+
@delete-chart-name="onDeleteChartName"
|
|
25
|
+
/>
|
|
18
26
|
|
|
19
27
|
<div class="horizontal-flex-container chart-options-content">
|
|
20
28
|
<common-monitor-advanced-tools-chart-options-modal-metrics
|
|
@@ -25,10 +33,18 @@
|
|
|
25
33
|
:chart="selectedMetric"
|
|
26
34
|
:language="props.language"
|
|
27
35
|
:type="props.type"
|
|
28
|
-
:selected-keys="
|
|
29
|
-
:selected-chart-type="
|
|
36
|
+
:selected-keys="localSelectedCountersKeys"
|
|
37
|
+
:selected-chart-type="localSelectedChartType"
|
|
38
|
+
:selected-timespan-type="localSelectedTimespanType"
|
|
39
|
+
:units-count="localUnitsCount"
|
|
40
|
+
:period-type="localPeriodType"
|
|
41
|
+
:selected-custom-time="localCustomTime"
|
|
30
42
|
@select-row="selectedRows = $event"
|
|
31
|
-
@update-chart-type="
|
|
43
|
+
@update-chart-type="selectedChartTypeLocal = $event"
|
|
44
|
+
@update-custom-time="localCustomTime = $event"
|
|
45
|
+
@update-timespan-type="timespanType = $event"
|
|
46
|
+
@update-unit-count="unitCount = $event"
|
|
47
|
+
@update-period-type="localPeriodType = $event"
|
|
32
48
|
/>
|
|
33
49
|
</div>
|
|
34
50
|
</div>
|
|
@@ -47,6 +63,7 @@ import {
|
|
|
47
63
|
T_ChartVm,
|
|
48
64
|
} from '~/components/common/monitor/advanced/tools/chartOptionsModal/models/types'
|
|
49
65
|
import { metricsFunc } from '~/components/common/monitor/advanced/tools/chartOptionsModal/metrics/config/optionsMetrics'
|
|
66
|
+
import { getCurrentOptionsStorageFunc } from '~/components/common/monitor/advanced/tools/config/advancedToolbar'
|
|
50
67
|
|
|
51
68
|
const props = defineProps<{
|
|
52
69
|
type: UI_T_AdvancedType
|
|
@@ -54,6 +71,11 @@ const props = defineProps<{
|
|
|
54
71
|
selectedCountersKeys: number[]
|
|
55
72
|
selectedMetric: T_ChartHost | T_ChartVm
|
|
56
73
|
selectedChartType: string
|
|
74
|
+
selectedTimespanType: string
|
|
75
|
+
unitsCount: number
|
|
76
|
+
periodType: string
|
|
77
|
+
selectedCustomTime: string
|
|
78
|
+
selectedChartOptionName: string
|
|
57
79
|
}>()
|
|
58
80
|
|
|
59
81
|
const emits = defineEmits<{
|
|
@@ -61,8 +83,17 @@ const emits = defineEmits<{
|
|
|
61
83
|
(event: 'select-row', value: UI_I_AdvancedCounterItem[]): void
|
|
62
84
|
(event: 'select-metric', value: string): void
|
|
63
85
|
(event: 'update-chart-type', value: string): void
|
|
86
|
+
(event: 'update-timespan-type', value: string): void
|
|
87
|
+
(event: 'update-unit-count', value: number): void
|
|
88
|
+
(event: 'update-period-type', value: string): void
|
|
89
|
+
(event: 'update-custom-time', value: string): void
|
|
90
|
+
(event: 'select-chart-name', value: string): void
|
|
91
|
+
(event: 'delete-option'): void
|
|
92
|
+
(event: 'save-option-name'): void
|
|
64
93
|
}>()
|
|
65
94
|
|
|
95
|
+
const routeType = '' + useRoute().params.type
|
|
96
|
+
|
|
66
97
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
67
98
|
|
|
68
99
|
const metricsItems = computed<UI_I_VerticalTabs[]>(() =>
|
|
@@ -72,6 +103,60 @@ const selectedMetric = ref<T_ChartHost | T_ChartVm>(
|
|
|
72
103
|
props.selectedMetric || '' + metricsItems.value[0]?.value
|
|
73
104
|
)
|
|
74
105
|
|
|
106
|
+
const localSelectedCountersKeys = ref<number[]>([])
|
|
107
|
+
watch(
|
|
108
|
+
() => props.selectedCountersKeys,
|
|
109
|
+
(newValue) => {
|
|
110
|
+
localSelectedCountersKeys.value = newValue
|
|
111
|
+
},
|
|
112
|
+
{ immediate: true, deep: true }
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
const localSelectedChartType = ref<string>('')
|
|
116
|
+
watch(
|
|
117
|
+
() => props.selectedChartType,
|
|
118
|
+
(newValue) => {
|
|
119
|
+
localSelectedChartType.value = newValue
|
|
120
|
+
},
|
|
121
|
+
{ immediate: true }
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
const localSelectedTimespanType = ref<string>('')
|
|
125
|
+
watch(
|
|
126
|
+
() => props.selectedTimespanType,
|
|
127
|
+
(newValue) => {
|
|
128
|
+
localSelectedTimespanType.value = newValue
|
|
129
|
+
},
|
|
130
|
+
{ immediate: true }
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
const localUnitsCount = ref<number>(0)
|
|
134
|
+
watch(
|
|
135
|
+
() => props.unitsCount,
|
|
136
|
+
(newValue) => {
|
|
137
|
+
localUnitsCount.value = newValue
|
|
138
|
+
},
|
|
139
|
+
{ immediate: true }
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
const localPeriodType = ref<string>('')
|
|
143
|
+
watch(
|
|
144
|
+
() => props.periodType,
|
|
145
|
+
(newValue) => {
|
|
146
|
+
localPeriodType.value = newValue
|
|
147
|
+
},
|
|
148
|
+
{ immediate: true }
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
const localCustomTime = ref<string>('')
|
|
152
|
+
watch(
|
|
153
|
+
() => props.selectedCustomTime,
|
|
154
|
+
(newValue) => {
|
|
155
|
+
localCustomTime.value = newValue
|
|
156
|
+
},
|
|
157
|
+
{ immediate: true }
|
|
158
|
+
)
|
|
159
|
+
|
|
75
160
|
const isShowAlerts = ref<boolean>(false)
|
|
76
161
|
const alerts = ref<string[]>([''])
|
|
77
162
|
|
|
@@ -85,10 +170,15 @@ const onHide = (): void => {
|
|
|
85
170
|
}
|
|
86
171
|
|
|
87
172
|
const selectedRows = ref<UI_I_AdvancedCounterItem[]>([])
|
|
88
|
-
const
|
|
173
|
+
const selectedChartTypeLocal = ref<string>('')
|
|
89
174
|
|
|
90
175
|
const checkValidations = (): boolean => {
|
|
91
|
-
if (selectedRows.value.length)
|
|
176
|
+
if (selectedRows.value.length) {
|
|
177
|
+
alerts.value = []
|
|
178
|
+
isShowAlerts.value = false
|
|
179
|
+
|
|
180
|
+
return true
|
|
181
|
+
}
|
|
92
182
|
|
|
93
183
|
alerts.value = [localization.value.noCountersSelected]
|
|
94
184
|
isShowAlerts.value = true
|
|
@@ -96,14 +186,133 @@ const checkValidations = (): boolean => {
|
|
|
96
186
|
return false
|
|
97
187
|
}
|
|
98
188
|
|
|
99
|
-
const
|
|
189
|
+
const localSelectedChartOptionName = ref<string>('')
|
|
190
|
+
watch(
|
|
191
|
+
() => props.selectedChartOptionName,
|
|
192
|
+
(newValue) => {
|
|
193
|
+
localSelectedChartOptionName.value = newValue
|
|
194
|
+
},
|
|
195
|
+
{ immediate: true }
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
const selectedLocalOptionName = ref<string>('')
|
|
199
|
+
|
|
200
|
+
const onSubmit = (): void => {
|
|
100
201
|
if (!checkValidations()) return
|
|
101
202
|
|
|
203
|
+
if (['select_options', 'default'].includes(selectedLocalOptionName.value))
|
|
204
|
+
selectedLocalOptionName.value = 'custom'
|
|
205
|
+
|
|
206
|
+
onSaveOptions(selectedLocalOptionName.value)
|
|
207
|
+
|
|
102
208
|
emits('select-metric', selectedMetric.value)
|
|
103
209
|
emits('select-row', selectedRows.value)
|
|
104
|
-
emits('update-chart-type',
|
|
210
|
+
emits('update-chart-type', selectedChartTypeLocal.value)
|
|
211
|
+
emits('update-timespan-type', timespanType.value)
|
|
212
|
+
emits('update-unit-count', unitCount.value)
|
|
213
|
+
emits('update-period-type', localPeriodType.value)
|
|
214
|
+
emits('update-custom-time', localCustomTime.value)
|
|
215
|
+
emits('select-chart-name', selectedLocalOptionName.value)
|
|
105
216
|
onHide()
|
|
106
217
|
}
|
|
218
|
+
|
|
219
|
+
const timespanType = ref<string>('')
|
|
220
|
+
const unitCount = ref<number>(1)
|
|
221
|
+
|
|
222
|
+
const optionsNames = ref<string[]>([])
|
|
223
|
+
|
|
224
|
+
const onSaveOptions = (name: string): void => {
|
|
225
|
+
const counters = selectedRows.value.map((item) => {
|
|
226
|
+
return {
|
|
227
|
+
id: item.id,
|
|
228
|
+
name: item.nameEn,
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
let chartType = 'line_graph'
|
|
232
|
+
if (selectedChartTypeLocal.value === 'spline') chartType = 'line_graph'
|
|
233
|
+
else if (selectedChartTypeLocal.value === 'area') chartType = 'stacked_graph'
|
|
234
|
+
|
|
235
|
+
const saveOptionsData = {
|
|
236
|
+
routeType,
|
|
237
|
+
chartType,
|
|
238
|
+
counters,
|
|
239
|
+
metric: selectedMetric.value,
|
|
240
|
+
timespan: {
|
|
241
|
+
periodType: localPeriodType.value,
|
|
242
|
+
units: localCustomTime.value,
|
|
243
|
+
unitsCount: unitCount.value,
|
|
244
|
+
type: timespanType.value,
|
|
245
|
+
},
|
|
246
|
+
}
|
|
247
|
+
useLocalStorage(`${name}ChartOptions`, saveOptionsData, false)
|
|
248
|
+
optionsNames.value = getCurrentOptionsStorageFunc(routeType)
|
|
249
|
+
localSelectedChartOptionName.value = name
|
|
250
|
+
emits('save-option-name')
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const setSelectOptions = (): void => {
|
|
254
|
+
setDefaultOptions()
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const setDefaultOptions = (): void => {
|
|
258
|
+
selectedMetric.value = metricsItems.value[0]?.value
|
|
259
|
+
localSelectedCountersKeys.value = []
|
|
260
|
+
localSelectedChartType.value = 'spline'
|
|
261
|
+
localSelectedTimespanType.value = ''
|
|
262
|
+
localUnitsCount.value = 0
|
|
263
|
+
localPeriodType.value = ''
|
|
264
|
+
localCustomTime.value = ''
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const setCustomOptions = (name: string): void => {
|
|
268
|
+
const selectedValue = useLocalStorage(name + 'ChartOptions', undefined, false)
|
|
269
|
+
|
|
270
|
+
if (selectedValue.routeType !== routeType) return
|
|
271
|
+
|
|
272
|
+
let currentChartType = ''
|
|
273
|
+
if (selectedValue.chartType === 'line_graph') currentChartType = 'spline'
|
|
274
|
+
else if (selectedValue.chartType === 'stacked_graph')
|
|
275
|
+
currentChartType = 'area'
|
|
276
|
+
|
|
277
|
+
selectedMetric.value = selectedValue.metric
|
|
278
|
+
localSelectedCountersKeys.value = selectedValue.counters.map(
|
|
279
|
+
(item) => item.id
|
|
280
|
+
)
|
|
281
|
+
localSelectedChartType.value = currentChartType
|
|
282
|
+
localSelectedTimespanType.value = selectedValue.timespan.type
|
|
283
|
+
localUnitsCount.value = selectedValue.timespan.unitsCount
|
|
284
|
+
localPeriodType.value = selectedValue.timespan.periodType
|
|
285
|
+
localCustomTime.value = selectedValue.timespan.units
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const onSelectLocalOptionName = (name: string): void => {
|
|
289
|
+
selectedLocalOptionName.value = name
|
|
290
|
+
|
|
291
|
+
if (optionsNames.value.includes(name)) setCustomOptions(name)
|
|
292
|
+
else if (name === 'default') setDefaultOptions()
|
|
293
|
+
else if (name === 'select_options') setSelectOptions()
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
watch(
|
|
297
|
+
localSelectedChartOptionName,
|
|
298
|
+
(newValue) => {
|
|
299
|
+
if (!newValue) return
|
|
300
|
+
|
|
301
|
+
setCustomOptions(newValue)
|
|
302
|
+
},
|
|
303
|
+
{ immediate: true }
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
const onDeleteChartName = (name: string): void => {
|
|
307
|
+
window.localStorage.removeItem(name + 'ChartOptions')
|
|
308
|
+
optionsNames.value = getCurrentOptionsStorageFunc(routeType)
|
|
309
|
+
setSelectOptions()
|
|
310
|
+
emits('delete-option')
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
onMounted(() => {
|
|
314
|
+
optionsNames.value = getCurrentOptionsStorageFunc(routeType)
|
|
315
|
+
})
|
|
107
316
|
</script>
|
|
108
317
|
|
|
109
318
|
<style scoped lang="scss">
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
>{{ localization.chartOptions }}:</label
|
|
6
6
|
>
|
|
7
7
|
<div class="select">
|
|
8
|
-
<select id="chartOptionsSelect" v-model="
|
|
8
|
+
<select id="chartOptionsSelect" v-model="localSelectedChartOption">
|
|
9
9
|
<option
|
|
10
10
|
v-for="item in chartOptions"
|
|
11
11
|
:key="item.value"
|
|
12
12
|
:value="item.value"
|
|
13
|
-
disabled
|
|
14
13
|
>
|
|
15
14
|
{{ item.text }}
|
|
16
15
|
</option>
|
|
@@ -25,35 +24,107 @@
|
|
|
25
24
|
{{ localization.saveOptionsAs }}...
|
|
26
25
|
</button>
|
|
27
26
|
<common-monitor-advanced-tools-chart-options-modal-actions-save-options-modal
|
|
28
|
-
v-
|
|
27
|
+
v-if="isShowSaveOptionsModal"
|
|
29
28
|
@hide="onHideSaveOptionsModal"
|
|
30
29
|
@save="onSaveOptions"
|
|
31
30
|
/>
|
|
32
|
-
<button
|
|
31
|
+
<button
|
|
32
|
+
class="btn chart-options-delete-button"
|
|
33
|
+
:disabled="!disabledDeleteAction"
|
|
34
|
+
@click="onDeleteAction"
|
|
35
|
+
>
|
|
33
36
|
{{ localization.deleteOptions }}
|
|
34
37
|
</button>
|
|
35
38
|
</div>
|
|
36
39
|
</div>
|
|
40
|
+
|
|
41
|
+
<common-modals-confirmation
|
|
42
|
+
v-if="isConfirmModal"
|
|
43
|
+
headline="localization.deletingSavedSettings"
|
|
44
|
+
:description="confirmModalDesc"
|
|
45
|
+
@hide-modal="isConfirmModal = false"
|
|
46
|
+
@confirm="onApplyDelete"
|
|
47
|
+
/>
|
|
37
48
|
</template>
|
|
38
49
|
|
|
39
50
|
<script setup lang="ts">
|
|
40
51
|
import { UI_I_Localization } from '~/models/interfaces'
|
|
41
52
|
import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
|
|
42
|
-
import {
|
|
53
|
+
import { chartOptionItems } from '~/components/common/monitor/advanced/tools/chartOptionsModal/actions/utils/optionsActions'
|
|
54
|
+
|
|
55
|
+
const props = defineProps<{
|
|
56
|
+
isDisabledSave: boolean
|
|
57
|
+
optionsNames: string[]
|
|
58
|
+
selectedChartOptionName: string
|
|
59
|
+
}>()
|
|
60
|
+
|
|
61
|
+
const emits = defineEmits<{
|
|
62
|
+
(event: 'save', value: string): void
|
|
63
|
+
(event: 'check-validation'): void
|
|
64
|
+
(event: 'select-local-option-name', value: string): void
|
|
65
|
+
(event: 'delete-chart-name', value: string): void
|
|
66
|
+
}>()
|
|
43
67
|
|
|
44
68
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
45
69
|
|
|
46
|
-
const
|
|
70
|
+
const localSelectedChartOption = ref<string>('select_options')
|
|
71
|
+
const disabledDeleteAction = computed<boolean>(() => {
|
|
72
|
+
const chartOptionName = localSelectedChartOption.value
|
|
73
|
+
let result = false
|
|
74
|
+
|
|
75
|
+
if (chartOptionName !== 'select_options' && chartOptionName !== 'default')
|
|
76
|
+
result = true
|
|
77
|
+
|
|
78
|
+
return result
|
|
79
|
+
})
|
|
47
80
|
const chartOptions = computed<UI_I_OptionItem[]>(() =>
|
|
48
|
-
|
|
81
|
+
chartOptionItems(localization.value, props.optionsNames)
|
|
82
|
+
)
|
|
83
|
+
watch(
|
|
84
|
+
() => props.selectedChartOptionName,
|
|
85
|
+
(newValue) => {
|
|
86
|
+
localSelectedChartOption.value =
|
|
87
|
+
newValue || localSelectedChartOption.value || 'select_options'
|
|
88
|
+
},
|
|
89
|
+
{ immediate: true }
|
|
90
|
+
)
|
|
91
|
+
watch(
|
|
92
|
+
localSelectedChartOption,
|
|
93
|
+
(newValue) => {
|
|
94
|
+
emits('select-local-option-name', newValue)
|
|
95
|
+
},
|
|
96
|
+
{ immediate: true }
|
|
49
97
|
)
|
|
50
98
|
|
|
51
99
|
const isShowSaveOptionsModal = ref<boolean>(false)
|
|
52
|
-
const onShowSaveOptionsModal = ():
|
|
53
|
-
(isShowSaveOptionsModal.value = true
|
|
100
|
+
const onShowSaveOptionsModal = (): void => {
|
|
101
|
+
if (!props.isDisabledSave) isShowSaveOptionsModal.value = true
|
|
102
|
+
|
|
103
|
+
emits('check-validation')
|
|
104
|
+
}
|
|
54
105
|
const onHideSaveOptionsModal = (): boolean =>
|
|
55
106
|
(isShowSaveOptionsModal.value = false)
|
|
56
|
-
const onSaveOptions = ():
|
|
107
|
+
const onSaveOptions = (name: string): void => {
|
|
108
|
+
onHideSaveOptionsModal()
|
|
109
|
+
emits('save', name)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const isConfirmModal = ref<boolean>(false)
|
|
113
|
+
const confirmModalDesc = ref<string>('')
|
|
114
|
+
|
|
115
|
+
const onDeleteAction = (): void => {
|
|
116
|
+
confirmModalDesc.value = localization.value.deletingSavedSettingsDesc.replace(
|
|
117
|
+
'{0}',
|
|
118
|
+
localSelectedChartOption.value
|
|
119
|
+
)
|
|
120
|
+
isConfirmModal.value = true
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const onApplyDelete = (): void => {
|
|
124
|
+
isConfirmModal.value = false
|
|
125
|
+
emits('delete-chart-name', localSelectedChartOption.value)
|
|
126
|
+
localSelectedChartOption.value = 'select_options'
|
|
127
|
+
}
|
|
57
128
|
</script>
|
|
58
129
|
|
|
59
130
|
<style scoped lang="scss">
|
|
@@ -7,11 +7,16 @@
|
|
|
7
7
|
@submit="onSave"
|
|
8
8
|
>
|
|
9
9
|
<template #modalBody>
|
|
10
|
+
<common-monitor-advanced-tools-chart-options-modal-notification
|
|
11
|
+
v-show="isShowAlerts"
|
|
12
|
+
:alerts="alerts"
|
|
13
|
+
@remove="onRemoveAlerts"
|
|
14
|
+
/>
|
|
10
15
|
<div class="form-control">
|
|
11
16
|
<label class="save-option-name-label" for="chartOptionsName"
|
|
12
17
|
>{{ localization.chartOptionsName }}:</label
|
|
13
18
|
>
|
|
14
|
-
<input id="chartOptionsName" type="text" />
|
|
19
|
+
<input id="chartOptionsName" v-model="name" type="text" />
|
|
15
20
|
</div>
|
|
16
21
|
</template>
|
|
17
22
|
</atoms-modal>
|
|
@@ -22,22 +27,40 @@ import { UI_I_Localization } from '~/models/interfaces'
|
|
|
22
27
|
|
|
23
28
|
const emits = defineEmits<{
|
|
24
29
|
(event: 'hide'): void
|
|
25
|
-
(event: 'save'): void
|
|
30
|
+
(event: 'save', value: string): void
|
|
26
31
|
}>()
|
|
27
32
|
|
|
28
33
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
29
34
|
|
|
35
|
+
const name = ref<string>('')
|
|
36
|
+
const isShowAlerts = ref<boolean>(false)
|
|
37
|
+
const alerts = ref<string[]>([])
|
|
38
|
+
|
|
30
39
|
const onHide = (): void => {
|
|
31
40
|
emits('hide')
|
|
32
41
|
}
|
|
33
42
|
const onSave = (): void => {
|
|
34
|
-
|
|
43
|
+
if (!name.value) {
|
|
44
|
+
alerts.value = [localization.value.settingsNameErrorDesc]
|
|
45
|
+
isShowAlerts.value = true
|
|
46
|
+
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
emits('save', name.value)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const onRemoveAlerts = (): void => {
|
|
54
|
+
isShowAlerts.value = false
|
|
55
|
+
alerts.value = []
|
|
35
56
|
}
|
|
36
57
|
</script>
|
|
37
58
|
|
|
38
59
|
<style scoped lang="scss">
|
|
39
60
|
:deep(.modal-dialog) {
|
|
40
|
-
|
|
61
|
+
.alert {
|
|
62
|
+
margin-bottom: 20px;
|
|
63
|
+
}
|
|
41
64
|
|
|
42
65
|
.form-control {
|
|
43
66
|
display: flex;
|
package/components/common/monitor/advanced/tools/chartOptionsModal/actions/utils/optionsActions.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UI_I_Localization } from '~/models/interfaces'
|
|
2
|
+
import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
|
|
3
|
+
|
|
4
|
+
export const chartOptionItems = (
|
|
5
|
+
localization: UI_I_Localization,
|
|
6
|
+
names: string[]
|
|
7
|
+
): UI_I_OptionItem[] => {
|
|
8
|
+
const mainOptionsNames = [
|
|
9
|
+
{
|
|
10
|
+
text: `--${localization.selectOption}--`,
|
|
11
|
+
value: 'select_options',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
text: localization.default,
|
|
15
|
+
value: 'default',
|
|
16
|
+
},
|
|
17
|
+
]
|
|
18
|
+
names.forEach((name) => {
|
|
19
|
+
mainOptionsNames.push({
|
|
20
|
+
text: name,
|
|
21
|
+
value: name,
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
return mainOptionsNames
|
|
25
|
+
}
|
|
@@ -10,7 +10,15 @@
|
|
|
10
10
|
:language="props.language"
|
|
11
11
|
:selected="selectedOptions"
|
|
12
12
|
:selected-chart-type="props.selectedChartType"
|
|
13
|
+
:selected-timespan-type="props.selectedTimespanType"
|
|
14
|
+
:units-count="props.unitsCount"
|
|
15
|
+
:period-type="props.periodType"
|
|
16
|
+
:selected-custom-time="props.selectedCustomTime"
|
|
13
17
|
@update-chart-type="emits('update-chart-type', $event)"
|
|
18
|
+
@update-custom-time="emits('update-custom-time', $event)"
|
|
19
|
+
@update-timespan-type="emits('update-timespan-type', $event)"
|
|
20
|
+
@update-unit-count="emits('update-unit-count', $event)"
|
|
21
|
+
@update-period-type="emits('update-period-type', $event)"
|
|
14
22
|
/>
|
|
15
23
|
</div>
|
|
16
24
|
</template>
|
|
@@ -32,11 +40,19 @@ const props = defineProps<{
|
|
|
32
40
|
type: UI_T_AdvancedType
|
|
33
41
|
selectedKeys: number[]
|
|
34
42
|
selectedChartType: string
|
|
43
|
+
selectedTimespanType: string
|
|
44
|
+
unitsCount: number
|
|
45
|
+
periodType: string
|
|
46
|
+
selectedCustomTime: string
|
|
35
47
|
}>()
|
|
36
48
|
|
|
37
49
|
const emits = defineEmits<{
|
|
38
50
|
(event: 'select-row', value: UI_I_AdvancedCounterItem[]): void
|
|
39
51
|
(event: 'update-chart-type', value: string): void
|
|
52
|
+
(event: 'update-custom-time', value: string): void
|
|
53
|
+
(event: 'update-timespan-type', value: string): void
|
|
54
|
+
(event: 'update-unit-count', value: number): void
|
|
55
|
+
(event: 'update-period-type', value: string): void
|
|
40
56
|
}>()
|
|
41
57
|
|
|
42
58
|
const selectedOptions = ref<UI_I_AdvancedTargetObject[][]>([])
|
package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/Timespan.vue
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
<common-monitor-advanced-tools-chart-options-modal-counters-timespan-form
|
|
4
4
|
:language="props.language"
|
|
5
5
|
:selected-chart-type="props.selectedChartType"
|
|
6
|
+
:selected-timespan-type="props.selectedTimespanType"
|
|
7
|
+
:units-count="props.unitsCount"
|
|
8
|
+
:period-type="props.periodType"
|
|
9
|
+
:selected-custom-time="props.selectedCustomTime"
|
|
6
10
|
@update-chart-type="emits('update-chart-type', $event)"
|
|
11
|
+
@update-custom-time="emits('update-custom-time', $event)"
|
|
12
|
+
@update-timespan-type="emits('update-timespan-type', $event)"
|
|
13
|
+
@update-unit-count="emits('update-unit-count', $event)"
|
|
14
|
+
@update-period-type="emits('update-period-type', $event)"
|
|
7
15
|
/>
|
|
8
16
|
<common-monitor-advanced-tools-chart-options-modal-counters-timespan-object
|
|
9
17
|
:selected="props.selected"
|
|
@@ -18,10 +26,18 @@ const props = defineProps<{
|
|
|
18
26
|
selected: UI_I_AdvancedTargetObject[][]
|
|
19
27
|
language: string
|
|
20
28
|
selectedChartType: string
|
|
29
|
+
selectedTimespanType: string
|
|
30
|
+
unitsCount: number
|
|
31
|
+
periodType: string
|
|
32
|
+
selectedCustomTime: string
|
|
21
33
|
}>()
|
|
22
34
|
|
|
23
35
|
const emits = defineEmits<{
|
|
24
36
|
(event: 'update-chart-type', value: string): void
|
|
37
|
+
(event: 'update-custom-time', value: string): void
|
|
38
|
+
(event: 'update-timespan-type', value: string): void
|
|
39
|
+
(event: 'update-unit-count', value: number): void
|
|
40
|
+
(event: 'update-period-type', value: string): void
|
|
25
41
|
}>()
|
|
26
42
|
</script>
|
|
27
43
|
|
package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<div class="select">
|
|
12
12
|
<select
|
|
13
13
|
id="chart-timespan-type-select"
|
|
14
|
-
v-model="
|
|
14
|
+
v-model="localSelectedTimespan"
|
|
15
15
|
>
|
|
16
16
|
<option
|
|
17
17
|
v-for="(item, index) in timespanOptions"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<div
|
|
28
28
|
:class="[
|
|
29
29
|
'custom-timespan-settings-container',
|
|
30
|
-
{ active:
|
|
30
|
+
{ active: localSelectedTimespan === 'custom_interval' },
|
|
31
31
|
]"
|
|
32
32
|
>
|
|
33
33
|
<table>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
<td class="relative">
|
|
37
37
|
<input
|
|
38
38
|
id="custom-time-lastInput"
|
|
39
|
-
v-model="
|
|
39
|
+
v-model="localPeriodType"
|
|
40
40
|
type="radio"
|
|
41
41
|
value="last"
|
|
42
42
|
class="custom-radio-button"
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
<div
|
|
53
53
|
:class="[
|
|
54
54
|
'custom-timespan-type-last-container',
|
|
55
|
-
{ active:
|
|
55
|
+
{ active: localPeriodType === 'last' },
|
|
56
56
|
]"
|
|
57
57
|
>
|
|
58
58
|
<input
|
|
59
59
|
id="chart-option-setting-row"
|
|
60
|
-
v-model="
|
|
60
|
+
v-model="localLast"
|
|
61
61
|
type="number"
|
|
62
62
|
class="chart-option-setting-row custom-time-input"
|
|
63
63
|
/>
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
<div class="select">
|
|
71
71
|
<select
|
|
72
72
|
id="chart-timespan-type-select"
|
|
73
|
-
v-model="
|
|
73
|
+
v-model="localSelectedCustomTime"
|
|
74
74
|
>
|
|
75
75
|
<option
|
|
76
76
|
v-for="(item, index) in customTimeOptions"
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
<td class="relative">
|
|
91
91
|
<input
|
|
92
92
|
id="custom-time-fromInput"
|
|
93
|
-
v-model="
|
|
93
|
+
v-model="localPeriodType"
|
|
94
94
|
type="radio"
|
|
95
|
-
value="
|
|
95
|
+
value="period"
|
|
96
96
|
class="custom-radio-button"
|
|
97
97
|
name="lastFrom"
|
|
98
98
|
/>
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
<div
|
|
107
107
|
:class="[
|
|
108
108
|
'date-container-row disabled-container calendar-date-row',
|
|
109
|
-
{ active:
|
|
109
|
+
{ active: localPeriodType === 'period' },
|
|
110
110
|
]"
|
|
111
111
|
>
|
|
112
112
|
<input
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
<div
|
|
141
141
|
:class="[
|
|
142
142
|
'date-container-row disabled-container calendar-date-row',
|
|
143
|
-
{ active:
|
|
143
|
+
{ active: localPeriodType === 'period' },
|
|
144
144
|
]"
|
|
145
145
|
>
|
|
146
146
|
<input
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
<td
|
|
172
172
|
:class="[
|
|
173
173
|
'disabled-container',
|
|
174
|
-
{ active:
|
|
174
|
+
{ active: localPeriodType === 'period' },
|
|
175
175
|
]"
|
|
176
176
|
>
|
|
177
177
|
<span> ({{ localization.isoTimeFormat }}) </span>
|
|
@@ -217,10 +217,18 @@ import {
|
|
|
217
217
|
const props = defineProps<{
|
|
218
218
|
language: string
|
|
219
219
|
selectedChartType: string
|
|
220
|
+
selectedTimespanType: string
|
|
221
|
+
unitsCount: number
|
|
222
|
+
periodType: string
|
|
223
|
+
selectedCustomTime: string
|
|
220
224
|
}>()
|
|
221
225
|
|
|
222
226
|
const emits = defineEmits<{
|
|
223
227
|
(event: 'update-chart-type', value: string): void
|
|
228
|
+
(event: 'update-custom-time', value: string): void
|
|
229
|
+
(event: 'update-timespan-type', value: string): void
|
|
230
|
+
(event: 'update-unit-count', value: number): void
|
|
231
|
+
(event: 'update-period-type', value: string): void
|
|
224
232
|
}>()
|
|
225
233
|
|
|
226
234
|
const { $formattedDate, $isDate, $getTimeFormat, $getUnixByDate } = useNuxtApp()
|
|
@@ -230,16 +238,75 @@ const localization = computed<UI_I_Localization>(() => useLocal())
|
|
|
230
238
|
const timespanOptions = computed<UI_I_OptionItem[]>(() =>
|
|
231
239
|
timespanFunc(localization.value)
|
|
232
240
|
)
|
|
233
|
-
const
|
|
241
|
+
const localSelectedTimespan = ref<string>(
|
|
242
|
+
props.selectedTimespanType || timespanOptions.value[0].value
|
|
243
|
+
)
|
|
244
|
+
watch(
|
|
245
|
+
() => props.selectedTimespanType,
|
|
246
|
+
(newValue) => {
|
|
247
|
+
localSelectedTimespan.value = newValue || timespanOptions.value[0].value
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
const localPeriodType = ref<string>('last')
|
|
251
|
+
watch(
|
|
252
|
+
() => props.periodType,
|
|
253
|
+
(newValue) => {
|
|
254
|
+
localPeriodType.value = newValue || 'last'
|
|
255
|
+
},
|
|
256
|
+
{ immediate: true }
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
watch(
|
|
260
|
+
localSelectedTimespan,
|
|
261
|
+
(newValue) => {
|
|
262
|
+
emits('update-timespan-type', newValue)
|
|
263
|
+
},
|
|
264
|
+
{ immediate: true }
|
|
265
|
+
)
|
|
234
266
|
|
|
235
|
-
|
|
267
|
+
watch(
|
|
268
|
+
localPeriodType,
|
|
269
|
+
(newValue) => {
|
|
270
|
+
const currentValue = newValue || 'period'
|
|
271
|
+
emits('update-period-type', currentValue)
|
|
272
|
+
},
|
|
273
|
+
{ immediate: true }
|
|
274
|
+
)
|
|
236
275
|
|
|
237
|
-
const
|
|
276
|
+
const localLast = ref<number>(1)
|
|
277
|
+
watch(
|
|
278
|
+
localLast,
|
|
279
|
+
(newValue) => {
|
|
280
|
+
emits('update-unit-count', newValue)
|
|
281
|
+
},
|
|
282
|
+
{ immediate: true }
|
|
283
|
+
)
|
|
284
|
+
watch(
|
|
285
|
+
() => props.unitsCount,
|
|
286
|
+
(newValue) => {
|
|
287
|
+
localLast.value = newValue > 0 ? newValue : 1
|
|
288
|
+
},
|
|
289
|
+
{ immediate: true }
|
|
290
|
+
)
|
|
238
291
|
|
|
239
|
-
const
|
|
292
|
+
const localSelectedCustomTime = ref<string>('hours')
|
|
240
293
|
const customTimeOptions = computed<UI_I_OptionItem[]>(() =>
|
|
241
294
|
customTimeFunc(localization.value)
|
|
242
295
|
)
|
|
296
|
+
watch(
|
|
297
|
+
() => props.selectedCustomTime,
|
|
298
|
+
(newValue) => {
|
|
299
|
+
localSelectedCustomTime.value = newValue || 'hours'
|
|
300
|
+
},
|
|
301
|
+
{ immediate: true }
|
|
302
|
+
)
|
|
303
|
+
watch(
|
|
304
|
+
localSelectedCustomTime,
|
|
305
|
+
(newValue) => {
|
|
306
|
+
emits('update-custom-time', newValue)
|
|
307
|
+
},
|
|
308
|
+
{ immediate: true }
|
|
309
|
+
)
|
|
243
310
|
|
|
244
311
|
const chartType = ref<string>('line_graph')
|
|
245
312
|
const chartTypeOptions = computed<UI_I_OptionItem[]>(() =>
|
|
@@ -264,14 +331,18 @@ watch(
|
|
|
264
331
|
{ immediate: true }
|
|
265
332
|
)
|
|
266
333
|
|
|
267
|
-
watch(
|
|
268
|
-
|
|
334
|
+
watch(
|
|
335
|
+
chartType,
|
|
336
|
+
(newValue) => {
|
|
337
|
+
let currentValue = 'spline'
|
|
269
338
|
|
|
270
|
-
|
|
271
|
-
|
|
339
|
+
if (newValue === 'line_graph') currentValue = 'spline'
|
|
340
|
+
else if (newValue === 'stacked_graph') currentValue = 'area'
|
|
272
341
|
|
|
273
|
-
|
|
274
|
-
}
|
|
342
|
+
emits('update-chart-type', currentValue)
|
|
343
|
+
},
|
|
344
|
+
{ immediate: true }
|
|
345
|
+
)
|
|
275
346
|
|
|
276
347
|
const yesterday = new Date().setDate(new Date().getDate() - 1)
|
|
277
348
|
const dateFrom = ref<number>(yesterday)
|
|
@@ -291,26 +362,26 @@ const getCurrentTime = (): void => {
|
|
|
291
362
|
currentTimeTo.value = currentTime
|
|
292
363
|
}
|
|
293
364
|
|
|
294
|
-
const onUpdateDateFrom = (val: number) => {
|
|
365
|
+
const onUpdateDateFrom = (val: number): void => {
|
|
295
366
|
if (!val) return
|
|
296
367
|
|
|
297
368
|
currentDateFrom.value = $formattedDate(new Date(val), '')
|
|
298
369
|
}
|
|
299
|
-
watch(currentDateFrom, (
|
|
300
|
-
if (!
|
|
370
|
+
watch(currentDateFrom, (newValue) => {
|
|
371
|
+
if (!newValue) return
|
|
301
372
|
|
|
302
|
-
if ($isDate(
|
|
373
|
+
if ($isDate(newValue)) dateFrom.value = $getUnixByDate(newValue)
|
|
303
374
|
})
|
|
304
375
|
|
|
305
|
-
const onUpdateDateTo = (val: number) => {
|
|
376
|
+
const onUpdateDateTo = (val: number): void => {
|
|
306
377
|
if (!val) return
|
|
307
378
|
|
|
308
379
|
currentDateTo.value = $formattedDate(new Date(val), '')
|
|
309
380
|
}
|
|
310
|
-
watch(currentDateTo, (
|
|
311
|
-
if (!
|
|
381
|
+
watch(currentDateTo, (newValue) => {
|
|
382
|
+
if (!newValue) return
|
|
312
383
|
|
|
313
|
-
if ($isDate(
|
|
384
|
+
if ($isDate(newValue)) dateTo.value = $getUnixByDate(newValue)
|
|
314
385
|
})
|
|
315
386
|
|
|
316
387
|
onMounted(() => {
|
|
@@ -4,7 +4,9 @@ import { UI_I_DropMenu } from '~/components/common/monitor/advanced/tools/models
|
|
|
4
4
|
import { UI_T_AdvancedType } from '~/components/common/monitor/advanced/models/types'
|
|
5
5
|
import { UI_I_OptionData } from '~/components/common/monitor/advanced/models/interfaces'
|
|
6
6
|
|
|
7
|
-
export const periodFunc = (
|
|
7
|
+
export const periodFunc = (
|
|
8
|
+
localization: UI_I_Localization
|
|
9
|
+
): UI_I_OptionItem[] => [
|
|
8
10
|
{
|
|
9
11
|
text: localization.realTime,
|
|
10
12
|
value: 'real_time',
|
|
@@ -29,7 +31,8 @@ export const periodFunc = (localization: UI_I_Localization): UI_I_OptionItem[] =
|
|
|
29
31
|
|
|
30
32
|
export const viewFunc = (
|
|
31
33
|
localization: UI_I_Localization,
|
|
32
|
-
type: UI_T_AdvancedType
|
|
34
|
+
type: UI_T_AdvancedType,
|
|
35
|
+
optionsNames?: string[]
|
|
33
36
|
): UI_I_OptionItem[] => {
|
|
34
37
|
const viewData: UI_I_OptionData = {
|
|
35
38
|
host: [
|
|
@@ -59,8 +62,17 @@ export const viewFunc = (
|
|
|
59
62
|
{ text: localization.virtualDisk, value: 'virtualDisk' },
|
|
60
63
|
],
|
|
61
64
|
}
|
|
65
|
+
const currentOptions = viewData[type]
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
if (optionsNames) {
|
|
68
|
+
optionsNames.forEach((item) => {
|
|
69
|
+
currentOptions.push({
|
|
70
|
+
text: item,
|
|
71
|
+
value: item,
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
return currentOptions
|
|
64
76
|
}
|
|
65
77
|
|
|
66
78
|
export const exportFunc = (
|
|
@@ -71,3 +83,17 @@ export const exportFunc = (
|
|
|
71
83
|
{ text: localization.toSvg + '...', action: 'svg' },
|
|
72
84
|
{ text: localization.toCsv + '...', action: 'csv' },
|
|
73
85
|
]
|
|
86
|
+
|
|
87
|
+
export const getCurrentOptionsStorageFunc = (routeType: string): string[] => {
|
|
88
|
+
const optionsNames = []
|
|
89
|
+
for (const key of Object.entries(localStorage)) {
|
|
90
|
+
const currentOptions = useLocalStorage(key[0], undefined, false)
|
|
91
|
+
if (
|
|
92
|
+
key[0].includes('ChartOptions') &&
|
|
93
|
+
currentOptions.routeType === routeType
|
|
94
|
+
) {
|
|
95
|
+
optionsNames.push(key[0].replace('ChartOptions', ''))
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return optionsNames
|
|
99
|
+
}
|
package/package.json
CHANGED
package/components/common/monitor/advanced/tools/chartOptionsModal/actions/config/optionsActions.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { UI_I_Localization } from '~/models/interfaces'
|
|
2
|
-
import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
|
|
3
|
-
|
|
4
|
-
export const chartOptionItemsFunc = (localization: UI_I_Localization): UI_I_OptionItem[] => [
|
|
5
|
-
{
|
|
6
|
-
text: `--${localization.selectOption}--`,
|
|
7
|
-
value: 'select_options',
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
text: localization.default,
|
|
11
|
-
value: 'default',
|
|
12
|
-
},
|
|
13
|
-
]
|