panel api

This commit is contained in:
euzu
2025-12-19 18:47:54 +01:00
parent c7ff1bb897
commit fea672a8a6
4 changed files with 10 additions and 3 deletions
+3 -1
View File
@@ -567,12 +567,14 @@ async fn patch_batch_csv_update_exp_date(
Ok(())
}
const MAX_ALIAS_NAME_ATTEMPTS: usize = 1000;
fn derive_unique_alias_name(existing: &[String], input_name: &str, username: &str) -> String {
let base = format!("{input_name}-{username}");
if !existing.contains(&base) {
return base;
}
for i in 2..1000 {
for i in 2..MAX_ALIAS_NAME_ATTEMPTS {
let cand = format!("{base}-{i}");
if !existing.contains(&cand) {
return cand;
+1
View File
@@ -395,6 +395,7 @@
"MESSAGE": "Enter Your Credentials"
},
"SAVE": {
"NO_CHANGES": "No changes",
"MAIN_CONFIG": {
"SUCCESS": "Main config saved!",
"FAIL": "Failed to save the main config!"
@@ -4,6 +4,7 @@ use crate::app::components::config::{ApiConfigView, HdHomerunConfigView, IpCheck
use crate::app::components::{Card, TabItem, TabSet, TextButton};
use crate::html_if;
use std::str::FromStr;
use log::warn;
use yew::platform::spawn_local;
use yew::prelude::*;
use yew_i18n::use_translation;
@@ -153,6 +154,7 @@ pub fn ConfigView() -> Html {
if modified_forms.is_empty() {
set_edit_mode.set(false);
services.toastr.info(translate.t("MESSAGES.SAVE.NO_CHANGES"));
return;
}
@@ -220,7 +222,10 @@ pub fn ConfigView() -> Html {
if ok {
set_edit_mode.set(false);
let _cfg = services.config.get_server_config().await;
if services.config.get_server_config().await.is_none() {
// Log but don't fail - save succeeded, refresh is best-effort
warn!("Config refresh failed");
}
}
});
})
@@ -393,7 +393,6 @@ pub fn PanelConfigView() -> Html {
} else {
form_state.dispatch(PanelConfigFormAction::SetAll(SourcesConfigDto::default()));
}
|| ()
});
}