Git-Status: success-Property entfernt, Tooltips mit Datei-Info an Dashboard-Badges

This commit is contained in:
Meleki committed 2026-02-28 23:34:08 +01:00
1 parent ac150af4c5
commit 6b7df138de
2 files changed
+24 -10

No files matched your search

+5 -5
View File
@@ -285,7 +285,7 @@ public static class SessionEndpoint
if (string.IsNullOrEmpty(workingDir)) if (string.IsNullOrEmpty(workingDir))
{ {
ctx.Response.StatusCode = 400; 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; return;
} }
@@ -306,7 +306,7 @@ public static class SessionEndpoint
if (proc == null) if (proc == null)
{ {
ctx.Response.StatusCode = 500; 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; return;
} }
@@ -317,7 +317,7 @@ public static class SessionEndpoint
if (proc.ExitCode != 0) if (proc.ExitCode != 0)
{ {
ctx.Response.StatusCode = 500; ctx.Response.StatusCode = 500;
await ctx.Response.WriteAsJsonAsync(new { success = false, error = stderr.Trim() }); await ctx.Response.WriteAsJsonAsync(new { error = stderr.Trim() });
return; return;
} }
@@ -386,12 +386,12 @@ public static class SessionEndpoint
// Kein Remote oder kein Upstream – outgoing bleibt 0 // 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) catch (Exception ex)
{ {
ctx.Response.StatusCode = 500; ctx.Response.StatusCode = 500;
await ctx.Response.WriteAsJsonAsync(new { success = false, error = ex.Message }); await ctx.Response.WriteAsJsonAsync(new { error = ex.Message });
} }
} }
} }
+19 -5
View File
@@ -40,7 +40,7 @@ registerPage('dashboard', {
// Git-Status asynchron laden // Git-Status asynchron laden
if (s.workspace) { if (s.workspace) {
apiGitStatus(s.sessionId).then(status => { apiGitStatus(s.sessionId).then(status => {
if (!status || !status.success) return; if (!status || status.error) return;
const addCount = (status.add || []).length; const addCount = (status.add || []).length;
const editCount = (status.edit || []).length; const editCount = (status.edit || []).length;
const deleteCount = (status.delete || []).length; const deleteCount = (status.delete || []).length;
@@ -51,13 +51,27 @@ registerPage('dashboard', {
if (!metaEl) return; if (!metaEl) return;
const parts = []; const parts = [];
if (addCount > 0) parts.push(`<span class="git-badge git-add">+${addCount}</span>`); const tooltipParts = [];
if (editCount > 0) parts.push(`<span class="git-badge git-edit">~${editCount}</span>`); if (addCount > 0) {
if (deleteCount > 0) parts.push(`<span class="git-badge git-delete">-${deleteCount}</span>`); parts.push(`<span class="git-badge git-add">+${addCount}</span>`);
if (outgoing > 0) parts.push(`<span class="git-badge git-outgoing"><i class="fa fa-arrow-up"></i> ${outgoing}</span>`); tooltipParts.push(`${addCount} ${addCount === 1 ? 'Datei' : 'Dateien'} hinzugefügt`);
}
if (editCount > 0) {
parts.push(`<span class="git-badge git-edit">~${editCount}</span>`);
tooltipParts.push(`${editCount} ${editCount === 1 ? 'Datei' : 'Dateien'} geändert`);
}
if (deleteCount > 0) {
parts.push(`<span class="git-badge git-delete">-${deleteCount}</span>`);
tooltipParts.push(`${deleteCount} ${deleteCount === 1 ? 'Datei' : 'Dateien'} gelöscht`);
}
if (outgoing > 0) {
parts.push(`<span class="git-badge git-outgoing"><i class="fa fa-arrow-up"></i> ${outgoing}</span>`);
tooltipParts.push(`${outgoing} ${outgoing === 1 ? 'Commit muss' : 'Commits müssen'} noch gepusht werden`);
}
const gitEl = document.createElement('span'); const gitEl = document.createElement('span');
gitEl.className = 'card-meta-item card-git-status'; gitEl.className = 'card-meta-item card-git-status';
gitEl.title = tooltipParts.join('\n');
gitEl.innerHTML = `<i class="fa fa-code-fork"></i> ${parts.join(' ')}`; gitEl.innerHTML = `<i class="fa fa-code-fork"></i> ${parts.join(' ')}`;
metaEl.appendChild(gitEl); metaEl.appendChild(gitEl);
}); });