ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
redesign(git): migrate Git page to Domains-style layout
Juan Denis5e54a691f559
diff --git a/frontend/src/pages/Git.jsx b/frontend/src/pages/Git.jsxindex e8406576..062e2071 100644--- a/frontend/src/pages/Git.jsx+++ b/frontend/src/pages/Git.jsx@@ -6,22 +6,35 @@ import Spinner from '../components/Spinner';import ConfirmDialog from '../components/ConfirmDialog';import { DangerZone } from '../components/DangerZone';import EmptyState from '../components/EmptyState';-import { Pill, MetricCard, PageTopbar } from '../components/ds';-import { AlertCircle, FolderGit2, Webhook, Rocket, Server, Globe, Terminal, Tag, X, GitBranch } from 'lucide-react';+import { Pill, MetricCard, PageTopbar, SegControl, Drawer } from '../components/ds';+import {+ AlertCircle, FolderGit2, Webhook, Rocket, Server, Globe, Terminal, Tag,+ X, GitBranch, RefreshCw, Plus, ExternalLink, Lock, Trash2, ChevronRight,+ Clock, AlertTriangle,+} from 'lucide-react';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Textarea } from '@/components/ui/textarea';-import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';+import { Label } from '@/components/ui/label';const VALID_TABS = ['overview', 'repositories', 'access', 'webhooks', 'deployments', 'settings'];+const TAB_OPTIONS = [+ { value: 'overview', label: 'Overview' },+ { value: 'repositories', label: 'Repositories' },+ { value: 'webhooks', label: 'Webhooks' },+ { value: 'deployments', label: 'Deployments' },+ { value: 'access', label: 'Access' },+ { value: 'settings', label: 'Settings' },+];-// Brand initials for the webhook source tiles (brand colors live in _git.scss)const SOURCE_INITIALS = { github: 'GH', gitlab: 'GL', bitbucket: 'BB' };function Git({ basePath = '/git' }) {const [status, setStatus] = useState(null);const [loading, setLoading] = useState(true);const [activeTab, setActiveTab] = useTabParam(basePath, VALID_TABS);+ const [pageError, setPageError] = useState('');+const [showInstallModal, setShowInstallModal] = useState(false);const [actionLoading, setActionLoading] = useState(false);const [confirmDialog, setConfirmDialog] = useState(null);@@ -30,11 +43,14 @@ function Git({ basePath = '/git' }) {adminEmail: '',adminPassword: ''});+// Webhook stateconst [webhooks, setWebhooks] = useState([]);const [webhooksLoading, setWebhooksLoading] = useState(false);const [showWebhookModal, setShowWebhookModal] = useState(false);- const [selectedWebhook, setSelectedWebhook] = useState(null);+ const [drawerWebhook, setDrawerWebhook] = useState(null);+ const [webhookFilter, setWebhookFilter] = useState('all');+ const [webhookDeployments, setWebhookDeployments] = useState([]);const [webhookForm, setWebhookForm] = useState({name: '',source: 'github',@@ -43,12 +59,11 @@ function Git({ basePath = '/git' }) {localRepoName: '',syncDirection: 'pull',autoSync: true,- // Deployment settingsappId: '',deployOnPush: false,preDeployScript: '',postDeployScript: '',- zeroDowntime: false+ zeroDowntime: false,});const [webhookSecret, setWebhookSecret] = useState(null);@@ -56,21 +71,24 @@ function Git({ basePath = '/git' }) {const [repositories, setRepositories] = useState([]);const [reposLoading, setReposLoading] = useState(false);const [selectedRepo, setSelectedRepo] = useState(null);- const [repoView, setRepoView] = useState('list'); // 'list', 'detail'+ const [drawerRepo, setDrawerRepo] = useState(null);const [branches, setBranches] = useState([]);const [commits, setCommits] = useState([]);const [selectedBranch, setSelectedBranch] = useState(null);const [files, setFiles] = useState([]);const [currentPath, setCurrentPath] = useState('');- const [repoDetailTab, setRepoDetailTab] = useState('files'); // 'files', 'commits', 'branches'+ const [repoDetailTab, setRepoDetailTab] = useState('files');+ const [repoFilter, setRepoFilter] = useState('all');// Deployment stateconst [applications, setApplications] = useState([]);const [deployments, setDeployments] = useState([]);const [deploymentsLoading, setDeploymentsLoading] = useState(false);const [selectedDeployment, setSelectedDeployment] = useState(null);+ const [drawerDeployment, setDrawerDeployment] = useState(null);const [showDeploymentLogs, setShowDeploymentLogs] = useState(false);const [deployingAppId, setDeployingAppId] = useState(null);+ const [deploymentFilter, setDeploymentFilter] = useState('all');const toast = useToast();@@ -92,6 +110,12 @@ function Git({ basePath = '/git' }) {}}, [activeTab, status?.installed, status?.running]);+ useEffect(() => {+ if (drawerWebhook?.id) {+ loadWebhookDeployments(drawerWebhook.id).then(setWebhookDeployments);+ }+ }, [drawerWebhook]);+const loadData = async () => {setLoading(true);try {@@ -125,12 +149,20 @@ function Git({ basePath = '/git' }) {}};+ const loadApplications = async () => {+ try {+ const data = await api.getApps();+ setApplications(data.apps || []);+ } catch (error) {+ console.error('Failed to load applications:', error);+ }+ };+const handleCreateWebhook = async () => {if (!webhookForm.name || !webhookForm.sourceRepoUrl) {toast.error('Name and repository URL are required');return;}-setActionLoading(true);try {const result = await api.createWebhook(webhookForm);@@ -139,18 +171,9 @@ function Git({ basePath = '/git' }) {setWebhookSecret(result.secret);setShowWebhookModal(false);setWebhookForm({- name: '',- source: 'github',- sourceRepoUrl: '',- sourceBranch: 'main',- localRepoName: '',- syncDirection: 'pull',- autoSync: true,- appId: '',- deployOnPush: false,- preDeployScript: '',- postDeployScript: '',- zeroDowntime: false+ name: '', source: 'github', sourceRepoUrl: '', sourceBranch: 'main',+ localRepoName: '', syncDirection: 'pull', autoSync: true, appId: '',+ deployOnPush: false, preDeployScript: '', postDeployScript: '', zeroDowntime: false,});await loadWebhooks();} else {@@ -178,6 +201,7 @@ function Git({ basePath = '/git' }) {toast.error(`Failed to delete: ${error.message}`);} finally {setConfirmDialog(null);+ setDrawerWebhook(null);}},onCancel: () => setConfirmDialog(null)@@ -190,6 +214,10 @@ function Git({ basePath = '/git' }) {if (result.success) {toast.success(result.message);await loadWebhooks();+ if (drawerWebhook?.id === webhookId) {+ const updated = webhooks.find(w => w.id === webhookId);+ if (updated) setDrawerWebhook(updated);+ }}} catch (error) {toast.error(`Failed to toggle webhook: ${error.message}`);@@ -199,11 +227,8 @@ function Git({ basePath = '/git' }) {const handleTestWebhook = async (webhookId) => {try {const result = await api.testWebhook(webhookId);- if (result.success) {- toast.success('Test event logged');- } else {- toast.error(result.error || 'Test failed');- }+ if (result.success) toast.success('Test event logged');+ else toast.error(result.error || 'Test failed');} catch (error) {toast.error(`Test failed: ${error.message}`);}@@ -232,43 +257,36 @@ function Git({ basePath = '/git' }) {}};- const selectRepository = async (repo) => {+ const openRepoDrawer = async (repo) => {+ setDrawerRepo(repo);setSelectedRepo(repo);- setRepoView('detail');+ setRepoViewState(repo);+ };++ const setRepoViewState = (repo) => {setCurrentPath('');setSelectedBranch(repo.default_branch);setRepoDetailTab('files');-- // Load branches, commits, and files- try {- const [branchesData, commitsData, filesData] = await Promise.all([- api.getBranches(repo.owner.login, repo.name),- api.getCommits(repo.owner.login, repo.name, repo.default_branch),- api.getRepoFiles(repo.owner.login, repo.name, repo.default_branch)- ]);-+ Promise.all([+ api.getBranches(repo.owner.login, repo.name),+ api.getCommits(repo.owner.login, repo.name, repo.default_branch),+ api.getRepoFiles(repo.owner.login, repo.name, repo.default_branch)+ ]).then(([branchesData, commitsData, filesData]) => {setBranches(branchesData.branches || []);setCommits(commitsData.commits || []);setFiles(filesData.files || []);- } catch (error) {- console.error('Failed to load repo details:', error);+ }).catch(() => {toast.error('Failed to load repository details');- }+ });};const navigateToPath = async (path) => {if (!selectedRepo) return;-try {- const data = await api.getRepoFiles(- selectedRepo.owner.login,- selectedRepo.name,- selectedBranch,- path- );+ const data = await api.getRepoFiles(selectedRepo.owner.login, selectedRepo.name, selectedBranch, path);setFiles(data.files || []);setCurrentPath(path);- } catch (error) {+ } catch {toast.error('Failed to load directory');}};@@ -282,80 +300,44 @@ function Git({ basePath = '/git' }) {const changeBranch = async (branchName) => {if (!selectedRepo) return;-setSelectedBranch(branchName);setCurrentPath('');-try {const [commitsData, filesData] = await Promise.all([api.getCommits(selectedRepo.owner.login, selectedRepo.name, branchName),api.getRepoFiles(selectedRepo.owner.login, selectedRepo.name, branchName)]);-setCommits(commitsData.commits || []);setFiles(filesData.files || []);- } catch (error) {+ } catch {toast.error('Failed to switch branch');}};const loadMoreCommits = async () => {if (!selectedRepo) return;-const currentPage = Math.ceil(commits.length / 30) + 1;try {- const data = await api.getCommits(- selectedRepo.owner.login,- selectedRepo.name,- selectedBranch,- currentPage- );- if (data.commits?.length) {- setCommits([...commits, ...data.commits]);- }- } catch (error) {+ const data = await api.getCommits(selectedRepo.owner.login, selectedRepo.name, selectedBranch, currentPage);+ if (data.commits?.length) setCommits([...commits, ...data.commits]);+ } catch {toast.error('Failed to load more commits');}};- const backToRepoList = () => {- setSelectedRepo(null);- setRepoView('list');- setBranches([]);- setCommits([]);- setFiles([]);- setCurrentPath('');- };-// Deployment functions- const loadApplications = async () => {- try {- const data = await api.getApps();- setApplications(data.apps || []);- } catch (error) {- console.error('Failed to load applications:', error);- }- };-const loadAllDeployments = async () => {setDeploymentsLoading(true);try {- // Load deployments for all webhooks that have deploy_on_push enabledconst webhooksData = await api.getWebhooks();const webhooksWithDeploy = (webhooksData.webhooks || []).filter(w => w.deploy_on_push && w.app_id);-let allDeployments = [];for (const webhook of webhooksWithDeploy) {const data = await api.getWebhookDeployments(webhook.id, 10);if (data.deployments) {- allDeployments = [...allDeployments, ...data.deployments.map(d => ({- ...d,- webhook_name: webhook.name- }))];+ allDeployments = [...allDeployments, ...data.deployments.map(d => ({ ...d, webhook_name: webhook.name }))];}}-- // Sort by created_at descendingallDeployments.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));setDeployments(allDeployments);} catch (error) {@@ -395,7 +377,7 @@ function Git({ basePath = '/git' }) {const handleRollback = async (appId, targetVersion) => {setConfirmDialog({title: 'Rollback Deployment',- message: `Are you sure you want to rollback to version ${targetVersion}? This will restart the application with the previous code.`,+ message: `Rollback to version ${targetVersion}? This will restart the application with the previous code.`,confirmText: 'Rollback',variant: 'warning',onConfirm: async () => {@@ -431,7 +413,6 @@ function Git({ basePath = '/git' }) {}};- // Maps a deployment status to a Pill / dot tone.const getStatusColor = (status) => {switch (status) {case 'success': return 'green';@@ -454,12 +435,10 @@ function Git({ basePath = '/git' }) {const date = new Date(dateString);const now = new Date();const diff = now - date;-if (diff < 60000) return 'just now';if (diff < 3600000) return `${Math.floor(diff / 60000)}m ago`;if (diff < 86400000) return `${Math.floor(diff / 3600000)}h ago`;if (diff < 604800000) return `${Math.floor(diff / 86400000)}d ago`;-return date.toLocaleDateString();};@@ -468,7 +447,6 @@ function Git({ basePath = '/git' }) {toast.error('Admin email is required');return;}-setActionLoading(true);try {const result = await api.installGit(installForm);@@ -492,7 +470,7 @@ function Git({ basePath = '/git' }) {const handleUninstall = async () => {setConfirmDialog({title: 'Uninstall Git Server',- message: 'Are you sure you want to uninstall the Git server? This will stop the Gitea container but preserve your data.',+ message: 'Uninstall the Gitea server? This will stop the container but preserve your data.',confirmText: 'Uninstall',variant: 'danger',onConfirm: async () => {@@ -528,7 +506,7 @@ function Git({ basePath = '/git' }) {const handleStop = async () => {setConfirmDialog({title: 'Stop Git Server',- message: 'Are you sure you want to stop the Git server?',+ message: 'Stop the Git server?',confirmText: 'Stop',variant: 'warning',onConfirm: async () => {@@ -549,7 +527,6 @@ function Git({ basePath = '/git' }) {};const openGitea = () => {- // Use slug-based URL (/gitea) if available, fallback to portif (status?.url_path) {window.open(`${window.location.origin}${status.url_path}`, '_blank');} else if (status?.http_port) {@@ -558,81 +535,522 @@ function Git({ basePath = '/git' }) {};const getGiteaUrl = () => {- if (status?.url_path) {- return `${window.location.origin}${status.url_path}`;- }+ if (status?.url_path) return `${window.location.origin}${status.url_path}`;return `http://${window.location.hostname}:${status?.http_port}`;};- if (loading) {+ const getAppName = (appId) => {+ const app = applications.find(a => String(a.id) === String(appId));+ return app ? app.name : 'Unknown';+ };++ // ── Filters ───────────────────────────────────────────────+ const filteredRepos = repositories.filter(repo => {+ if (repoFilter === 'private') return repo.private;+ if (repoFilter === 'forks') return repo.fork;+ return true;+ });++ const filteredWebhooks = webhooks.filter(w => {+ if (webhookFilter === 'active') return w.is_active;+ if (webhookFilter === 'inactive') return !w.is_active;+ return true;+ });++ const filteredDeployments = deployments.filter(d => {+ if (deploymentFilter === 'all') return true;+ return d.status === deploymentFilter;+ });++ // ── KPIs ──────────────────────────────────────────────────+ const repoPrivateCount = repositories.filter(r => r.private).length;+ const repoForkCount = repositories.filter(r => r.fork).length;+ const repoUpdatedCount = repositories.filter(r => {+ if (!r.updated_at) return false;+ return (Date.now() - new Date(r.updated_at).getTime()) < 86400000 * 7;+ }).length;++ const webhookActiveCount = webhooks.filter(w => w.is_active).length;+ const webhookInactiveCount = webhooks.filter(w => !w.is_active).length;+ const webhookDeployCount = webhooks.filter(w => w.deploy_on_push).length;++ const deploymentSuccessCount = deployments.filter(d => d.status === 'success').length;+ const deploymentFailedCount = deployments.filter(d => d.status === 'failed').length;+ const deploymentRunningCount = deployments.filter(d => d.status === 'running').length;++ const renderKpis = () => {+ switch (activeTab) {+ case 'overview':+ return (+ <div className="dom-kpis">+ <MetricCard tone={status?.running ? 'green' : 'red'} icon={<Server size={16} />} value={status?.running ? 'Running' : 'Stopped'} label="Server status" />+ <MetricCard tone="accent" icon={<Globe size={16} />} value={status?.url_path || '/gitea'} label="URL path" />+ <MetricCard tone="cyan" icon={<Terminal size={16} />} value={status?.ssh_port || 'N/A'} label="SSH port" />+ <MetricCard tone="violet" icon={<Tag size={16} />} value={status?.version || 'Unknown'} label="Gitea version" />+ </div>+ );+ case 'repositories':+ return (+ <div className="dom-kpis">+ <MetricCard tone="accent" icon={<FolderGit2 size={16} />} value={repositories.length} label="Repositories" />+ <MetricCard tone="amber" icon={<Lock size={16} />} value={repoPrivateCount} label="Private" />+ <MetricCard tone="cyan" icon={<GitBranch size={16} />} value={repoForkCount} label="Forks" />+ <MetricCard tone="green" icon={<Clock size={16} />} value={repoUpdatedCount} label="Updated ≤7d" />+ </div>+ );+ case 'webhooks':+ return (+ <div className="dom-kpis">+ <MetricCard tone="accent" icon={<Webhook size={16} />} value={webhooks.length} label="Webhooks" />+ <MetricCard tone="green" icon={<Server size={16} />} value={webhookActiveCount} label="Active" />+ <MetricCard tone="gray" icon={<AlertCircle size={16} />} value={webhookInactiveCount} label="Inactive" />+ <MetricCard tone="cyan" icon={<Rocket size={16} />} value={webhookDeployCount} label="Deploy on push" />+ </div>+ );+ case 'deployments':+ return (+ <div className="dom-kpis">+ <MetricCard tone="accent" icon={<Rocket size={16} />} value={deployments.length} label="Deployments" />+ <MetricCard tone="green" icon={<Server size={16} />} value={deploymentSuccessCount} label="Success" />+ <MetricCard tone="red" icon={<AlertTriangle size={16} />} value={deploymentFailedCount} label="Failed" />+ <MetricCard tone="amber" icon={<Clock size={16} />} value={deploymentRunningCount} label="Running" />+ </div>+ );+ default:+ return null;+ }+ };++ // ── Tab content ───────────────────────────────────────────+ const renderOverview = () => (+ <>+ <div className="dom-listhead">+ <h2 className="dom-listhead__title">Server overview</h2>+ </div>+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">HTTP URL</div>+ <div className="sk-spec-card__value" style={{ fontSize: 13 }}>{status?.running ? getGiteaUrl() : 'Server not running'}</div>+ <div className="sk-spec-card__sub">Web interface</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">SSH Clone URL</div>+ <div className="sk-spec-card__value" style={{ fontSize: 13 }}>ssh://git@{window.location.hostname}:{status?.ssh_port}/user/repo.git</div>+ <div className="sk-spec-card__sub">Use your SSH key</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Quick actions</div>+ <div className="git-quick-actions" style={{ marginTop: 8 }}>+ <Button variant="outline" size="sm" onClick={openGitea} disabled={!status?.running}>Open Gitea</Button>+ <Button variant="outline" size="sm" onClick={() => { navigator.clipboard.writeText(`git clone ssh://git@${window.location.hostname}:${status?.ssh_port}/user/repo.git`); toast.success('SSH URL copied'); }}>+ Copy SSH URL+ </Button>+ </div>+ <div className="sk-spec-card__sub">Access repositories</div>+ </div>+ </div>+ </>+ );++ const renderRepositories = () => {+ if (!status?.running) {+ return (+ <EmptyState+ icon={AlertCircle}+ title="Server not running"+ description="Start the Git server to browse repositories."+ action={<Button onClick={handleStart}>Start Server</Button>}+ />+ );+ }+ if (reposLoading) return <div className="loading-state"><Spinner /></div>;+ if (repositories.length === 0) {+ return (+ <EmptyState+ icon={FolderGit2}+ title="No repositories yet"+ description="Create your first repository in Gitea."+ action={<Button onClick={openGitea}>Open Gitea</Button>}+ />+ );+ }+ return (+ <>+ <div className="dom-listhead">+ <h2 className="dom-listhead__title">Repositories</h2>+ <SegControl+ value={repoFilter}+ onChange={setRepoFilter}+ options={[+ { value: 'all', label: 'All', count: repositories.length },+ { value: 'private', label: 'Private', count: repoPrivateCount },+ { value: 'forks', label: 'Forks', count: repoForkCount },+ ]}+ />+ </div>+ {filteredRepos.length === 0 ? (+ <div className="dom-empty">No repositories match this filter.</div>+ ) : (+ <div className="dom-card">+ <table className="sk-dtable git-repos-table">+ <thead>+ <tr>+ <th>Repository</th>+ <th>Branch</th>+ <th>Stars</th>+ <th>Forks</th>+ <th>Updated</th>+ <th style={{ width: 30 }} />+ </tr>+ </thead>+ <tbody>+ {filteredRepos.map(repo => (+ <tr key={repo.id} className="is-clickable" onClick={() => openRepoDrawer(repo)}>+ <td>+ <div className="sk-cell-name">+ <span className="dom-fav git-repo-ico">+ {repo.private ? (+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>+ ) : (+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2"><circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/></svg>+ )}+ </span>+ <div className="git-repocell">+ <div className="git-reponame">+ <span className="own">{repo.owner.login}/</span>{repo.name}+ {repo.private && <span className="git-chip git-chip--amber">private</span>}+ {repo.fork && <span className="git-chip git-chip--cyan">fork</span>}+ </div>+ {repo.description && <div className="sk-cell-sub git-repo-desc">{repo.description}</div>}+ </div>+ </div>+ </td>+ <td>+ <span className="git-branch-chip">+ <svg viewBox="0 0 24 24" width="11" height="11" stroke="currentColor" fill="none" strokeWidth="2"><line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/></svg>+ {repo.default_branch}+ </span>+ </td>+ <td className="sk-cell-mono">{repo.stars}</td>+ <td className="sk-cell-mono">{repo.forks}</td>+ <td className="sk-cell-mono">{formatDate(repo.updated_at)}</td>+ <td><ChevronRight size={16} className="dom-chev" /></td>+ </tr>+ ))}+ </tbody>+ </table>+ </div>+ )}+ </>+ );+ };++ const renderAccess = () => (+ <>+ <div className="dom-listhead">+ <h2 className="dom-listhead__title">Access information</h2>+ </div>+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">HTTP Access</div>+ <div className="sk-spec-card__value" style={{ fontSize: 13 }}>{getGiteaUrl()}</div>+ <div className="sk-spec-card__sub">Web browser access</div>+ <div className="git-quick-actions" style={{ marginTop: 12 }}>+ <Button variant="outline" size="sm" onClick={() => { navigator.clipboard.writeText(getGiteaUrl()); toast.success('URL copied'); }}>Copy URL</Button>+ <Button variant="outline" size="sm" onClick={openGitea} disabled={!status?.running}>Open Gitea</Button>+ </div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">SSH Access</div>+ <div className="sk-spec-card__value" style={{ fontSize: 13 }}>ssh://git@{window.location.hostname}:{status?.ssh_port}/username/repo.git</div>+ <div className="sk-spec-card__sub">Clone repositories via SSH</div>+ <div className="git-quick-actions" style={{ marginTop: 12 }}>+ <Button variant="outline" size="sm" onClick={() => { navigator.clipboard.writeText(`ssh://git@${window.location.hostname}:${status?.ssh_port}/username/repo.git`); toast.success('SSH URL copied'); }}>Copy SSH URL</Button>+ </div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">SSH key requirement</div>+ <div className="sk-spec-card__value" style={{ fontSize: 13 }}>Add your public key in Gitea</div>+ <div className="sk-spec-card__sub">Required for SSH clone/push</div>+ </div>+ </div>+ </>+ );++ const renderWebhooks = () => {+ if (webhooksLoading) return <div className="loading-state"><Spinner /></div>;+ if (webhooks.length === 0) {+ return (+ <EmptyState+ icon={Webhook}+ title="No webhooks configured"+ description="Add a webhook to sync repositories from external sources."+ action={<Button onClick={() => setShowWebhookModal(true)}>Add Webhook</Button>}+ />+ );+ }return (- <div className="page-container git-page">- <div className="page-loading">- <Spinner size="lg" />+ <>+ <div className="dom-listhead">+ <h2 className="dom-listhead__title">External repository webhooks</h2>+ <SegControl+ value={webhookFilter}+ onChange={setWebhookFilter}+ options={[+ { value: 'all', label: 'All', count: webhooks.length },+ { value: 'active', label: 'Active', count: webhookActiveCount },+ { value: 'inactive', label: 'Inactive', count: webhookInactiveCount },+ ]}+ /></div>+ {filteredWebhooks.length === 0 ? (+ <div className="dom-empty">No webhooks match this filter.</div>+ ) : (+ <div className="dom-card">+ <table className="sk-dtable git-webhooks-table">+ <thead>+ <tr>+ <th>Webhook</th>+ <th>Repository</th>+ <th>Branch</th>+ <th>Last sync</th>+ <th>Syncs</th>+ <th>Status</th>+ <th style={{ width: 30 }} />+ </tr>+ </thead>+ <tbody>+ {filteredWebhooks.map(webhook => (+ <tr key={webhook.id} className={`is-clickable ${!webhook.is_active ? 'is-disabled' : ''}`} onClick={() => setDrawerWebhook(webhook)}>+ <td>+ <div className="sk-cell-name">+ <span className={`git-src-tile git-src-tile--${webhook.source}`}>{SOURCE_INITIALS[webhook.source] || webhook.source?.slice(0, 2).toUpperCase()}</span>+ <div className="git-repocell">+ <div className="git-reponame">{webhook.name}</div>+ <div className="sk-cell-sub">{webhook.source}{webhook.deploy_on_push ? ' · deploy on push' : ''}</div>+ </div>+ </div>+ </td>+ <td className="sk-cell-mono git-url" title={webhook.source_repo_url}>{webhook.source_repo_url}</td>+ <td>+ <span className="git-branch-chip">+ <svg viewBox="0 0 24 24" width="11" height="11" stroke="currentColor" fill="none" strokeWidth="2"><line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/></svg>+ {webhook.source_branch}+ </span>+ </td>+ <td className="sk-cell-mono" title={webhook.last_sync_at ? new Date(webhook.last_sync_at).toLocaleString() : undefined}>+ {webhook.last_sync_at ? formatDate(webhook.last_sync_at) : 'never'}+ </td>+ <td className="sk-cell-mono">{webhook.sync_count}</td>+ <td><Pill kind={webhook.is_active ? 'green' : 'gray'}>{webhook.is_active ? 'Active' : 'Inactive'}</Pill></td>+ <td><ChevronRight size={16} className="dom-chev" /></td>+ </tr>+ ))}+ </tbody>+ </table>+ </div>+ )}+ </>+ );+ };++ const renderDeployments = () => {+ if (deploymentsLoading) return <div className="loading-state"><Spinner /></div>;+ if (deployments.length === 0) {+ return (+ <EmptyState+ icon={Rocket}+ title="No deployments yet"+ description='Configure a webhook with "Deploy on Push" enabled to see deployments here.'+ action={<Button onClick={() => setActiveTab('webhooks')}>Configure Webhooks</Button>}+ />+ );+ }+ return (+ <>+ <div className="dom-listhead">+ <h2 className="dom-listhead__title">Deployment history</h2>+ <SegControl+ value={deploymentFilter}+ onChange={setDeploymentFilter}+ options={[+ { value: 'all', label: 'All', count: deployments.length },+ { value: 'success', label: 'Success', count: deploymentSuccessCount },+ { value: 'failed', label: 'Failed', count: deploymentFailedCount },+ { value: 'running', label: 'Running', count: deploymentRunningCount },+ ]}+ />+ </div>+ {filteredDeployments.length === 0 ? (+ <div className="dom-empty">No deployments match this filter.</div>+ ) : (+ <div className="dom-card">+ {filteredDeployments.map(deployment => (+ <div key={deployment.id} className="git-deploy-row is-clickable" onClick={() => setDrawerDeployment(deployment)}>+ <span className={`git-deploy-dot git-deploy-dot--${getStatusColor(deployment.status)}`} />+ <div className="git-deploy-body">+ <div className="git-deploy-top">+ <span className="git-deploy-version">v{deployment.version}</span>+ <Pill kind={getStatusColor(deployment.status)}>{deployment.status}</Pill>+ {deployment.is_rollback && <span className="git-chip git-chip--cyan">rollback</span>}+ {deployment.commit_sha && <code className="git-hash">{deployment.commit_sha.slice(0, 7)}</code>}+ </div>+ {deployment.commit_message && <div className="git-deploy-msg">{deployment.commit_message.split('\n')[0]}</div>}+ <div className="git-deploy-meta">+ <span>{deployment.branch}</span>+ <span>{deployment.triggered_by}</span>+ {deployment.webhook_name && <span>{deployment.webhook_name}</span>}+ {deployment.duration_seconds != null && <span>{deployment.duration_seconds}s</span>}+ </div>+ {deployment.error_message && <div className="git-deploy-error">{deployment.error_message}</div>}+ </div>+ <div className="git-deploy-side">+ <span className="git-deploy-time">{formatDate(deployment.created_at)}</span>+ <ChevronRight size={16} className="dom-chev" />+ </div>+ </div>+ ))}+ </div>+ )}+ </>+ );+ };++ const renderSettings = () => (+ <>+ <div className="dom-listhead">+ <h2 className="dom-listhead__title">Server settings</h2>+ </div>+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Server power</div>+ <div className="git-quick-actions" style={{ marginTop: 8 }}>+ {status?.running ? (+ <Button variant="secondary" onClick={handleStop} disabled={actionLoading}>Stop Server</Button>+ ) : (+ <Button onClick={handleStart} disabled={actionLoading}>Start Server</Button>+ )}+ </div>+ <div className="sk-spec-card__sub">Start or stop the Gitea container</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Uninstall</div>+ <div className="git-quick-actions" style={{ marginTop: 8 }}>+ <Button variant="destructive" onClick={handleUninstall} disabled={actionLoading}>Uninstall Git Server</Button>+ </div>+ <div className="sk-spec-card__sub">Stops Gitea; data is preserved unless removed manually</div>+ </div>+ </div>+ <div style={{ marginTop: 24 }}>+ <DangerZone+ title="Danger Zone"+ description="Uninstalling will stop the Gitea container. Your data will be preserved unless you choose to remove it."+ />+ </div>+ </>+ );++ const renderTabContent = () => {+ switch (activeTab) {+ case 'overview': return renderOverview();+ case 'repositories': return renderRepositories();+ case 'access': return renderAccess();+ case 'webhooks': return renderWebhooks();+ case 'deployments': return renderDeployments();+ case 'settings': return renderSettings();+ default: return renderOverview();+ }+ };++ const tabTitle = {+ overview: 'Overview',+ repositories: 'Repositories',+ access: 'Access Info',+ webhooks: 'Webhooks',+ deployments: 'Deployments',+ settings: 'Settings',+ }[activeTab];++ const topbarActions = () => {+ if (!status?.installed) {+ return <Button onClick={() => setShowInstallModal(true)}>Install Git Server</Button>;+ }+ const common = (+ <Button variant="outline" onClick={openGitea} disabled={!status?.running}>+ <ExternalLink size={15} /> Open Gitea+ </Button>+ );+ switch (activeTab) {+ case 'webhooks':+ return (+ <>+ {common}+ <Button onClick={() => setShowWebhookModal(true)}><Plus size={15} /> Add Webhook</Button>+ </>+ );+ case 'deployments':+ return (+ <>+ {common}+ <Button variant="outline" onClick={loadAllDeployments} disabled={deploymentsLoading}>+ <RefreshCw size={15} /> Refresh+ </Button>+ </>+ );+ case 'repositories':+ return (+ <>+ {common}+ <Button variant="outline" onClick={loadRepositories} disabled={reposLoading}>+ <RefreshCw size={15} /> Refresh+ </Button>+ </>+ );+ default:+ return (+ <>+ {common}+ {status?.running ? (+ <Button variant="secondary" onClick={handleStop} disabled={actionLoading}>Stop Server</Button>+ ) : (+ <Button onClick={handleStart} disabled={actionLoading}>Start Server</Button>+ )}+ </>+ );+ }+ };++ if (loading) {+ return (+ <div className="git-page domains-page">+ <div className="page-loading"><Spinner size="lg" /></div></div>);}return (- <div className="page-container git-page">- <PageTopbar- icon={<GitBranch size={18} />}- title="Git Server"- actions={<>- {!status?.installed ? (- <Button onClick={() => setShowInstallModal(true)}>- Install Git Server- </Button>- ) : (- <>- <Button- variant="outline"- onClick={openGitea}- disabled={!status?.running}- >- Open Gitea- </Button>- {status?.running ? (- <Button- variant="secondary"- onClick={handleStop}- disabled={actionLoading}- >- Stop Server- </Button>- ) : (- <Button- onClick={handleStart}- disabled={actionLoading}- >- Start Server- </Button>- )}- </>- )}- </>}- />+ <div className="git-page domains-page">+ <PageTopbar icon={<GitBranch size={18} />} title="Git Server" actions={topbarActions()} />++ {pageError && (+ <div className="error-banner">+ {pageError}+ <button onClick={() => setPageError('')} style={{ float: 'right', background: 'none', border: 'none', cursor: 'pointer' }}>×</button>+ </div>+ )}{!status?.installed ? (<div className="empty-state-large"><div className="empty-icon"><svg viewBox="0 0 24 24" width="64" height="64" stroke="currentColor" fill="none" strokeWidth="1.5">- <circle cx="18" cy="18" r="3"/>- <circle cx="6" cy="6" r="3"/>- <path d="M6 21V9a9 9 0 0 0 9 9"/>+ <circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/></svg></div><h2>No Git Server Installed</h2><p>Install Gitea to host and manage your Git repositories locally.</p>-<div className="resource-warning"><div className="warning-header">- <svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" fill="none" strokeWidth="2">- <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>- <line x1="12" y1="9" x2="12" y2="13"/>- <line x1="12" y1="17" x2="12.01" y2="17"/>- </svg>+ <AlertTriangle size={20} /><strong>Resource Requirements</strong></div><ul>@@ -641,729 +1059,299 @@ function Git({ basePath = '/git' }) {<li><strong>Components:</strong> Gitea + PostgreSQL database</li></ul></div>-- <Button size="lg" onClick={() => setShowInstallModal(true)}>- Install Git Server- </Button>+ <Button size="lg" onClick={() => setShowInstallModal(true)}>Install Git Server</Button></div>) : (- <>- <div className="git-hint">- <div className="git-hint__icon"><GitBranch size={20} /></div>- <div className="git-hint__body">- <div className="git-hint__title">Connect any site or service to a repository</div>- <div className="git-hint__sub">- Host it on your built-in Gitea — private, self-hosted inside ServerKit —- or link an external provider. Push to deploy, automatically.+ <div className="domains-body">+ {renderKpis()}+ <div className="dom-listhead">+ <h2 className="dom-listhead__title">{tabTitle}</h2>+ <SegControl value={activeTab} onChange={setActiveTab} options={TAB_OPTIONS} />+ </div>+ {renderTabContent()}+ </div>+ )}++ {/* Repository drawer */}+ <Drawer+ open={!!drawerRepo}+ onOpenChange={(open) => { if (!open) { setDrawerRepo(null); setSelectedRepo(null); } }}+ icon={<FolderGit2 size={18} />}+ iconColor="var(--accent-bright)"+ title={drawerRepo ? `${drawerRepo.owner.login}/${drawerRepo.name}` : ''}+ subtitle={drawerRepo ? `${drawerRepo.description || 'No description'} · ${drawerRepo.private ? 'private' : 'public'}` : ''}+ width={720}+ >+ {drawerRepo && selectedRepo && (+ <div className="dom-drawer">+ <div className="dom-drawer__actions">+ <Button variant="outline" size="sm" onClick={openGitea} disabled={!status?.running}>+ <ExternalLink size={14} /> Open in Gitea+ </Button>+ <Button variant="outline" size="sm" onClick={() => {+ navigator.clipboard.writeText(`${getGiteaUrl()}/${selectedRepo.owner.login}/${selectedRepo.name}`);+ toast.success('Repository URL copied');+ }}>+ Copy URL+ </Button>+ </div>+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Default branch</div>+ <div className="sk-spec-card__value">{selectedRepo.default_branch}</div>+ <div className="sk-spec-card__sub">{branches.length} branches</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Stars</div>+ <div className="sk-spec-card__value">{selectedRepo.stars}</div>+ <div className="sk-spec-card__sub">{selectedRepo.forks} forks</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Visibility</div>+ <div className="sk-spec-card__value">{selectedRepo.private ? 'Private' : 'Public'}</div>+ <div className="sk-spec-card__sub">{selectedRepo.fork ? 'Fork' : 'Original'}</div></div></div>- </div>- <div className="git-kpis" aria-label="Git server status">- <MetricCard- className="git-kpi-text"- icon={<Server size={17} />}- tone={status?.running ? 'green' : 'red'}- value={status?.running ? 'Running' : 'Stopped'}- label="Server status"- />- <MetricCard- className="git-kpi-text"- icon={<Globe size={17} />}- tone="accent"- value={status?.url_path || '/gitea'}- label="URL path"- />- <MetricCard- icon={<Terminal size={17} />}- tone="cyan"- value={status?.ssh_port || 'N/A'}- label="SSH port"- />- <MetricCard- className="git-kpi-text"- icon={<Tag size={17} />}- tone="violet"- value={status?.version || 'Unknown'}- label="Gitea version"- />- </div>+ <div className="git-repo-detail-tabs">+ <div className="branch-selector">+ <Label>Branch</Label>+ <select value={selectedBranch || ''} onChange={(e) => changeBranch(e.target.value)}>+ {branches.map(b => <option key={b.name} value={b.name}>{b.name}</option>)}+ </select>+ </div>+ <div className="git-mini-tabs">+ <button type="button" className={repoDetailTab === 'files' ? 'active' : ''} onClick={() => setRepoDetailTab('files')}>Files</button>+ <button type="button" className={repoDetailTab === 'commits' ? 'active' : ''} onClick={() => setRepoDetailTab('commits')}>Commits</button>+ <button type="button" className={repoDetailTab === 'branches' ? 'active' : ''} onClick={() => setRepoDetailTab('branches')}>Branches</button>+ </div>+ </div>- <Tabs value={activeTab} onValueChange={setActiveTab}>- <TabsList>- <TabsTrigger value="overview">Overview</TabsTrigger>- <TabsTrigger value="repositories">Repositories</TabsTrigger>- <TabsTrigger value="access">Access Info</TabsTrigger>- <TabsTrigger value="webhooks">Webhooks</TabsTrigger>- <TabsTrigger value="deployments">Deployments</TabsTrigger>- <TabsTrigger value="settings">Settings</TabsTrigger>- </TabsList>-- <div className="tab-content">- <TabsContent value="overview">- <div className="overview-tab">- <div className="info-card">- <h3>Server Information</h3>- <div className="info-grid">- <div className="info-item">- <span className="info-label">Status</span>- <span className={`info-value ${status?.running ? 'text-success' : 'text-danger'}`}>- {status?.running ? 'Running' : 'Stopped'}- </span>- </div>- <div className="info-item">- <span className="info-label">HTTP URL</span>- <span className="info-value">- {status?.running ? (- <a href={getGiteaUrl()} target="_blank" rel="noopener noreferrer">- {getGiteaUrl()}- </a>- ) : 'Server not running'}- </span>+ {repoDetailTab === 'files' && (+ <div className="files-browser">+ {currentPath && (+ <div className="breadcrumb">+ <button onClick={() => navigateToPath('')}>{selectedRepo.name}</button>+ {currentPath.split('/').map((part, i, arr) => (+ <span key={i}><span className="separator">/</span><button onClick={() => navigateToPath(arr.slice(0, i + 1).join('/'))}>{part}</button></span>+ ))}+ </div>+ )}+ <div className="files-list">+ {currentPath && (+ <div className="file-item dir" onClick={navigateUp}>+ <div className="file-icon">+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2"><polyline points="15 18 9 12 15 6"/></svg></div>- <div className="info-item">- <span className="info-label">SSH Clone URL</span>- <span className="info-value code">- ssh://git@{window.location.hostname}:{status?.ssh_port}/user/repo.git- </span>+ <span className="file-name">..</span>+ </div>+ )}+ {files.sort((a, b) => {+ if (a.type === 'dir' && b.type !== 'dir') return -1;+ if (a.type !== 'dir' && b.type === 'dir') return 1;+ return a.name.localeCompare(b.name);+ }).map(file => (+ <div key={file.path} className={`file-item ${file.type}`} onClick={() => file.type === 'dir' && navigateToPath(file.path)}>+ <div className="file-icon">+ {file.type === 'dir' ? (+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>+ ) : (+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>+ )}</div>+ <span className="file-name">{file.name}</span>+ {file.type === 'file' && <span className="file-size">{formatFileSize(file.size)}</span>}</div>- </div>- <div className="info-card">- <h3>Quick Actions</h3>- <div className="quick-actions">- <Button- variant="outline"- onClick={openGitea}- disabled={!status?.running}- >- Open Web Interface- </Button>- <Button- variant="outline"- onClick={() => {- navigator.clipboard.writeText(`git clone ssh://git@${window.location.hostname}:${status?.ssh_port}/user/repo.git`);- toast.success('SSH URL copied to clipboard');- }}- >- Copy SSH URL- </Button>+ ))}+ </div>+ </div>+ )}++ {repoDetailTab === 'commits' && (+ <div className="commits-list">+ {commits.map(commit => (+ <div key={commit.sha} className="commit-item">+ <div className="commit-info">+ <div className="commit-message">{commit.message?.split('\n')[0]}</div>+ <div className="commit-meta">+ <span className="author">{commit.author?.name}</span>+ <span className="date">{formatDate(commit.author?.date)}</span>+ </div></div>+ <code className="git-hash">{commit.short_sha}</code></div>- </div>- </TabsContent>-- <TabsContent value="repositories">- <div className="repositories-tab">- {!status?.running ? (- <EmptyState- icon={AlertCircle}- title="Server not running"- description="Start the Git server to browse repositories."- action={<Button onClick={handleStart}>Start Server</Button>}- />- ) : repoView === 'list' ? (- <>- <div className="repos-header">- <h3>- Repositories- {repositories.length > 0 && (- <span className="git-count"> · {repositories.length}</span>- )}- </h3>- <Button- variant="outline"- size="sm"- onClick={loadRepositories}- disabled={reposLoading}- >- Refresh- </Button>+ ))}+ {commits.length >= 30 && (+ <Button variant="outline" className="btn-block" onClick={loadMoreCommits}>Load More</Button>+ )}+ </div>+ )}++ {repoDetailTab === 'branches' && (+ <div className="branches-list">+ {branches.map(branch => (+ <div key={branch.name} className={`branch-item ${branch.name === selectedBranch ? 'active' : ''}`}>+ <div className="branch-info">+ <div className="branch-name">+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2"><line x1="6" y1="3" x2="6" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/></svg>+ {branch.name}+ {branch.name === selectedRepo?.default_branch && <span className="git-chip git-chip--green">default</span>}+ {branch.protected && <span className="git-chip git-chip--amber">protected</span>}</div>-- {reposLoading ? (- <div className="loading-state">- <Spinner />- </div>- ) : repositories.length === 0 ? (- <EmptyState- icon={FolderGit2}- title="No repositories yet"- description="Create your first repository in Gitea."- action={<Button onClick={openGitea}>Open Gitea</Button>}- />- ) : (- <div className="git-table-card">- <table className="sk-dtable git-repos-table">- <thead>- <tr>- <th>Repository</th>- <th>Branch</th>- <th>Stars</th>- <th>Forks</th>- <th>Updated</th>- <th aria-label="Open"></th>- </tr>- </thead>- <tbody>- {repositories.map((repo) => (- <tr- key={repo.id}- className="is-clickable"- onClick={() => selectRepository(repo)}- >- <td>- <div className="sk-cell-name">- <span className="git-repo-ico">- {repo.private ? (- <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">- <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>- <path d="M7 11V7a5 5 0 0 1 10 0v4"/>- </svg>- ) : (- <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">- <circle cx="18" cy="18" r="3"/>- <circle cx="6" cy="6" r="3"/>- <path d="M6 21V9a9 9 0 0 0 9 9"/>- </svg>- )}- </span>- <div className="git-repocell">- <div className="git-reponame">- <span className="own">{repo.owner.login}/</span>{repo.name}- {repo.private && <span className="git-chip git-chip--amber">private</span>}- {repo.fork && <span className="git-chip git-chip--cyan">fork</span>}- </div>- {repo.description && (- <div className="sk-cell-sub git-repo-desc">{repo.description}</div>- )}- </div>- </div>- </td>- <td>- <span className="git-branch-chip">- <svg viewBox="0 0 24 24" width="11" height="11" stroke="currentColor" fill="none" strokeWidth="2">- <line x1="6" y1="3" x2="6" y2="15"/>- <circle cx="18" cy="6" r="3"/>- <circle cx="6" cy="18" r="3"/>- <path d="M18 9a9 9 0 0 1-9 9"/>- </svg>- {repo.default_branch}- </span>- </td>- <td className="sk-cell-mono">{repo.stars}</td>- <td className="sk-cell-mono">{repo.forks}</td>- <td className="sk-cell-mono">{formatDate(repo.updated_at)}</td>- <td>- <svg className="git-chev" viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <polyline points="9 18 15 12 9 6"/>- </svg>- </td>- </tr>- ))}- </tbody>- </table>+ {branch.commit && (+ <div className="branch-commit">+ <code>{branch.commit.sha?.slice(0, 7)}</code>+ <span className="commit-date">{formatDate(branch.commit.date)}</span></div>)}- </>- ) : (- <div className="repo-detail">- <div className="repo-detail-header">- <Button variant="ghost" size="sm" onClick={backToRepoList}>- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <polyline points="15 18 9 12 15 6"/>- </svg>- Back- </Button>- <div className="repo-title">- <h3><span className="own">{selectedRepo?.owner.login}/</span>{selectedRepo?.name}</h3>- {selectedRepo?.description && (- <p>{selectedRepo.description}</p>- )}- </div>- <div className="branch-selector">- <select- value={selectedBranch || ''}- onChange={(e) => changeBranch(e.target.value)}- >- {branches.map((b) => (- <option key={b.name} value={b.name}>{b.name}</option>- ))}- </select>- </div>- </div>-- <Tabs value={repoDetailTab} onValueChange={setRepoDetailTab}>- <TabsList>- <TabsTrigger value="files">- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>- </svg>- Files- </TabsTrigger>- <TabsTrigger value="commits">- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <circle cx="12" cy="12" r="4"/>- <line x1="1.05" y1="12" x2="7" y2="12"/>- <line x1="17.01" y1="12" x2="22.96" y2="12"/>- </svg>- Commits ({commits.length})- </TabsTrigger>- <TabsTrigger value="branches">- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <line x1="6" y1="3" x2="6" y2="15"/>- <circle cx="18" cy="6" r="3"/>- <circle cx="6" cy="18" r="3"/>- <path d="M18 9a9 9 0 0 1-9 9"/>- </svg>- Branches ({branches.length})- </TabsTrigger>- </TabsList>-- <div className="repo-detail-content">- <TabsContent value="files">- <div className="files-browser">- {currentPath && (- <div className="breadcrumb">- <button onClick={() => navigateToPath('')}>- {selectedRepo?.name}- </button>- {currentPath.split('/').map((part, i, arr) => (- <span key={i}>- <span className="separator">/</span>- <button- onClick={() => navigateToPath(arr.slice(0, i + 1).join('/'))}- >- {part}- </button>- </span>- ))}- </div>- )}- <div className="files-list">- {currentPath && (- <div className="file-item dir" onClick={navigateUp}>- <div className="file-icon">- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <polyline points="15 18 9 12 15 6"/>- </svg>- </div>- <span className="file-name">..</span>- </div>- )}- {files- .sort((a, b) => {- if (a.type === 'dir' && b.type !== 'dir') return -1;- if (a.type !== 'dir' && b.type === 'dir') return 1;- return a.name.localeCompare(b.name);- })- .map((file) => (- <div- key={file.path}- className={`file-item ${file.type}`}- onClick={() => file.type === 'dir' && navigateToPath(file.path)}- >- <div className="file-icon">- {file.type === 'dir' ? (- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>- </svg>- ) : (- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>- <polyline points="14 2 14 8 20 8"/>- </svg>- )}- </div>- <span className="file-name">{file.name}</span>- {file.type === 'file' && (- <span className="file-size">{formatFileSize(file.size)}</span>- )}- </div>- ))}- </div>- </div>- </TabsContent>-- <TabsContent value="commits">- <div className="commits-list">- {commits.map((commit) => (- <div key={commit.sha} className="commit-item">- <div className="commit-info">- <div className="commit-message">- {commit.message?.split('\n')[0]}- </div>- <div className="commit-meta">- <span className="author">{commit.author?.name}</span>- <span className="date">{formatDate(commit.author?.date)}</span>- </div>- </div>- <div className="commit-sha">- <code className="git-hash">{commit.short_sha}</code>- </div>- </div>- ))}- {commits.length >= 30 && (- <Button- variant="outline"- className="btn-block"- onClick={loadMoreCommits}- >- Load More- </Button>- )}- </div>- </TabsContent>-- <TabsContent value="branches">- <div className="branches-list">- {branches.map((branch) => (- <div- key={branch.name}- className={`branch-item ${branch.name === selectedBranch ? 'active' : ''}`}- >- <div className="branch-info">- <div className="branch-name">- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">- <line x1="6" y1="3" x2="6" y2="15"/>- <circle cx="18" cy="6" r="3"/>- <circle cx="6" cy="18" r="3"/>- <path d="M18 9a9 9 0 0 1-9 9"/>- </svg>- {branch.name}- {branch.name === selectedRepo?.default_branch && (- <span className="git-chip git-chip--green">default</span>- )}- {branch.protected && (- <span className="git-chip git-chip--amber">protected</span>- )}- </div>- {branch.commit && (- <div className="branch-commit">- <code>{branch.commit.sha?.slice(0, 7)}</code>- <span className="commit-date">- {formatDate(branch.commit.date)}- </span>- </div>- )}- </div>- <Button- size="sm"- variant="ghost"- onClick={() => changeBranch(branch.name)}- >- Switch- </Button>- </div>- ))}- </div>- </TabsContent>- </div>- </Tabs>- </div>- )}- </div>- </TabsContent>-- <TabsContent value="access">- <div className="access-tab">- <div className="info-card">- <h3>HTTP Access</h3>- <p className="text-muted">Access Gitea through your web browser</p>- <div className="access-url">- <code>{getGiteaUrl()}</code>- <Button- size="sm"- variant="outline"- onClick={() => {- navigator.clipboard.writeText(getGiteaUrl());- toast.success('URL copied');- }}- >- Copy- </Button></div>+ <Button size="sm" variant="ghost" onClick={() => changeBranch(branch.name)}>Switch</Button></div>- <div className="info-card">- <h3>SSH Access</h3>- <p className="text-muted">Clone repositories via SSH</p>- <div className="access-url">- <code>ssh://git@{window.location.hostname}:{status?.ssh_port}/username/repo.git</code>- <Button- size="sm"- variant="outline"- onClick={() => {- navigator.clipboard.writeText(`ssh://git@${window.location.hostname}:${status?.ssh_port}/username/repo.git`);- toast.success('URL copied');- }}- >- Copy- </Button>- </div>- <div className="ssh-note">- <strong>Note:</strong> Add your SSH public key in Gitea settings to use SSH access.- </div>+ ))}+ </div>+ )}+ </div>+ )}+ </Drawer>++ {/* Webhook drawer */}+ <Drawer+ open={!!drawerWebhook}+ onOpenChange={(open) => { if (!open) setDrawerWebhook(null); }}+ icon={<Webhook size={18} />}+ iconColor="var(--accent-bright)"+ title={drawerWebhook?.name || ''}+ subtitle={drawerWebhook ? `${drawerWebhook.source} · ${drawerWebhook.is_active ? 'active' : 'inactive'}` : ''}+ width={640}+ >+ {drawerWebhook && (+ <div className="dom-drawer">+ <div className="dom-drawer__actions">+ <Button variant="outline" size="sm" onClick={() => copyWebhookUrl(drawerWebhook)}>Copy URL</Button>+ <Button variant="outline" size="sm" onClick={() => handleTestWebhook(drawerWebhook.id)}>Test</Button>+ <Button variant="outline" size="sm" onClick={() => handleToggleWebhook(drawerWebhook.id)}>+ {drawerWebhook.is_active ? 'Disable' : 'Enable'}+ </Button>+ <Button variant="outline" size="sm" className="dom-delete-btn" onClick={() => handleDeleteWebhook(drawerWebhook.id)}>+ <Trash2 size={14} /> Delete+ </Button>+ </div>+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Source</div>+ <div className="sk-spec-card__value">{drawerWebhook.source}</div>+ <div className="sk-spec-card__sub">{drawerWebhook.source_repo_url}</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Branch</div>+ <div className="sk-spec-card__value">{drawerWebhook.source_branch}</div>+ <div className="sk-spec-card__sub">{drawerWebhook.sync_direction}</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Status</div>+ <div style={{ marginTop: 8 }}><Pill kind={drawerWebhook.is_active ? 'green' : 'gray'}>{drawerWebhook.is_active ? 'Active' : 'Inactive'}</Pill></div>+ <div className="sk-spec-card__sub">{drawerWebhook.sync_count} syncs</div>+ </div>+ </div>+ {drawerWebhook.app_id && (+ <div className="dom-drawer__section">+ <h3 className="dom-drawer__sectiontitle">Deployment</h3>+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Application</div>+ <div className="sk-spec-card__value">{getAppName(drawerWebhook.app_id)}</div></div>- </div>- </TabsContent>-- <TabsContent value="webhooks">- <div className="webhooks-tab">- <div className="webhooks-header">- <div>- <h3>External Repository Webhooks</h3>- <p className="text-muted">Sync repositories from GitHub, GitLab, or Bitbucket</p>- </div>- <Button onClick={() => setShowWebhookModal(true)}>- Add Webhook- </Button>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Deploy on push</div>+ <div style={{ marginTop: 8 }}><Pill kind={drawerWebhook.deploy_on_push ? 'green' : 'gray'}>{drawerWebhook.deploy_on_push ? 'Enabled' : 'Disabled'}</Pill></div></div>-- {webhooksLoading ? (- <div className="loading-state">- <Spinner />- </div>- ) : webhooks.length === 0 ? (- <EmptyState- icon={Webhook}- title="No webhooks configured"- description="Add a webhook to sync repositories from external sources."- action={<Button onClick={() => setShowWebhookModal(true)}>Add Webhook</Button>}- />- ) : (- <div className="git-table-card">- <table className="sk-dtable git-webhooks-table">- <thead>- <tr>- <th>Webhook</th>- <th>Repository</th>- <th>Branch</th>- <th>Last sync</th>- <th>Syncs</th>- <th>Status</th>- <th aria-label="Actions"></th>- </tr>- </thead>- <tbody>- {webhooks.map((webhook) => (- <tr key={webhook.id} className={!webhook.is_active ? 'is-disabled' : ''}>- <td>- <div className="sk-cell-name">- <span className={`git-src-tile git-src-tile--${webhook.source}`}>- {SOURCE_INITIALS[webhook.source] || webhook.source?.slice(0, 2).toUpperCase()}- </span>- <div className="git-repocell">- <div className="git-reponame">{webhook.name}</div>- <div className="sk-cell-sub">- {webhook.source}- {webhook.deploy_on_push ? ' · deploy on push' : ''}- </div>- </div>- </div>- </td>- <td className="sk-cell-mono git-url" title={webhook.source_repo_url}>- {webhook.source_repo_url}- </td>- <td>- <span className="git-branch-chip">- <svg viewBox="0 0 24 24" width="11" height="11" stroke="currentColor" fill="none" strokeWidth="2">- <line x1="6" y1="3" x2="6" y2="15"/>- <circle cx="18" cy="6" r="3"/>- <circle cx="6" cy="18" r="3"/>- <path d="M18 9a9 9 0 0 1-9 9"/>- </svg>- {webhook.source_branch}- </span>- </td>- <td- className="sk-cell-mono"- title={webhook.last_sync_at ? new Date(webhook.last_sync_at).toLocaleString() : undefined}- >- {webhook.last_sync_at ? formatDate(webhook.last_sync_at) : 'never'}- </td>- <td className="sk-cell-mono">{webhook.sync_count}</td>- <td>- <Pill kind={webhook.is_active ? 'green' : 'gray'}>- {webhook.is_active ? 'Active' : 'Inactive'}- </Pill>- </td>- <td>- <div className="git-row-actions">- <Button- size="sm"- variant="ghost"- onClick={() => copyWebhookUrl(webhook)}- title="Copy webhook URL"- >- Copy URL- </Button>- <Button- size="sm"- variant="ghost"- onClick={() => handleTestWebhook(webhook.id)}- title="Test webhook"- >- Test- </Button>- <Button- size="sm"- variant="ghost"- onClick={() => handleToggleWebhook(webhook.id)}- >- {webhook.is_active ? 'Disable' : 'Enable'}- </Button>- <Button- size="sm"- variant="ghost"- className="git-danger-btn"- onClick={() => handleDeleteWebhook(webhook.id)}- >- Delete- </Button>- </div>- </td>- </tr>- ))}- </tbody>- </table>- </div>- )}- </div>- </TabsContent>-- <TabsContent value="deployments">- <div className="deployments-tab">- <div className="deployments-header">- <div>- <h3>Deployment History</h3>- <p className="text-muted">Track automatic and manual deployments</p>- </div>- <Button- variant="outline"- onClick={loadAllDeployments}- disabled={deploymentsLoading}- >- Refresh- </Button>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Zero downtime</div>+ <div style={{ marginTop: 8 }}><Pill kind={drawerWebhook.zero_downtime ? 'green' : 'gray'}>{drawerWebhook.zero_downtime ? 'Yes' : 'No'}</Pill></div></div>-- {deploymentsLoading ? (- <div className="loading-state">- <Spinner />- </div>- ) : deployments.length === 0 ? (- <EmptyState- icon={Rocket}- title="No deployments yet"- description='Configure a webhook with "Deploy on Push" enabled to see deployments here.'- action={<Button onClick={() => setActiveTab('webhooks')}>Configure Webhooks</Button>}- />- ) : (- <div className="git-deploys-card">- {deployments.map((deployment) => (- <div key={deployment.id} className="git-deploy-row">- <span className={`git-deploy-dot git-deploy-dot--${getStatusColor(deployment.status)}`} />- <div className="git-deploy-body">- <div className="git-deploy-top">- <span className="git-deploy-version">v{deployment.version}</span>- <Pill kind={getStatusColor(deployment.status)}>{deployment.status}</Pill>- {deployment.is_rollback && (- <span className="git-chip git-chip--cyan">rollback</span>- )}- {deployment.commit_sha && (- <code className="git-hash">{deployment.commit_sha.slice(0, 7)}</code>- )}- </div>- {deployment.commit_message && (- <div className="git-deploy-msg">{deployment.commit_message.split('\n')[0]}</div>- )}- <div className="git-deploy-meta">- <span>{deployment.branch}</span>- <span>{deployment.triggered_by}</span>- {deployment.webhook_name && <span>{deployment.webhook_name}</span>}- {deployment.duration_seconds != null && <span>{deployment.duration_seconds}s</span>}- </div>- {deployment.error_message && (- <div className="git-deploy-error">{deployment.error_message}</div>- )}- </div>- <div className="git-deploy-side">- <span className="git-deploy-time">{formatDate(deployment.created_at)}</span>- <div className="git-deploy-actions">- <Button- size="sm"- variant="outline"- onClick={() => viewDeploymentLogs(deployment.id)}- >- View Logs- </Button>- {deployment.status === 'success' && !deployment.is_rollback && (- <Button- size="sm"- variant="secondary"- onClick={() => handleRollback(deployment.app_id, deployment.version)}- >- Rollback to This- </Button>- )}- {deployment.status === 'success' && (- <Button- size="sm"- onClick={() => handleTriggerDeploy(deployment.app_id)}- disabled={deployingAppId === deployment.app_id}- >- {deployingAppId === deployment.app_id ? 'Deploying...' : 'Redeploy'}- </Button>- )}- </div>- </div>- </div>- ))}- </div>- )}</div>- </TabsContent>-- <TabsContent value="settings">- <div className="settings-tab">- <div className="info-card">- <h3>Server Management</h3>- <div className="settings-actions">- {status?.running ? (- <Button- variant="secondary"- onClick={handleStop}- disabled={actionLoading}- >- Stop Server- </Button>- ) : (- <Button- onClick={handleStart}- disabled={actionLoading}- >- Start Server- </Button>- )}- <Button- variant="destructive"- onClick={handleUninstall}- disabled={actionLoading}- >- Uninstall- </Button>- </div>- </div>- <DangerZone- title="Danger Zone"- description="Uninstalling will stop the Gitea container. Your data will be preserved unless you choose to remove it."- />+ </div>+ )}+ <div className="dom-drawer__section">+ <h3 className="dom-drawer__sectiontitle">Recent deployments</h3>+ {webhookDeployments.length === 0 ? (+ <p className="dom-drawer__hint">No deployments for this webhook.</p>+ ) : (+ <div className="dom-dns__table">+ <table className="sk-dtable">+ <thead><tr><th>Version</th><th>Status</th><th>When</th></tr></thead>+ <tbody>+ {webhookDeployments.map(d => (+ <tr key={d.id} className="is-clickable" onClick={() => { setDrawerWebhook(null); viewDeploymentLogs(d.id); }}>+ <td>v{d.version}</td>+ <td><Pill kind={getStatusColor(d.status)}>{d.status}</Pill></td>+ <td>{formatDate(d.created_at)}</td>+ </tr>+ ))}+ </tbody>+ </table></div>- </TabsContent>+ )}</div>- </Tabs>- </>- )}+ </div>+ )}+ </Drawer>++ {/* Deployment drawer */}+ <Drawer+ open={!!drawerDeployment}+ onOpenChange={(open) => { if (!open) setDrawerDeployment(null); }}+ icon={<Rocket size={18} />}+ iconColor="var(--accent-bright)"+ title={drawerDeployment ? `Deployment v${drawerDeployment.version}` : ''}+ subtitle={drawerDeployment ? `${drawerDeployment.webhook_name || 'Manual'} · ${drawerDeployment.status}` : ''}+ width={640}+ >+ {drawerDeployment && (+ <div className="dom-drawer">+ <div className="dom-drawer__actions">+ <Button variant="outline" size="sm" onClick={() => viewDeploymentLogs(drawerDeployment.id)}>View Logs</Button>+ {drawerDeployment.status === 'success' && !drawerDeployment.is_rollback && (+ <Button variant="secondary" size="sm" onClick={() => handleRollback(drawerDeployment.app_id, drawerDeployment.version)}>Rollback</Button>+ )}+ {drawerDeployment.status === 'success' && (+ <Button size="sm" onClick={() => handleTriggerDeploy(drawerDeployment.app_id)} disabled={deployingAppId === drawerDeployment.app_id}>+ {deployingAppId === drawerDeployment.app_id ? 'Deploying...' : 'Redeploy'}+ </Button>+ )}+ </div>+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Status</div>+ <div style={{ marginTop: 8 }}><Pill kind={getStatusColor(drawerDeployment.status)}>{drawerDeployment.status}</Pill></div>+ {drawerDeployment.duration_seconds != null && <div className="sk-spec-card__sub">{drawerDeployment.duration_seconds}s</div>}+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Branch</div>+ <div className="sk-spec-card__value">{drawerDeployment.branch}</div>+ <div className="sk-spec-card__sub">{drawerDeployment.triggered_by}</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">Commit</div>+ <div className="sk-spec-card__value">{drawerDeployment.commit_sha ? drawerDeployment.commit_sha.slice(0, 7) : '—'}</div>+ <div className="sk-spec-card__sub">{formatDate(drawerDeployment.created_at)}</div>+ </div>+ </div>+ {drawerDeployment.commit_message && (+ <div className="dom-drawer__section">+ <h3 className="dom-drawer__sectiontitle">Commit message</h3>+ <p className="dom-drawer__hint">{drawerDeployment.commit_message.split('\n')[0]}</p>+ </div>+ )}+ {drawerDeployment.error_message && (+ <div className="dom-drawer__section">+ <h3 className="dom-drawer__sectiontitle">Error</h3>+ <p className="dom-drawer__hint dom-dns__error">{drawerDeployment.error_message}</p>+ </div>+ )}+ </div>+ )}+ </Drawer>{/* Install Modal */}{showInstallModal && (@@ -1371,17 +1359,11 @@ function Git({ basePath = '/git' }) {<div className="modal modal-lg" onClick={(e) => e.stopPropagation()}><div className="modal-header"><h2>Install Git Server</h2>- <button className="btn btn-icon" onClick={() => setShowInstallModal(false)}>- <X size={18} />- </button>+ <button className="btn btn-icon" onClick={() => setShowInstallModal(false)}><X size={18} /></button></div><div className="modal-body"><div className="install-warning">- <svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" fill="none" strokeWidth="2">- <circle cx="12" cy="12" r="10"/>- <line x1="12" y1="8" x2="12" y2="12"/>- <line x1="12" y1="16" x2="12.01" y2="16"/>- </svg>+ <AlertTriangle size={20} /><div><strong>This will install:</strong><ul>@@ -1390,43 +1372,22 @@ function Git({ basePath = '/git' }) {</ul></div></div>-<div className="form-group">- <label>Admin Username</label>- <Input- type="text"- value={installForm.adminUser}- onChange={(e) => setInstallForm({ ...installForm, adminUser: e.target.value })}- placeholder="admin"- />+ <Label>Admin Username</Label>+ <Input type="text" value={installForm.adminUser} onChange={(e) => setInstallForm({ ...installForm, adminUser: e.target.value })} placeholder="admin" /></div><div className="form-group">- <label>Admin Email <span className="required">*</span></label>- <Input- type="email"- value={installForm.adminEmail}- onChange={(e) => setInstallForm({ ...installForm, adminEmail: e.target.value })}- placeholder="[email protected]"- />+ <Label>Admin Email <span className="required">*</span></Label>+ <Input type="email" value={installForm.adminEmail} onChange={(e) => setInstallForm({ ...installForm, adminEmail: e.target.value })} placeholder="[email protected]" /></div><div className="form-group">- <label>Admin Password (leave empty to auto-generate)</label>- <Input- type="password"- value={installForm.adminPassword}- onChange={(e) => setInstallForm({ ...installForm, adminPassword: e.target.value })}- placeholder="Auto-generate secure password"- />+ <Label>Admin Password (leave empty to auto-generate)</Label>+ <Input type="password" value={installForm.adminPassword} onChange={(e) => setInstallForm({ ...installForm, adminPassword: e.target.value })} placeholder="Auto-generate secure password" /></div></div><div className="modal-footer">- <Button variant="outline" onClick={() => setShowInstallModal(false)}>- Cancel- </Button>- <Button- onClick={handleInstall}- disabled={actionLoading || !installForm.adminEmail}- >+ <Button variant="outline" onClick={() => setShowInstallModal(false)}>Cancel</Button>+ <Button onClick={handleInstall} disabled={actionLoading || !installForm.adminEmail}>{actionLoading ? 'Installing...' : 'Install Git Server'}</Button></div>@@ -1440,170 +1401,89 @@ function Git({ basePath = '/git' }) {<div className="modal modal-lg" onClick={(e) => e.stopPropagation()}><div className="modal-header"><h2>Add Webhook</h2>- <button className="btn btn-icon" onClick={() => setShowWebhookModal(false)}>- <X size={18} />- </button>+ <button className="btn btn-icon" onClick={() => setShowWebhookModal(false)}><X size={18} /></button></div><div className="modal-body"><div className="form-group">- <label>Name <span className="required">*</span></label>- <Input- type="text"- value={webhookForm.name}- onChange={(e) => setWebhookForm({ ...webhookForm, name: e.target.value })}- placeholder="My GitHub Repo"- />+ <Label>Name <span className="required">*</span></Label>+ <Input type="text" value={webhookForm.name} onChange={(e) => setWebhookForm({ ...webhookForm, name: e.target.value })} placeholder="My GitHub Repo" /></div>-<div className="form-group">- <label>Source</label>- <select- value={webhookForm.source}- onChange={(e) => setWebhookForm({ ...webhookForm, source: e.target.value })}- >+ <Label>Source</Label>+ <select value={webhookForm.source} onChange={(e) => setWebhookForm({ ...webhookForm, source: e.target.value })}><option value="github">GitHub</option><option value="gitlab">GitLab</option><option value="bitbucket">Bitbucket</option></select></div>-<div className="form-group">- <label>Repository URL <span className="required">*</span></label>- <Input- type="text"- value={webhookForm.sourceRepoUrl}- onChange={(e) => setWebhookForm({ ...webhookForm, sourceRepoUrl: e.target.value })}- placeholder="https://github.com/user/repo.git"- />+ <Label>Repository URL <span className="required">*</span></Label>+ <Input type="text" value={webhookForm.sourceRepoUrl} onChange={(e) => setWebhookForm({ ...webhookForm, sourceRepoUrl: e.target.value })} placeholder="https://github.com/user/repo.git" /></div>-<div className="form-row"><div className="form-group">- <label>Branch</label>- <Input- type="text"- value={webhookForm.sourceBranch}- onChange={(e) => setWebhookForm({ ...webhookForm, sourceBranch: e.target.value })}- placeholder="main"- />+ <Label>Branch</Label>+ <Input type="text" value={webhookForm.sourceBranch} onChange={(e) => setWebhookForm({ ...webhookForm, sourceBranch: e.target.value })} placeholder="main" /></div>-<div className="form-group">- <label>Sync Direction</label>- <select- value={webhookForm.syncDirection}- onChange={(e) => setWebhookForm({ ...webhookForm, syncDirection: e.target.value })}- >+ <Label>Sync Direction</Label>+ <select value={webhookForm.syncDirection} onChange={(e) => setWebhookForm({ ...webhookForm, syncDirection: e.target.value })}><option value="pull">Pull (External → Local)</option><option value="push">Push (Local → External)</option><option value="bidirectional">Bidirectional</option></select></div></div>-- <div className="form-group">- <label>Local Repository Name (optional)</label>- <Input- type="text"- value={webhookForm.localRepoName}- onChange={(e) => setWebhookForm({ ...webhookForm, localRepoName: e.target.value })}- placeholder="Leave empty to use same name"- />- </div>-<div className="form-group checkbox"><label>- <input- type="checkbox"- checked={webhookForm.autoSync}- onChange={(e) => setWebhookForm({ ...webhookForm, autoSync: e.target.checked })}- />+ <input type="checkbox" checked={webhookForm.autoSync} onChange={(e) => setWebhookForm({ ...webhookForm, autoSync: e.target.checked })} />Auto-sync on push events</label></div>-+ <div className="form-group">+ <Label>Local Repository Name (optional)</Label>+ <Input type="text" value={webhookForm.localRepoName} onChange={(e) => setWebhookForm({ ...webhookForm, localRepoName: e.target.value })} placeholder="Leave empty to use same name" />+ </div><div className="form-section"><h4>Deployment Settings</h4><p className="text-muted">Optionally deploy an application when code is pushed</p>-<div className="form-group">- <label>Deploy to Application</label>- <select- value={webhookForm.appId}- onChange={(e) => setWebhookForm({- ...webhookForm,- appId: e.target.value,- deployOnPush: e.target.value ? webhookForm.deployOnPush : false- })}- >+ <Label>Deploy to Application</Label>+ <select value={webhookForm.appId} onChange={(e) => setWebhookForm({ ...webhookForm, appId: e.target.value, deployOnPush: e.target.value ? webhookForm.deployOnPush : false })}><option value="">None (sync only)</option>- {applications.map((app) => (- <option key={app.id} value={app.id}>- {app.name} ({app.status})- </option>- ))}+ {applications.map(app => <option key={app.id} value={app.id}>{app.name} ({app.status})</option>)}</select></div>-{webhookForm.appId && (<><div className="form-group checkbox"><label>- <input- type="checkbox"- checked={webhookForm.deployOnPush}- onChange={(e) => setWebhookForm({ ...webhookForm, deployOnPush: e.target.checked })}- />+ <input type="checkbox" checked={webhookForm.deployOnPush} onChange={(e) => setWebhookForm({ ...webhookForm, deployOnPush: e.target.checked })} />Deploy on push</label><span className="form-hint">Automatically deploy when code is pushed to the branch</span></div>-<div className="form-group checkbox"><label>- <input- type="checkbox"- checked={webhookForm.zeroDowntime}- onChange={(e) => setWebhookForm({ ...webhookForm, zeroDowntime: e.target.checked })}- />+ <input type="checkbox" checked={webhookForm.zeroDowntime} onChange={(e) => setWebhookForm({ ...webhookForm, zeroDowntime: e.target.checked })} />Zero-downtime deployment</label>- <span className="form-hint">Use rolling update to minimize downtime</span></div>-<div className="form-group">- <label>Pre-deploy Script (optional)</label>- <Textarea- value={webhookForm.preDeployScript}- onChange={(e) => setWebhookForm({ ...webhookForm, preDeployScript: e.target.value })}- placeholder="#!/bin/bash npm install"- rows={3}- />- <span className="form-hint">Runs before pulling code (e.g., npm install, migrations)</span>+ <Label>Pre-deploy Script (optional)</Label>+ <Textarea value={webhookForm.preDeployScript} onChange={(e) => setWebhookForm({ ...webhookForm, preDeployScript: e.target.value })} placeholder="#!/bin/bash npm install" rows={3} /></div>-<div className="form-group">- <label>Post-deploy Script (optional)</label>- <Textarea- value={webhookForm.postDeployScript}- onChange={(e) => setWebhookForm({ ...webhookForm, postDeployScript: e.target.value })}- placeholder="#!/bin/bash npm run cache:clear"- rows={3}- />- <span className="form-hint">Runs after deployment completes (e.g., cache clear)</span>+ <Label>Post-deploy Script (optional)</Label>+ <Textarea value={webhookForm.postDeployScript} onChange={(e) => setWebhookForm({ ...webhookForm, postDeployScript: e.target.value })} placeholder="#!/bin/bash npm run cache:clear" rows={3} /></div></>)}</div></div><div className="modal-footer">- <Button variant="outline" onClick={() => setShowWebhookModal(false)}>- Cancel- </Button>- <Button- onClick={handleCreateWebhook}- disabled={actionLoading || !webhookForm.name || !webhookForm.sourceRepoUrl}- >+ <Button variant="outline" onClick={() => setShowWebhookModal(false)}>Cancel</Button>+ <Button onClick={handleCreateWebhook} disabled={actionLoading || !webhookForm.name || !webhookForm.sourceRepoUrl}>{actionLoading ? 'Creating...' : 'Create Webhook'}</Button></div>@@ -1617,40 +1497,21 @@ function Git({ basePath = '/git' }) {<div className="modal" onClick={(e) => e.stopPropagation()}><div className="modal-header"><h2>Webhook Secret</h2>- <button className="btn btn-icon" onClick={() => setWebhookSecret(null)}>- <X size={18} />- </button>+ <button className="btn btn-icon" onClick={() => setWebhookSecret(null)}><X size={18} /></button></div><div className="modal-body"><div className="secret-warning">- <svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" fill="none" strokeWidth="2">- <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>- <line x1="12" y1="9" x2="12" y2="13"/>- <line x1="12" y1="17" x2="12.01" y2="17"/>- </svg>+ <AlertTriangle size={20} /><span>Save this secret! It will not be shown again.</span></div><div className="secret-display"><code>{webhookSecret}</code>- <Button- size="sm"- variant="outline"- onClick={() => {- navigator.clipboard.writeText(webhookSecret);- toast.success('Secret copied to clipboard');- }}- >- Copy- </Button>+ <Button size="sm" variant="outline" onClick={() => { navigator.clipboard.writeText(webhookSecret); toast.success('Secret copied'); }}>Copy</Button></div>- <p className="text-muted">- Use this secret when configuring the webhook in your repository settings.- </p>+ <p className="text-muted">Use this secret when configuring the webhook in your repository settings.</p></div><div className="modal-footer">- <Button onClick={() => setWebhookSecret(null)}>- I've Saved It- </Button>+ <Button onClick={() => setWebhookSecret(null)}>I've Saved It</Button></div></div></div>@@ -1662,83 +1523,29 @@ function Git({ basePath = '/git' }) {<div className="modal modal-xl" onClick={(e) => e.stopPropagation()}><div className="modal-header"><h2>Deployment v{selectedDeployment.version} Logs</h2>- <button className="btn btn-icon" onClick={() => setShowDeploymentLogs(false)}>- <X size={18} />- </button>+ <button className="btn btn-icon" onClick={() => setShowDeploymentLogs(false)}><X size={18} /></button></div><div className="modal-body"><div className="deployment-summary">- <div className="summary-item">- <span className="label">Status:</span>- <Pill kind={getStatusColor(selectedDeployment.status)}>- {selectedDeployment.status}- </Pill>- </div>- {selectedDeployment.commit_sha && (- <div className="summary-item">- <span className="label">Commit:</span>- <code className="git-hash">{selectedDeployment.commit_sha.slice(0, 7)}</code>- </div>- )}- <div className="summary-item">- <span className="label">Branch:</span>- <span>{selectedDeployment.branch}</span>- </div>- <div className="summary-item">- <span className="label">Triggered by:</span>- <span>{selectedDeployment.triggered_by}</span>- </div>- {selectedDeployment.duration_seconds != null && (- <div className="summary-item">- <span className="label">Duration:</span>- <span>{selectedDeployment.duration_seconds}s</span>- </div>- )}+ <div className="summary-item"><span className="label">Status:</span><Pill kind={getStatusColor(selectedDeployment.status)}>{selectedDeployment.status}</Pill></div>+ {selectedDeployment.commit_sha && <div className="summary-item"><span className="label">Commit:</span><code className="git-hash">{selectedDeployment.commit_sha.slice(0, 7)}</code></div>}+ <div className="summary-item"><span className="label">Branch:</span><span>{selectedDeployment.branch}</span></div>+ <div className="summary-item"><span className="label">Triggered by:</span><span>{selectedDeployment.triggered_by}</span></div>+ {selectedDeployment.duration_seconds != null && <div className="summary-item"><span className="label">Duration:</span><span>{selectedDeployment.duration_seconds}s</span></div>}</div>-- {selectedDeployment.error_message && (- <div className="deployment-error">- <strong>Error:</strong> {selectedDeployment.error_message}- </div>- )}-- {selectedDeployment.pre_script_output && (- <div className="log-section">- <h4>Pre-deployment Script Output</h4>- <pre className="log-output">{selectedDeployment.pre_script_output}</pre>- </div>- )}-- {selectedDeployment.deploy_output && (- <div className="log-section">- <h4>Deployment Output</h4>- <pre className="log-output">{selectedDeployment.deploy_output}</pre>- </div>- )}-- {selectedDeployment.post_script_output && (- <div className="log-section">- <h4>Post-deployment Script Output</h4>- <pre className="log-output">{selectedDeployment.post_script_output}</pre>- </div>- )}-- {!selectedDeployment.pre_script_output && !selectedDeployment.deploy_output && !selectedDeployment.post_script_output && (- <div className="no-logs">- <p>No deployment logs available.</p>- </div>- )}+ {selectedDeployment.error_message && <div className="deployment-error"><strong>Error:</strong> {selectedDeployment.error_message}</div>}+ {selectedDeployment.pre_script_output && <div className="log-section"><h4>Pre-deployment Script Output</h4><pre className="log-output">{selectedDeployment.pre_script_output}</pre></div>}+ {selectedDeployment.deploy_output && <div className="log-section"><h4>Deployment Output</h4><pre className="log-output">{selectedDeployment.deploy_output}</pre></div>}+ {selectedDeployment.post_script_output && <div className="log-section"><h4>Post-deployment Script Output</h4><pre className="log-output">{selectedDeployment.post_script_output}</pre></div>}+ {!selectedDeployment.pre_script_output && !selectedDeployment.deploy_output && !selectedDeployment.post_script_output && <div className="no-logs"><p>No deployment logs available.</p></div>}</div><div className="modal-footer">- <Button variant="outline" onClick={() => setShowDeploymentLogs(false)}>- Close- </Button>+ <Button variant="outline" onClick={() => setShowDeploymentLogs(false)}>Close</Button></div></div></div>)}- {/* Confirm Dialog */}{confirmDialog && (<ConfirmDialogtitle={confirmDialog.title}diff --git a/frontend/src/styles/pages/_git.scss b/frontend/src/styles/pages/_git.scssindex 1c7d5e02..bc99e3cc 100644--- a/frontend/src/styles/pages/_git.scss+++ b/frontend/src/styles/pages/_git.scss@@ -335,6 +335,75 @@}}+ // ── quick-action button row used inside spec cards ──────+ .git-quick-actions {+ display: flex;+ flex-wrap: wrap;+ gap: $space-2;+ }++ // ── repository drawer: branch selector + mini tabs ──────+ .git-repo-detail-tabs {+ display: flex;+ align-items: flex-end;+ justify-content: space-between;+ gap: $space-3;+ margin-bottom: $space-4;+ flex-wrap: wrap;++ .branch-selector {+ display: flex;+ flex-direction: column;+ gap: $space-1;++ label {+ font-size: 11px;+ color: var(--text-faint);+ }++ select {+ padding: 6px 10px;+ background: var(--surface-2);+ border: 1px solid var(--border);+ border-radius: $radius-md;+ font-family: var(--mono);+ font-size: 12px;+ color: var(--text);+ cursor: pointer;++ &:focus {+ outline: none;+ border-color: var(--accent);+ }+ }+ }+ }++ .git-mini-tabs {+ display: flex;+ gap: $space-1;+ background: var(--surface-2);+ border: 1px solid var(--border-soft);+ border-radius: var(--radius);+ padding: 4px;++ button {+ padding: 6px 12px;+ border: none;+ border-radius: $radius-md;+ background: transparent;+ color: var(--text-dim);+ font-size: 13px;+ cursor: pointer;++ &.active {+ background: var(--surface);+ color: var(--text);+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);+ }+ }+ }+// ── info cards (overview / access / settings) ───────────.info-card {background: var(--surface);@@ -489,266 +558,200 @@}// ── Repositories tab ─────────────────────────────────────- .repositories-tab {- .repos-header {- display: flex;- justify-content: space-between;- align-items: center;- gap: $space-3;- margin-bottom: $space-3;-- h3 {- margin: 0;- font-family: var(--mono);- font-size: 10.5px;- font-weight: $font-weight-semibold;- letter-spacing: 0.08em;- text-transform: uppercase;- color: var(--text-faint);- }- }+ .git-repos-table {+ th:nth-child(2) { width: 170px; }+ th:nth-child(3),+ th:nth-child(4) { width: 70px; }+ th:nth-child(5) { width: 120px; }+ th:last-child { width: 1%; }+ }- .git-repos-table {- th:nth-child(2) { width: 170px; }- th:nth-child(3),- th:nth-child(4) { width: 70px; }- th:nth-child(5) { width: 120px; }- th:last-child { width: 1%; }- }+ // ── repository drawer contents ──+ .files-browser,+ .commits-list,+ .branches-list {+ background: var(--surface);+ border: 1px solid var(--border-soft);+ border-radius: var(--radius);+ overflow: hidden;+ }- // ── repository detail view ──- .repo-detail-header {+ // files browser (mono tree)+ .files-browser {+ .breadcrumb {display: flex;align-items: center;- gap: $space-3;- margin-bottom: $space-4;- padding-bottom: $space-4;+ flex-wrap: wrap;+ padding: 9px $space-4;+ background: var(--surface-2);border-bottom: 1px solid var(--border-soft);+ font-family: var(--mono);+ font-size: 12px;- .repo-title {- flex: 1;- min-width: 0;-- h3 {- margin: 0;- font-size: 15px;- font-weight: $font-weight-semibold;- overflow-wrap: anywhere;-- .own {- color: var(--text-faint);- font-weight: $font-weight-normal;- }- }-- p {- margin: 2px 0 0;- font-size: 12.5px;- color: var(--text-faint);- }- }-- .branch-selector select {- padding: 6px 10px;- background: var(--surface-2);- border: 1px solid var(--border);- border-radius: $radius-md;- font-family: var(--mono);- font-size: 12px;- color: var(--text);+ button {+ background: none;+ border: none;+ padding: 0;+ font: inherit;+ color: var(--accent-bright);cursor: pointer;- &:focus {- outline: none;- border-color: var(--accent);+ &:hover {+ text-decoration: underline;}}- }- .repo-detail-content {- background: var(--surface);- border: 1px solid var(--border-soft);- border-radius: var(--radius);- overflow: hidden;+ .separator {+ margin: 0 6px;+ color: var(--text-ghost);+ }}- // ── files browser (mono tree, re-tinted only) ──- .files-browser {- .breadcrumb {+ .files-list {+ .file-item {display: flex;align-items: center;- flex-wrap: wrap;+ gap: $space-3;padding: 9px $space-4;- background: var(--surface-2);border-bottom: 1px solid var(--border-soft);- font-family: var(--mono);- font-size: 12px;+ transition: background 0.12s;- button {- background: none;- border: none;- padding: 0;- font: inherit;- color: var(--accent-bright);+ &:last-child {+ border-bottom: none;+ }++ &.dir {cursor: pointer;&:hover {- text-decoration: underline;+ background: var(--surface-2);}}- .separator {- margin: 0 6px;- color: var(--text-ghost);+ .file-icon {+ display: inline-flex;+ color: var(--text-faint);}- }- .files-list {- .file-item {- display: flex;- align-items: center;- gap: $space-3;- padding: 9px $space-4;- border-bottom: 1px solid var(--border-soft);- transition: background 0.12s;-- &:last-child {- border-bottom: none;- }-- &.dir {- cursor: pointer;-- &:hover {- background: var(--surface-2);- }- }-- .file-icon {- display: inline-flex;- color: var(--text-faint);- }-- &.dir .file-icon {- color: var(--accent-bright);- }+ &.dir .file-icon {+ color: var(--accent-bright);+ }- .file-name {- flex: 1;- min-width: 0;- font-family: var(--mono);- font-size: 12.5px;- overflow-wrap: anywhere;- }+ .file-name {+ flex: 1;+ min-width: 0;+ font-family: var(--mono);+ font-size: 12.5px;+ overflow-wrap: anywhere;+ }- .file-size {- font-family: var(--mono);- font-size: 11px;- color: var(--text-faint);- }+ .file-size {+ font-family: var(--mono);+ font-size: 11px;+ color: var(--text-faint);}}}+ }- // ── commits (feed-style rows + hash chips) ──- .commits-list {- .commit-item {- display: flex;- align-items: flex-start;- gap: $space-3;- padding: 12px $space-4;- border-bottom: 1px solid var(--border-soft);+ // commits (feed-style rows + hash chips)+ .commits-list {+ .commit-item {+ display: flex;+ align-items: flex-start;+ gap: $space-3;+ padding: 12px $space-4;+ border-bottom: 1px solid var(--border-soft);- &:last-child {- border-bottom: none;- }+ &:last-child {+ border-bottom: none;+ }- .commit-info {- flex: 1;- min-width: 0;+ .commit-info {+ flex: 1;+ min-width: 0;- .commit-message {- font-size: 13px;- font-weight: $font-weight-medium;- white-space: nowrap;- overflow: hidden;- text-overflow: ellipsis;- }+ .commit-message {+ font-size: 13px;+ font-weight: $font-weight-medium;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ }- .commit-meta {- margin-top: 3px;- font-family: var(--mono);- font-size: 11px;- color: var(--text-faint);+ .commit-meta {+ margin-top: 3px;+ font-family: var(--mono);+ font-size: 11px;+ color: var(--text-faint);- .author {- color: var(--text-dim);- margin-right: $space-2;- }+ .author {+ color: var(--text-dim);+ margin-right: $space-2;}}-- .commit-sha {- flex-shrink: 0;- margin-top: 1px;- }}- .btn-block {- width: calc(100% - #{$space-8});- margin: $space-4;+ .commit-sha {+ flex-shrink: 0;+ margin-top: 1px;}}- // ── branches ──- .branches-list {- .branch-item {- display: flex;- align-items: center;- gap: $space-4;- padding: 11px $space-4;- border-bottom: 1px solid var(--border-soft);+ .btn-block {+ width: calc(100% - #{$space-8});+ margin: $space-4;+ }+ }- &:last-child {- border-bottom: none;- }+ // branches+ .branches-list {+ .branch-item {+ display: flex;+ align-items: center;+ gap: $space-4;+ padding: 11px $space-4;+ border-bottom: 1px solid var(--border-soft);- &.active {- background: var(--accent-bg-soft);- }+ &:last-child {+ border-bottom: none;+ }- .branch-info {- flex: 1;- min-width: 0;+ &.active {+ background: var(--accent-bg-soft);+ }- .branch-name {- display: flex;- align-items: center;- gap: $space-2;- font-family: var(--mono);- font-size: 12.5px;- font-weight: $font-weight-medium;-- svg {- color: var(--text-faint);- flex-shrink: 0;- }-- .git-chip {- margin-left: 0;- }- }+ .branch-info {+ flex: 1;+ min-width: 0;++ .branch-name {+ display: flex;+ align-items: center;+ gap: $space-2;+ font-family: var(--mono);+ font-size: 12.5px;+ font-weight: $font-weight-medium;- .branch-commit {- margin-top: 3px;- font-family: var(--mono);- font-size: 11px;+ svg {color: var(--text-faint);+ flex-shrink: 0;+ }++ .git-chip {+ margin-left: 0;+ }+ }- code {- color: var(--accent-bright);- margin-right: $space-2;- }+ .branch-commit {+ margin-top: 3px;+ font-family: var(--mono);+ font-size: 11px;+ color: var(--text-faint);++ code {+ color: var(--accent-bright);+ margin-right: $space-2;}}}@@ -756,75 +759,24 @@}// ── Webhooks tab ─────────────────────────────────────────- .webhooks-tab {- .webhooks-header {- display: flex;- justify-content: space-between;- align-items: flex-start;- gap: $space-4;- margin-bottom: $space-4;-- h3 {- margin: 0;- font-family: var(--mono);- font-size: 10.5px;- font-weight: $font-weight-semibold;- letter-spacing: 0.08em;- text-transform: uppercase;- color: var(--text-faint);- }+ .git-webhooks-table {+ th:last-child { width: 1%; }+ td:last-child { white-space: nowrap; }- .text-muted {- color: var(--text-dim);- font-size: 12.5px;- margin: $space-2 0 0;- }+ .git-url {+ max-width: 280px;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;}- .git-webhooks-table {- th:last-child { width: 1%; }- td:last-child { white-space: nowrap; }-- .git-url {- max-width: 280px;- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;- }-- // disabled hooks dim, but their action buttons stay legible- tbody tr.is-disabled td:not(:last-child) {- opacity: 0.55;- }+ // disabled hooks dim, but their action buttons stay legible+ tbody tr.is-disabled td:not(:last-child) {+ opacity: 0.55;}}// ── Deployments tab (feed-style history rows) ────────────- .deployments-tab {- .deployments-header {- display: flex;- justify-content: space-between;- align-items: flex-start;- gap: $space-4;- margin-bottom: $space-4;-- h3 {- margin: 0;- font-family: var(--mono);- font-size: 10.5px;- font-weight: $font-weight-semibold;- letter-spacing: 0.08em;- text-transform: uppercase;- color: var(--text-faint);- }-- .text-muted {- color: var(--text-dim);- font-size: 12.5px;- margin: $space-2 0 0;- }- }- }.git-deploys-card {background: var(--surface);