Skip to content

Commit f71ed85

Browse files
M. Weberyadvr
authored andcommitted
dashboard improvements (#27)
* Add new grid values new classes to replace inline stlyes with it * Fix navigation scroll behavior Signed-off-by: Rohit Yadav <[email protected]>
1 parent 84d48f7 commit f71ed85

File tree

4 files changed

+106
-67
lines changed

4 files changed

+106
-67
lines changed

ui/src/components/menu/SideMenu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default {
6767
z-index: 10;
6868
height: auto;
6969
70-
.ant-layout-sider-children {
70+
/deep/ .ant-layout-sider-children {
7171
overflow-y: hidden;
7272
7373
&:hover {

ui/src/style/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,11 @@
3737
- repeatly used elements like buttons, inputs
3838
7. components
3939
- complex elements like dropdown, forms, table, search (usualy include this to components/FooterToolbar/ folder)
40+
41+
42+
# The "/deep/" combinator
43+
- use the /deep/ combinator (or in other versions ">>>") helps us to exclude "scoped" rules into global
44+
- e.g. <style scoped> .a .b .c {}</style> will scope a generated data ID like .a .b .c[data-abcde] {}
45+
- but <style scoped> .a /deep/ .b .c {} </style> will scope .a[data-abcde] .b .c {}
46+
- so everything after deep will be outside the defined scope
47+
- watch this article for technical information. https://vue-loader.vuejs.org/guide/scoped-css.html#child-component-root-elements

ui/src/views/dashboard/CapacityDashboard.vue

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
<template>
2-
<a-row :gutter="12" :style="{ marginTop: '24px' }">
2+
<a-row class="capacity-dashboard" :gutter="24">
33
<a-col :xl="18">
4-
<div class="ant-pro-capacity-dashboard__wrapper">
5-
<div class="ant-pro-capacity-dashboard__select">
4+
<div class="capacity-dashboard-wrapper">
5+
<div class="capacity-dashboard-select">
66
<a-select
77
showSearch
88
optionFilterProp="children"
99
:defaultValue="zoneSelected.name"
1010
:value="zoneSelected.name"
11-
@change="changeZone"
12-
style="width: 100%" >
11+
@change="changeZone">
1312
<a-select-option v-for="(zone, index) in zones" :key="index">
1413
{{ zone.name }}
1514
</a-select-option>
1615
</a-select>
1716
</div>
18-
<div class="ant-pro-capacity-dashboard__button">
17+
<div class="capacity-dashboard-button">
1918
<a-tooltip placement="bottom">
2019
<template slot="title">
2120
Fetch Latest
@@ -24,31 +23,31 @@
2423
type="primary"
2524
shape="circle"
2625
@click="listCapacity(zoneSelected, true)">
27-
<a-icon style="font-size: 16px; padding: 2px" type="reload" />
26+
<a-icon class="capacity-dashboard-button-icon" type="reload" />
2827
</a-button>
2928
</a-tooltip>
3029
</div>
31-
<div class="ant-pro-capacity-dashboard__button">
30+
<div class="capacity-dashboard-button">
3231
<a-tooltip placement="bottom">
3332
<template slot="title">
3433
View Alerts
3534
</template>
3635
<a-button shape="circle">
3736
<router-link :to="{ name: 'alert' }">
38-
<a-icon style="font-size: 16px; padding: 2px" type="flag" />
37+
<a-icon class="capacity-dashboard-button-icon" type="flag" />
3938
</router-link>
4039
</a-button>
4140
</a-tooltip>
4241
</div>
43-
<div class="ant-pro-capacity-dashboard__button">
42+
<div class="capacity-dashboard-button">
4443
<a-tooltip placement="bottom">
4544
<template slot="title">
4645
View Hosts in Alert State
4746
</template>
4847
<a-button type="danger" shape="circle">
4948
<router-link :to="{ name: 'host', query: {'state': 'Alert'} }">
5049
<a-badge dot>
51-
<a-icon style="font-size: 16px" type="desktop" />
50+
<a-icon class="capacity-dashboard-button-icon" type="desktop" />
5251
</a-badge>
5352
</router-link>
5453
</a-button>
@@ -57,12 +56,14 @@
5756
</div>
5857
<a-row :gutter="12">
5958
<a-col
60-
:xl="6"
59+
:xs="12"
60+
:sm="8"
61+
:md="6"
6162
:style="{ marginBottom: '12px' }"
6263
v-for="stat in stats"
6364
:key="stat.type">
6465
<chart-card :loading="loading">
65-
<div style="text-align: center; white-space: nowrap; overflow: hidden;">
66+
<div class="capacity-dashboard-chart-card-inner">
6667
<h4>{{ stat.name }}</h4>
6768
<a-progress type="dashboard" :percent="Number(parseFloat(stat.percentused, 10).toFixed(2))" :width="100" />
6869
</div>
@@ -78,7 +79,7 @@
7879
<a-button><router-link :to="{ name: 'event' }">View Events</router-link></a-button>
7980
</div>
8081
<template slot="footer">
81-
<div :style="{ paddingTop: '12px', paddingLeft: '3px', whiteSpace: 'normal' }">
82+
<div class="capacity-dashboard-footer">
8283
<a-timeline pending="...">
8384
<a-timeline-item
8485
v-for="event in events"
@@ -198,19 +199,42 @@ export default {
198199
</script>
199200

200201
<style lang="less" scoped>
201-
.ant-pro-capacity-dashboard {
202-
&__wrapper {
202+
.capacity-dashboard {
203+
margin-top: 24px;
204+
205+
&-wrapper {
203206
display: flex;
204207
margin-bottom: 12px;
205208
}
206209
207-
&__select {
208-
width: 100%;
210+
&-chart-card-inner {
211+
text-align: center;
212+
white-space: nowrap;
213+
overflow: hidden;
214+
}
215+
216+
&-select {
217+
width: 100%; // for flexbox causes
218+
219+
.ant-select {
220+
width: 100%; // to fill flex item width
221+
}
209222
}
210223
211-
&__button {
224+
&-button {
212225
width: auto;
213226
padding-left: 12px;
214227
}
228+
229+
&-button-icon {
230+
font-size: 16px;
231+
padding: 2px;
232+
}
233+
234+
&-footer {
235+
padding-top: 12px;
236+
padding-left: 3px;
237+
white-space: normal;
238+
}
215239
}
216240
</style>

ui/src/views/dashboard/UsageDashboard.vue

Lines changed: 54 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,48 @@
11
<template>
2-
<div class="page-header-index-wide">
3-
<a-row :gutter="12">
4-
<a-col
5-
class="user-dashboard-chart-card"
6-
:xl="16">
7-
<a-row :gutter="12">
8-
<a-col
9-
:xl="8"
10-
v-for="stat in stats"
11-
:key="stat.type"
12-
:style="{ marginBottom: '12px' }">
13-
<chart-card class="user-dashboard-chart-card" :loading="loading">
14-
<router-link :to="{ name: stat.path }">
15-
<div style="text-align: center">
16-
<h4>{{ stat.name }}</h4>
17-
<h1>{{ stat.count == undefined ? 0 : stat.count }}</h1>
18-
</div>
19-
</router-link>
20-
</chart-card>
21-
</a-col>
22-
</a-row>
23-
</a-col>
24-
<a-col
25-
:xl="8"
26-
:style="{ marginTop: '24px' }">
27-
<chart-card>
28-
<div style="text-align: center">
29-
<a-button><router-link :to="{ name: 'event' }">View Events</router-link></a-button>
2+
<a-row class="usage-dashboard" :gutter="24">
3+
<a-col
4+
:xl="16">
5+
<a-row :gutter="12">
6+
<a-col
7+
class="usage-dashboard-chart-tile"
8+
:xs="12"
9+
:md="8"
10+
v-for="stat in stats"
11+
:key="stat.type">
12+
<chart-card class="usage-dashboard-chart-card" :loading="loading">
13+
<router-link :to="{ name: stat.path }">
14+
<div class="usage-dashboard-chart-card-inner">
15+
<h4>{{ stat.name }}</h4>
16+
<h1>{{ stat.count == undefined ? 0 : stat.count }}</h1>
17+
</div>
18+
</router-link>
19+
</chart-card>
20+
</a-col>
21+
</a-row>
22+
</a-col>
23+
<a-col
24+
:xl="8">
25+
<chart-card>
26+
<div class="usage-dashboard-chart-card-inner">
27+
<a-button><router-link :to="{ name: 'event' }">View Events</router-link></a-button>
28+
</div>
29+
<template slot="footer">
30+
<div class="usage-dashboard-chart-footer">
31+
<a-timeline pending="...">
32+
<a-timeline-item
33+
v-for="event in events"
34+
:key="event.id"
35+
:color="getEventColour(event)">
36+
<span :style="{ color: '#999' }"><small>{{ event.created }}</small></span><br/>
37+
<span :style="{ color: '#666' }"><small>{{ event.type }}</small></span><br/>
38+
<span :style="{ color: '#aaa' }">({{ event.username }}) {{ event.description }}</span>
39+
</a-timeline-item>
40+
</a-timeline>
3041
</div>
31-
<template slot="footer">
32-
<div :style="{ paddingTop: '12px', paddingLeft: '3px', whiteSpace: 'normal' }">
33-
<a-timeline pending="...">
34-
<a-timeline-item
35-
v-for="event in events"
36-
:key="event.id"
37-
:color="getEventColour(event)">
38-
<span :style="{ color: '#999' }"><small>{{ event.created }}</small></span><br/>
39-
<span :style="{ color: '#666' }"><small>{{ event.type }}</small></span><br/>
40-
<span :style="{ color: '#aaa' }">({{ event.username }}) {{ event.description }}</span>
41-
</a-timeline-item>
42-
</a-timeline>
43-
</div>
44-
</template>
45-
</chart-card>
46-
</a-col>
47-
</a-row>
48-
</div>
42+
</template>
43+
</chart-card>
44+
</a-col>
45+
</a-row>
4946
</template>
5047

5148
<script>
@@ -153,15 +150,25 @@ export default {
153150
</script>
154151

155152
<style lang="less" scoped>
156-
.user-dashboard {
153+
.usage-dashboard {
157154
margin-top: 24px;
158155
156+
&-chart-tile {
157+
margin-bottom: 12px;
158+
}
159+
159160
&-chart-card {
160161
padding-top: 24px;
161162
}
162163
163164
&-chart-card-inner {
164165
text-align: center;
165166
}
167+
168+
&-footer {
169+
padding-top: 12px;
170+
padding-left: 3px;
171+
white-space: normal;
172+
}
166173
}
167174
</style>

0 commit comments

Comments
 (0)