Display the list of OTA updates in the frontend
This commit is contained in:
		@@ -191,7 +191,7 @@ pub async fn secure_server(energy_actor: EnergyActorAddr) -> anyhow::Result<()>
 | 
			
		||||
                "/web_api/ota/{platform}/{version}",
 | 
			
		||||
                web::post().to(ota_controller::upload_firmware),
 | 
			
		||||
            )
 | 
			
		||||
            // TODO : list all ota software updates
 | 
			
		||||
            .route("/web_api/ota", web::get().to(ota_controller::list_all_ota))
 | 
			
		||||
            .route(
 | 
			
		||||
                "/web_api/ota/{platform}",
 | 
			
		||||
                web::get().to(ota_controller::list_updates_platform),
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ use actix_multipart::form::MultipartForm;
 | 
			
		||||
use actix_web::{web, HttpResponse};
 | 
			
		||||
 | 
			
		||||
pub async fn supported_platforms() -> HttpResult {
 | 
			
		||||
    Ok(HttpResponse::Ok().json(vec![OTAPlatform::Wt32Eth01]))
 | 
			
		||||
    Ok(HttpResponse::Ok().json(OTAPlatform::supported_platforms()))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, MultipartForm)]
 | 
			
		||||
@@ -53,6 +53,11 @@ pub async fn upload_firmware(
 | 
			
		||||
    Ok(HttpResponse::Accepted().body("OTA update successfully saved."))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Get the list of all OTA updates
 | 
			
		||||
pub async fn list_all_ota() -> HttpResult {
 | 
			
		||||
    Ok(HttpResponse::Ok().json(ota_manager::get_all_ota_updates()?))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(serde::Deserialize)]
 | 
			
		||||
pub struct ListOTAPath {
 | 
			
		||||
    platform: OTAPlatform,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user