Commit-Ausblendung (für UI) implementiert
Dieser Commit ist enthalten in:
committet von
Claude Project Manager
Ursprung
dad07c7879
Commit
50da44aabc
@ -19,6 +19,7 @@ class GiteaManager {
|
||||
this.initialized = false;
|
||||
this.refreshInterval = null;
|
||||
this.isLoading = false;
|
||||
this.hiddenCommits = new Set(); // Ausgeblendete Commits
|
||||
}
|
||||
|
||||
async init() {
|
||||
@ -79,6 +80,10 @@ class GiteaManager {
|
||||
// Branch umbenennen
|
||||
$('#btn-rename-branch')?.addEventListener('click', () => this.openRenameBranchModal());
|
||||
$('#git-rename-branch-form')?.addEventListener('submit', (e) => this.executeRenameBranch(e));
|
||||
|
||||
// Commits ausblenden
|
||||
$('#btn-clear-commits')?.addEventListener('click', () => this.clearAllCommits());
|
||||
$('#git-commits-list')?.addEventListener('click', (e) => this.handleCommitListClick(e));
|
||||
}
|
||||
|
||||
subscribeToStore() {
|
||||
@ -775,24 +780,73 @@ class GiteaManager {
|
||||
|
||||
renderCommits() {
|
||||
const listEl = $('#git-commits-list');
|
||||
const clearBtn = $('#btn-clear-commits');
|
||||
if (!listEl) return;
|
||||
|
||||
if (this.commits.length === 0) {
|
||||
listEl.innerHTML = '<div class="gitea-empty-state" style="padding: var(--spacing-4);"><p>Keine Commits gefunden</p></div>';
|
||||
// Filtern: Ausgeblendete Commits nicht anzeigen
|
||||
const visibleCommits = this.commits.filter(commit => {
|
||||
const hash = commit.hash || commit.sha || commit.shortHash;
|
||||
return !this.hiddenCommits.has(hash);
|
||||
});
|
||||
|
||||
// Button-Text anpassen
|
||||
if (clearBtn) {
|
||||
clearBtn.style.display = visibleCommits.length > 0 ? '' : 'none';
|
||||
}
|
||||
|
||||
if (visibleCommits.length === 0) {
|
||||
const message = this.commits.length > 0
|
||||
? 'Alle Commits ausgeblendet'
|
||||
: 'Keine Commits gefunden';
|
||||
listEl.innerHTML = `<div class="gitea-empty-state" style="padding: var(--spacing-4);"><p>${message}</p></div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
listEl.innerHTML = this.commits.map(commit => `
|
||||
<div class="commit-item">
|
||||
<span class="commit-hash">${escapeHtml(commit.shortHash || commit.sha?.substring(0, 7))}</span>
|
||||
listEl.innerHTML = visibleCommits.map(commit => {
|
||||
const hash = commit.hash || commit.sha || '';
|
||||
const shortHash = commit.shortHash || hash.substring(0, 7);
|
||||
return `
|
||||
<div class="commit-item" data-hash="${escapeHtml(hash)}">
|
||||
<span class="commit-hash">${escapeHtml(shortHash)}</span>
|
||||
<div class="commit-info">
|
||||
<div class="commit-message">${escapeHtml(commit.message?.split('\n')[0] || '')}</div>
|
||||
<div class="commit-meta">
|
||||
<span class="author">${escapeHtml(commit.author)}</span> · ${this.formatDate(commit.date)}
|
||||
</div>
|
||||
</div>
|
||||
<button class="commit-delete" title="Ausblenden" data-hash="${escapeHtml(hash)}">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16"><path d="M18 6L6 18M6 6l12 12" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
`).join('');
|
||||
`}).join('');
|
||||
}
|
||||
|
||||
handleCommitListClick(e) {
|
||||
const deleteBtn = e.target.closest('.commit-delete');
|
||||
if (deleteBtn) {
|
||||
const hash = deleteBtn.dataset.hash;
|
||||
if (hash) {
|
||||
this.hideCommit(hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hideCommit(hash) {
|
||||
this.hiddenCommits.add(hash);
|
||||
this.renderCommits();
|
||||
this.showToast('Commit ausgeblendet', 'info');
|
||||
}
|
||||
|
||||
clearAllCommits() {
|
||||
// Alle sichtbaren Commits ausblenden
|
||||
this.commits.forEach(commit => {
|
||||
const hash = commit.hash || commit.sha || commit.shortHash;
|
||||
if (hash) {
|
||||
this.hiddenCommits.add(hash);
|
||||
}
|
||||
});
|
||||
this.renderCommits();
|
||||
this.showToast('Alle Commits ausgeblendet', 'info');
|
||||
}
|
||||
|
||||
renderChanges() {
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren