Feat: Support URL parameters to change Dashboard filters

This commit is contained in:
NihadBadalov 2024-02-15 12:25:07 +01:00
parent cf2d603e27
commit 091dc06839

View File

@ -206,6 +206,29 @@ export default {
},
mounted() {
window.addEventListener("scroll", this.onScroll);
const url = new URL(location.href);
const params = url.searchParams;
const filterParam = params.get("filter");
const statusParams = params.getAll("status");
if (filterParam !== "true") {
return;
}
const states = {
up: 1,
down: 0,
pending: 2,
maintenance: 3,
};
this.updateFilter({
...this.filterState,
status: statusParams.map(
status => states[status]
),
});
},
beforeUnmount() {
window.removeEventListener("scroll", this.onScroll);