This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
button { padding: 8px 16px; cursor: pointer; border: none; border-radius: 4px; margin-right: 5px; margin-top: 5px; font-size: 14px; }
|
||||
.btn-subscribe { background: #007bff; color: white; }
|
||||
.btn-unsubscribe { background: #dc3545; color: white; }
|
||||
.btn-push { background: #28a745; color: white; }
|
||||
.status-ok { color: #28a745; font-size: 13px; }
|
||||
.status-warn { color: #dc3545; font-size: 13px; }
|
||||
hr { border: none; border-top: 1px solid #ccc; margin: 20px 0; }
|
||||
@@ -49,7 +50,6 @@ async function loadProjects() {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Cache setzen:
|
||||
subscribedNames.clear();
|
||||
data.projects.forEach(proj => subscribedNames.add(proj.name));
|
||||
|
||||
@@ -65,7 +65,6 @@ async function loadProjects() {
|
||||
const card = document.createElement("div");
|
||||
card.className = "project-card";
|
||||
|
||||
// ✅ NEU: Zeige Berechtigungs-Status!
|
||||
const writeStatus = proj.can_write ?
|
||||
'<span class="status-ok">✅ Schreibfrei</span>' :
|
||||
'<span class="status-warn">❌ Nur Lesen</span>';
|
||||
@@ -77,6 +76,7 @@ async function loadProjects() {
|
||||
</div>
|
||||
${proj.has_git ? '<span style="font-size:12px;color:#007bff;margin-top:5px;display:block">📦 Git Repository</span>' : ''}
|
||||
<div style="margin-top: 8px; font-size: 13px;">
|
||||
<button class="btn-push" onclick="pushProject('${proj.name}')">📤 Änderungen pushen</button>
|
||||
<button class="btn-unsubscribe" onclick="unsubscribe('${proj.name}')">🗑️ Deabonieren</button>
|
||||
<a href="${API_BASE}/projects/${proj.name}" target="_blank"><button class="btn-check">📁 Öffnen</button></a>
|
||||
</div>
|
||||
@@ -88,6 +88,30 @@ async function loadProjects() {
|
||||
return data.projects;
|
||||
}
|
||||
|
||||
async function pushProject(projectName) {
|
||||
const commitMsg = prompt("Commit-Nachricht:", "AI-bearbeitete Änderungen");
|
||||
if (!commitMsg) return; // Abgebrochen
|
||||
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/api/push/${projectName}`, {
|
||||
method: "POST",
|
||||
headers: {"Content-Type": "application/json"}
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
if (data.success) {
|
||||
alert(`✅ ${projectName} erfolgreich gepusht!\n\n${data.output || ''}`);
|
||||
loadProjects(); // Refresh
|
||||
} else {
|
||||
alert(`❌ Push fehlgeschlagen: ${data.error || 'Unbekannter Fehler'}`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
alert("❌ Verbindungsfehler beim Pushen");
|
||||
}
|
||||
}
|
||||
|
||||
async function unsubscribe(name) {
|
||||
if (!confirm(`Möchtest du '${name}' wirklich deabonnieren?\nDer komplette Ordner wird geloescht!`)) return;
|
||||
|
||||
@@ -107,7 +131,7 @@ async function unsubscribe(name) {
|
||||
}
|
||||
}
|
||||
|
||||
let allRepos = []; // Globaler Cache für Repositories
|
||||
let allRepos = [];
|
||||
|
||||
async function loadRepos() {
|
||||
try {
|
||||
@@ -132,7 +156,6 @@ async function loadRepos() {
|
||||
|
||||
titleEl.innerHTML = `Gitea Repositories (${allRepos.length})`;
|
||||
|
||||
// Sortiere: Abonnierte zuerst, dann nicht abonnierte
|
||||
const subscribed = allRepos.filter(r => subscribedNames.has(r.name));
|
||||
const notSubscribed = allRepos.filter(r => !subscribedNames.has(r.name));
|
||||
|
||||
@@ -167,7 +190,7 @@ function addRepoCard(repo, container) {
|
||||
}
|
||||
|
||||
async function subscribe(repo) {
|
||||
if (subscribedNames.has(repo.name)) return; // Schon abonniert!
|
||||
if (subscribedNames.has(repo.name)) return;
|
||||
|
||||
const target = prompt("Gewünschter Name (Standard: Repo-Name):") || repo.name;
|
||||
|
||||
@@ -187,8 +210,8 @@ async function subscribe(repo) {
|
||||
}
|
||||
}
|
||||
|
||||
// Starte beim Laden: ✅ MIT ABSOLUTEN URLS!
|
||||
loadProjects().then(() => loadRepos());</script>
|
||||
loadProjects().then(() => loadRepos());
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user