From 6b7df138ded2b57e40a3d7469d9528cc5afc4e76 Mon Sep 17 00:00:00 2001 From: Meleki Date: Sat, 28 Feb 2026 23:34:08 +0100 Subject: [PATCH] Git-Status: success-Property entfernt, Tooltips mit Datei-Info an Dashboard-Badges --- Endpoints/SessionEndpoint.cs | 10 +++++----- wwwroot/js/pages/dashboard.js | 24 +++++++++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Endpoints/SessionEndpoint.cs b/Endpoints/SessionEndpoint.cs index 34dfafc..b35952b 100644 --- a/Endpoints/SessionEndpoint.cs +++ b/Endpoints/SessionEndpoint.cs @@ -285,7 +285,7 @@ public static class SessionEndpoint if (string.IsNullOrEmpty(workingDir)) { ctx.Response.StatusCode = 400; - await ctx.Response.WriteAsJsonAsync(new { success = false, error = "Kein Workspace konfiguriert" }); + await ctx.Response.WriteAsJsonAsync(new { error = "Kein Workspace konfiguriert" }); return; } @@ -306,7 +306,7 @@ public static class SessionEndpoint if (proc == null) { ctx.Response.StatusCode = 500; - await ctx.Response.WriteAsJsonAsync(new { success = false, error = "Git-Prozess konnte nicht gestartet werden" }); + await ctx.Response.WriteAsJsonAsync(new { error = "Git-Prozess konnte nicht gestartet werden" }); return; } @@ -317,7 +317,7 @@ public static class SessionEndpoint if (proc.ExitCode != 0) { ctx.Response.StatusCode = 500; - await ctx.Response.WriteAsJsonAsync(new { success = false, error = stderr.Trim() }); + await ctx.Response.WriteAsJsonAsync(new { error = stderr.Trim() }); return; } @@ -386,12 +386,12 @@ public static class SessionEndpoint // Kein Remote oder kein Upstream – outgoing bleibt 0 } - await ctx.Response.WriteAsJsonAsync(new { success = true, add, edit, delete, outgoing }); + await ctx.Response.WriteAsJsonAsync(new { add, edit, delete, outgoing }); } catch (Exception ex) { ctx.Response.StatusCode = 500; - await ctx.Response.WriteAsJsonAsync(new { success = false, error = ex.Message }); + await ctx.Response.WriteAsJsonAsync(new { error = ex.Message }); } } } diff --git a/wwwroot/js/pages/dashboard.js b/wwwroot/js/pages/dashboard.js index 6f0b1b0..25f6c9a 100644 --- a/wwwroot/js/pages/dashboard.js +++ b/wwwroot/js/pages/dashboard.js @@ -40,7 +40,7 @@ registerPage('dashboard', { // Git-Status asynchron laden if (s.workspace) { apiGitStatus(s.sessionId).then(status => { - if (!status || !status.success) return; + if (!status || status.error) return; const addCount = (status.add || []).length; const editCount = (status.edit || []).length; const deleteCount = (status.delete || []).length; @@ -51,13 +51,27 @@ registerPage('dashboard', { if (!metaEl) return; const parts = []; - if (addCount > 0) parts.push(`+${addCount}`); - if (editCount > 0) parts.push(`~${editCount}`); - if (deleteCount > 0) parts.push(`-${deleteCount}`); - if (outgoing > 0) parts.push(` ${outgoing}`); + const tooltipParts = []; + if (addCount > 0) { + parts.push(`+${addCount}`); + tooltipParts.push(`${addCount} ${addCount === 1 ? 'Datei' : 'Dateien'} hinzugefügt`); + } + if (editCount > 0) { + parts.push(`~${editCount}`); + tooltipParts.push(`${editCount} ${editCount === 1 ? 'Datei' : 'Dateien'} geändert`); + } + if (deleteCount > 0) { + parts.push(`-${deleteCount}`); + tooltipParts.push(`${deleteCount} ${deleteCount === 1 ? 'Datei' : 'Dateien'} gelöscht`); + } + if (outgoing > 0) { + parts.push(` ${outgoing}`); + tooltipParts.push(`${outgoing} ${outgoing === 1 ? 'Commit muss' : 'Commits müssen'} noch gepusht werden`); + } const gitEl = document.createElement('span'); gitEl.className = 'card-meta-item card-git-status'; + gitEl.title = tooltipParts.join('\n'); gitEl.innerHTML = ` ${parts.join(' ')}`; metaEl.appendChild(gitEl); });