Website changes

This commit is contained in:
Dano van den Bosch
2024-04-03 10:12:25 +02:00
parent 8503300aa0
commit 50906649c2
4 changed files with 40 additions and 19 deletions

View File

@@ -29,6 +29,15 @@
</nav>
<div id="editNode">
<p id="text">Status updating</p>
<select id="mySelect"></select>
<textarea maxlength="44" id="inputName"></textarea>
<textarea maxlength="44" id="inputLocation"></textarea>
<button id="button" onclick="changeText()">Change Information</button>
</div>
<body>
<script src="GaugGroup.js"></script>
<script src="graph-classes.js"></script>

View File

@@ -12,6 +12,14 @@
justify-content: left;
} */
.nav-button {
background-color: #333;
color: #fff;
border: none;
cursor: pointer;
font-size: 17px;
}
#editNode{
display: flex;
justify-content: center;
@@ -21,13 +29,14 @@
/* border: 20px solid orange; */
}
/* #editNode {
#editNode {
margin-top: 1%;
width: 98vw;
height: 20vh;
display: flex;
justify-content: center;
/* flex-direction: column; Keep as column
/* justify-content: ;
/* justify-content: ; */
align-items: center;
background-color: #333;
@@ -39,7 +48,7 @@
margin-bottom: 10px;
position: relative;
float: top;
} */
}
body {
display: flex;

View File

@@ -8,8 +8,6 @@
</head>
<body>
<button id="settings" onclick="settings()">Settings</button>
<div id="editNode">

View File

@@ -17,26 +17,30 @@ function settings() {
updateNode.style.display = "block";
locationInput.value = "";
nameInput.value = "";
fetch(apiGetAllNode)
.then(response => {
if (!response.ok) {
document.getElementById('text').innerHTML = "Error: Network response was not ok";
throw new Error('Network response was not ok');
}
document.getElementById('text').innerHTML = "Fetching data";
return response.json();
})
.then(data => {
document.getElementById('text').innerHTML = "Data fetched";
handleData(data);
})
getNodeInfo();
} else {
updateNode.style.display = "none";
}
}
function getNodeInfo() {
fetch(apiGetAllNode)
.then(response => {
if (!response.ok) {
document.getElementById('text').innerHTML = "Error: Network response was not ok";
throw new Error('Network response was not ok');
}
document.getElementById('text').innerHTML = "Fetching data";
return response.json();
})
.then(data => {
document.getElementById('text').innerHTML = "Data fetched";
handleData(data);
})
}
function handleData(JSONdata) {
var i, L = select.options.length - 1;
for (i = L; i >= 0; i--) {
@@ -71,6 +75,7 @@ function changeText() {
var text = document.getElementById('text');
text.innerHTML = "Changes made"
getNodeInfo();
}
function updateNodeInfo(node, newNodeName, newNodeLocation) {