From b7720df305d7574cbe319e84549b0ce99da7a118 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 19 Oct 2024 15:32:38 +0200 Subject: [PATCH] Assign version to backend --- central_backend/Cargo.lock | 2 +- central_backend/Cargo.toml | 2 +- central_backend/src/server/web_api/server_controller.rs | 2 ++ central_frontend/src/api/ServerApi.ts | 1 + central_frontend/src/widgets/SolarEnergyNavList.tsx | 9 +++++++++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/central_backend/Cargo.lock b/central_backend/Cargo.lock index fc4112d..74303d8 100644 --- a/central_backend/Cargo.lock +++ b/central_backend/Cargo.lock @@ -656,7 +656,7 @@ dependencies = [ [[package]] name = "central_backend" -version = "0.1.0" +version = "1.0.2" dependencies = [ "actix", "actix-cors", diff --git a/central_backend/Cargo.toml b/central_backend/Cargo.toml index 2cf54fd..36cd1f2 100644 --- a/central_backend/Cargo.toml +++ b/central_backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "central_backend" -version = "0.1.0" +version = "1.0.2" edition = "2021" [dependencies] diff --git a/central_backend/src/server/web_api/server_controller.rs b/central_backend/src/server/web_api/server_controller.rs index 95b067c..8eeab1d 100644 --- a/central_backend/src/server/web_api/server_controller.rs +++ b/central_backend/src/server/web_api/server_controller.rs @@ -13,6 +13,7 @@ struct ServerConfig { auth_disabled: bool, constraints: StaticConstraints, unsecure_origin: String, + backend_version: &'static str, } impl Default for ServerConfig { @@ -21,6 +22,7 @@ impl Default for ServerConfig { auth_disabled: AppConfig::get().unsecure_disable_login, constraints: Default::default(), unsecure_origin: AppConfig::get().unsecure_origin(), + backend_version: env!("CARGO_PKG_VERSION"), } } } diff --git a/central_frontend/src/api/ServerApi.ts b/central_frontend/src/api/ServerApi.ts index c77105f..5db6f9f 100644 --- a/central_frontend/src/api/ServerApi.ts +++ b/central_frontend/src/api/ServerApi.ts @@ -4,6 +4,7 @@ export interface ServerConfig { auth_disabled: boolean; constraints: ServerConstraint; unsecure_origin: string; + backend_version: string; } export interface ServerConstraint { diff --git a/central_frontend/src/widgets/SolarEnergyNavList.tsx b/central_frontend/src/widgets/SolarEnergyNavList.tsx index c9262b5..e2310f3 100644 --- a/central_frontend/src/widgets/SolarEnergyNavList.tsx +++ b/central_frontend/src/widgets/SolarEnergyNavList.tsx @@ -12,9 +12,11 @@ import { ListItemButton, ListItemIcon, ListItemText, + Typography, } from "@mui/material"; import { useLocation } from "react-router-dom"; import { RouterLink } from "./RouterLink"; +import { ServerApi } from "../api/ServerApi"; export function SolarEnergyNavList(): React.ReactElement { return ( @@ -52,6 +54,13 @@ export function SolarEnergyNavList(): React.ReactElement { uri="/logs" icon={} /> + + Version {ServerApi.Config.backend_version} + ); }