view server preset [refs #24]

This commit is contained in:
Thomas Weinhold 2026-01-21 21:41:37 +01:00
commit 1ab7022d69
2 changed files with 30 additions and 6 deletions

View file

@ -98,6 +98,7 @@ impl CollPreset {
html += "<div>";
html += &self.html_view_general();
html += &self.html_view_server();
html += &self.html_view_rating();
html += &self.html_view_session();
html += &self.html_view_classes(db).await;
@ -399,4 +400,27 @@ impl CollPreset {
html += "</div>";
html
}
fn html_view_server(&self) -> String {
let mut html = "<div class=\"PresetViewTableBox\">".to_string();
html += &format!("<label>{}</label>", self.coll_server.label());
fn table_row(param: &dyn NdpcParameter, icon: &str) -> String {
format!("<tr title=\"{}\"><td>{}</td><td class=\"{}\">{}</td></tr>",
param.label(),
icon,
css_class_unlock(param),
param.value2str(),
)
}
html += "<table>";
html += &table_row(&self.coll_server.param_name, phosphor_svgs::icon::article::DUOTONE);
html += &table_row(&self.coll_server.param_password, phosphor_svgs::icon::password::DUOTONE);
html += "</table>";
html += "</div>";
html
}
}

View file

@ -5,8 +5,8 @@ use sslo_lib::ndpc2::parameter::NdpcParameter;
#[derive(Clone)]
pub struct CollServer {
meta: NdpcCollectionMetaData,
name: ParamString,
password: ParamString,
pub param_name: ParamString,
pub param_password: ParamString,
}
impl CollServer {
@ -26,8 +26,8 @@ impl CollServer {
Self {
meta: NdpcCollectionMetaData::new(),
name,
password,
param_name: name,
param_password: password,
}
}
}
@ -39,10 +39,10 @@ impl NdpcCollection for CollServer {
fn label(&self) -> &str { "Server" }
fn child_parameters(&self) -> Vec<&dyn NdpcParameter> {
vec![&self.name, &self.password]
vec![&self.param_name, &self.param_password]
}
fn child_parameters_mut(&mut self) -> Vec<&mut dyn NdpcParameter> {
vec![&mut self.name, &mut self.password]
vec![&mut self.param_name, &mut self.param_password]
}
fn child_collections(&self) -> Vec<&dyn NdpcCollection> { vec![] }