From fdef108031b2f17aef038811eb4f91167b91212c Mon Sep 17 00:00:00 2001 From: Emerson Felipe Date: Mon, 14 Oct 2024 21:09:08 +0000 Subject: [PATCH] Simplify 'Proxmox Version' field showing only the actual value and not entire JSON --- .../templates/netbox_proxbox/home.html | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/netbox_proxbox/templates/netbox_proxbox/home.html b/netbox_proxbox/templates/netbox_proxbox/home.html index d969265..9090aac 100755 --- a/netbox_proxbox/templates/netbox_proxbox/home.html +++ b/netbox_proxbox/templates/netbox_proxbox/home.html @@ -79,21 +79,28 @@

Log Messages

let elemento = document.getElementsByClassName("proxmox_version") for (let item of elemento) { - - let td = item.getElementsByTagName("td") + let td = item.getElementsByTagName("td") + if (td[0].id) { - + let tdID = td[0].id try { - request = await fetch(`${fastapi_endpoint}/proxmox/version?source=netbox&list_all=false&plugin_name=netbox_proxbox&domain=${td[0].id}`) + request = await fetch(`${fastapi_endpoint}/proxmox/version?source=netbox&list_all=false&plugin_name=netbox_proxbox&domain=${tdID}`) response = await request.json() - console.log(response[0]) + // console.log(response[0]) } catch (error) { console.log(error) } - td[0].textContent = JSON.stringify(response) + for (let value in response[0]) { + console.log(response[0][value].release) + console.log(response[0][value].repoid) + console.log(response[0][value].version) + + td[0].textContent = response[0][value].version + } + //td[0].textContent = JSON.stringify(response[0][value].version) } }