mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 08:44:04 +00:00
Feat: Support URL parameters to change Dashboard filters
This commit is contained in:
parent
cf2d603e27
commit
091dc06839
1 changed files with 23 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue