diff --git a/docs/brainstorm/UML-infrastrucuteV2.md b/docs/brainstorm/UML-infrastrucuteV2.md new file mode 100644 index 0000000..059a1e5 --- /dev/null +++ b/docs/brainstorm/UML-infrastrucuteV2.md @@ -0,0 +1,72 @@ +```mermaid +classDiagram + setup --> websocketSetup + loop --> screenButtonHandler + screenButtonHandler --> DisplayText + screenButtonHandler --> sendData + sendData --> Server + setup --> loop + python --> Server + Server --> website + + +namespace ESP32Questionbox { + class setup { + +int questionID + +char*[] Question + +char*[] Answer + +Adafruit_ST7796S_kbv tft + +DisplayText displayText + +void websocketSetup() + } + + class loop { + +void screenButtonHandler() + +void sendData(int question, String answer) + +void hexdump(const void* mem, uint32_t len, uint8_t cols) + } + + class websocketSetup { + +connectWifi() + +websocketConnect() + } + + class screenButtonHandler { + -bool redButton + -bool greenButton + -bool whiteButton + +displayText.writeText() + +sendData() + } + class DisplayText { + +void writeText(char* text, int size, int posX, int posY, int screenTime, bool center, bool bottom) + -int centerText(char* text) + -void printWordsFull(char* text, bool bottom) + } + class sendData{ + +webSocket.sendTXT + } +} +namespace server { + class python { + +databaseScript() + +websocketScript() + +flaskScript() + } + class Server { + +websocket() + +flask() + +mariaDB() + } +} + +namespace user { + class website { + + getLiveData() + + getHistoricalData() + + showData() + + } +} + +``` diff --git a/web/newWebsite/graph-main.js b/web/newWebsite/graph-main.js index cd9760a..6caadde 100644 --- a/web/newWebsite/graph-main.js +++ b/web/newWebsite/graph-main.js @@ -2,6 +2,7 @@ const data = []; processor = new DataProcessor(); let link; +nodeDataArray = {}; // Function to create checkbox with label function createCheckBox(id, label) { @@ -16,7 +17,41 @@ function createCheckBox(id, label) { return { checkbox, checkboxLabel }; } + fetch("http://145.92.8.114/getNodeInfo?macAdress=*") + .then(response => { + if (!response.ok) { + throw new Error('Network response was not ok'); + } + return response.json(); + }) + .then(data => { + handleData(data); + }) + +function handleData(JSONdata) { + select = document.getElementById('node-input'); + console.log(JSONdata); + for (var i = 0; i < JSONdata.length; i++) { + console.log(JSONdata[i]); + console.log(option) + var node = JSONdata[i].NodeID; + var name = JSONdata[i].Name; + var location = JSONdata[i].Location; + nodeDataArray[node] = { name: name, location: location }; + // Create new option element + var option = document.createElement('option'); + + // Set the value of the option + option.value = node; + + // Set the text of the option + option.text = name; + + // Add the option to the select + select.add(option); + } +} // Create HTML input elements for user input const container = document.createElement("div"); container.setAttribute("class", "container"); @@ -102,11 +137,10 @@ container.appendChild(dateFilter); const nodeFilter = document.createElement("div"); nodeFilter.setAttribute("class", "node-filter"); -const nodeInput = document.createElement("input"); -nodeInput.setAttribute("type", "text"); +const nodeInput = document.createElement("select"); +nodeInput.setAttribute("type", "select"); nodeInput.setAttribute("placeholder", "Enter Node Name (* for all)"); nodeInput.setAttribute("id", "node-input"); -nodeInput.setAttribute("class", "input-field"); nodeFilter.appendChild(nodeInput); container.appendChild(nodeFilter); diff --git a/web/newWebsite/index.html b/web/newWebsite/index.html index 6346d81..e31a4ba 100644 --- a/web/newWebsite/index.html +++ b/web/newWebsite/index.html @@ -25,6 +25,9 @@ +