From 9b0ca0d074f570b14916fdc88d41853645fbbffa Mon Sep 17 00:00:00 2001 From: Chester Enright Date: Sat, 16 Sep 2023 01:07:00 -0500 Subject: [PATCH 01/22] fix: could add an ip even if one existed already Trello: https://trello.com/c/lsxVQEc3 --- .../src/components/CreateEditHost.vue | 21 ++++++++++++--- frontend/labyrinth/src/views/Dashboard.vue | 26 +++++++++++++++++-- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/frontend/labyrinth/src/components/CreateEditHost.vue b/frontend/labyrinth/src/components/CreateEditHost.vue index 1bd46c2..3ec980c 100644 --- a/frontend/labyrinth/src/components/CreateEditHost.vue +++ b/frontend/labyrinth/src/components/CreateEditHost.vue @@ -32,9 +32,16 @@ + + Error: IP Address already exists! + @@ -298,11 +305,11 @@ export default { components: { Checks, }, - props: ["inp_host"], + props: ["inp_host", "all_ips"], data() { return { isNew: true, - host: "", + host: {}, metrics: [], safe_host: { @@ -397,6 +404,14 @@ export default { ); return -1; } + + if(this.inp_host == '' && this.all_ips.has(this.host.ip)){ + this.$store.commit( + "updateError", + "Error: IP Address already exists." + ); + return -1; + } var host = JSON.parse(JSON.stringify(this.host)); host["services"] = host["services"].map((x) => x["name"]); diff --git a/frontend/labyrinth/src/views/Dashboard.vue b/frontend/labyrinth/src/views/Dashboard.vue index a4419cf..d55efd4 100644 --- a/frontend/labyrinth/src/views/Dashboard.vue +++ b/frontend/labyrinth/src/views/Dashboard.vue @@ -4,8 +4,11 @@
- - + { + if(subnet.groups){ + subnet.groups.forEach(group=>{ + if(group.hosts){ + group.hosts.forEach(host=>{ + if(host.ip){ + retval.add(host.ip) + } + }) + } + }) + } + }) + return retval + } + }, methods: { capitalize: Helper.capitalize, convertSubnet(subnet) { From a21571e7a8baa470256ab7c4ae372276fe2c7544 Mon Sep 17 00:00:00 2001 From: Chester Enright Date: Sat, 16 Sep 2023 01:27:28 -0500 Subject: [PATCH 02/22] chore: updated default metric count to 100 We've switched to latest-metrics, so the count will be however many there are --- backend/serve.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/serve.py b/backend/serve.py index 10ebc0f..4ffdc81 100755 --- a/backend/serve.py +++ b/backend/serve.py @@ -1586,7 +1586,7 @@ def last_metrics(count): @app.route("/metrics///") @app.route("/metrics///