feat(domain,application,infrastructure,backend,web-server,app-tauri,frontend): lot utilisateur #325 #326 — icônes projet avec watermark CLI custom et localisation FR/EN (QA verte)
Lot en un seul commit: les deux features partagent les mêmes contrats (domain/settings.rs, DTO, commandes Tauri/HTTP, web-server) et les mêmes surfaces UI — la séparation par fichiers était impossible sans chirurgie de hunks risquant des états intermédiaires non compilables (convention lot des batches #310-#313 et #315). #325 — icône configurable par projet, watermark CLI custom: - domaine: ProjectIconSet (devicon, simple-icons, lucide, idea), ProjectIconRef validé (nom ASCII 1..=64, -_. internes), champ icon optionnel sur ProjectSettings; sérialisation camelCase et try_from strict - application: UpdateProjectSettings.execute accepte un patch theme_color OU icon (absent = inchangé, null = défaut produit), tests in-dependants avec store mémoire - backend/app-tauri/web-server: ProjectIconRefDto, UpdateProjectSettingsRequestDto avec icon optionnel (désérialisation additive), commandes update_project_settings alignées Tauri/HTTP, tests DTO et HTTP (défaut null, set, clear, nom invalide rejeté) - frontend: catalogue projectIcons (recherche EN), ProjectIconPicker en grille multi-lignes dans Paramètres projet, affichage de l'icône dans ProjectTabs et watermark grand format à faible opacité en fond de CLI custom; ports ProjectSettings.icon, Partial<ProjectSettings>, adapters tauri/mock/http et tests alignés #326 — localisation FR/EN et traduction des textes IdeA: - domaine: IdeaLanguage (fr | en), champ language optionnel sur IdeaUserSettings (absence = défaut produit, série additive validée) - backend/web-server: UserSettingsDto.language, update_user_settings accepte language, tests HTTP alignés; fixtures structured_launch_d3 mises à jour - frontend: i18n/ (catalogue FR/EN, I18nProvider, scan anti-régression des sources visibles), GeneralSettings avec sélecteur de langue dans les paramètres, setupI18n dans vitest; migration de l'ensemble des textes hardcodés vers le catalogue sur toutes les surfaces (agents, layout, projets, tickets, sprints, web, plugins, permissions, git, templates, skills, mémoire, model servers, embedder, first-run, devices, scheduled tasks, workstate, dialogs), FR conservé par défaut; recherche d'icônes #325 en anglais conformément au ticket QA verte sur feature/batch-325-326-project-icons-localisation. Aucun push.
This commit is contained in:
@ -3266,12 +3266,16 @@ pub struct UserSettingsDto {
|
||||
/// Default interface for newly opened agent terminals.
|
||||
#[serde(default)]
|
||||
pub default_agent_terminal_interface: Option<domain::DefaultAgentTerminalInterface>,
|
||||
/// Preferred interface language. Absence preserves the product default.
|
||||
#[serde(default)]
|
||||
pub language: Option<domain::IdeaLanguage>,
|
||||
}
|
||||
|
||||
impl From<domain::IdeaUserSettings> for UserSettingsDto {
|
||||
fn from(value: domain::IdeaUserSettings) -> Self {
|
||||
Self {
|
||||
default_agent_terminal_interface: value.default_agent_terminal_interface,
|
||||
language: value.language,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3280,10 +3284,38 @@ impl From<UserSettingsDto> for domain::IdeaUserSettings {
|
||||
fn from(value: UserSettingsDto) -> Self {
|
||||
Self {
|
||||
default_agent_terminal_interface: value.default_agent_terminal_interface,
|
||||
language: value.language,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Validated project icon wire reference.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ProjectIconRefDto {
|
||||
/// Known icon catalogue.
|
||||
pub set: domain::ProjectIconSet,
|
||||
/// Stable icon name within the catalogue.
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
impl From<domain::ProjectIconRef> for ProjectIconRefDto {
|
||||
fn from(value: domain::ProjectIconRef) -> Self {
|
||||
Self {
|
||||
set: value.set(),
|
||||
name: value.name().to_owned(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<ProjectIconRefDto> for domain::ProjectIconRef {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(value: ProjectIconRefDto) -> Result<Self, Self::Error> {
|
||||
Self::new(value.set, value.name)
|
||||
}
|
||||
}
|
||||
|
||||
/// Project-owned settings wire contract.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@ -3291,12 +3323,16 @@ pub struct ProjectSettingsDto {
|
||||
/// Optional validated project theme colour.
|
||||
#[serde(default)]
|
||||
pub theme_color: Option<String>,
|
||||
/// Optional validated project icon.
|
||||
#[serde(default)]
|
||||
pub icon: Option<ProjectIconRefDto>,
|
||||
}
|
||||
|
||||
impl From<domain::ProjectSettings> for ProjectSettingsDto {
|
||||
fn from(value: domain::ProjectSettings) -> Self {
|
||||
Self {
|
||||
theme_color: value.theme_color.map(|color| color.as_str().to_owned()),
|
||||
icon: value.icon.map(Into::into),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3308,6 +3344,8 @@ pub struct UpdateProjectSettingsRequestDto {
|
||||
pub project_id: String,
|
||||
/// Missing leaves the colour unchanged; null restores the product default.
|
||||
pub theme_color: Option<Option<String>>,
|
||||
/// Missing leaves the icon unchanged; null restores the product default.
|
||||
pub icon: Option<Option<ProjectIconRefDto>>,
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for UpdateProjectSettingsRequestDto {
|
||||
@ -3323,9 +3361,12 @@ impl<'de> Deserialize<'de> for UpdateProjectSettingsRequestDto {
|
||||
take_required_string(object, "projectId").map_err(serde::de::Error::custom)?;
|
||||
let theme_color = take_optional_value::<String>(object, "themeColor")
|
||||
.map_err(serde::de::Error::custom)?;
|
||||
let icon = take_optional_value::<ProjectIconRefDto>(object, "icon")
|
||||
.map_err(serde::de::Error::custom)?;
|
||||
Ok(Self {
|
||||
project_id,
|
||||
theme_color,
|
||||
icon,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -6257,6 +6298,52 @@ mod tests {
|
||||
use serde_json::json;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[test]
|
||||
fn settings_dtos_are_additive_and_validate_language_and_icon_contracts() {
|
||||
let legacy_user: UserSettingsDto = serde_json::from_value(json!({})).unwrap();
|
||||
assert_eq!(legacy_user.language, None);
|
||||
let english: UserSettingsDto = serde_json::from_value(json!({ "language": "en" })).unwrap();
|
||||
assert_eq!(english.language, Some(domain::IdeaLanguage::En));
|
||||
assert!(serde_json::from_value::<UserSettingsDto>(json!({ "language": "de" })).is_err());
|
||||
|
||||
let project_id = Uuid::from_u128(325).to_string();
|
||||
let absent: UpdateProjectSettingsRequestDto = serde_json::from_value(json!({
|
||||
"projectId": project_id
|
||||
}))
|
||||
.unwrap();
|
||||
assert!(absent.theme_color.is_none());
|
||||
assert!(absent.icon.is_none());
|
||||
|
||||
let clear: UpdateProjectSettingsRequestDto = serde_json::from_value(json!({
|
||||
"projectId": project_id,
|
||||
"icon": null
|
||||
}))
|
||||
.unwrap();
|
||||
assert_eq!(clear.icon, Some(None));
|
||||
|
||||
let set: UpdateProjectSettingsRequestDto = serde_json::from_value(json!({
|
||||
"projectId": project_id,
|
||||
"icon": { "set": "simple-icons", "name": "github" }
|
||||
}))
|
||||
.unwrap();
|
||||
let icon: domain::ProjectIconRef = set.icon.unwrap().unwrap().try_into().unwrap();
|
||||
assert_eq!(icon.set(), domain::ProjectIconSet::SimpleIcons);
|
||||
assert_eq!(icon.name(), "github");
|
||||
|
||||
let invalid_name = ProjectIconRefDto {
|
||||
set: domain::ProjectIconSet::Lucide,
|
||||
name: "two words".to_owned(),
|
||||
};
|
||||
assert!(domain::ProjectIconRef::try_from(invalid_name).is_err());
|
||||
assert!(
|
||||
serde_json::from_value::<UpdateProjectSettingsRequestDto>(json!({
|
||||
"projectId": project_id,
|
||||
"icon": { "set": "font-awesome", "name": "star" }
|
||||
}))
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn slash_command_requests_accept_optional_project_scope() {
|
||||
let project_id = Uuid::from_u128(321).to_string();
|
||||
|
||||
Reference in New Issue
Block a user