Skip to content

Commit

Permalink
feat: redesigned timeline filter settings, hid inside <details>
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Nov 19, 2023
1 parent 35ad0ae commit 609a7cc
Showing 1 changed file with 52 additions and 30 deletions.
82 changes: 52 additions & 30 deletions src/views/Timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,34 @@
div
h2 Timeline

div.d-flex.justify-content-between.align-items-end
table
tr
th.pr-2
label Host filter:
td
select(v-model="filter_hostname")
option(:value='null') *
option(v-for="host in hosts", :value="host") {{ host }}
th.pr-2
label Client filter:
td
select(v-model="filter_client")
option(:value='null') *
option(v-for="client in clients", :value="client") {{ client }}
input-timeinterval(v-model="daterange", :defaultDuration="timeintervalDefaultDuration", :maxDuration="maxDuration").mb-2

input-timeinterval(v-model="daterange", :defaultDuration="timeintervalDefaultDuration", :maxDuration="maxDuration")
// blocks
div.d-inline-block.border.rounded.p-2.mr-2
| Events shown: {{ num_events }}
details.d-inline-block.bg-light.small.border.rounded.mr-2.px-2
summary.p-2
b Filters
div.p-2.bg-light
table
tr
th.pt-2.pr-3
label Host:
td
select(v-model="filter_hostname")
option(:value='null') All
option(v-for="host in hosts", :value="host") {{ host }}
tr
th.pt-2.pr-3
label Client:
td
select(v-model="filter_client")
option(:value='null') All
option(v-for="client in clients", :value="client") {{ client }}
div(style="float: right; color: #999").d-inline-block.pt-3
| Drag to pan and scroll to zoom

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

Expand All @@ -47,6 +51,7 @@ export default {
all_buckets: null,
hosts: null,
buckets: null,
clients: null,
daterange: null,
maxDuration: 31 * 24 * 60 * 60,
filter_hostname: null,
Expand Down Expand Up @@ -90,16 +95,33 @@ export default {
this.clients = this.all_buckets
.map(a => a.client)
.filter((value, index, array) => array.indexOf(value) === index);
this.buckets = this.all_buckets;
this.buckets = _.filter(
this.buckets,
b => this.filter_hostname == null || b.hostname == this.filter_hostname
);
this.buckets = _.filter(
this.buckets,
b => this.filter_client == null || b.client == this.filter_client
);
let buckets = this.all_buckets;
if (this.filter_hostname) {
buckets = _.filter(buckets, b => b.hostname == this.filter_hostname);
}
if (this.filter_client) {
buckets = _.filter(buckets, b => b.client == this.filter_client);
}
this.buckets = buckets;
},
},
};
</script>

<style scoped>
details {
position: relative;
}
details[open] summary ~ * {
visibility: visible;
position: absolute;
border: 1px solid #ddd;
border-radius: 5px;
left: 0;
top: 2.7em;
background: white;
z-index: 100;
}
</style>

1 comment on commit 609a7cc

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are screenshots of this commit:

Screenshots using aw-server v0.12.3b11 (click to expand)

Screenshots using aw-server-rust master (click to expand)

Screenshots using aw-server-rust v0.12.3b11 (click to expand)

Please sign in to comment.