Add NAS dashboard MVP: Docker mgmt, Gitea, Files, Terminal
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<script>
|
||||
import { get } from "../lib/api.js";
|
||||
let repos = $state([]);
|
||||
let commits = $state([]);
|
||||
let selectedRepo = $state("");
|
||||
async function load() { const data = await get("/gitea/repos"); repos = data?.data || []; }
|
||||
async function showCommits(owner, repo) {
|
||||
selectedRepo = `${owner}/${repo}`;
|
||||
const data = await get(`/gitea/repos/${owner}/${repo}/commits`);
|
||||
commits = Array.isArray(data) ? data : [];
|
||||
}
|
||||
load();
|
||||
</script>
|
||||
|
||||
<h2 class="text-2xl font-bold mb-6">Gitea Repos</h2>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
{#each repos as r}
|
||||
<button class="border rounded-lg p-4 text-left hover:bg-gray-50" onclick={() => showCommits(r.owner?.login, r.name)}>
|
||||
<span class="font-medium">{r.full_name}</span>
|
||||
<p class="text-xs text-gray-400 mt-1">{r.description || "No description"}</p>
|
||||
<p class="text-xs text-gray-400">Updated {new Date(r.updated_at).toLocaleDateString()}</p>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
{#if selectedRepo}
|
||||
<div class="mt-6">
|
||||
<h3 class="font-semibold mb-3">Commits: {selectedRepo}</h3>
|
||||
<div class="space-y-2">
|
||||
{#each commits.slice(0, 20) as c}
|
||||
<div class="border-b pb-2">
|
||||
<p class="text-sm">{c.commit?.message?.split("\n")[0]}</p>
|
||||
<p class="text-xs text-gray-400">{c.commit?.author?.name} - {new Date(c.commit?.author?.date).toLocaleString()}</p>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user