diff --git a/src/Heimdall.Web/Components/Pages/SettingsPage.razor b/src/Heimdall.Web/Components/Pages/SettingsPage.razor
index 9760b5c..d133243 100644
--- a/src/Heimdall.Web/Components/Pages/SettingsPage.razor
+++ b/src/Heimdall.Web/Components/Pages/SettingsPage.razor
@@ -89,76 +89,84 @@ else
@foreach (var category in _filteredSettings)
{
-
-
- @category.Key
- @category.Value.Count
-
+
+
+
+
+ @category.Key
+
+ @category.Value.Count
+
-
-
- Clé
- Valeur
- Type
- Description
- Mis à jour
- Actions
-
-
-
- @context.Key
-
-
- @switch (context.ValueType.ToLowerInvariant())
- {
- case "boolean":
- case "bool":
-
- break;
- case "number":
- case "int":
- case "integer":
- @context.Value
- break;
- case "select":
- case "dropdown":
- @context.Value
- break;
- default:
- @context.Value
- break;
- }
-
-
-
- @context.ValueType
-
-
-
-
- @(context.Description ?? "—")
-
-
-
- @context.UpdatedAt.ToString("g")
-
-
-
-
-
-
-
-
-
-
-
- Aucun paramètre dans cette catégorie
-
-
+
+ @foreach (var setting in category.Value)
+ {
+
+
+
+
+
+
+ @(setting.Description ?? HumanizeKey(setting.Key))
+
+
+ @setting.Key
+
+
+
+
+
+
+
+ @switch (setting.ValueType.ToLowerInvariant())
+ {
+ case "boolean":
+ case "bool":
+
+
+
+ @(setting.Value?.Equals("true", StringComparison.OrdinalIgnoreCase) == true ? "Activé" : "Désactivé")
+
+
+ break;
+ case "number":
+ case "int":
+ case "integer":
+ case "double":
+
+ break;
+ case "select":
+ case "dropdown":
+
+ @foreach (var opt in (setting.AllowedValues ?? "").Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
+ {
+ @opt
+ }
+
+ break;
+ default:
+
+ break;
+ }
+
+
+
+ @setting.UpdatedAt.ToString("g")
+
+
+
+ }
+
+
}
}
@@ -439,6 +447,42 @@ else
};
}
+ private static Color GetTypeColorEnum(string valueType) => valueType.ToLowerInvariant() switch
+ {
+ "boolean" or "bool" => Color.Success,
+ "number" or "int" or "integer" or "double" => Color.Info,
+ "select" or "dropdown" => Color.Warning,
+ _ => Color.Secondary
+ };
+
+ private static string GetTypeIcon(string valueType) => valueType.ToLowerInvariant() switch
+ {
+ "boolean" or "bool" => Icons.Material.Filled.ToggleOn,
+ "number" or "int" or "integer" or "double" => Icons.Material.Filled.Tag,
+ "select" or "dropdown" => Icons.Material.Filled.ArrowDropDownCircle,
+ _ => Icons.Material.Filled.TextFields
+ };
+
+ private static string GetCategoryIcon(string category) => category.ToLowerInvariant() switch
+ {
+ "general" or "general" => Icons.Material.Filled.Settings,
+ "detection" => Icons.Material.Filled.Visibility,
+ "recording" => Icons.Material.Filled.Videocam,
+ "logging" or "log" => Icons.Material.Filled.BugReport,
+ "network" => Icons.Material.Filled.Wifi,
+ "storage" => Icons.Material.Filled.Storage,
+ "notification" or "notifications" => Icons.Material.Filled.Notifications,
+ _ => Icons.Material.Filled.Folder
+ };
+
+ private static string HumanizeKey(string key)
+ {
+ var parts = key.Split('.', '_', '-');
+ return string.Join(' ', parts.Select(p => p.Length <= 2
+ ? p.ToUpperInvariant()
+ : char.ToUpperInvariant(p[0]) + p[1..]));
+ }
+
// ─── Create ───────────────────────────────────────────────────────
private async Task CreateSetting()
@@ -540,6 +584,39 @@ else
finally { _saving = false; }
}
+ // ─── Inline edit (table) ─────────────────────────────────────────
+
+ private async Task SaveInline(AppSettingItem setting, string value)
+ {
+ try
+ {
+ var result = await Api.UpdateSettingAsync(setting.Key, new UpdateAppSettingRequest(
+ value?.Trim() ?? "",
+ string.IsNullOrWhiteSpace(setting.Description) ? null : setting.Description.Trim(),
+ string.IsNullOrWhiteSpace(setting.Category) ? null : setting.Category.Trim(),
+ setting.ValueType,
+ string.IsNullOrWhiteSpace(setting.AllowedValues) ? null : setting.AllowedValues
+ ));
+ if (result.IsSuccessStatusCode)
+ {
+ Snackbar.Add($"« {setting.Key} » mis à jour — notifié aux agents", Severity.Success);
+ await LoadSettings();
+ }
+ else
+ {
+ var body = await result.Content.ReadAsStringAsync();
+ Snackbar.Add($"Erreur : {result.StatusCode} — {body}", Severity.Error);
+ }
+ }
+ catch (Exception ex)
+ {
+ Snackbar.Add($"Erreur : {ex.Message}", Severity.Error);
+ }
+ }
+
+ private async Task SaveBoolInline(AppSettingItem setting, bool value)
+ => await SaveInline(setting, value.ToString().ToLowerInvariant());
+
// ─── Delete ───────────────────────────────────────────────────────
private void ConfirmDelete(AppSettingItem setting)
diff --git a/src/Heimdall.Web/wwwroot/app.css b/src/Heimdall.Web/wwwroot/app.css
index cfaf707..8b402fd 100644
--- a/src/Heimdall.Web/wwwroot/app.css
+++ b/src/Heimdall.Web/wwwroot/app.css
@@ -306,6 +306,25 @@ code {
font-weight: 500 !important;
}
+.settings-card {
+ transition: box-shadow 0.2s ease, transform 0.15s ease;
+}
+
+.settings-card:hover {
+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
+ transform: translateY(-1px);
+}
+
+.settings-label {
+ line-height: 1.3;
+}
+
+.settings-key {
+ font-family: var(--mud-font-monospace), monospace;
+ font-size: 0.72rem;
+ opacity: 0.75;
+}
+
/* ═══════════════════════════════════════════════════════════════════
Empty states
═══════════════════════════════════════════════════════════════════ */
diff --git a/tests/Heimdall.Web.Tests/Components/Pages/SettingsPageTests.cs b/tests/Heimdall.Web.Tests/Components/Pages/SettingsPageTests.cs
index ca48428..9213ede 100644
--- a/tests/Heimdall.Web.Tests/Components/Pages/SettingsPageTests.cs
+++ b/tests/Heimdall.Web.Tests/Components/Pages/SettingsPageTests.cs
@@ -120,18 +120,14 @@ public class SettingsPageTests : PageTestBase
var cut = RenderPage();
cut.WaitForAssertion(() => cut.Markup.ShouldContain("log.level"));
- // Icon-buttons : [0]=refresh (header), [1]=edit, [2]=delete
- cut.FindAll("button.mud-icon-button")[1].Click();
- cut.WaitForAssertion(() => cut.Markup.ShouldContain("log.level"));
-
- cut.FindAll(".mud-dialog input")[0].Input("debug");
- cut.Find("form").Submit();
+ // Édition inline : le champ texte de la carte sauvegarde directement (pas de dialog)
+ cut.FindAll(".settings-card .mud-input input")[0].Change("debug");
cut.WaitForAssertion(() =>
{
var snackbar = Services.GetRequiredService();
snackbar.ShownSnackbars.Select(m => m.Message?.ToString() ?? "")
- .ShouldContain(m => m.Contains("Paramètre mis à jour", StringComparison.OrdinalIgnoreCase));
+ .ShouldContain(m => m.Contains("mis à jour", StringComparison.OrdinalIgnoreCase));
});
}
@@ -145,7 +141,8 @@ public class SettingsPageTests : PageTestBase
var cut = RenderPage();
cut.WaitForAssertion(() => cut.Markup.ShouldContain("log.level"));
- cut.FindAll("button.mud-icon-button")[2].Click();
+ // Icon-buttons : [0]=refresh (header), [1]=delete (carte)
+ cut.FindAll("button.mud-icon-button")[1].Click();
cut.WaitForAssertion(() => cut.Markup.ShouldContain("Confirmer la suppression"));
cut.FindAll("button").Single(b => b.TextContent.Trim() == "Supprimer").Click();