feat: Add search_enabled and menu_launcher_enabled directives to .product file
- Add search_enabled field to ProductConfig to control omnibox visibility (defaults to false) - Add menu_launcher_enabled field to ProductConfig to control apps menu button visibility (defaults to false) - Update .product file to set both directives to false by default - Update get_product_config_json to include new fields in API response - Parse search_enabled and menu_launcher_enabled from .product file with support for true/false, 1/0, yes/no values This allows disabling the suite search mechanism and hiding the menu launcher when empty, providing a cleaner UI for deployments that don't need these features.
This commit is contained in:
parent
1f7cdfa9cf
commit
94fede7cc4
2 changed files with 37 additions and 0 deletions
11
.product
11
.product
|
|
@ -14,6 +14,17 @@ name=General Bots
|
||||||
# Only listed apps will be visible in the UI and have their APIs enabled.
|
# Only listed apps will be visible in the UI and have their APIs enabled.
|
||||||
apps=chat,drive,tasks,sources,settings
|
apps=chat,drive,tasks,sources,settings
|
||||||
|
|
||||||
|
# Search mechanism enabled
|
||||||
|
# Controls whether the omnibox/search toolbar is displayed in the suite
|
||||||
|
# Set to false to disable the search mechanism
|
||||||
|
search_enabled=false
|
||||||
|
|
||||||
|
# Menu launcher enabled
|
||||||
|
# Controls whether the apps menu launcher is displayed in the suite
|
||||||
|
# Set to false to hide the menu launcher button
|
||||||
|
# When the menu is empty (no apps to show), it will be automatically hidden
|
||||||
|
menu_launcher_enabled=false
|
||||||
|
|
||||||
# Default theme
|
# Default theme
|
||||||
# Available themes: dark, light, blue, purple, green, orange, sentient, cyberpunk,
|
# Available themes: dark, light, blue, purple, green, orange, sentient, cyberpunk,
|
||||||
# retrowave, vapordream, y2kglow, arcadeflash, discofever, grungeera,
|
# retrowave, vapordream, y2kglow, arcadeflash, discofever, grungeera,
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,14 @@ pub struct ProductConfig {
|
||||||
|
|
||||||
/// Copyright text (optional)
|
/// Copyright text (optional)
|
||||||
pub copyright: Option<String>,
|
pub copyright: Option<String>,
|
||||||
|
|
||||||
|
/// Search mechanism enabled (optional)
|
||||||
|
/// Controls whether the omnibox/search toolbar is displayed in the suite
|
||||||
|
pub search_enabled: Option<bool>,
|
||||||
|
|
||||||
|
/// Menu launcher enabled (optional)
|
||||||
|
/// Controls whether the apps menu launcher is displayed in the suite
|
||||||
|
pub menu_launcher_enabled: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ProductConfig {
|
impl Default for ProductConfig {
|
||||||
|
|
@ -81,6 +89,8 @@ impl Default for ProductConfig {
|
||||||
support_email: None,
|
support_email: None,
|
||||||
docs_url: None,
|
docs_url: None,
|
||||||
copyright: None,
|
copyright: None,
|
||||||
|
search_enabled: Some(false),
|
||||||
|
menu_launcher_enabled: Some(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -179,6 +189,18 @@ impl ProductConfig {
|
||||||
config.copyright = Some(value.to_string());
|
config.copyright = Some(value.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"search_enabled" => {
|
||||||
|
let enabled = value.eq_ignore_ascii_case("true")
|
||||||
|
|| value == "1"
|
||||||
|
|| value.eq_ignore_ascii_case("yes");
|
||||||
|
config.search_enabled = Some(enabled);
|
||||||
|
}
|
||||||
|
"menu_launcher_enabled" => {
|
||||||
|
let enabled = value.eq_ignore_ascii_case("true")
|
||||||
|
|| value == "1"
|
||||||
|
|| value.eq_ignore_ascii_case("yes");
|
||||||
|
config.menu_launcher_enabled = Some(enabled);
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
warn!("Unknown product configuration key: {}", key);
|
warn!("Unknown product configuration key: {}", key);
|
||||||
}
|
}
|
||||||
|
|
@ -331,6 +353,8 @@ pub fn get_product_config_json() -> serde_json::Value {
|
||||||
"primary_color": c.primary_color,
|
"primary_color": c.primary_color,
|
||||||
"docs_url": c.docs_url,
|
"docs_url": c.docs_url,
|
||||||
"copyright": c.get_copyright(),
|
"copyright": c.get_copyright(),
|
||||||
|
"search_enabled": c.search_enabled.unwrap_or(false),
|
||||||
|
"menu_launcher_enabled": c.menu_launcher_enabled.unwrap_or(false),
|
||||||
}),
|
}),
|
||||||
None => serde_json::json!({
|
None => serde_json::json!({
|
||||||
"name": "General Bots",
|
"name": "General Bots",
|
||||||
|
|
@ -338,6 +362,8 @@ pub fn get_product_config_json() -> serde_json::Value {
|
||||||
"compiled_features": compiled,
|
"compiled_features": compiled,
|
||||||
"version": env!("CARGO_PKG_VERSION"),
|
"version": env!("CARGO_PKG_VERSION"),
|
||||||
"theme": "sentient",
|
"theme": "sentient",
|
||||||
|
"search_enabled": false,
|
||||||
|
"menu_launcher_enabled": false,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue