From d552975d6c35daebf44946a00b94a7c9500ae6e7 Mon Sep 17 00:00:00 2001 From: Suven-p Date: Mon, 28 Oct 2024 07:01:07 +0545 Subject: [PATCH] Display toast on invalid query params --- src/components/MonitorList.vue | 14 ++++++++++--- src/components/MonitorListFilter.vue | 31 ++++++++++++++++++++++++---- src/lang/en.json | 3 ++- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/components/MonitorList.vue b/src/components/MonitorList.vue index 272421e02..8b85b9762 100644 --- a/src/components/MonitorList.vue +++ b/src/components/MonitorList.vue @@ -160,7 +160,7 @@ export default { /** * Returns applied filters based on query params. - * @returns {{ status: number[], active: bool, tags: number[] }} The current filter state. + * @returns {{ status: number[], active: any[], tags: number[] }} The current filter state. */ filterState() { // Since query params are always strings, convert them to the correct type @@ -174,7 +174,15 @@ export default { if (!Array.isArray(active)) { active = [ active ]; } - active = active.map(val => val === "true"); + active = active.map(val => { + if (val === "true") { + return true; + } + if (val === "false") { + return false; + } + return val; + }); let tags = this.$route.query["tags"] || []; if (!Array.isArray(tags)) { tags = [ tags ]; @@ -279,7 +287,7 @@ export default { }, /** * Update the MonitorList Filter - * @param {{ status: number[], active: bool, tags: number[] }} newFilter Object with new filter + * @param {{ status: number[], active: any[], tags: number[] }} newFilter Object with new filter * @returns {void} */ updateFilter(newFilter) { diff --git a/src/components/MonitorListFilter.vue b/src/components/MonitorListFilter.vue index 930c6ea7a..251551006 100644 --- a/src/components/MonitorListFilter.vue +++ b/src/components/MonitorListFilter.vue @@ -80,8 +80,9 @@