Commit 59c5ae39 by Corey Koval

Cleaned up code

parent 48f52161
......@@ -7,7 +7,7 @@ import time
import sqlite3
import threading
import signal
import hashlib
# import hashlib
from colorsys import hsv_to_rgb
from optparse import OptionParser
from os import system, name, kill, getpid
......
......@@ -4,7 +4,10 @@
function updateRx(callBack, id) {
fetch("/rx_params")
.then(data => { return data.json() })
.then(res => { callBack(res, id) })
.then(res => { callBack(res, id);
// console.log("updateRx Complete");
// console.log(res);
})
}
// ******************************************************
......@@ -89,12 +92,10 @@ function editReceivers(rx_json, id) {
};
clearOld();
fetch("/rx_params/" + id, otherParams)
.then(data => { return data.json() })
.then(res => { updateRx(showReceivers, id) })
.then(res => { loadCzml() })
//.catch(error=>{console.log(error)})
// updateRx(showReceivers, id);
// loadCzml();
.then(res => {
updateRx(showReceivers, id);
loadCzml();
})
}
}
......@@ -113,12 +114,10 @@ function makeNewRx(url) {
};
clearOld();
fetch("/rx_params/new", otherParams)
.then(data => { return data.json() })
.then(res => { updateRx(createReceivers, true) })
.then(res => { loadCzml() })
//.catch(error=>{console.log(error)})
//.then(updateRx(createReceivers, true));
// loadCzml();
.then(res => {
updateRx(createReceivers, true);
loadCzml();
})
}
// *****************************************
......@@ -144,16 +143,14 @@ function deleteReceiver(uid) {
};
clearOld();
fetch("/rx_params/del", otherParams)
.then(data => { return data.json() })
.then(res => { removerx(uid) })
.then(res => { loadCzml() })
//.catch(error=>{console.log(error)})
//.then(updateRx(createReceivers, true));
// loadCzml();
.then(res => {
removerx(uid);
loadCzml();
})
}
// *******************************************
// * Fills in Rx UI cards with Rx info
// * Fills in Rx UI cards with Rx info
// *******************************************
function showReceivers(rx_json, id) {
const receivers = rx_json['receivers'];
......@@ -206,7 +203,7 @@ function createReceivers(rx_json, id) {
} else {
receivers = rx_json['receivers'];
}
console.log(receivers);
// console.log(receivers);
for (let i = 0; i < Object.keys(receivers).length; i++) {
const rxcard = document.createElement('div');
......@@ -283,4 +280,4 @@ function refreshRx(rx_json, id) {
// ****************************************************
function loadRx(action) {
updateRx(action, null);
}
\ No newline at end of file
}
......@@ -31,24 +31,27 @@
viewer.zoomTo(loadCzml());
function updateParams(parameter) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", "/update?"+parameter, true ); // false for synchronous request
xmlHttp.send( null );
xmlHttp.onload = function() {
loadRx(refreshRx);
clearOld();
loadCzml();
}
fetch("/update?"+parameter)
.then(function(response) {
if (response.status == 200) {
loadRx(refreshRx);
clearOld();
loadCzml();
console.log(response);
}
})
}
function loadCzml() {
var dataSourcePromise = Cesium.CzmlDataSource.load('/static/output.czml');
viewer.dataSources.add(dataSourcePromise);
console.log("Loaded CZML");
return dataSourcePromise;
}
function clearOld() {
viewer.dataSources.removeAll(true);
console.log("Cleared old");
}
// Add Cesium OSM Buildings, a global 3D buildings layer.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment