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() {
|
created() {
|
||||||
// refresh data every five minutes
|
// refresh data every five minutes
|
||||||
window.setInterval(this.refresh, 5 * 60 * 1000);
|
window.setInterval(this.refresh, 5 * 60 * 1000);
|
||||||
|
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
this.toolFilter = urlParams.get('tool');
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
@ -79,13 +84,17 @@ export default class App extends Vue {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
eventDataTransform(eventData: EventInput): EventInput {
|
eventDataTransform(eventData: EventInput): EventInput | false {
|
||||||
const match = eventData.title.match(/([^\/]*) \/ ([^-]*) - (.*)/);
|
const match = eventData.title.match(/([^\/]*) \| ([^-]*) - (.*)/);
|
||||||
if (match !== null) {
|
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 eventData;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user