Skip to content

Commit

Permalink
Filtering clients and hosts on timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
skaparis committed Nov 17, 2023
1 parent e05e805 commit eeae62f
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/views/Timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
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='*') *
option(v-for="host in hosts", :value="host") {{ host }}
th.pr-2
label Client filter:
td
select(v-model="filter_client")
option(value='*') *
option(v-for="client in clients", :value="client") {{ client }}

input-timeinterval(v-model="daterange", :defaultDuration="timeintervalDefaultDuration", :maxDuration="maxDuration")

div(v-if="buckets !== null")
Expand All @@ -28,9 +44,13 @@ export default {
name: 'Timeline',
data() {
return {
all_buckets: null,
hosts: null,
buckets: null,
daterange: null,
maxDuration: 31 * 24 * 60 * 60,
filter_hostname: '*',
filter_client: '*',
};
},
computed: {
Expand All @@ -46,16 +66,31 @@ export default {
daterange() {
this.getBuckets();
},
filter_hostname() {
this.getBuckets();
},
filter_client() {
this.getBuckets();
}

Check warning on line 74 in src/views/Timeline.vue

View workflow job for this annotation

GitHub Actions / lint (12.x)

Insert `,`

Check warning on line 74 in src/views/Timeline.vue

View workflow job for this annotation

GitHub Actions / Build (node-16)

Insert `,`
},
methods: {
getBuckets: async function () {
if (this.daterange == null) return;
this.buckets = Object.freeze(
this.all_buckets = Object.freeze(
await useBucketsStore().getBucketsWithEvents({
start: this.daterange[0].format(),
end: this.daterange[1].format(),
})
);
this.hosts = this.all_buckets.map(a => a.hostname).filter((value, index, array) => array.indexOf(value) === index);

Check warning on line 87 in src/views/Timeline.vue

View workflow job for this annotation

GitHub Actions / lint (12.x)

Replace `.map(a·=>·a.hostname)` with `⏎········.map(a·=>·a.hostname)⏎········`

Check warning on line 87 in src/views/Timeline.vue

View workflow job for this annotation

GitHub Actions / Build (node-16)

Replace `.map(a·=>·a.hostname)` with `⏎········.map(a·=>·a.hostname)⏎········`
this.clients = this.all_buckets.map(a => a.client).filter((value, index, array) => array.indexOf(value) === index);

Check warning on line 88 in src/views/Timeline.vue

View workflow job for this annotation

GitHub Actions / lint (12.x)

Replace `.map(a·=>·a.client)` with `⏎········.map(a·=>·a.client)⏎········`

Check warning on line 88 in src/views/Timeline.vue

View workflow job for this annotation

GitHub Actions / Build (node-16)

Replace `.map(a·=>·a.client)` with `⏎········.map(a·=>·a.client)⏎········`
console.log(this.clients);
console.log(this.all_buckets);
this.buckets = this.all_buckets;
this.buckets = _.filter(this.buckets, b => this.filter_hostname == '*' || b.hostname == this.filter_hostname);

Check warning on line 92 in src/views/Timeline.vue

View workflow job for this annotation

GitHub Actions / lint (12.x)

Replace `this.buckets,·b·=>·this.filter_hostname·==·'*'·||·b.hostname·==·this.filter_hostname` with `⏎········this.buckets,⏎········b·=>·this.filter_hostname·==·'*'·||·b.hostname·==·this.filter_hostname⏎······`

Check warning on line 92 in src/views/Timeline.vue

View workflow job for this annotation

GitHub Actions / Build (node-16)

Replace `this.buckets,·b·=>·this.filter_hostname·==·'*'·||·b.hostname·==·this.filter_hostname` with `⏎········this.buckets,⏎········b·=>·this.filter_hostname·==·'*'·||·b.hostname·==·this.filter_hostname⏎······`
this.buckets = _.filter(this.buckets, b => this.filter_client == '*' || b.client == this.filter_client);

Check warning on line 93 in src/views/Timeline.vue

View workflow job for this annotation

GitHub Actions / lint (12.x)

Replace `this.buckets,·b·=>·this.filter_client·==·'*'·||·b.client·==·this.filter_client` with `⏎········this.buckets,⏎········b·=>·this.filter_client·==·'*'·||·b.client·==·this.filter_client⏎······`

Check warning on line 93 in src/views/Timeline.vue

View workflow job for this annotation

GitHub Actions / Build (node-16)

Replace `this.buckets,·b·=>·this.filter_client·==·'*'·||·b.client·==·this.filter_client` with `⏎········this.buckets,⏎········b·=>·this.filter_client·==·'*'·||·b.client·==·this.filter_client⏎······`
},
},
};
Expand Down

1 comment on commit eeae62f

@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.