Skip to content

Commit 6eeaf1e

Browse files
authored
Show Scalar Data and add ExpandPanel (#272)
* Watch tagInfo changes to update chart and fix tooltip issue * Add expand panel and maintain isShow state in the panel * Add Expand Panel in Image
1 parent 6e8a010 commit 6eeaf1e

File tree

5 files changed

+90
-12
lines changed

5 files changed

+90
-12
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<template>
2+
<div class="visual-dl-expand-panel">
3+
<h3
4+
class="visual-dl-expand-head"
5+
@click="handleHeadClick()"
6+
>
7+
<span>{{title}}</span>
8+
<span class="visual-dl-expand-head-info">
9+
<v-icon class="visual-dl-expand-head-arrow" size="20">{{iconName}}</v-icon>
10+
<span class="visual-dl-expand-head-num">({{info}})</span>
11+
</span>
12+
</h3>
13+
<div
14+
v-if="isShow"
15+
class="visual-dl-expand-panel-content"
16+
>
17+
<slot></slot>
18+
</div>
19+
</div>
20+
</template>
21+
<script>
22+
export default {
23+
props: {
24+
title: String,
25+
info: Number
26+
},
27+
computed: {
28+
iconName() {
29+
return this.isShow ? 'expand_less' : 'expand_more';
30+
}
31+
},
32+
data() {
33+
return {
34+
isShow: true
35+
};
36+
},
37+
methods: {
38+
handleHeadClick() {
39+
this.toogleShow();
40+
},
41+
toogleShow() {
42+
this.isShow = !this.isShow;
43+
}
44+
}
45+
};
46+
</script>
47+
<style lang="stylus">
48+
.visual-dl-expand-panel
49+
text-align left
50+
.visual-dl-expand-head
51+
border solid 1px #ccc
52+
line-height 50px
53+
height 50px
54+
padding 0 20px
55+
cursor pointer
56+
position relative
57+
.visual-dl-expand-head-info
58+
position absolute
59+
left 90%
60+
.visual-dl-expand-head-arrow
61+
vertical-align middle
62+
.visual-dl-expand-head-num
63+
line-height 20px
64+
font-size 12px
65+
font-weight normal
66+
.visual-dl-expand-panel-content
67+
padding 0 20px
68+
.visual-dl-expand-panel-content:after
69+
content: "";
70+
clear: both;
71+
display: block;
72+
</style>
73+
74+

frontend/src/images/ui/ChartPage.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="visual-dl-chart-page">
3-
<!--<ui-expand-panel isShow="{{expand}}" info="{{total}}" title="{{title}}">-->
3+
<ui-expand-panel :info="total" :title="title">
44
<ui-image
55
class="visual-dl-chart-image"
66
v-for="tagInfo in filteredPageList"
@@ -16,11 +16,11 @@
1616
:length="total"
1717
:total-visible="pageSize"
1818
></v-pagination>
19-
<!--</ui-expand-panel>-->
19+
</ui-expand-panel>
2020
</div>
2121
</template>
2222
<script>
23-
//import ExpandPanel from '../../common/component/ExpandPanel';
23+
import ExpandPanel from '../../common/component/ExpandPanel';
2424
import Image from './Image';
2525
//import Pagination from 'san-mui/Pagination';
2626
@@ -30,7 +30,7 @@ export default {
3030
props: ['config', 'runsItems', 'tagList', 'title'],
3131
components: {
3232
'ui-image': Image,
33-
//'ui-expand-panel': ExpandPanel,
33+
'ui-expand-panel': ExpandPanel,
3434
//'ui-pagination': Pagination
3535
},
3636
computed: {

frontend/src/scalars/Scalars.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<div class="visual-dl-page-container">
33
<div class="visual-dl-page-left">
44
<ui-chart-page
5-
:expand="true"
65
:config="filteredConfig"
76
:runsItems="runsItems"
87
:tagList="filteredTagsList"

frontend/src/scalars/ui/Chart.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ export default {
9393
horizontal: function(val) {
9494
this.setChartHorizon();
9595
},
96+
tagInfo: function(val) {
97+
this.setChartsOptions(val);
98+
this.getOriginChartData(val);
99+
}
96100
// runs: function(val) {
97101
// this.setChartsRuns();
98102
// }
@@ -168,6 +172,7 @@ export default {
168172
);
169173
seriesOption = flatten(seriesOption);
170174
let legendOptions = tagList.map(item => item.run);
175+
let instance = this;
171176
let option = {
172177
color: [
173178
'#c23531',
@@ -194,8 +199,8 @@ export default {
194199
},
195200
position: ['10%', '90%'],
196201
formatter(params, ticket, callback) {
197-
let data = this.getFormatterPoints(params[0].data);
198-
return this.transformFormatterData(data);
202+
let data = instance.getFormatterPoints(params[0].data);
203+
return instance.transformFormatterData(data);
199204
}
200205
},
201206
toolbox: {

frontend/src/scalars/ui/ChartPage.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="visual-dl-chart-page">
3-
<!--<ui-expand-panel isShow="{{expand}}" info="{{tagList.length}}" title="{{title}}">-->
3+
<ui-expand-panel :info="tagList.length" :title="title">
44
<div ref="chartPageBox" class="visual-dl-chart-page-box">
55
<ui-chart
66
v-for="tag in filteredTagList"
@@ -22,11 +22,11 @@
2222
:length="total"
2323
:total-visible="pageSize"
2424
/>
25-
<!--</ui-expand-panel>-->
25+
</ui-expand-panel>
2626
</div>
2727
</template>
2828
<script>
29-
// import ExpandPanel from '../../common/component/ExpandPanel';
29+
import ExpandPanel from '../../common/component/ExpandPanel';
3030
import Chart from './Chart';
3131
// import Pagination from 'san-mui/Pagination';
3232
@@ -35,10 +35,10 @@ import {cloneDeep} from 'lodash';
3535
export default {
3636
components: {
3737
'ui-chart': Chart,
38-
// 'ui-expand-panel': ExpandPanel,
38+
'ui-expand-panel': ExpandPanel,
3939
// 'ui-pagination': Pagination
4040
},
41-
props: ['expand', 'config', 'runsItems', 'tagList', 'title'],
41+
props: ['config', 'runsItems', 'tagList', 'title'],
4242
computed: {
4343
filteredRunsList() {
4444
let tagList = this.tagList || [];

0 commit comments

Comments
 (0)