From 281ac0b069fce6ff99446f4a2dda45b83c5e8d98 Mon Sep 17 00:00:00 2001 From: sadnub Date: Fri, 6 Nov 2020 15:55:51 -0500 Subject: [PATCH] fix client tree to pull the correct agents in table --- src/views/Dashboard.vue | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index ce477d0..4ac2ba6 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -60,7 +60,7 @@ - + @@ -392,22 +392,18 @@ export default { loadFrame(activenode, destroySub = true) { if (destroySub) this.$store.commit("destroySubTable"); - let client_id, site_id, url; - try { - site_id = activenode.split("|")[1]; - url = `/agents/bysite/${site_id}/`; - } catch (e) { - try { - client_id = activenode.split("|")[1]; - } catch (e) { - return false; - } - if (client_id === null || client_id === undefined) { - url = null; - } else { - url = `/agents/byclient/${client_id}/`; - } + let url, urlType, id; + if (typeof activenode === "string") { + urlType = activenode.split("|")[0]; + id = activenode.split("|")[1]; } + + if (urlType === "Client") { + url = `/agents/byclient/${id}/`; + } else if (urlType === "Site") { + url = `/agents/bysite/${id}/`; + } + if (url) { this.$store.commit("AGENT_TABLE_LOADING", true); axios.get(url).then(r => {