Display the list of pending devices in the UI

This commit is contained in:
2024-07-03 19:17:47 +02:00
parent 01ffe085d7
commit 716af6219a
14 changed files with 301 additions and 17 deletions

View File

@ -0,0 +1,28 @@
use crate::energy::energy_actor;
use crate::server::custom_error::HttpResult;
use crate::server::WebEnergyActor;
use actix_web::HttpResponse;
/// Get the list of pending (not accepted yet) devices
pub async fn list_pending(actor: WebEnergyActor) -> HttpResult {
let list = actor
.send(energy_actor::GetDeviceLists)
.await?
.into_iter()
.filter(|d| !d.validated)
.collect::<Vec<_>>();
Ok(HttpResponse::Ok().json(list))
}
/// Get the list of validated (not accepted yet) devices
pub async fn list_validated(actor: WebEnergyActor) -> HttpResult {
let list = actor
.send(energy_actor::GetDeviceLists)
.await?
.into_iter()
.filter(|d| d.validated)
.collect::<Vec<_>>();
Ok(HttpResponse::Ok().json(list))
}

View File

@ -1,3 +1,4 @@
pub mod auth_controller;
pub mod devices_controller;
pub mod energy_controller;
pub mod server_controller;