Update API and add webapp saving
This commit is contained in:
@@ -78,11 +78,12 @@ function createToast(notificationMessage){
|
||||
document.getElementById("toastZone").appendChild(wrapperDiv);
|
||||
|
||||
$('.toast').toast('show');
|
||||
return $('.toast');
|
||||
}
|
||||
|
||||
function sendNodeHeartbeat(nodeId){
|
||||
const Http = new XMLHttpRequest();
|
||||
const url='/nodes/'+nodeId;
|
||||
const url='/nodes/nodeCheckIn/'+nodeId;
|
||||
Http.open("GET", url);
|
||||
Http.send();
|
||||
|
||||
@@ -139,5 +140,51 @@ function leaveServer(){
|
||||
console.log(Http.status);
|
||||
console.log(responseObject);
|
||||
createToast(`${responseObject} is leaving`);
|
||||
setTimeout(() => {}, 45000);
|
||||
}
|
||||
}
|
||||
|
||||
function saveNodeDetails() {
|
||||
const nodeId = document.getElementById("nodeId").value;
|
||||
const nodeName = document.getElementById("inputNodeName").value;
|
||||
const nodeIp = document.getElementById("inputNodeIp").value;
|
||||
const nodePort = document.getElementById("inputOrgName").value;
|
||||
const nodeLocation = document.getElementById("inputNodeLocation").value;
|
||||
|
||||
const reqBody = {
|
||||
'id': nodeId,
|
||||
'name': nodeName,
|
||||
'ip': nodeIp,
|
||||
'port': nodePort,
|
||||
'location': nodeLocation,
|
||||
'online': true
|
||||
}
|
||||
|
||||
console.log("Request Body: ", reqBody);
|
||||
|
||||
const Http = new XMLHttpRequest();
|
||||
const url='/nodes/'+nodeId;
|
||||
Http.open("PUT", url);
|
||||
Http.setRequestHeader("Content-Type", "application/json");
|
||||
Http.send(JSON.stringify(reqBody));
|
||||
|
||||
Http.onloadend = (e) => {
|
||||
const responseObject = JSON.parse(Http.responseText)
|
||||
console.log(Http.status);
|
||||
console.log(responseObject);
|
||||
createToast(`Node Updated!`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function addNewSystem() {
|
||||
|
||||
}
|
||||
|
||||
function updateSystem() {
|
||||
|
||||
}
|
||||
|
||||
function requestNodeUpdate() {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user