bfg-common 1.1.5 → 1.1.6
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/components/common/home/Card.vue +63 -0
- package/components/common/home/ResourceBlock.vue +117 -0
- package/components/common/home/StatusContent.vue +47 -0
- package/components/common/home/alertsTable/AlertsTable.vue +105 -0
- package/components/common/home/alertsTable/config/config.ts +61 -0
- package/components/common/home/alertsTable/models/enums.ts +11 -0
- package/components/common/home/alertsTable/models/interfaces.ts +19 -0
- package/components/common/home/alertsTable/models/types.ts +18 -0
- package/components/common/home/config/configResourceMeterBlock.ts +25 -0
- package/components/common/home/models/interfaces.ts +59 -0
- package/components/common/home/models/types.ts +18 -0
- package/components/common/home/servicesTable/ServicesTable.vue +79 -0
- package/components/common/home/servicesTable/config/config.ts +62 -0
- package/package.json +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="card">
|
|
3
|
+
<div class="header flex-align-center flex-space-between">
|
|
4
|
+
<div class="flex-align-center">
|
|
5
|
+
<i :class="['card-icon', props.iconName]" />
|
|
6
|
+
<p>{{ props.title }}</p>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="pull-right">
|
|
9
|
+
{{ props.count }}
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="block">
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
const props = withDefaults(
|
|
20
|
+
defineProps<{
|
|
21
|
+
title: string
|
|
22
|
+
count: number
|
|
23
|
+
iconName: string
|
|
24
|
+
}>(),
|
|
25
|
+
{ count: 0 }
|
|
26
|
+
)
|
|
27
|
+
</script>
|
|
28
|
+
<style scoped lang="scss">
|
|
29
|
+
.card {
|
|
30
|
+
color: var(--global-font-color);
|
|
31
|
+
background-color: var(--global-bg-color);
|
|
32
|
+
|
|
33
|
+
.block {
|
|
34
|
+
color: inherit;
|
|
35
|
+
background-color: inherit;
|
|
36
|
+
padding: 12px 18px;
|
|
37
|
+
}
|
|
38
|
+
.header {
|
|
39
|
+
color: var(--global-font-color2);
|
|
40
|
+
background-color: inherit;
|
|
41
|
+
padding: 12px 18px;
|
|
42
|
+
height: auto;
|
|
43
|
+
border-bottom: 1px solid var(--global-border-color);
|
|
44
|
+
|
|
45
|
+
i {
|
|
46
|
+
margin: 1px 4px 0;
|
|
47
|
+
}
|
|
48
|
+
p {
|
|
49
|
+
font-size: 18px;
|
|
50
|
+
margin-left: 4px;
|
|
51
|
+
}
|
|
52
|
+
.pull-right {
|
|
53
|
+
font-size: 18px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.card-icon {
|
|
57
|
+
width: 18px;
|
|
58
|
+
height: 18px;
|
|
59
|
+
fill: var(--global-font-color2);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</style>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="card">
|
|
3
|
+
<div class="card-block">
|
|
4
|
+
<div class="clr-row vc-capacity-content">
|
|
5
|
+
<div
|
|
6
|
+
v-for="item in props.items"
|
|
7
|
+
:key="item.type"
|
|
8
|
+
class="clr-col-md clr-col-sm-12 clr-col-xs-12 capacity-entity"
|
|
9
|
+
>
|
|
10
|
+
<div class="capacity-entity-content">
|
|
11
|
+
<h3 class="capacity-entity-label">
|
|
12
|
+
{{ localization[item.type] }}
|
|
13
|
+
</h3>
|
|
14
|
+
<div class="capacity-entity-metrics-content">
|
|
15
|
+
<h4 class="capacity-entity-free">
|
|
16
|
+
{{ item.free.text }} {{ localization.free }}
|
|
17
|
+
</h4>
|
|
18
|
+
<progress
|
|
19
|
+
class="progress-block"
|
|
20
|
+
:max="item.capacity.value"
|
|
21
|
+
:value="item.used.value"
|
|
22
|
+
/>
|
|
23
|
+
<div class="capacity-entity-used">
|
|
24
|
+
{{ item.used.text }} {{ localization.used?.toLowerCase() }} |
|
|
25
|
+
{{ item.capacity.text }} {{ localization.total?.toLowerCase() }}
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
<script setup lang="ts">
|
|
35
|
+
import { UI_I_Localization } from '~/models/interfaces'
|
|
36
|
+
import type {
|
|
37
|
+
UI_I_ResourceMeter,
|
|
38
|
+
UI_I_MeterBlockItem,
|
|
39
|
+
} from '~/components/common/home/models/interfaces'
|
|
40
|
+
|
|
41
|
+
const props = defineProps<{
|
|
42
|
+
items: UI_I_ResourceMeter<UI_I_MeterBlockItem>[]
|
|
43
|
+
}>()
|
|
44
|
+
|
|
45
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
46
|
+
</script>
|
|
47
|
+
<style lang="scss" scoped>
|
|
48
|
+
.card {
|
|
49
|
+
color: var(--global-font-color);
|
|
50
|
+
background-color: var(--global-bg-color);
|
|
51
|
+
|
|
52
|
+
&-block {
|
|
53
|
+
.capacity-entity {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
align-items: center;
|
|
57
|
+
margin: 0;
|
|
58
|
+
padding: 0 10px;
|
|
59
|
+
border-left: 1px solid var(--global-border-color);
|
|
60
|
+
|
|
61
|
+
&:first-of-type {
|
|
62
|
+
border-left: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.capacity-entity-content {
|
|
66
|
+
min-height: 120px;
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
align-items: center;
|
|
71
|
+
width: 100%;
|
|
72
|
+
|
|
73
|
+
h3 {
|
|
74
|
+
font-size: 18px;
|
|
75
|
+
font-weight: 200;
|
|
76
|
+
margin-bottom: 5px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
progress.progress-block {
|
|
80
|
+
width: 100%;
|
|
81
|
+
height: 0.6395rem;
|
|
82
|
+
line-height: 24px;
|
|
83
|
+
background-color: var(--progress-bg-color);
|
|
84
|
+
}
|
|
85
|
+
progress::-webkit-progress-value,
|
|
86
|
+
progress::-moz-progress-value {
|
|
87
|
+
background-color: var(--progress-value-bg-color);
|
|
88
|
+
}
|
|
89
|
+
progress::-webkit-progress-bar {
|
|
90
|
+
background-color: var(--progress-bg-color);
|
|
91
|
+
}
|
|
92
|
+
.capacity-entity-free {
|
|
93
|
+
font-size: 22px;
|
|
94
|
+
font-weight: 200;
|
|
95
|
+
margin-bottom: 10px;
|
|
96
|
+
}
|
|
97
|
+
.capacity-entity-used {
|
|
98
|
+
font-size: 12px;
|
|
99
|
+
}
|
|
100
|
+
.capacity-entity-label {
|
|
101
|
+
align-self: flex-start;
|
|
102
|
+
// font-size: 0.9rem;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
.capacity-entity-content:nth-child(1) {
|
|
109
|
+
border-left: none;
|
|
110
|
+
}
|
|
111
|
+
.capacity-entity-metrics-content {
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: column;
|
|
114
|
+
justify-content: space-between;
|
|
115
|
+
align-items: center;
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="entity-status-content">
|
|
3
|
+
<div v-for="(text, value) in props.items" :key="value" class="item">
|
|
4
|
+
<h3 class="entity-status-item-value">
|
|
5
|
+
{{ text }}
|
|
6
|
+
</h3>
|
|
7
|
+
<div class="entity-status-item-status">{{ localization[value] }}</div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import type { UI_I_Localization } from '~/models/interfaces'
|
|
14
|
+
import type { UI_I_Card } from '~/components/common/home/models/interfaces'
|
|
15
|
+
|
|
16
|
+
const props = defineProps<{
|
|
17
|
+
items: UI_I_Card
|
|
18
|
+
}>()
|
|
19
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<style scoped lang="scss">
|
|
23
|
+
.entity-status-content {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: space-around;
|
|
26
|
+
align-items: center;
|
|
27
|
+
min-height: 100px;
|
|
28
|
+
|
|
29
|
+
.item {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
align-items: center;
|
|
34
|
+
color: inherit;
|
|
35
|
+
background-color: inherit;
|
|
36
|
+
|
|
37
|
+
.entity-status-item-value {
|
|
38
|
+
font-size: 22px;
|
|
39
|
+
font-weight: 200;
|
|
40
|
+
}
|
|
41
|
+
.entity-status-item-status {
|
|
42
|
+
font-size: 13px;
|
|
43
|
+
margin-top: 5px;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="most-alert">
|
|
3
|
+
<atoms-table-data-grid
|
|
4
|
+
v-model:selected-row="selectedRow"
|
|
5
|
+
v-model:page-size="pageSize"
|
|
6
|
+
v-model:page="page"
|
|
7
|
+
class="data-table"
|
|
8
|
+
:head-items="headItems"
|
|
9
|
+
:body-items="bodyItems"
|
|
10
|
+
:total-items="bodyItems.length"
|
|
11
|
+
:total-pages="1"
|
|
12
|
+
off-select-by-row
|
|
13
|
+
hide-page-size
|
|
14
|
+
show-page-info
|
|
15
|
+
server-off
|
|
16
|
+
>
|
|
17
|
+
<template #th="{ item }">
|
|
18
|
+
<atoms-the-icon
|
|
19
|
+
width="20px"
|
|
20
|
+
height="20px"
|
|
21
|
+
:name="item.iconName"
|
|
22
|
+
class="title-icon"
|
|
23
|
+
/>
|
|
24
|
+
<span> {{ item.text }} </span>
|
|
25
|
+
</template>
|
|
26
|
+
<template #icon="{ item }">
|
|
27
|
+
<span :class="['datagrid-cell-icon', item.data.iconClassName]" />
|
|
28
|
+
<a
|
|
29
|
+
v-if="item.data.isLink"
|
|
30
|
+
href="javascript:void(0)"
|
|
31
|
+
class="text-ellipsis"
|
|
32
|
+
:title="item.text"
|
|
33
|
+
@click="selectNodeOfTree(item.data)"
|
|
34
|
+
>{{ item.text }}</a
|
|
35
|
+
>
|
|
36
|
+
<span v-else class="text-ellipsis">
|
|
37
|
+
{{ item.text }}
|
|
38
|
+
</span>
|
|
39
|
+
</template>
|
|
40
|
+
</atoms-table-data-grid>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup lang="ts">
|
|
45
|
+
import type {
|
|
46
|
+
UI_I_HeadItem,
|
|
47
|
+
UI_I_BodyItem,
|
|
48
|
+
} from '~/components/atoms/table/dataGrid/models/interfaces'
|
|
49
|
+
import type { UI_I_Localization } from '~/models/interfaces'
|
|
50
|
+
import type { UI_T_SelectedRow } from '~/components/atoms/table/dataGrid/models/types'
|
|
51
|
+
import type { UI_I_Alert } from '~/components/common/home/models/interfaces'
|
|
52
|
+
import type { UI_I_AlertData } from '~/components/common/home/alertsTable/models/interfaces'
|
|
53
|
+
import * as table from '~/components/common/home/alertsTable/config/config'
|
|
54
|
+
|
|
55
|
+
const props = defineProps<{
|
|
56
|
+
dataTable: UI_I_Alert[]
|
|
57
|
+
}>()
|
|
58
|
+
|
|
59
|
+
const emits = defineEmits<{
|
|
60
|
+
(event: 'select-node-of-tree', value: UI_I_AlertData): void
|
|
61
|
+
}>()
|
|
62
|
+
|
|
63
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
64
|
+
|
|
65
|
+
const selectedRow = ref<UI_T_SelectedRow>(null)
|
|
66
|
+
const headItems = computed<UI_I_HeadItem[]>(() =>
|
|
67
|
+
table.headItems(localization.value)
|
|
68
|
+
)
|
|
69
|
+
const bodyItems = ref<UI_I_BodyItem[][]>([])
|
|
70
|
+
watch(
|
|
71
|
+
() => props.dataTable,
|
|
72
|
+
(newValue) => {
|
|
73
|
+
if (!newValue?.length) {
|
|
74
|
+
bodyItems.value = []
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
bodyItems.value = table.bodyItems(newValue)
|
|
79
|
+
},
|
|
80
|
+
{ deep: true, immediate: true }
|
|
81
|
+
)
|
|
82
|
+
const page = ref<number>(1)
|
|
83
|
+
const pageSize = ref<number>(1)
|
|
84
|
+
|
|
85
|
+
const selectNodeOfTree = (item: UI_I_AlertData): void => {
|
|
86
|
+
emits('select-node-of-tree', item)
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<style lang="scss" scoped>
|
|
91
|
+
.most-alert {
|
|
92
|
+
margin: 0;
|
|
93
|
+
border: none;
|
|
94
|
+
|
|
95
|
+
:deep(.datagrid-outer-wrapper) {
|
|
96
|
+
padding: 0;
|
|
97
|
+
|
|
98
|
+
.datagrid {
|
|
99
|
+
margin: 0;
|
|
100
|
+
border: unset;
|
|
101
|
+
min-height: 200px;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
</style>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UI_I_HeadItem,
|
|
3
|
+
UI_I_BodyItem,
|
|
4
|
+
} from '~/components/atoms/table/dataGrid/models/interfaces'
|
|
5
|
+
import type { UI_I_Localization } from '~/models/interfaces'
|
|
6
|
+
import type { UI_T_AlertColumnKeys } from '~/components/common/home/models/types'
|
|
7
|
+
import type { UI_I_Alert } from '~/components/common/home/models/interfaces'
|
|
8
|
+
import type { UI_I_AlertData } from '~/components/common/home/alertsTable/models/interfaces'
|
|
9
|
+
import { UI_E_TabsByTypeEnum } from '~/components/common/home/alertsTable/models/enums'
|
|
10
|
+
import { constructHeadItem } from '~/components/atoms/table/dataGrid/utils/constructDataTable'
|
|
11
|
+
|
|
12
|
+
export const alertsTableKeys: UI_T_AlertColumnKeys[] = [
|
|
13
|
+
'item',
|
|
14
|
+
'alerts',
|
|
15
|
+
'warnings',
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
const getItems = (
|
|
19
|
+
localization: UI_I_Localization
|
|
20
|
+
): [string, boolean, string, string, string][] => {
|
|
21
|
+
return [
|
|
22
|
+
[localization.item, true, '34%', alertsTableKeys[0], ''],
|
|
23
|
+
[localization.alerts, true, '33%', alertsTableKeys[1], 'error-outline'],
|
|
24
|
+
[localization.warnings, true, '33%', alertsTableKeys[2], 'warning-outline'],
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
|
|
29
|
+
const result: UI_I_HeadItem[] = []
|
|
30
|
+
getItems(localization).forEach((item, i) => {
|
|
31
|
+
const col = i === 0 ? 'icon' : `col${i + 1}`
|
|
32
|
+
result.push(
|
|
33
|
+
constructHeadItem(col, item[0], item[3], true, item[2], item[4])
|
|
34
|
+
)
|
|
35
|
+
})
|
|
36
|
+
return result
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const bodyItems = (data: UI_I_Alert[]): UI_I_BodyItem[][] => {
|
|
40
|
+
const bodyItems: UI_I_BodyItem[][] = []
|
|
41
|
+
data.forEach((alert: UI_I_Alert, key) => {
|
|
42
|
+
const alertData: UI_I_AlertData = {
|
|
43
|
+
iconClassName: 'vsphere-icon-folder',
|
|
44
|
+
id: alert.id,
|
|
45
|
+
nav: UI_E_TabsByTypeEnum[alert.type],
|
|
46
|
+
type: alert.type,
|
|
47
|
+
isLink: true,
|
|
48
|
+
}
|
|
49
|
+
bodyItems.push([
|
|
50
|
+
{
|
|
51
|
+
key: 'icon',
|
|
52
|
+
text: alert[alertsTableKeys[0]].toString(),
|
|
53
|
+
data: alertData,
|
|
54
|
+
id: key,
|
|
55
|
+
},
|
|
56
|
+
{ key: 'col2', text: alert[alertsTableKeys[1]].toString(), id: key },
|
|
57
|
+
{ key: 'col3', text: alert[alertsTableKeys[2]].toString(), id: key },
|
|
58
|
+
])
|
|
59
|
+
})
|
|
60
|
+
return bodyItems
|
|
61
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { UI_T_NavNodes } from '~/components/common/home/alertsTable/models/types'
|
|
2
|
+
import type { UI_I_TreeNode } from '~/components/common/recursionTree/models/interfaces'
|
|
3
|
+
import type { UI_T_InventoryAllTreeName } from '~/components/common/home/alertsTable/models/types'
|
|
4
|
+
|
|
5
|
+
export interface UI_I_AlertData {
|
|
6
|
+
iconClassName: string
|
|
7
|
+
id: number
|
|
8
|
+
nav: UI_T_NavNodes
|
|
9
|
+
type: string
|
|
10
|
+
isLink: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface UI_I_ShowNodePayload {
|
|
14
|
+
node: UI_I_TreeNode
|
|
15
|
+
treeName: UI_T_InventoryAllTreeName
|
|
16
|
+
}
|
|
17
|
+
export interface UI_I_SelectNodePayload extends UI_I_ShowNodePayload {
|
|
18
|
+
doSelect?: boolean
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type UI_T_NavNodes =
|
|
2
|
+
| 'h'
|
|
3
|
+
// для прокуратор
|
|
4
|
+
| 'v'
|
|
5
|
+
| 's'
|
|
6
|
+
| 'n'
|
|
7
|
+
|
|
8
|
+
export type UI_T_InventoryTreeName =
|
|
9
|
+
| 'hostsAndClustersTree'
|
|
10
|
+
// для прокуратор
|
|
11
|
+
| 'vmsTree'
|
|
12
|
+
| 'storagesTree'
|
|
13
|
+
| 'networksTree'
|
|
14
|
+
|
|
15
|
+
export type UI_T_InventoryAllTreeName =
|
|
16
|
+
| UI_T_InventoryTreeName
|
|
17
|
+
| 'folderTree'
|
|
18
|
+
| 'computeResourceTree'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UI_I_MeterBlockItem,
|
|
3
|
+
UI_I_ResourceMeter,
|
|
4
|
+
} from '~/components/common/home/models/interfaces'
|
|
5
|
+
|
|
6
|
+
export const optionsDefault: UI_I_ResourceMeter<UI_I_MeterBlockItem>[] = [
|
|
7
|
+
{
|
|
8
|
+
type: 'cpu',
|
|
9
|
+
free: { text: '0', value: 0 },
|
|
10
|
+
used: { text: '0', value: 0 },
|
|
11
|
+
capacity: { text: '0', value: 0 },
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'memory',
|
|
15
|
+
free: { text: '0', value: 0 },
|
|
16
|
+
used: { text: '0', value: 0 },
|
|
17
|
+
capacity: { text: '0', value: 0 },
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'storage',
|
|
21
|
+
free: { text: '0', value: 0 },
|
|
22
|
+
used: { text: '0', value: 0 },
|
|
23
|
+
capacity: { text: '0', value: 0 },
|
|
24
|
+
},
|
|
25
|
+
]
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { UI_T_NodeType } from '~/components/common/home/models/types'
|
|
2
|
+
|
|
3
|
+
export interface UI_I_ZoneList {
|
|
4
|
+
name: string
|
|
5
|
+
id: number
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface UI_I_ResourceMeter<T> {
|
|
9
|
+
type: string
|
|
10
|
+
capacity?: T
|
|
11
|
+
free?: T
|
|
12
|
+
used?: T
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface UI_I_MeterBlockItem {
|
|
16
|
+
value: number
|
|
17
|
+
text: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface UI_I_Hosts {
|
|
21
|
+
connected: number
|
|
22
|
+
disconnected: number
|
|
23
|
+
maintenance: number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface UI_I_Vms {
|
|
27
|
+
powered_on: number
|
|
28
|
+
powered_off: number
|
|
29
|
+
suspended: number
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface UI_I_Alert {
|
|
33
|
+
item: string
|
|
34
|
+
type: UI_T_NodeType
|
|
35
|
+
id: number
|
|
36
|
+
alerts: number
|
|
37
|
+
warnings: number
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface UI_I_Service {
|
|
41
|
+
id: number
|
|
42
|
+
item: string
|
|
43
|
+
statusIcon: string
|
|
44
|
+
statusText: string
|
|
45
|
+
version: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface UI_I_HomeInfo {
|
|
49
|
+
resource_meter: UI_I_ResourceMeter<UI_I_MeterBlockItem>[]
|
|
50
|
+
hosts: UI_I_Hosts
|
|
51
|
+
vms: UI_I_Vms
|
|
52
|
+
alerts: UI_I_Alert[]
|
|
53
|
+
services: UI_I_Service[]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface UI_I_Card {
|
|
57
|
+
text: string
|
|
58
|
+
value: number
|
|
59
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type UI_T_NodeType =
|
|
2
|
+
| 'zone'
|
|
3
|
+
| 'folder'
|
|
4
|
+
| 'datacenter'
|
|
5
|
+
| 'cluster'
|
|
6
|
+
// для прокуратор
|
|
7
|
+
| 'host'
|
|
8
|
+
| 'vm'
|
|
9
|
+
| 'datastore'
|
|
10
|
+
| 'network'
|
|
11
|
+
|
|
12
|
+
export type UI_T_AlertColumnKeys = 'item' | 'alerts' | 'warnings'
|
|
13
|
+
|
|
14
|
+
export type UI_T_ServiceColumnKeys =
|
|
15
|
+
| 'item'
|
|
16
|
+
| 'statusText'
|
|
17
|
+
| 'statusIcon'
|
|
18
|
+
| 'version'
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="most-alert">
|
|
3
|
+
<atoms-table-data-grid
|
|
4
|
+
v-model:selected-row="selectedRow"
|
|
5
|
+
v-model:page-size="pageSize"
|
|
6
|
+
v-model:page="page"
|
|
7
|
+
class="data-table"
|
|
8
|
+
:head-items="headItems"
|
|
9
|
+
:body-items="bodyItems"
|
|
10
|
+
:total-items="bodyItems.length"
|
|
11
|
+
:total-pages="1"
|
|
12
|
+
off-select-by-row
|
|
13
|
+
hide-page-size
|
|
14
|
+
show-page-info
|
|
15
|
+
server-off
|
|
16
|
+
>
|
|
17
|
+
<template #icon="{ item }">
|
|
18
|
+
<span :class="['datagrid-cell-icon', item.data.iconClassName]" />
|
|
19
|
+
<span class="text-ellipsis">
|
|
20
|
+
{{ item.text }}
|
|
21
|
+
</span>
|
|
22
|
+
</template>
|
|
23
|
+
</atoms-table-data-grid>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import type {
|
|
29
|
+
UI_I_HeadItem,
|
|
30
|
+
UI_I_BodyItem,
|
|
31
|
+
} from '~/components/atoms/table/dataGrid/models/interfaces'
|
|
32
|
+
import type { UI_T_SelectedRow } from '~/components/atoms/table/dataGrid/models/types'
|
|
33
|
+
import type { UI_I_Localization } from '~/models/interfaces'
|
|
34
|
+
import type { UI_I_Service } from '~/components/common/home/models/interfaces'
|
|
35
|
+
import * as table from '~/components/common/home/servicesTable/config/config'
|
|
36
|
+
|
|
37
|
+
const props = defineProps<{
|
|
38
|
+
dataTable: UI_I_Service[]
|
|
39
|
+
}>()
|
|
40
|
+
|
|
41
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
42
|
+
|
|
43
|
+
const selectedRow = ref<UI_T_SelectedRow>(null)
|
|
44
|
+
const headItems = computed<UI_I_HeadItem[]>(() =>
|
|
45
|
+
table.headItems(localization.value)
|
|
46
|
+
)
|
|
47
|
+
const bodyItems = ref<UI_I_BodyItem[][]>([])
|
|
48
|
+
watch(
|
|
49
|
+
() => props.dataTable,
|
|
50
|
+
(newValue) => {
|
|
51
|
+
if (!newValue?.length) {
|
|
52
|
+
bodyItems.value = []
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
bodyItems.value = table.bodyItems(newValue)
|
|
57
|
+
},
|
|
58
|
+
{ deep: true, immediate: true }
|
|
59
|
+
)
|
|
60
|
+
const page = ref<number>(1)
|
|
61
|
+
const pageSize = ref<number>(1)
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style lang="scss" scoped>
|
|
65
|
+
.most-alert {
|
|
66
|
+
margin: 0;
|
|
67
|
+
border: none;
|
|
68
|
+
|
|
69
|
+
:deep(.datagrid-outer-wrapper) {
|
|
70
|
+
padding: 0;
|
|
71
|
+
|
|
72
|
+
.datagrid {
|
|
73
|
+
margin: 0;
|
|
74
|
+
border: unset;
|
|
75
|
+
min-height: 200px;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
UI_I_BodyItem,
|
|
3
|
+
UI_I_HeadItem,
|
|
4
|
+
} from '~/components/atoms/table/dataGrid/models/interfaces'
|
|
5
|
+
import type { UI_I_Localization } from '~/models/interfaces'
|
|
6
|
+
import { constructHeadItem } from '~/components/atoms/table/dataGrid/utils/constructDataTable'
|
|
7
|
+
import type { UI_T_ServiceColumnKeys } from '~/components/common/home/models/types'
|
|
8
|
+
import type { UI_I_Service } from '~/components/common/home/models/interfaces'
|
|
9
|
+
|
|
10
|
+
export const servicesTableKeys: UI_T_ServiceColumnKeys[] = [
|
|
11
|
+
'item',
|
|
12
|
+
'statusText',
|
|
13
|
+
'statusIcon',
|
|
14
|
+
'version',
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
const getItems = (
|
|
18
|
+
localization: UI_I_Localization
|
|
19
|
+
): [string, boolean, string, string][] => {
|
|
20
|
+
return [
|
|
21
|
+
[localization.item, true, '34%', servicesTableKeys[0]],
|
|
22
|
+
[localization.status, true, '33%', servicesTableKeys[1]],
|
|
23
|
+
[localization.version, true, '33%', servicesTableKeys[2]],
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const headItems = (localization: UI_I_Localization): UI_I_HeadItem[] => {
|
|
28
|
+
const result: UI_I_HeadItem[] = []
|
|
29
|
+
getItems(localization).forEach((item, i) => {
|
|
30
|
+
const col = i === 1 ? 'icon' : `col${i + 1}`
|
|
31
|
+
result.push(constructHeadItem(col, item[0], item[3], true, item[2]))
|
|
32
|
+
})
|
|
33
|
+
return result
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const bodyItems = (data: UI_I_Service[]): UI_I_BodyItem[][] => {
|
|
37
|
+
const bodyItems: UI_I_BodyItem[][] = []
|
|
38
|
+
data.forEach((service: UI_I_Service, key) => {
|
|
39
|
+
const statusData = {
|
|
40
|
+
iconClassName: `vsphere-icon-status-${service.statusIcon}`,
|
|
41
|
+
}
|
|
42
|
+
bodyItems.push([
|
|
43
|
+
{
|
|
44
|
+
key: 'col1',
|
|
45
|
+
text: service[servicesTableKeys[0]].toString(),
|
|
46
|
+
id: key,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: 'icon',
|
|
50
|
+
text: service[servicesTableKeys[1]].toString(),
|
|
51
|
+
data: statusData,
|
|
52
|
+
id: key,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: 'col3',
|
|
56
|
+
text: service[servicesTableKeys[2]].toString(),
|
|
57
|
+
id: key,
|
|
58
|
+
},
|
|
59
|
+
])
|
|
60
|
+
})
|
|
61
|
+
return bodyItems
|
|
62
|
+
}
|