bfg-common 1.6.90 → 1.6.92

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,295 +1,295 @@
1
- <template>
2
- <common-monitor-advanced-tools-chart-options-modal-counters-timespan-object-object-new
3
- v-if="isNewView"
4
- v-model:selected-row="selectedRow"
5
- :table-type="tableType"
6
- :loading="props.loading"
7
- :body-items="bodyItems"
8
- />
9
- <common-monitor-advanced-tools-chart-options-modal-counters-timespan-object-object-old
10
- v-else
11
- v-model:selected-row="selectedRow"
12
- v-model:column-items="columnItems"
13
- v-model:pagination="pagination"
14
- :table-type="tableType"
15
- :loading="props.loading"
16
- :head-items="headItems"
17
- :body-items="bodyItems"
18
- />
19
- </template>
20
-
21
- <script setup lang="ts">
22
- import type {
23
- UI_I_HeadItem,
24
- UI_I_BodyItem,
25
- UI_I_ColumnKey,
26
- } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
27
- import type { UI_I_Localization } from '~/lib/models/interfaces'
28
- import type { UI_I_Pagination } from '~/lib/models/table/interfaces'
29
- import type { UI_I_AdvancedTargetObject } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/lib/models/interfaces'
30
- import type { UI_I_ObjectItem } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/lib/models/interfaces'
31
- import type { UI_T_DataGridType } from '~/components/atoms/table/dataGrid/lib/models/types'
32
- import type { UI_T_AdvancedType } from '~/components/common/monitor/advanced/lib/models/types'
33
- import type {
34
- UI_T_ChartHost,
35
- UI_T_ChartVm,
36
- } from '~/components/common/monitor/advanced/tools/chartOptionsModal/lib/models/types'
37
- import * as table from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/lib/config/objectTable'
38
-
39
- const props = defineProps<{
40
- type: UI_T_AdvancedType
41
- chart: UI_T_ChartHost | UI_T_ChartVm
42
- totalCores: number
43
- hostId: string
44
- selectedMetricsKeys: number[]
45
- totalMetricItems: number
46
- currentSelectedObjects: string
47
- loading: boolean
48
- currentItems: UI_I_ObjectItem[]
49
- }>()
50
-
51
- const emits = defineEmits<{
52
- (event: 'select-objects', value: string): void
53
- }>()
54
-
55
- const { $store }: any = useNuxtApp()
56
-
57
- const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
58
-
59
- const localization = computed<UI_I_Localization>(() => useLocal())
60
-
61
- const tableType = computed<UI_T_DataGridType>(() => {
62
- let result = 'checkbox'
63
-
64
- if (props.type === 'host') {
65
- result = ['disk', 'network'].includes(props.chart) ? 'radio' : 'checkbox'
66
- }
67
-
68
- return result
69
- })
70
-
71
- const selectedRow = ref<number[] | number>([])
72
- const pagination = ref<UI_I_Pagination>({
73
- page: 1,
74
- pageSize: 35,
75
- })
76
-
77
- const headItems = computed<UI_I_HeadItem[]>(() =>
78
- table.headItems(localization.value)
79
- )
80
- const columnItems = computed<UI_I_ColumnKey[]>(() =>
81
- table.columnKeys(localization.value)
82
- )
83
-
84
- const bodyItems = ref<UI_I_BodyItem[][]>([])
85
-
86
- let items: UI_I_AdvancedTargetObject[] = []
87
- let firstRequest = false
88
- const getTotalCores = (): void => {
89
- if (
90
- props.selectedMetricsKeys.includes(1) &&
91
- !props.totalCores &&
92
- !firstRequest
93
- ) {
94
- firstRequest = true
95
- }
96
- }
97
- const updateSelectedRow = (): void => {
98
- if (selectedRow.value.length) return
99
-
100
- if (props.type === 'vm' && props.chart === 'network') {
101
- selectedRow.value = []
102
-
103
- if (props.currentItems.length === 1) selectedRow.value.push(0)
104
- else if (props.currentItems.length > 1) {
105
- const totalIndex = props.currentItems.findIndex(
106
- (item) => item.target_object.toLowerCase() === 'total'
107
- )
108
-
109
- totalIndex >= 0 && selectedRow.value.push(totalIndex)
110
- }
111
- }
112
- }
113
- watch(
114
- () => props.selectedMetricsKeys,
115
- () => {
116
- getTotalCores()
117
- },
118
- { deep: true }
119
- )
120
- watch(
121
- () => [
122
- props.type,
123
- props.chart,
124
- props.totalCores,
125
- props.hostId,
126
- props.selectedMetricsKeys,
127
- props.currentItems,
128
- ],
129
- (newValue) => {
130
- items = []
131
- selectedRow.value = []
132
-
133
- if (newValue[0] === 'host' && newValue[1] === 'cpu') {
134
- if (newValue[4].includes(0)) {
135
- items.push({
136
- id: 'total',
137
- target_object: newValue[3],
138
- })
139
- }
140
- if (newValue[4].includes(1)) {
141
- for (let i = 0; i < newValue[2]; i++) {
142
- items.push({
143
- id: 'core' + i,
144
- target_object: 'core' + i,
145
- })
146
- }
147
- }
148
- if (newValue[4].includes(2)) {
149
- for (let i = 0; i < newValue[2]; i++) {
150
- items.push({
151
- id: 'core' + i + 'MHz',
152
- target_object: 'core' + i + 'MHz',
153
- })
154
- }
155
- }
156
- // if (newValue[4].includes(3)) {
157
- // items.push({
158
- // id: 'totalMHz',
159
- // target_object: 'totalMHz',
160
- // })
161
- // }
162
- // if (newValue[4].includes(4)) {
163
- // items.push({
164
- // id: 'averageMHz',
165
- // target_object: 'averageMHz',
166
- // })
167
- // }
168
- } else if (
169
- newValue[0] === 'host' &&
170
- ['disk', 'network'].includes(newValue[1])
171
- ) {
172
- let newItems = []
173
-
174
- if (newValue[1] === 'network')
175
- newItems.push({
176
- id: 'total',
177
- // target_object: localization.value.common.total.toLowerCase(),
178
- target_object: 'total',
179
- })
180
-
181
- newItems = [...newItems, ...props.currentItems]
182
-
183
- items = newItems
184
- } else if (newValue[0] === 'vm' && newValue[1] === 'network') {
185
- items = [...props.currentItems]
186
- }
187
-
188
- bodyItems.value = table.bodyItems(items)
189
- updateSelectedRow()
190
- },
191
- { immediate: true, deep: true }
192
- )
193
-
194
- watch(
195
- selectedRow,
196
- (newValue) => {
197
- const selectedItems: string[] = []
198
-
199
- if (props.type === 'host' && ['disk', 'network'].includes(props.chart)) {
200
- selectedItems.push(items[newValue]?.target_object)
201
- } else if (props.type === 'vm' && ['network'].includes(props.chart)) {
202
- newValue.forEach((key) => {
203
- const newItem = items[key]?.target_object
204
- newItem && selectedItems.push(newItem)
205
- })
206
- } else
207
- newValue.forEach((key) => {
208
- selectedItems.push(items[key].id)
209
- })
210
-
211
- let selectedNames = ''
212
-
213
- if (
214
- items.length === newValue.length &&
215
- props.selectedMetricsKeys.length === props.totalMetricItems
216
- ) {
217
- selectedNames = '*'
218
-
219
- if (props.type === 'vm') selectedNames = 'total'
220
- } else selectedNames = selectedItems.join(', ')
221
-
222
- /* if (props.type === 'vm' && ['network'].includes(props.chart)) {
223
- if (
224
- selectedItems.includes('total') ||
225
- (!selectedItems.includes('total') &&
226
- items.length === newValue.length + 1)
227
- )
228
- selectedNames = 'total'
229
- } */
230
-
231
- if (!props.currentSelectedObjects) emits('select-objects', selectedNames)
232
- },
233
- { deep: true }
234
- )
235
-
236
- watch(
237
- () => [props.currentSelectedObjects, bodyItems.value],
238
- ([selectedObjects, all]) => {
239
- if (!all.length) return
240
-
241
- if (props.type === 'host' && props.chart === 'cpu') {
242
- if (selectedObjects === '*') {
243
- selectedRow.value = all.map((item) => item[0].id)
244
- } else {
245
- const selectedNames = selectedObjects.split(', ')
246
- const selectedKeys: number[] = []
247
- all.forEach((item) => {
248
- if (selectedNames.includes('total') && !selectedKeys.includes(0))
249
- selectedKeys.push(0)
250
- if (selectedNames.includes(item[0].text))
251
- selectedKeys.push(item[0].id)
252
- })
253
- selectedRow.value = selectedKeys
254
- }
255
- } else if (
256
- props.type === 'host' &&
257
- ['disk', 'network'].includes(props.chart)
258
- ) {
259
- if (selectedObjects) {
260
- const selectedId = all.find(
261
- (item) => item[0].text === selectedObjects
262
- )?.[0]?.id
263
- typeof selectedId === 'number' && (selectedRow.value = selectedId)
264
- }
265
- }
266
- },
267
- { immediate: true }
268
- )
269
- </script>
270
-
271
- <style scoped lang="scss">
272
- .chart-option-objects-split {
273
- flex: 1;
274
-
275
- .chart-options-grid-title {
276
- display: block;
277
- margin-bottom: -20px;
278
- }
279
- .flex-to-absolute-positioning-container {
280
- height: 100%;
281
- max-height: 204px;
282
- .flex-to-absolute-positioning-container-inner {
283
- height: inherit;
284
-
285
- .data-table {
286
- height: inherit;
287
-
288
- :deep(.datagrid-outer-wrapper) {
289
- height: inherit;
290
- }
291
- }
292
- }
293
- }
294
- }
295
- </style>
1
+ <template>
2
+ <common-monitor-advanced-tools-chart-options-modal-counters-timespan-object-object-new
3
+ v-if="isNewView"
4
+ v-model:selected-row="selectedRow"
5
+ :table-type="tableType"
6
+ :loading="props.loading"
7
+ :body-items="bodyItems"
8
+ />
9
+ <common-monitor-advanced-tools-chart-options-modal-counters-timespan-object-object-old
10
+ v-else
11
+ v-model:selected-row="selectedRow"
12
+ v-model:column-items="columnItems"
13
+ v-model:pagination="pagination"
14
+ :table-type="tableType"
15
+ :loading="props.loading"
16
+ :head-items="headItems"
17
+ :body-items="bodyItems"
18
+ />
19
+ </template>
20
+
21
+ <script setup lang="ts">
22
+ import type {
23
+ UI_I_HeadItem,
24
+ UI_I_BodyItem,
25
+ UI_I_ColumnKey,
26
+ } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
27
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
28
+ import type { UI_I_Pagination } from '~/lib/models/table/interfaces'
29
+ import type { UI_I_AdvancedTargetObject } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/table/lib/models/interfaces'
30
+ import type { UI_I_ObjectItem } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/lib/models/interfaces'
31
+ import type { UI_T_DataGridType } from '~/components/atoms/table/dataGrid/lib/models/types'
32
+ import type { UI_T_AdvancedType } from '~/components/common/monitor/advanced/lib/models/types'
33
+ import type {
34
+ UI_T_ChartHost,
35
+ UI_T_ChartVm,
36
+ } from '~/components/common/monitor/advanced/tools/chartOptionsModal/lib/models/types'
37
+ import * as table from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/object/lib/config/objectTable'
38
+
39
+ const props = defineProps<{
40
+ type: UI_T_AdvancedType
41
+ chart: UI_T_ChartHost | UI_T_ChartVm
42
+ totalCores: number
43
+ hostId: string
44
+ selectedMetricsKeys: number[]
45
+ totalMetricItems: number
46
+ currentSelectedObjects: string
47
+ loading: boolean
48
+ currentItems: UI_I_ObjectItem[]
49
+ }>()
50
+
51
+ const emits = defineEmits<{
52
+ (event: 'select-objects', value: string): void
53
+ }>()
54
+
55
+ const { $store }: any = useNuxtApp()
56
+
57
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
58
+
59
+ const localization = computed<UI_I_Localization>(() => useLocal())
60
+
61
+ const tableType = computed<UI_T_DataGridType>(() => {
62
+ let result = 'checkbox'
63
+
64
+ if (props.type === 'host') {
65
+ result = ['disk', 'network'].includes(props.chart) ? 'radio' : 'checkbox'
66
+ }
67
+
68
+ return result
69
+ })
70
+
71
+ const selectedRow = ref<number[] | number>([])
72
+ const pagination = ref<UI_I_Pagination>({
73
+ page: 1,
74
+ pageSize: 35,
75
+ })
76
+
77
+ const headItems = computed<UI_I_HeadItem[]>(() =>
78
+ table.headItems(localization.value)
79
+ )
80
+ const columnItems = computed<UI_I_ColumnKey[]>(() =>
81
+ table.columnKeys(localization.value)
82
+ )
83
+
84
+ const bodyItems = ref<UI_I_BodyItem[][]>([])
85
+
86
+ let items: UI_I_AdvancedTargetObject[] = []
87
+ let firstRequest = false
88
+ const getTotalCores = (): void => {
89
+ if (
90
+ props.selectedMetricsKeys.includes(1) &&
91
+ !props.totalCores &&
92
+ !firstRequest
93
+ ) {
94
+ firstRequest = true
95
+ }
96
+ }
97
+ const updateSelectedRow = (): void => {
98
+ if (selectedRow.value.length) return
99
+
100
+ if (props.type === 'vm' && props.chart === 'network') {
101
+ selectedRow.value = []
102
+
103
+ if (props.currentItems.length === 1) selectedRow.value.push(0)
104
+ else if (props.currentItems.length > 1) {
105
+ const totalIndex = props.currentItems.findIndex(
106
+ (item) => item.target_object.toLowerCase() === 'total'
107
+ )
108
+
109
+ totalIndex >= 0 && selectedRow.value.push(totalIndex)
110
+ }
111
+ }
112
+ }
113
+ watch(
114
+ () => props.selectedMetricsKeys,
115
+ () => {
116
+ getTotalCores()
117
+ },
118
+ { deep: true }
119
+ )
120
+ watch(
121
+ () => [
122
+ props.type,
123
+ props.chart,
124
+ props.totalCores,
125
+ props.hostId,
126
+ props.selectedMetricsKeys,
127
+ props.currentItems,
128
+ ],
129
+ (newValue) => {
130
+ items = []
131
+ selectedRow.value = []
132
+
133
+ if (newValue[0] === 'host' && newValue[1] === 'cpu') {
134
+ if (newValue[4].includes(0)) {
135
+ items.push({
136
+ id: 'total',
137
+ target_object: newValue[3],
138
+ })
139
+ }
140
+ if (newValue[4].includes(1)) {
141
+ for (let i = 0; i < newValue[2]; i++) {
142
+ items.push({
143
+ id: 'core' + i,
144
+ target_object: 'core' + i,
145
+ })
146
+ }
147
+ }
148
+ if (newValue[4].includes(2)) {
149
+ for (let i = 0; i < newValue[2]; i++) {
150
+ items.push({
151
+ id: 'core' + i + 'MHz',
152
+ target_object: 'core' + i + 'MHz',
153
+ })
154
+ }
155
+ }
156
+ // if (newValue[4].includes(3)) {
157
+ // items.push({
158
+ // id: 'totalMHz',
159
+ // target_object: 'totalMHz',
160
+ // })
161
+ // }
162
+ // if (newValue[4].includes(4)) {
163
+ // items.push({
164
+ // id: 'averageMHz',
165
+ // target_object: 'averageMHz',
166
+ // })
167
+ // }
168
+ } else if (
169
+ newValue[0] === 'host' &&
170
+ ['disk', 'network'].includes(newValue[1])
171
+ ) {
172
+ let newItems = []
173
+
174
+ if (newValue[1] === 'network')
175
+ newItems.push({
176
+ id: 'total',
177
+ // target_object: localization.value.common.total.toLowerCase(),
178
+ target_object: 'total',
179
+ })
180
+
181
+ newItems = [...newItems, ...props.currentItems]
182
+
183
+ items = newItems
184
+ } else if (newValue[0] === 'vm' && newValue[1] === 'network') {
185
+ items = [...props.currentItems]
186
+ }
187
+
188
+ bodyItems.value = table.bodyItems(items)
189
+ updateSelectedRow()
190
+ },
191
+ { immediate: true, deep: true }
192
+ )
193
+
194
+ watch(
195
+ selectedRow,
196
+ (newValue) => {
197
+ const selectedItems: string[] = []
198
+
199
+ if (props.type === 'host' && ['disk', 'network'].includes(props.chart)) {
200
+ selectedItems.push(items[newValue]?.target_object)
201
+ } else if (props.type === 'vm' && ['network'].includes(props.chart)) {
202
+ newValue.forEach((key) => {
203
+ const newItem = items[key]?.target_object
204
+ newItem && selectedItems.push(newItem)
205
+ })
206
+ } else
207
+ newValue.forEach((key) => {
208
+ selectedItems.push(items[key].id)
209
+ })
210
+
211
+ let selectedNames = ''
212
+
213
+ if (
214
+ items.length === newValue.length &&
215
+ props.selectedMetricsKeys.length === props.totalMetricItems
216
+ ) {
217
+ selectedNames = '*'
218
+
219
+ if (props.type === 'vm') selectedNames = 'total'
220
+ } else selectedNames = selectedItems.join(', ')
221
+
222
+ /* if (props.type === 'vm' && ['network'].includes(props.chart)) {
223
+ if (
224
+ selectedItems.includes('total') ||
225
+ (!selectedItems.includes('total') &&
226
+ items.length === newValue.length + 1)
227
+ )
228
+ selectedNames = 'total'
229
+ } */
230
+
231
+ if (!props.currentSelectedObjects) emits('select-objects', selectedNames)
232
+ },
233
+ { deep: true }
234
+ )
235
+
236
+ watch(
237
+ () => [props.currentSelectedObjects, bodyItems.value],
238
+ ([selectedObjects, all]) => {
239
+ if (!all.length) return
240
+
241
+ if (props.type === 'host' && props.chart === 'cpu') {
242
+ if (selectedObjects === '*') {
243
+ selectedRow.value = all.map((item) => item[0].id)
244
+ } else {
245
+ const selectedNames = selectedObjects.split(', ')
246
+ const selectedKeys: number[] = []
247
+ all.forEach((item) => {
248
+ if (selectedNames.includes('total') && !selectedKeys.includes(0))
249
+ selectedKeys.push(0)
250
+ if (selectedNames.includes(item[0].text))
251
+ selectedKeys.push(item[0].id)
252
+ })
253
+ selectedRow.value = selectedKeys
254
+ }
255
+ } else if (
256
+ props.type === 'host' &&
257
+ ['disk', 'network'].includes(props.chart)
258
+ ) {
259
+ if (selectedObjects) {
260
+ const selectedId = all.find(
261
+ (item) => item[0].text === selectedObjects
262
+ )?.[0]?.id
263
+ typeof selectedId === 'number' && (selectedRow.value = selectedId)
264
+ }
265
+ }
266
+ },
267
+ { immediate: true }
268
+ )
269
+ </script>
270
+
271
+ <style scoped lang="scss">
272
+ .chart-option-objects-split {
273
+ flex: 1;
274
+
275
+ .chart-options-grid-title {
276
+ display: block;
277
+ margin-bottom: -20px;
278
+ }
279
+ .flex-to-absolute-positioning-container {
280
+ height: 100%;
281
+ max-height: 204px;
282
+ .flex-to-absolute-positioning-container-inner {
283
+ height: inherit;
284
+
285
+ .data-table {
286
+ height: inherit;
287
+
288
+ :deep(.datagrid-outer-wrapper) {
289
+ height: inherit;
290
+ }
291
+ }
292
+ }
293
+ }
294
+ }
295
+ </style>
@@ -1,22 +1,22 @@
1
- export const allowedHostCpuFieldNotObject = [
2
- 'totalMHz',
3
- 'averageMHz',
4
- 'cpu ready',
5
- 'cpu demand',
6
- 'cpu contention avg10',
7
- 'cpu contention avg60',
8
- 'cpu contention avg300',
9
- 'cpu co-stop avg10',
10
- 'cpu co-stop avg60',
11
- 'cpu co-stop avg300',
12
- ]
13
-
14
- export const allowedHostNetworkFieldNotObject = [
15
- 'total link speed',
16
- 'total utilization percent',
17
- ]
18
-
19
- export const allowedHostNetworkFieldBeforeObject = [
20
- '{iface} link speed',
21
- '{iface} utilization percent',
22
- ]
1
+ export const allowedHostCpuFieldNotObject = [
2
+ 'totalMHz',
3
+ 'averageMHz',
4
+ 'cpu ready',
5
+ 'cpu demand',
6
+ 'cpu contention avg10',
7
+ 'cpu contention avg60',
8
+ 'cpu contention avg300',
9
+ 'cpu co-stop avg10',
10
+ 'cpu co-stop avg60',
11
+ 'cpu co-stop avg300',
12
+ ]
13
+
14
+ export const allowedHostNetworkFieldNotObject = [
15
+ 'total link speed',
16
+ 'total utilization percent',
17
+ ]
18
+
19
+ export const allowedHostNetworkFieldBeforeObject = [
20
+ '{iface} link speed',
21
+ '{iface} utilization percent',
22
+ ]