mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-14 11:45:02 +01:00
remove old code
This commit is contained in:
parent
85ef2aa7fd
commit
392bf67fc2
5 changed files with 0 additions and 105 deletions
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"singleQuote": true
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta
|
|
||||||
name="viewport"
|
|
||||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
|
|
||||||
/>
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
|
||||||
<title>AMQP Data</title>
|
|
||||||
<link rel="stylesheet" href="style.css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>AMQP Data</h1>
|
|
||||||
<h2>Connections</h2>
|
|
||||||
<div id="connection-wrapper"></div>
|
|
||||||
<h2>Queues</h2>
|
|
||||||
<div id="queue-wrapper"></div>
|
|
||||||
|
|
||||||
<script src="script.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
const renderTable = (colNames, rows) => {
|
|
||||||
const table = document.createElement('table');
|
|
||||||
|
|
||||||
const headerRow = document.createElement('tr');
|
|
||||||
|
|
||||||
colNames.forEach((name) => {
|
|
||||||
const th = document.createElement('th');
|
|
||||||
th.innerText = name;
|
|
||||||
|
|
||||||
headerRow.append(th);
|
|
||||||
});
|
|
||||||
table.append(headerRow);
|
|
||||||
|
|
||||||
rows.forEach((row) => {
|
|
||||||
const contentRow = document.createElement('tr');
|
|
||||||
row.forEach((cell) => {
|
|
||||||
const td = document.createElement('td');
|
|
||||||
td.innerText = cell;
|
|
||||||
contentRow.append(td);
|
|
||||||
});
|
|
||||||
table.append(contentRow);
|
|
||||||
});
|
|
||||||
|
|
||||||
return table;
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderConnections = (connections) => {
|
|
||||||
const wrapper = document.getElementById('connection-wrapper');
|
|
||||||
|
|
||||||
const table = renderTable(
|
|
||||||
['Connection ID', 'Client Address', 'Channels'],
|
|
||||||
connections.map((conn) => {
|
|
||||||
const channels = conn.channels
|
|
||||||
.map((chan) => `${chan.number} - ${chan.id}`)
|
|
||||||
.join('\n');
|
|
||||||
return [conn.id, conn.peer_addr, channels];
|
|
||||||
})
|
|
||||||
);
|
|
||||||
wrapper.replaceChildren(table);
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderQueues = (queues) => {
|
|
||||||
const wrapper = document.getElementById('queue-wrapper');
|
|
||||||
|
|
||||||
const table = renderTable(
|
|
||||||
['Queue ID', 'Name', 'Durable'],
|
|
||||||
queues.map((queue) => {
|
|
||||||
return [queue.id, queue.name, queue.durable ? 'Yes' : 'No'];
|
|
||||||
})
|
|
||||||
);
|
|
||||||
wrapper.replaceChildren(table);
|
|
||||||
};
|
|
||||||
|
|
||||||
const refresh = async () => {
|
|
||||||
const fetched = await fetch('api/data');
|
|
||||||
const data = await fetched.json();
|
|
||||||
renderConnections(data.connections);
|
|
||||||
renderQueues(data.queues);
|
|
||||||
};
|
|
||||||
|
|
||||||
setInterval(refresh, 1000);
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
html {
|
|
||||||
font-family: arial, sans-serif;
|
|
||||||
margin: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table,
|
|
||||||
th,
|
|
||||||
td {
|
|
||||||
border: 1px solid black;
|
|
||||||
border-collapse: collapse;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|
@ -14,10 +14,6 @@ use serde::Serialize;
|
||||||
use tower_http::cors::{Any, CorsLayer};
|
use tower_http::cors::{Any, CorsLayer};
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
|
||||||
// const INDEX_HTML: &str = include_str!("../assets/index.html");
|
|
||||||
// const SCRIPT_JS: &str = include_str!("../assets/script.js");
|
|
||||||
// const STYLE_CSS: &str = include_str!("../assets/style.css");
|
|
||||||
|
|
||||||
const DATA_ZIP: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/frontend.zip"));
|
const DATA_ZIP: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/frontend.zip"));
|
||||||
|
|
||||||
pub async fn dashboard(global_data: GlobalData) {
|
pub async fn dashboard(global_data: GlobalData) {
|
||||||
|
|
@ -32,9 +28,6 @@ pub async fn dashboard(global_data: GlobalData) {
|
||||||
});
|
});
|
||||||
|
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
//.route("/", get(get_index_html))
|
|
||||||
//.route("/script.js", get(get_script_js))
|
|
||||||
//.route("/style.css", get(get_style_css))
|
|
||||||
.route("/api/data", get(move || get_data(global_data)).layer(cors))
|
.route("/api/data", get(move || get_data(global_data)).layer(cors))
|
||||||
.fallback(static_file_service);
|
.fallback(static_file_service);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue