aboutsummaryrefslogtreecommitdiff
path: root/src/public/js/index.js
diff options
context:
space:
mode:
authorJakob Stendahl <jakob.stendahl@outlook.com>2021-09-19 19:43:11 +0200
committerJakob Stendahl <jakob.stendahl@outlook.com>2021-09-19 19:43:11 +0200
commit7bdce37fd3f18e2712e18c4e2c64cac69af0aca1 (patch)
treeb7ad3f1cca92e2dfd2664ae9e65652bd03ff58b2 /src/public/js/index.js
parente6880cd8ccf82d993f222cb14b4860581654acb8 (diff)
downloadLuxcena-Neo-7bdce37fd3f18e2712e18c4e2c64cac69af0aca1.tar.gz
Luxcena-Neo-7bdce37fd3f18e2712e18c4e2c64cac69af0aca1.zip
:boom: Introduce new UI based on svelte, and rewrite a lot of the node app and the NeoRuntime
Diffstat (limited to 'src/public/js/index.js')
-rw-r--r--src/public/js/index.js68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/public/js/index.js b/src/public/js/index.js
deleted file mode 100644
index 5b67de2..0000000
--- a/src/public/js/index.js
+++ /dev/null
@@ -1,68 +0,0 @@
-let socket = io();
-
-module.exports = () => {
- M.AutoInit();
- setupSocket();
-
- setInterval(() => {
- socket.emit("GetGeneralInfo");
- }, 500);
-
- socket.emit("GetLog", {filter: "success error event", entryN: 10});
-};
-
-function setupSocket() {
-
- socket.on("lastLogEntries", (entries) => {
- let list = "";
- entries.forEach((entry) => {
- list += "<tr><td>" + prettifyType(entry.type) + "</td><td>" + entry.time + "</td><td>" + entry.details + "</td></tr>";
- });
-
- document.getElementById("log-table-body").innerHTML = list;
- M.AutoInit();
- });
-
- socket.on("newLogEntry", (entry) => {
- // Start with parsing the new entry, no reason to select the DOM-element and stuff, if we are filtering out the entry anyway.
- let type = entry.type;
- if ( (type.toUpperCase() !== "SUCCESS") && (type.toUpperCase() !== "ERROR") && (type.toUpperCase() !== "EVENT") && (type.toUpperCase() !== "INFO")) {
- return;
- }
-
- let logTable = document.getElementById("log-table-body");
-
- let LTable = logTable.rows.length;
- logTable.deleteRow(LTable - 1); // Since length outputs a 1-based number
-
- let newEntry = logTable.insertRow(0);
- newEntry.insertCell(0).innerHTML = prettifyType(entry.type);
- newEntry.insertCell(1).innerHTML = entry.time;
- newEntry.insertCell(2).innerHTML = entry.details;
- M.AutoInit();
- newEntry.className = "newLogEntry";
- });
-
- socket.on("generalInfo", (info) => {
- if (info["scriptIsExited"]) {
- document.getElementById("currentScript").innerHTML = info["currentScript"] + " (exited)";
- } else {
- document.getElementById("currentScript").innerHTML = info["currentScript"];
- }
- document.getElementById("uptime").innerHTML = info["uptime"] + " seconds";
- });
-
-}
-
-function prettifyType(type) {
- let prettyTable = {
- "DEBUG": `<span class="tooltipped" data-position="top" data-tooltip="Debug-log">😸</span>`,
- "INFO": `<span class="tooltipped" data-position="top" data-tooltip="Just some information">â„šī¸</span>`,
- "WARNING": `<span class="tooltipped" data-position="top" data-tooltip="A warning">âš ī¸</span>`,
- "EVENT": `<span class="tooltipped" data-position="top" data-tooltip="Event">âšĄī¸</span>`,
- "SUCCESS": `<span class="tooltipped" data-position="top" data-tooltip="Something exited successfully">✅</span>`,
- "ERROR": `<span class="tooltipped" data-position="top" data-tooltip="Error">🔴</span>`,
- "PYTHON": `<span class="tooltipped" data-position="top" data-tooltip="Output from user-script">🐍</span>`
- };
- return prettyTable[type];
-}