more queue stuff

This commit is contained in:
nora 2022-02-27 18:26:02 +01:00
parent 14ad4e1011
commit 4643483d70
15 changed files with 126 additions and 42 deletions

View file

@ -51,6 +51,7 @@ async fn get_style_css() -> Response {
#[derive(Serialize)]
struct Data {
connections: Vec<Connection>,
queues: Vec<Queue>,
}
#[derive(Serialize)]
@ -66,6 +67,13 @@ struct Channel {
number: u16,
}
#[derive(Serialize)]
struct Queue {
id: String,
name: String,
durable: bool,
}
async fn get_data(global_data: GlobalData) -> impl IntoResponse {
let global_data = global_data.lock();
@ -92,7 +100,20 @@ async fn get_data(global_data: GlobalData) -> impl IntoResponse {
})
.collect();
let data = Data { connections };
let queues = global_data
.queues
.values()
.map(|queue| Queue {
id: queue.id.to_string(),
name: queue.name.to_string(),
durable: queue.durable,
})
.collect();
let data = Data {
connections,
queues,
};
Json(data)
}