mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Semi-functional placeholder for the Shaped Devices page.
This commit is contained in:
parent
a3ce3384ee
commit
490c6856a0
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
scripts=( index.js template.js login.js first-run.js )
|
||||
scripts=( index.js template.js login.js first-run.js shaped-devices.js )
|
||||
for script in "${scripts[@]}"
|
||||
do
|
||||
echo "Building {$script}"
|
||||
|
@ -0,0 +1,33 @@
|
||||
import {simpleRow, theading} from "./helpers/builders";
|
||||
|
||||
function loadDevices() {
|
||||
$.get("/local-api/devicesAll", (data) => {
|
||||
console.log(data);
|
||||
let table = document.createElement("table");
|
||||
table.classList.add("table", "table-striped");
|
||||
let thead = document.createElement("thead");
|
||||
thead.appendChild(theading("Circuit"));
|
||||
thead.appendChild(theading("Device"));
|
||||
thead.appendChild(theading("Plans"));
|
||||
thead.appendChild(theading("IP"));
|
||||
table.appendChild(thead);
|
||||
let tb = document.createElement("tbody");
|
||||
data.forEach((d) => {
|
||||
let tr = document.createElement("tr");
|
||||
tr.appendChild(simpleRow(d.circuit_name));
|
||||
tr.appendChild(simpleRow(d.device_name));
|
||||
tr.appendChild(simpleRow(d.download_max_mbps + " / " + d.upload_max_mbps));
|
||||
tr.appendChild(simpleRow(""));
|
||||
tb.append(tr);
|
||||
})
|
||||
table.appendChild(tb);
|
||||
|
||||
let target = document.getElementById("deviceTable");
|
||||
while (target.children.length > 0) {
|
||||
target.removeChild(target.lastChild);
|
||||
}
|
||||
target.appendChild(table);
|
||||
})
|
||||
}
|
||||
|
||||
loadDevices();
|
@ -1,6 +1,7 @@
|
||||
mod dashboard_themes;
|
||||
mod version_check;
|
||||
mod device_counts;
|
||||
mod shaped_device_api;
|
||||
|
||||
use axum::Router;
|
||||
use axum::routing::{get, post};
|
||||
@ -13,4 +14,5 @@ pub fn local_api() -> Router {
|
||||
.route("/dashletGet", post(dashboard_themes::get_theme))
|
||||
.route("/versionCheck", get(version_check::version_check))
|
||||
.route("/deviceCount", get(device_counts::count_users))
|
||||
.route("/devicesAll", get(shaped_device_api::all_shaped_devices))
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
use axum::Json;
|
||||
use lqos_config::ShapedDevice;
|
||||
use crate::shaped_devices_tracker::SHAPED_DEVICES;
|
||||
|
||||
pub async fn all_shaped_devices() -> Json<Vec<ShapedDevice>> {
|
||||
Json(SHAPED_DEVICES.read().unwrap().devices.clone())
|
||||
}
|
12
src/rust/lqosd/src/node_manager/static2/shaped_devices.html
Normal file
12
src/rust/lqosd/src/node_manager/static2/shaped_devices.html
Normal file
@ -0,0 +1,12 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h5><i class="fa fa-group"></i> Shaped Devices</h5>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div id="deviceTable">
|
||||
<i class="fa fa-spinner fa-spin"></i> Loading, Please Wait...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="shaped-devices.js"></script>
|
@ -24,7 +24,7 @@
|
||||
<ul class="navbar-nav flex-column">
|
||||
<!-- Logo -->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link">
|
||||
<a class="nav-link" href="index.html">
|
||||
<img src="tinylogo.svg" alt="LibreQoS SVG Logo" width="48" height="48">
|
||||
</a>
|
||||
</li>
|
||||
@ -43,7 +43,7 @@
|
||||
</li>
|
||||
<!-- Dashboard -->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link">
|
||||
<a class="nav-link" href="index.html">
|
||||
<i class="fa fa-dashboard nav-icon"></i> Dashboard
|
||||
</a>
|
||||
</li>
|
||||
@ -55,7 +55,7 @@
|
||||
</li>
|
||||
<!-- Shaped Devices -->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link">
|
||||
<a class="nav-link" href="shaped_devices.html">
|
||||
<i class="fa fa-user-circle nav-icon"></i> <span id="shapedDeviceCount" class="badge">?</span> Devices
|
||||
</a>
|
||||
</li>
|
||||
|
@ -29,7 +29,7 @@ pub(super) fn static_routes() -> Result<Router> {
|
||||
// Add HTML pages to serve directly to this list, otherwise
|
||||
// they won't have template + authentication applied to them.
|
||||
let html_pages = [
|
||||
"index.html"
|
||||
"index.html", "shaped_devices.html"
|
||||
];
|
||||
|
||||
// Iterate through pages and construct the router
|
||||
|
Loading…
Reference in New Issue
Block a user