Compare commits
3 Commits
3b248e36ec
...
8a0baa5bc9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a0baa5bc9 | ||
|
|
ec091c0017 | ||
|
|
a5996ccfc0 |
@@ -30,13 +30,15 @@ function addToastToStorage(time, message) {
|
|||||||
var toasts = [{ 'time': time, 'message': message }]
|
var toasts = [{ 'time': time, 'message': message }]
|
||||||
var storedToasts = getStoredToasts();
|
var storedToasts = getStoredToasts();
|
||||||
console.log("Adding new notification to storage: ", toasts);
|
console.log("Adding new notification to storage: ", toasts);
|
||||||
toasts = toasts.concat(storedToasts);
|
if (storedToasts) {
|
||||||
console.log("Combined new and stored notifications: ", toasts);
|
toasts = toasts.concat(storedToasts);
|
||||||
toasts = toasts.filter((value, index, self) =>
|
console.log("Combined new and stored notifications: ", toasts);
|
||||||
index === self.findIndex((t) => (
|
toasts = toasts.filter((value, index, self) =>
|
||||||
t.time === value.time && t.message === value.message
|
index === self.findIndex((t) => (
|
||||||
))
|
t.time === value.time && t.message === value.message
|
||||||
)
|
))
|
||||||
|
)
|
||||||
|
}
|
||||||
console.log("Deduped stored notifications: ", toasts);
|
console.log("Deduped stored notifications: ", toasts);
|
||||||
localStorage.setItem("toasts", JSON.stringify(toasts));
|
localStorage.setItem("toasts", JSON.stringify(toasts));
|
||||||
navbarUpdateNotificationBellCount(toasts);
|
navbarUpdateNotificationBellCount(toasts);
|
||||||
@@ -251,8 +253,8 @@ function joinServer() {
|
|||||||
const responseObject = JSON.parse(Http.responseText)
|
const responseObject = JSON.parse(Http.responseText)
|
||||||
console.log(Http.status);
|
console.log(Http.status);
|
||||||
console.log(responseObject);
|
console.log(responseObject);
|
||||||
createToast(`${responseObject.name} will join shortly`, { showNow: true });
|
createToast(`${responseObject.name} will join shortly`);
|
||||||
$("#joinModal").modal('toggle');
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Bootstrap demo</title>
|
<title>'<%=node.name%>' - Configuration</title>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
|
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css">
|
||||||
@@ -153,7 +153,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% // new System Modal %>
|
<% // new System Modal %>
|
||||||
<%- include("partials/modifySystemModal.ejs", {'system': "New System" , 'frequencies' : [], 'mode' : '' }) %>
|
<%- include("partials/modifySystemModal.ejs", {'system': "New System" , 'frequencies' : [], 'mode' : '' }) %>
|
||||||
|
<% // Join Server Modal %>
|
||||||
|
<%- include("partials/joinModal.ejs", {'node': node}) %>
|
||||||
</body>
|
</body>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"
|
||||||
integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
|
integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label class="small mb-1" for="selectRadioPreset">Selected Preset:</label>
|
<label class="small mb-1" for="selectRadioPreset">Selected Preset:</label>
|
||||||
<select class="custom-select" id="selectRadioPreset">
|
<select class="custom-select" id="selectRadioPreset">
|
||||||
<% for(const system in nearbySystems) { %>
|
<% for(const system in node.nearbySystems) { %>
|
||||||
<option value="<%=system%>"><%=system%></option>
|
<option value="<%=system%>"><%=system%></option>
|
||||||
<% } %>
|
<% } %>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -30,13 +30,15 @@ function addToastToStorage(time, message) {
|
|||||||
var toasts = [{ 'time': time, 'message': message }]
|
var toasts = [{ 'time': time, 'message': message }]
|
||||||
var storedToasts = getStoredToasts();
|
var storedToasts = getStoredToasts();
|
||||||
console.log("Adding new notification to storage: ", toasts);
|
console.log("Adding new notification to storage: ", toasts);
|
||||||
toasts = toasts.concat(storedToasts);
|
if (storedToasts) {
|
||||||
console.log("Combined new and stored notifications: ", toasts);
|
toasts = toasts.concat(storedToasts);
|
||||||
toasts = toasts.filter((value, index, self) =>
|
console.log("Combined new and stored notifications: ", toasts);
|
||||||
index === self.findIndex((t) => (
|
toasts = toasts.filter((value, index, self) =>
|
||||||
t.time === value.time && t.message === value.message
|
index === self.findIndex((t) => (
|
||||||
))
|
t.time === value.time && t.message === value.message
|
||||||
)
|
))
|
||||||
|
)
|
||||||
|
}
|
||||||
console.log("Deduped stored notifications: ", toasts);
|
console.log("Deduped stored notifications: ", toasts);
|
||||||
localStorage.setItem("toasts", JSON.stringify(toasts));
|
localStorage.setItem("toasts", JSON.stringify(toasts));
|
||||||
navbarUpdateNotificationBellCount(toasts);
|
navbarUpdateNotificationBellCount(toasts);
|
||||||
@@ -254,7 +256,7 @@ function joinServer() {
|
|||||||
console.log(Http.status);
|
console.log(Http.status);
|
||||||
console.log(responseObject);
|
console.log(responseObject);
|
||||||
createToast(`${responseObject.name} will join shortly`, { showNow: true });
|
createToast(`${responseObject.name} will join shortly`, { showNow: true });
|
||||||
$("#joinModal").modal('toggle');
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,27 +6,7 @@ const { getAllNodes, getNodeInfoFromId } = require("../utilities/mysqlHandler");
|
|||||||
/* GET home page. */
|
/* GET home page. */
|
||||||
router.get('/', (req, res) => {
|
router.get('/', (req, res) => {
|
||||||
//var sources = libCore.getSources();
|
//var sources = libCore.getSources();
|
||||||
return res.render('index');
|
return res.render('index', {'page': 'index'});
|
||||||
|
|
||||||
var htmlOutput = "";
|
|
||||||
|
|
||||||
sources.forEach(source => {
|
|
||||||
htmlOutput += `
|
|
||||||
<div style='margin-bottom:15px;'>
|
|
||||||
|
|
||||||
<div> Title: ${source.title} </div>
|
|
||||||
<div> Link: ${source.link} </div>
|
|
||||||
<div> category: ${source.category} </div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<hr />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
`
|
|
||||||
});
|
|
||||||
res.send(htmlOutput);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* GET node controller page. */
|
/* GET node controller page. */
|
||||||
@@ -38,7 +18,7 @@ router.get('/controller', async (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//var sources = libCore.getSources();
|
//var sources = libCore.getSources();
|
||||||
return res.render('controller', {'nodes' : nodes});
|
return res.render('controller', {'nodes' : nodes, 'page': 'controller'});
|
||||||
});
|
});
|
||||||
|
|
||||||
/* GET individual node page. */
|
/* GET individual node page. */
|
||||||
@@ -46,7 +26,7 @@ router.get('/node/:id', async (req, res) => {
|
|||||||
var node = await getNodeInfoFromId(req.params.id);
|
var node = await getNodeInfoFromId(req.params.id);
|
||||||
|
|
||||||
//var sources = libCore.getSources();
|
//var sources = libCore.getSources();
|
||||||
return res.render('node', {'node' : node});
|
return res.render('node', {'node' : node, 'page': 'node'});
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<%- include('partials/htmlHead.ejs') %>
|
<%- include('partials/htmlHead.ejs', {'page': page}) %>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row row-cols-1 row-cols-md-2 row-cols-xl-4">
|
<div class="row row-cols-1 row-cols-md-2 row-cols-xl-4">
|
||||||
<div class="col-xl-3 col-lg-6">
|
<div class="col-xl-3 col-lg-6">
|
||||||
|
|||||||
@@ -134,5 +134,7 @@
|
|||||||
|
|
||||||
<% // new System Modal %>
|
<% // new System Modal %>
|
||||||
<%- include("partials/modifySystemModal.ejs", {'system': "New System", 'frequencies': [], 'mode': ''}) %>
|
<%- include("partials/modifySystemModal.ejs", {'system': "New System", 'frequencies': [], 'mode': ''}) %>
|
||||||
|
<% // Join Server Modal %>
|
||||||
|
<%- include("partials/joinModal.ejs", {'node': node}) %>
|
||||||
<%- include('partials/bodyEnd.ejs') %>
|
<%- include('partials/bodyEnd.ejs') %>
|
||||||
<%- include('partials/htmlFooter.ejs') %>
|
<%- include('partials/htmlFooter.ejs') %>
|
||||||
@@ -1,7 +1,20 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Bootstrap demo</title>
|
<% switch (page) {
|
||||||
|
case "index":%>
|
||||||
|
<title>Node Dashboard</title>
|
||||||
|
<% break;
|
||||||
|
case "controller":%>
|
||||||
|
<title>Node Controller</title>
|
||||||
|
<% break;
|
||||||
|
case "node":%>
|
||||||
|
<title>Node Configuration</title>
|
||||||
|
<% break;
|
||||||
|
default:%>
|
||||||
|
<title>DRB_CnC Server</title>
|
||||||
|
<%break;
|
||||||
|
} %>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
|
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en" data-bs-theme="auto">
|
<html lang="en" data-bs-theme="auto">
|
||||||
<%- include('head.ejs') %>
|
<%- include('head.ejs', {'page': page}) %>
|
||||||
<body>
|
<body>
|
||||||
<%- include('navbar.ejs') %>
|
<%- include('navbar.ejs') %>
|
||||||
<%- include('sidebar.ejs') %>
|
<%- include('sidebar.ejs') %>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label class="small mb-1" for="selectRadioPreset">Selected Preset:</label>
|
<label class="small mb-1" for="selectRadioPreset">Selected Preset:</label>
|
||||||
<select class="custom-select" id="selectRadioPreset">
|
<select class="custom-select" id="selectRadioPreset">
|
||||||
<% for(const system in nearbySystems) { %>
|
<% for(const system in node.nearbySystems) { %>
|
||||||
<option value="<%=system%>"><%=system%></option>
|
<option value="<%=system%>"><%=system%></option>
|
||||||
<% } %>
|
<% } %>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Reference in New Issue
Block a user