Skip to content

Commit 609a7cc

Browse files
committed
feat: redesigned timeline filter settings, hid inside <details>
1 parent 35ad0ae commit 609a7cc

File tree

1 file changed

+52
-30
lines changed

1 file changed

+52
-30
lines changed

src/views/Timeline.vue

Lines changed: 52 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,34 @@
22
div
33
h2 Timeline
44

5-
div.d-flex.justify-content-between.align-items-end
6-
table
7-
tr
8-
th.pr-2
9-
label Host filter:
10-
td
11-
select(v-model="filter_hostname")
12-
option(:value='null') *
13-
option(v-for="host in hosts", :value="host") {{ host }}
14-
th.pr-2
15-
label Client filter:
16-
td
17-
select(v-model="filter_client")
18-
option(:value='null') *
19-
option(v-for="client in clients", :value="client") {{ client }}
5+
input-timeinterval(v-model="daterange", :defaultDuration="timeintervalDefaultDuration", :maxDuration="maxDuration").mb-2
206

21-
input-timeinterval(v-model="daterange", :defaultDuration="timeintervalDefaultDuration", :maxDuration="maxDuration")
7+
// blocks
8+
div.d-inline-block.border.rounded.p-2.mr-2
9+
| Events shown: {{ num_events }}
10+
details.d-inline-block.bg-light.small.border.rounded.mr-2.px-2
11+
summary.p-2
12+
b Filters
13+
div.p-2.bg-light
14+
table
15+
tr
16+
th.pt-2.pr-3
17+
label Host:
18+
td
19+
select(v-model="filter_hostname")
20+
option(:value='null') All
21+
option(v-for="host in hosts", :value="host") {{ host }}
22+
tr
23+
th.pt-2.pr-3
24+
label Client:
25+
td
26+
select(v-model="filter_client")
27+
option(:value='null') All
28+
option(v-for="client in clients", :value="client") {{ client }}
29+
div(style="float: right; color: #999").d-inline-block.pt-3
30+
| Drag to pan and scroll to zoom
2231

2332
div(v-if="buckets !== null")
24-
div
25-
div(style="float: left")
26-
| Events shown: {{ num_events }}
27-
div(style="float: right; color: #999")
28-
| Drag to pan and scroll to zoom.
2933
div(style="clear: both")
3034
vis-timeline(:buckets="buckets", :showRowLabels='true', :queriedInterval="daterange")
3135

@@ -47,6 +51,7 @@ export default {
4751
all_buckets: null,
4852
hosts: null,
4953
buckets: null,
54+
clients: null,
5055
daterange: null,
5156
maxDuration: 31 * 24 * 60 * 60,
5257
filter_hostname: null,
@@ -90,16 +95,33 @@ export default {
9095
this.clients = this.all_buckets
9196
.map(a => a.client)
9297
.filter((value, index, array) => array.indexOf(value) === index);
93-
this.buckets = this.all_buckets;
94-
this.buckets = _.filter(
95-
this.buckets,
96-
b => this.filter_hostname == null || b.hostname == this.filter_hostname
97-
);
98-
this.buckets = _.filter(
99-
this.buckets,
100-
b => this.filter_client == null || b.client == this.filter_client
101-
);
98+
99+
let buckets = this.all_buckets;
100+
if (this.filter_hostname) {
101+
buckets = _.filter(buckets, b => b.hostname == this.filter_hostname);
102+
}
103+
if (this.filter_client) {
104+
buckets = _.filter(buckets, b => b.client == this.filter_client);
105+
}
106+
this.buckets = buckets;
102107
},
103108
},
104109
};
105110
</script>
111+
112+
<style scoped>
113+
details {
114+
position: relative;
115+
}
116+
117+
details[open] summary ~ * {
118+
visibility: visible;
119+
position: absolute;
120+
border: 1px solid #ddd;
121+
border-radius: 5px;
122+
left: 0;
123+
top: 2.7em;
124+
background: white;
125+
z-index: 100;
126+
}
127+
</style>

0 commit comments

Comments
 (0)