Allow filtering events by a tool name in query string param
This commit is contained in:
parent
542f5d8bf1
commit
37e814580a
17
src/App.vue
17
src/App.vue
@ -64,9 +64,14 @@ export default class App extends Vue {
|
||||
},
|
||||
};
|
||||
|
||||
toolFilter: string | null = null;
|
||||
|
||||
created() {
|
||||
// refresh data every five minutes
|
||||
window.setInterval(this.refresh, 5 * 60 * 1000);
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
this.toolFilter = urlParams.get('tool');
|
||||
}
|
||||
|
||||
refresh() {
|
||||
@ -79,14 +84,18 @@ export default class App extends Vue {
|
||||
});
|
||||
}
|
||||
|
||||
eventDataTransform(eventData: EventInput): EventInput {
|
||||
const match = eventData.title.match(/([^\/]*) \/ ([^-]*) - (.*)/);
|
||||
eventDataTransform(eventData: EventInput): EventInput | false {
|
||||
const match = eventData.title.match(/([^\/]*) \| ([^-]*) - (.*)/);
|
||||
if (match !== null) {
|
||||
eventData.title = match[3];
|
||||
}
|
||||
const [, member, shop, tool] = match;
|
||||
eventData.title = member;
|
||||
if (this.toolFilter === null || tool.includes(this.toolFilter)) {
|
||||
return eventData;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss"></style>
|
||||
|
Loading…
Reference in New Issue
Block a user