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
refactor(git): relocate the Git page into the serverkit-git extension (plan 52 Phase 6, frontend half)
Juan Denis2e0330d84d30
diff --git a/builtin-extensions/serverkit-git/frontend/index.jsx b/builtin-extensions/serverkit-git/frontend/index.jsxindex b46c71a3..f993488a 100644--- a/builtin-extensions/serverkit-git/frontend/index.jsx+++ b/builtin-extensions/serverkit-git/frontend/index.jsx@@ -1,10 +1,20 @@-// Re-exports the existing host Git page through the extension system.-// The extension owns the canonical /git route; the host keeps the page-// component as implementation detail until the Git UI is fully split.+// Git UI, contributed through the extension system. The full page lives in+// this extension now (pages/Git.jsx + styles/git.scss + its own Gitea API+// client) — plan 52 Phase 6. Imports go through 'serverkit-sdk' so the same+// source works baked in-tree (the panel's build-time glob) and as a+// runtime-ESM bundle once the extension leaves the tree.//-// After install, this file lives at frontend/src/plugins/serverkit-git/-// so the relative import resolves against the host's pages directory.-import GitPage from '../../pages/Git';+// Two halves, one page: the Gitea self-host surface calls this extension's+// backend (/api/v1/git status/lifecycle/repos, mounted when installed); the+// webhooks + deployments tabs call the CORE deploy-pipeline endpoints, which+// exist on every panel.+//+// The SCSS side-effect import compiles the page styles through this+// extension's own module graph — the host's main.scss no longer carries a+// _git partial.+import './styles/git.scss';++import GitPage from './pages/Git';export function GitExtensionPage() {return <GitPage basePath="/git" />;diff --git a/frontend/src/pages/Git.jsx b/builtin-extensions/serverkit-git/frontend/pages/Git.jsxsimilarity index 98%rename from frontend/src/pages/Git.jsxrename to builtin-extensions/serverkit-git/frontend/pages/Git.jsxindex 0953d0a6..2b73bc5d 100644--- a/frontend/src/pages/Git.jsx+++ b/builtin-extensions/serverkit-git/frontend/pages/Git.jsx@@ -1,32 +1,19 @@import { useState, useEffect, useMemo } from 'react';-import useTabParam from '../hooks/useTabParam';-import { api } from '../services/api';-import { useToast } from '../contexts/ToastContext';-import ConfirmDialog from '../components/ConfirmDialog';-import { DangerZone } from '../components/DangerZone';-import EmptyState from '../components/EmptyState';-import Modal from '@/components/Modal';+import giteaApi from '../services/gitea';import {+ api, useTabParam, useToast, ConfirmDialog, DangerZone, EmptyState, Modal,Pill, MetricCard, KpiBand, SegControl, Drawer, DataTable, DataTableFooter,ListToolbar, statusKind,-} from '../components/ds';-import {useTableChrome, GridViewPicker, GridChips, GridFilterButton,GridToolsMenu, GridFilterDrawer,-} from '@/components/ds/grid';-import { useTableSort } from '@/hooks/useTableSort';-import { useColumnVisibility } from '@/hooks/useColumnVisibility';-import PageLayout from '../layouts/PageLayout';+ useTableSort, useColumnVisibility, PageLayout,+ Button, Input, Textarea, Label, copyToClipboard,+} from 'serverkit-sdk';import {AlertCircle, FolderGit2, Webhook, Rocket, Server, Globe, Terminal, Tag,GitBranch, RefreshCw, Plus, ExternalLink, Lock, Trash2, ChevronRight,Clock, AlertTriangle, Settings,} from 'lucide-react';-import { Button } from '@/components/ui/button';-import { Input } from '@/components/ui/input';-import { Textarea } from '@/components/ui/textarea';-import { Label } from '@/components/ui/label';-import { copyToClipboard } from '@/utils/clipboard';import { useTranslation } from 'react-i18next';const VALID_TABS = ['overview', 'repositories', 'access', 'webhooks', 'deployments', 'settings'];@@ -583,7 +570,7 @@ function Git({ basePath = '/git' }) {const loadStatus = async () => {try {- const data = await api.getGitServerStatus();+ const data = await giteaApi.getGitServerStatus();setStatus(data);} catch (error) {console.error('Failed to load status:', error);@@ -699,7 +686,7 @@ function Git({ basePath = '/git' }) {const loadRepositories = async () => {setReposLoading(true);try {- const data = await api.getRepositories();+ const data = await giteaApi.getRepositories();setRepositories(data.repositories || []);} catch (error) {console.error('Failed to load repositories:', error);@@ -722,9 +709,9 @@ function Git({ basePath = '/git' }) {setSelectedBranch(repo.default_branch);setRepoDetailTab('files');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)+ giteaApi.getBranches(repo.owner.login, repo.name),+ giteaApi.getCommits(repo.owner.login, repo.name, repo.default_branch),+ giteaApi.getRepoFiles(repo.owner.login, repo.name, repo.default_branch)]).then(([branchesData, commitsData, filesData]) => {setBranches(branchesData.branches || []);setCommits(commitsData.commits || []);@@ -737,7 +724,7 @@ function Git({ basePath = '/git' }) {const navigateToPath = async (path) => {if (!selectedRepo) return;try {- const data = await api.getRepoFiles(selectedRepo.owner.login, selectedRepo.name, selectedBranch, path);+ const data = await giteaApi.getRepoFiles(selectedRepo.owner.login, selectedRepo.name, selectedBranch, path);setFiles(data.files || []);setCurrentPath(path);} catch {@@ -758,8 +745,8 @@ function Git({ basePath = '/git' }) {setCurrentPath('');try {const [commitsData, filesData] = await Promise.all([- api.getCommits(selectedRepo.owner.login, selectedRepo.name, branchName),- api.getRepoFiles(selectedRepo.owner.login, selectedRepo.name, branchName)+ giteaApi.getCommits(selectedRepo.owner.login, selectedRepo.name, branchName),+ giteaApi.getRepoFiles(selectedRepo.owner.login, selectedRepo.name, branchName)]);setCommits(commitsData.commits || []);setFiles(filesData.files || []);@@ -772,7 +759,7 @@ function Git({ basePath = '/git' }) {if (!selectedRepo) return;const currentPage = Math.ceil(commits.length / 30) + 1;try {- const data = await api.getCommits(selectedRepo.owner.login, selectedRepo.name, selectedBranch, currentPage);+ const data = await giteaApi.getCommits(selectedRepo.owner.login, selectedRepo.name, selectedBranch, currentPage);if (data.commits?.length) setCommits([...commits, ...data.commits]);} catch {toast.error(t('app.git.failedToLoadMoreCommits', 'Failed to load more commits'));@@ -882,7 +869,7 @@ function Git({ basePath = '/git' }) {}setActionLoading(true);try {- const result = await api.installGit(installForm);+ const result = await giteaApi.installGit(installForm);if (result.success) {toast.success(t('app.git.gitServerInstalledSuccessfully', 'Git server installed successfully'));setShowInstallModal(false);@@ -909,7 +896,7 @@ function Git({ basePath = '/git' }) {onConfirm: async () => {setActionLoading(true);try {- await api.uninstallGit(false);+ await giteaApi.uninstallGit(false);toast.success(t('app.git.gitServerUninstalled', 'Git server uninstalled'));await loadData();} catch (error) {@@ -926,7 +913,7 @@ function Git({ basePath = '/git' }) {const handleStart = async () => {setActionLoading(true);try {- await api.startGit();+ await giteaApi.startGit();toast.success(t('app.git.gitServerStarted', 'Git server started'));await loadStatus();} catch (error) {@@ -945,7 +932,7 @@ function Git({ basePath = '/git' }) {onConfirm: async () => {setActionLoading(true);try {- await api.stopGit();+ await giteaApi.stopGit();toast.success(t('app.git.gitServerStopped', 'Git server stopped'));await loadStatus();} catch (error) {diff --git a/builtin-extensions/serverkit-git/frontend/services/gitea.js b/builtin-extensions/serverkit-git/frontend/services/gitea.jsnew file mode 100644index 00000000..860b2d7e--- /dev/null+++ b/builtin-extensions/serverkit-git/frontend/services/gitea.js@@ -0,0 +1,45 @@+// The extension's own Gitea self-host client (/api/v1/git/* — server+// lifecycle + repo browsing), built on the panel's ApiClient via the SDK+// singleton — moved out of the host's services/api/files.js with the Git+// page (plan 52 Phase 6). The webhook + deployment endpoints stay CORE+// (they are the deploy pipeline); the page calls those through the core+// `api` object from serverkit-sdk.+import { api } from 'serverkit-sdk';++const giteaApi = {+ // Server lifecycle+ getGitServerStatus: () => api.request('/git/status'),+ getGitRequirements: () => api.request('/git/requirements'),+ installGit: (data) => api.request('/git/install', { method: 'POST', body: data }),+ uninstallGit: (removeData = false) => api.request('/git/uninstall', { method: 'POST', body: { removeData } }),+ startGit: () => api.request('/git/start', { method: 'POST' }),+ stopGit: () => api.request('/git/stop', { method: 'POST' }),+ restartGit: () => api.request('/git/restart', { method: 'POST' }),++ // Repositories+ getRepositories: (limit = 50) => api.request(`/git/repos?limit=${limit}`),+ getRepository: (owner, repo) => api.request(`/git/repos/${owner}/${repo}`),+ getRepoStats: (owner, repo) => api.request(`/git/repos/${owner}/${repo}/stats`),+ getBranches: (owner, repo) => api.request(`/git/repos/${owner}/${repo}/branches`),+ getBranch: (owner, repo, branch) => api.request(`/git/repos/${owner}/${repo}/branches/${branch}`),+ getCommits: (owner, repo, branch = null, page = 1, limit = 30) => {+ let url = `/git/repos/${owner}/${repo}/commits?page=${page}&limit=${limit}`;+ if (branch) url += `&branch=${branch}`;+ return api.request(url);+ },+ getCommit: (owner, repo, sha) => api.request(`/git/repos/${owner}/${repo}/commits/${sha}`),+ getRepoFiles: (owner, repo, ref = 'main', path = '') => {+ let url = `/git/repos/${owner}/${repo}/contents?ref=${ref}`;+ if (path) url += `&path=${path}`;+ return api.request(url);+ },+ getFileContent: (owner, repo, filepath, ref = 'main') => api.request(`/git/repos/${owner}/${repo}/contents/${filepath}?ref=${ref}`),+ getRepoReadme: (owner, repo, ref = null) => {+ let url = `/git/repos/${owner}/${repo}/readme`;+ if (ref) url += `?ref=${ref}`;+ return api.request(url);+ },+ getGiteaVersion: () => api.request('/git/version'),+};++export default giteaApi;diff --git a/frontend/src/styles/pages/_git.scss b/builtin-extensions/serverkit-git/frontend/styles/git.scsssimilarity index 97%rename from frontend/src/styles/pages/_git.scssrename to builtin-extensions/serverkit-git/frontend/styles/git.scssindex 106aca0d..5687c441 100644--- a/frontend/src/styles/pages/_git.scss+++ b/builtin-extensions/serverkit-git/frontend/styles/git.scss@@ -1,3 +1,10 @@+// Compiled through the extension's module graph (imported by index.jsx).+// The host's design-token partial is imported via a sync-safe relative+// path — the baked copy lives at frontend/src/plugins/serverkit-git/,+// so this resolves to frontend/src/styles/_variables.scss.+@import '../../../styles/variables';+@import '../../../styles/mixins';+// ============================================// GIT PAGE (redesign — infra console look)// ============================================@@ -206,7 +213,20 @@// Mono category chip (private / fork / default / protected / rollback) —// %sk-state shape (_design-system.scss) with smaller local sizing kept.git-chip {- @extend %sk-state;+ // %sk-state shape inlined (the placeholder lives in the host's+ // _design-system.scss, a different compile unit than this+ // extension's module graph — @extend can't cross that boundary).+ display: inline-flex;+ align-items: center;+ padding: 3px 9px;+ border-radius: 6px;+ font-family: var(--mono);+ font-size: 10px;+ font-weight: 600;+ letter-spacing: 0.05em;+ text-transform: uppercase;+ white-space: nowrap;+ flex-shrink: 0;vertical-align: middle;margin-left: 7px;padding: 1px 6px;diff --git a/frontend/public/serverkit-vendor/serverkit-sdk.mjs b/frontend/public/serverkit-vendor/serverkit-sdk.mjsindex d08dafe7..3341792a 100644--- a/frontend/public/serverkit-vendor/serverkit-sdk.mjs+++ b/frontend/public/serverkit-vendor/serverkit-sdk.mjs@@ -100,6 +100,10 @@ export const GridChips = m.GridChips;export const GridFilterButton = m.GridFilterButton;export const GridToolsMenu = m.GridToolsMenu;export const GridFilterDrawer = m.GridFilterDrawer;+export const statusKind = m.statusKind;+export const statusVariant = m.statusVariant;+export const statusDotClass = m.statusDotClass;+export const statusLabel = m.statusLabel;export const PageLayout = m.PageLayout;export const useTableSort = m.useTableSort;export const useColumnVisibility = m.useColumnVisibility;diff --git a/frontend/scripts/check-frontend-boundaries.mjs b/frontend/scripts/check-frontend-boundaries.mjsindex 771c65fc..f81ed32b 100644--- a/frontend/scripts/check-frontend-boundaries.mjs+++ b/frontend/scripts/check-frontend-boundaries.mjs@@ -222,13 +222,13 @@ for (const file of LEGACY_POLLERS.keys()) {const ADOPTION_CEILINGS = [{name: 'raw api.* calls in pages/ (E1: useServerQuery/useServerMutation)',- ceiling: 431,+ ceiling: 405,include: (file) => file.startsWith('pages/'),pattern: /\bapi\s*\.\s*\w+\s*\(/g,},{name: 'per-page toast.error extractions in pages/ (E1: query-layer error presentation)',- ceiling: 264,+ ceiling: 218,include: (file) => file.startsWith('pages/'),pattern: /toast\s*\.\s*error\s*\(/g,},diff --git a/frontend/src/plugins/sdk/index.js b/frontend/src/plugins/sdk/index.jsindex 12c634ce..004a9859 100644--- a/frontend/src/plugins/sdk/index.js+++ b/frontend/src/plugins/sdk/index.js@@ -187,6 +187,9 @@ export {useTableChrome, GridViewPicker, GridChips, GridFilterButton,GridToolsMenu, GridFilterDrawer,} from '../../components/ds/grid';+export {+ statusKind, statusVariant, statusDotClass, statusLabel,+} from '../../components/ds/status';export { default as PageLayout } from '../../layouts/PageLayout';export { useTableSort } from '../../hooks/useTableSort';export { useColumnVisibility } from '../../hooks/useColumnVisibility';diff --git a/frontend/src/plugins/serverkit-git/index.jsx b/frontend/src/plugins/serverkit-git/index.jsxindex b46c71a3..f993488a 100644--- a/frontend/src/plugins/serverkit-git/index.jsx+++ b/frontend/src/plugins/serverkit-git/index.jsx@@ -1,10 +1,20 @@-// Re-exports the existing host Git page through the extension system.-// The extension owns the canonical /git route; the host keeps the page-// component as implementation detail until the Git UI is fully split.+// Git UI, contributed through the extension system. The full page lives in+// this extension now (pages/Git.jsx + styles/git.scss + its own Gitea API+// client) — plan 52 Phase 6. Imports go through 'serverkit-sdk' so the same+// source works baked in-tree (the panel's build-time glob) and as a+// runtime-ESM bundle once the extension leaves the tree.//-// After install, this file lives at frontend/src/plugins/serverkit-git/-// so the relative import resolves against the host's pages directory.-import GitPage from '../../pages/Git';+// Two halves, one page: the Gitea self-host surface calls this extension's+// backend (/api/v1/git status/lifecycle/repos, mounted when installed); the+// webhooks + deployments tabs call the CORE deploy-pipeline endpoints, which+// exist on every panel.+//+// The SCSS side-effect import compiles the page styles through this+// extension's own module graph — the host's main.scss no longer carries a+// _git partial.+import './styles/git.scss';++import GitPage from './pages/Git';export function GitExtensionPage() {return <GitPage basePath="/git" />;diff --git a/frontend/src/plugins/serverkit-git/pages/Git.jsx b/frontend/src/plugins/serverkit-git/pages/Git.jsxnew file mode 100644index 00000000..2b73bc5d--- /dev/null+++ b/frontend/src/plugins/serverkit-git/pages/Git.jsx@@ -0,0 +1,1907 @@+import { useState, useEffect, useMemo } from 'react';+import giteaApi from '../services/gitea';+import {+ api, useTabParam, useToast, ConfirmDialog, DangerZone, EmptyState, Modal,+ Pill, MetricCard, KpiBand, SegControl, Drawer, DataTable, DataTableFooter,+ ListToolbar, statusKind,+ useTableChrome, GridViewPicker, GridChips, GridFilterButton,+ GridToolsMenu, GridFilterDrawer,+ useTableSort, useColumnVisibility, PageLayout,+ Button, Input, Textarea, Label, copyToClipboard,+} from 'serverkit-sdk';+import {+ AlertCircle, FolderGit2, Webhook, Rocket, Server, Globe, Terminal, Tag,+ GitBranch, RefreshCw, Plus, ExternalLink, Lock, Trash2, ChevronRight,+ Clock, AlertTriangle, Settings,+} from 'lucide-react';+import { useTranslation } from 'react-i18next';++const VALID_TABS = ['overview', 'repositories', 'access', 'webhooks', 'deployments', 'settings'];++const SOURCE_INITIALS = { github: 'GH', gitlab: 'GL', bitbucket: 'BB' };++const formatDate = (dateString) => {+ if (!dateString) return 'Unknown';+ 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();+};++// Columns for the shared DataTable. Cell markup and classNames are identical+// to the hand-rolled tables they replace, so _git.scss keeps applying+// (.sk-cell-name, .git-reponame, .git-branch-chip, .git-url, .dom-chev).+//+// Two accessors per column on purpose: `value` is what the column MENU, the+// filter rules and the export read (ds/grid/fields.js), `sortValue` is what+// DataTable's sorter reads. A column declaring only `sortValue` silently types+// itself from it — which is how a numeric sort key turns a status column into+// a number and makes every string rule match nothing.+const REPO_COLUMNS = [+ {+ key: 'name',+ headerKey: 'app.git.repository', header: 'Repository',+ sortable: true,+ hideable: false,+ // Rules read `owner/name`, which is what the cell shows and what you+ // would paste in from Gitea; the SORT stays on the bare repo name so+ // the list is not silently grouped by owner.+ type: 'text',+ value: (repo) => repo.full_name || `${repo.owner?.login || ''}/${repo.name || ''}`,+ sortValue: (repo) => repo.name || '',+ render: (repo) => (+ <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}+ </div>+ {repo.description && <div className="sk-cell-sub git-repo-desc">{repo.description}</div>}+ </div>+ </div>+ ),+ },+ {+ // Promoted out of the name cell, where the same fact rode as a chip:+ // "what is private" was the whole point of one of the segments this+ // table used to carry, and inside another cell it could not be sorted,+ // grouped or filtered. Declared enum — two repos on a fresh server+ // fail the cardinality test and the column would fall back to text.+ key: 'visibility',+ headerKey: 'app.git.visibility', header: 'Visibility',+ sortable: true,+ type: 'enum',+ groupable: true,+ enumOrder: ['Private', 'Public'],+ value: (repo) => (repo.private ? 'Private' : 'Public'),+ groupValue: (repo) => (repo.private ? 'Private' : 'Public'),+ sortValue: (repo) => (repo.private ? 'Private' : 'Public'),+ render: (repo) => (+ <span className={`git-chip git-chip--${repo.private ? 'amber' : 'cyan'}`}>+ {repo.private ? 'private' : 'public'}+ </span>+ ),+ },+ {+ // The other promoted chip. Fork is tested BEFORE mirror so this column+ // keeps the exact meaning the old "Forks" segment had (`repo.fork`) —+ // a repo that is both reads as a fork, as it did then.+ key: 'kind',+ headerKey: 'common.labels.kind', header: 'Kind',+ sortable: true,+ type: 'enum',+ groupable: true,+ enumOrder: ['Source', 'Fork', 'Mirror'],+ value: (repo) => (repo.fork ? 'Fork' : repo.mirror ? 'Mirror' : 'Source'),+ groupValue: (repo) => (repo.fork ? 'Fork' : repo.mirror ? 'Mirror' : 'Source'),+ sortValue: (repo) => (repo.fork ? 'Fork' : repo.mirror ? 'Mirror' : 'Source'),+ render: (repo) => (repo.fork ? (+ <span className="git-chip git-chip--cyan">fork</span>+ ) : repo.mirror ? (+ <span className="git-chip git-chip--cyan">mirror</span>+ ) : (+ <span className="sk-cell-sub">source</span>+ )),+ },+ {+ key: 'branch',+ headerKey: 'common.labels.branch', header: 'Branch',+ sortable: true,+ // main/master/develop on nearly every server — a pick-list, not a+ // fragment you type.+ type: 'enum',+ value: (repo) => repo.default_branch || '',+ sortValue: (repo) => repo.default_branch || '',+ render: (repo) => (+ <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>+ ),+ },+ {+ key: 'stars',+ headerKey: 'app.git.stars', header: 'Stars',+ sortable: true,+ type: 'num',+ value: (repo) => repo.stars ?? 0,+ sortValue: (repo) => repo.stars ?? 0,+ cellClassName: 'sk-cell-mono',+ },+ {+ key: 'forks',+ headerKey: 'app.git.forks', header: 'Forks',+ sortable: true,+ type: 'num',+ value: (repo) => repo.forks ?? 0,+ sortValue: (repo) => repo.forks ?? 0,+ cellClassName: 'sk-cell-mono',+ },+ {+ key: 'updated',+ headerKey: 'app.git.updated', header: 'Updated',+ sortable: true,+ // Declared, not inferred: the sorter wants epoch ms, and letting that+ // number type the column would offer "is under 1754…" instead of a+ // date picker — and make any date rule match nothing.+ type: 'date',+ value: (repo) => repo.updated_at || null,+ sortValue: (repo) => (repo.updated_at ? new Date(repo.updated_at).getTime() : null),+ cellClassName: 'sk-cell-mono',+ render: (repo) => formatDate(repo.updated_at),+ },+ {+ key: 'open',+ header: '',+ sortable: false,+ hideable: false,+ width: 30,+ render: () => <ChevronRight size={16} className="dom-chev" />,+ },+];++const WEBHOOK_COLUMNS = [+ {+ key: 'name',+ headerKey: 'app.git.webhook', header: 'Webhook',+ sortable: true,+ hideable: false,+ type: 'text',+ value: (webhook) => webhook.name || '',+ sortValue: (webhook) => webhook.name || '',+ render: (webhook) => (+ <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>+ ),+ },+ {+ // The clone URL carries the host, so `contains github.com` is how you+ // slice by provider without a column of its own.+ key: 'repository',+ headerKey: 'app.git.repository', header: 'Repository',+ sortable: true,+ type: 'text',+ value: (webhook) => webhook.source_repo_url || '',+ sortValue: (webhook) => webhook.source_repo_url || '',+ cellClassName: 'sk-cell-mono git-url',+ render: (webhook) => <span title={webhook.source_repo_url}>{webhook.source_repo_url}</span>,+ },+ {+ key: 'branch',+ headerKey: 'common.labels.branch', header: 'Branch',+ sortable: true,+ type: 'enum',+ value: (webhook) => webhook.source_branch || '',+ sortValue: (webhook) => webhook.source_branch || '',+ render: (webhook) => (+ <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>+ ),+ },+ {+ key: 'lastSync',+ headerKey: 'app.git.lastSync', header: 'Last sync',+ sortable: true,+ // Declared date, not inferred from the epoch `sortValue`. A hook that+ // never ran has none, and a date rule can only compare two real dates —+ // "never synced" is therefore a rule on `syncState`, not on this column.+ type: 'date',+ value: (webhook) => webhook.last_sync_at || null,+ sortValue: (webhook) => (webhook.last_sync_at ? new Date(webhook.last_sync_at).getTime() : null),+ cellClassName: 'sk-cell-mono',+ render: (webhook) => (+ <span title={webhook.last_sync_at ? new Date(webhook.last_sync_at).toLocaleString() : undefined}>+ {webhook.last_sync_at ? formatDate(webhook.last_sync_at) : 'never'}+ </span>+ ),+ },+ {+ // The health of the last delivery, which the table never showed:+ // `last_sync_status` is written by the sync worker ('success' |+ // 'failed' | 'pending') and is null until a hook has fired once, which+ // is the 'never' bucket below. A configured-but-broken hook used to be+ // indistinguishable from a working one on this page.+ key: 'syncState',+ headerKey: 'app.git.lastResult', header: 'Last result',+ sortable: true,+ type: 'enum',+ enumOrder: ['success', 'failed', 'pending', 'never'],+ value: (webhook) => webhook.last_sync_status || 'never',+ sortValue: (webhook) => webhook.last_sync_status || 'never',+ render: (webhook) => {+ const state = webhook.last_sync_status || 'never';+ const kind = { success: 'green', failed: 'red', pending: 'amber' }[state] || 'gray';+ return (+ <Pill kind={kind} dot={false} title={webhook.last_sync_message || undefined}>+ {state}+ </Pill>+ );+ },+ },+ {+ key: 'sync_count',+ headerKey: 'app.git.syncs', header: 'Syncs',+ sortable: true,+ type: 'num',+ value: (webhook) => webhook.sync_count ?? 0,+ sortValue: (webhook) => webhook.sync_count ?? 0,+ cellClassName: 'sk-cell-mono',+ },+ {+ key: 'status',+ headerKey: 'common.labels.status', header: 'Status',+ sortable: true,+ // Declared enum with a STRING `value`: `sortValue` is 1/0 so that a+ // sort puts the live hooks together, and letting that number type the+ // column would have made every 'Active' rule match zero rows.+ type: 'enum',+ enumOrder: ['Active', 'Inactive'],+ value: (webhook) => (webhook.is_active ? 'Active' : 'Inactive'),+ sortValue: (webhook) => (webhook.is_active ? 1 : 0),+ render: (webhook) => <Pill kind={webhook.is_active ? 'green' : 'gray'}>{webhook.is_active ? 'Active' : 'Inactive'}</Pill>,+ },+ {+ key: 'open',+ header: '',+ sortable: false,+ hideable: false,+ width: 30,+ render: () => <ChevronRight size={16} className="dom-chev" />,+ },+];++// Built-in saved views for the two list surfaces. Every rule matches a+// column's `value` accessor, so the strings below are the LABELS the cells+// render ('Private', 'Fork', 'Active') — never a raw backend boolean.+//+// These replace the two segment rows the tabs used to carry: every bucket+// either offered (All / Private / Forks, All / Active / Inactive) is a rule+// here, and the per-column "⋮" now offers the same slices on every other+// column for free.+const NO_RULES = { match: 'all', rules: [] };++const REPO_VIEWS = [+ {+ // The landing view: what has moved lately. Gitea's `updated_at` covers+ // pushes and settings changes alike, which is exactly "has anyone+ // touched this".+ name: 'Recently updated',+ state: {+ sorts: [{ key: 'updated', direction: 'desc' }],+ hiddenKeys: [],+ columnFilters: NO_RULES,+ },+ },+ {+ // The old "Private" segment.+ name: 'Private',+ state: {+ sorts: [{ key: 'name', direction: 'asc' }],+ hiddenKeys: ['visibility'],+ columnFilters: {+ match: 'all',+ rules: [{ id: 'rv1', field: 'visibility', op: 'any', value: ['Private'] }],+ },+ },+ },+ {+ // The inverse, and the one worth reading on a self-hosted server:+ // anything here is readable by every Gitea account, and by anonymous+ // visitors if the instance allows them.+ name: 'Public',+ state: {+ sorts: [{ key: 'name', direction: 'asc' }],+ hiddenKeys: ['visibility'],+ columnFilters: {+ match: 'all',+ rules: [{ id: 'rv2', field: 'visibility', op: 'any', value: ['Public'] }],+ },+ },+ },+ {+ // The old "Forks" segment. Stalest first: a fork nobody has pushed to+ // since it was made is usually the one to delete.+ name: 'Forks',+ state: {+ sorts: [{ key: 'updated', direction: 'asc' }],+ hiddenKeys: ['kind'],+ columnFilters: {+ match: 'all',+ rules: [{ id: 'rv3', field: 'kind', op: 'any', value: ['Fork'] }],+ },+ },+ },+];++const WEBHOOK_VIEWS = [+ {+ // The old "Active" segment, most recently synced first — the hooks that+ // will actually fire on the next push.+ name: 'Active',+ state: {+ sorts: [{ key: 'lastSync', direction: 'desc' }],+ hiddenKeys: [],+ columnFilters: {+ match: 'all',+ rules: [{ id: 'wv1', field: 'status', op: 'any', value: ['Active'] }],+ },+ },+ },+ {+ // The old "Inactive" segment: configured, disabled, still listed.+ name: 'Inactive',+ state: {+ sorts: [{ key: 'name', direction: 'asc' }],+ hiddenKeys: [],+ columnFilters: {+ match: 'all',+ rules: [{ id: 'wv2', field: 'status', op: 'any', value: ['Inactive'] }],+ },+ },+ },+ {+ // An exception list — empty is the right answer. A hook whose last+ // delivery failed is silently not deploying anything, and nothing else+ // on this page says so.+ name: 'Failing syncs',+ state: {+ sorts: [{ key: 'lastSync', direction: 'desc' }],+ hiddenKeys: [],+ columnFilters: {+ match: 'all',+ rules: [{ id: 'wv3', field: 'syncState', op: 'any', value: ['failed'] }],+ },+ },+ },+ {+ // Created but never fired once — usually a webhook that was added here+ // and never registered on the provider side, so the push it is waiting+ // for never arrives.+ name: 'Never synced',+ state: {+ sorts: [{ key: 'name', direction: 'asc' }],+ hiddenKeys: [],+ columnFilters: {+ match: 'all',+ rules: [{ id: 'wv4', field: 'syncState', op: 'any', value: ['never'] }],+ },+ },+ },+];++// Recent deployments table inside the webhook drawer.+const HOOK_DEPLOY_COLUMNS = [+ {+ key: 'version',+ headerKey: 'common.labels.version', header: 'Version',+ sortable: true,+ sortValue: (d) => d.version ?? 0,+ render: (d) => `v${d.version}`,+ },+ {+ key: 'status',+ headerKey: 'common.labels.status', header: 'Status',+ sortable: true,+ sortValue: (d) => d.status || '',+ render: (d) => <Pill kind={statusKind(d.status)}>{d.status}</Pill>,+ },+ {+ key: 'when',+ headerKey: 'common.labels.when', header: 'When',+ sortable: true,+ sortValue: (d) => (d.created_at ? new Date(d.created_at).getTime() : null),+ render: (d) => formatDate(d.created_at),+ },+];++function Git({ basePath = '/git' }) {+ const { t } = useTranslation();+ 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);+ const [installForm, setInstallForm] = useState({+ adminUser: 'admin',+ adminEmail: '',+ adminPassword: ''+ });++ // Webhook state+ const [webhooks, setWebhooks] = useState([]);+ const [webhooksLoading, setWebhooksLoading] = useState(false);+ const [showWebhookModal, setShowWebhookModal] = useState(false);+ const [drawerWebhook, setDrawerWebhook] = useState(null);+ const [webhookDeployments, setWebhookDeployments] = useState([]);+ const [webhookForm, setWebhookForm] = useState({+ name: '',+ source: 'github',+ sourceRepoUrl: '',+ sourceBranch: 'main',+ localRepoName: '',+ syncDirection: 'pull',+ autoSync: true,+ appId: '',+ deployOnPush: false,+ preDeployScript: '',+ postDeployScript: '',+ zeroDowntime: false,+ });+ const [webhookSecret, setWebhookSecret] = useState(null);++ // Repository state+ const [repositories, setRepositories] = useState([]);+ const [reposLoading, setReposLoading] = useState(false);+ const [selectedRepo, setSelectedRepo] = useState(null);+ 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');++ // Deployment state+ const [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 { sorts: repoSorts, setSorts: setRepoSorts } = useTableSort({ storageKey: 'serverkit-table-git-repos-sort' });+ const {+ hiddenKeys: repoHiddenKeys, setHiddenKeys: setRepoHiddenKeys,+ } = useColumnVisibility({ storageKey: 'serverkit-table-git-repos-cols' });+ const { sorts: webhookSorts, setSorts: setWebhookSorts } = useTableSort({ storageKey: 'serverkit-table-git-webhooks-sort' });+ const {+ hiddenKeys: webhookHiddenKeys, setHiddenKeys: setWebhookHiddenKeys,+ } = useColumnVisibility({ storageKey: 'serverkit-table-git-webhooks-cols' });++ // Repositories and Webhooks live on different tabs and only one RENDERS at+ // a time, but both chromes are hooks on this one component, so both are+ // MOUNTED at all times — and each would write `?view=`/`?sort=` over the+ // other's. Hence a urlScope apiece: the params become `repos.view` and+ // `hooks.view`, and a link to one tab's view means nothing to the other.+ const repoChrome = useTableChrome({+ columns: REPO_COLUMNS,+ rows: repositories,+ viewPageKey: 'git-repositories',+ urlScope: 'repos',+ builtinViews: REPO_VIEWS,+ noun: 'repositories',+ sorts: repoSorts,+ setSorts: setRepoSorts,+ hiddenKeys: repoHiddenKeys,+ setHiddenKeys: setRepoHiddenKeys,+ });++ const webhookChrome = useTableChrome({+ columns: WEBHOOK_COLUMNS,+ rows: webhooks,+ viewPageKey: 'git-webhooks',+ urlScope: 'hooks',+ builtinViews: WEBHOOK_VIEWS,+ noun: 'webhooks',+ sorts: webhookSorts,+ setSorts: setWebhookSorts,+ hiddenKeys: webhookHiddenKeys,+ setHiddenKeys: setWebhookHiddenKeys,+ });++ const toast = useToast();++ useEffect(() => {+ loadData();+ }, []);++ useEffect(() => {+ if (activeTab === 'webhooks' && status?.installed) {+ loadWebhooks();+ loadApplications();+ }+ if (activeTab === 'repositories' && status?.installed && status?.running) {+ loadRepositories();+ }+ if (activeTab === 'deployments' && status?.installed) {+ loadWebhooks();+ loadAllDeployments();+ }+ }, [activeTab, status?.installed, status?.running]);++ useEffect(() => {+ if (drawerWebhook?.id) {+ loadWebhookDeployments(drawerWebhook.id).then(setWebhookDeployments);+ }+ }, [drawerWebhook]);++ const loadData = async () => {+ setLoading(true);+ try {+ await loadStatus();+ } catch (error) {+ console.error('Failed to load git data:', error);+ } finally {+ setLoading(false);+ }+ };++ const loadStatus = async () => {+ try {+ const data = await giteaApi.getGitServerStatus();+ setStatus(data);+ } catch (error) {+ console.error('Failed to load status:', error);+ setStatus({ installed: false });+ }+ };++ const loadWebhooks = async () => {+ setWebhooksLoading(true);+ try {+ const data = await api.getWebhooks();+ setWebhooks(data.webhooks || []);+ } catch (error) {+ console.error('Failed to load webhooks:', error);+ } finally {+ setWebhooksLoading(false);+ }+ };++ 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(t('app.git.nameAndRepositoryUrlAreRequired', 'Name and repository URL are required'));+ return;+ }+ setActionLoading(true);+ try {+ const result = await api.createWebhook(webhookForm);+ if (result.success) {+ toast.success(t('app.git.webhookCreatedSuccessfully', 'Webhook created successfully'));+ setWebhookSecret(result.secret);+ setShowWebhookModal(false);+ setWebhookForm({+ name: '', source: 'github', sourceRepoUrl: '', sourceBranch: 'main',+ localRepoName: '', syncDirection: 'pull', autoSync: true, appId: '',+ deployOnPush: false, preDeployScript: '', postDeployScript: '', zeroDowntime: false,+ });+ await loadWebhooks();+ } else {+ toast.error(result.error || t('app.git.failedToCreateWebhook', 'Failed to create webhook'));+ }+ } catch (error) {+ toast.error(t('app.git.failedToCreateWebhook2', 'Failed to create webhook: {{message}}', { message: error.message }));+ } finally {+ setActionLoading(false);+ }+ };++ const handleDeleteWebhook = async (webhookId) => {+ setConfirmDialog({+ titleKey: 'app.git.deleteWebhook', title: 'Delete Webhook',+ messageKey: 'app.git.areYouSureYouWantTo', message: 'Are you sure you want to delete this webhook? This cannot be undone.',+ confirmTextKey: 'common.actions.delete', confirmText: 'Delete',+ variant: 'danger',+ onConfirm: async () => {+ try {+ await api.deleteWebhook(webhookId);+ toast.success(t('app.git.webhookDeleted', 'Webhook deleted'));+ await loadWebhooks();+ } catch (error) {+ toast.error(t('app.git.failedToDelete', 'Failed to delete: {{message}}', { message: error.message }));+ } finally {+ setConfirmDialog(null);+ setDrawerWebhook(null);+ }+ },+ onCancel: () => setConfirmDialog(null)+ });+ };++ const handleToggleWebhook = async (webhookId) => {+ try {+ const result = await api.toggleWebhook(webhookId);+ 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(t('app.git.failedToToggleWebhook', 'Failed to toggle webhook: {{message}}', { message: error.message }));+ }+ };++ const handleTestWebhook = async (webhookId) => {+ try {+ const result = await api.testWebhook(webhookId);+ if (result.success) toast.success(t('app.git.testEventLogged', 'Test event logged'));+ else toast.error(result.error || t('app.git.testFailed', 'Test failed'));+ } catch (error) {+ toast.error(t('app.git.testFailed2', 'Test failed: {{message}}', { message: error.message }));+ }+ };++ const copyWebhookUrl = (webhook) => {+ const baseUrl = window.location.origin;+ const url = `${baseUrl}/api${webhook.webhook_url}`;+ copyToClipboard(url);+ toast.success(t('app.git.webhookUrlCopied', 'Webhook URL copied'));+ };++ // Repository functions+ const loadRepositories = async () => {+ setReposLoading(true);+ try {+ const data = await giteaApi.getRepositories();+ setRepositories(data.repositories || []);+ } catch (error) {+ console.error('Failed to load repositories:', error);+ if (error.message?.includes('not running')) {+ toast.error(t('app.git.giteaServerIsNotRunning', 'Gitea server is not running'));+ }+ } finally {+ setReposLoading(false);+ }+ };++ const openRepoDrawer = async (repo) => {+ setDrawerRepo(repo);+ setSelectedRepo(repo);+ setRepoViewState(repo);+ };++ const setRepoViewState = (repo) => {+ setCurrentPath('');+ setSelectedBranch(repo.default_branch);+ setRepoDetailTab('files');+ Promise.all([+ giteaApi.getBranches(repo.owner.login, repo.name),+ giteaApi.getCommits(repo.owner.login, repo.name, repo.default_branch),+ giteaApi.getRepoFiles(repo.owner.login, repo.name, repo.default_branch)+ ]).then(([branchesData, commitsData, filesData]) => {+ setBranches(branchesData.branches || []);+ setCommits(commitsData.commits || []);+ setFiles(filesData.files || []);+ }).catch(() => {+ toast.error(t('app.git.failedToLoadRepositoryDetails', 'Failed to load repository details'));+ });+ };++ const navigateToPath = async (path) => {+ if (!selectedRepo) return;+ try {+ const data = await giteaApi.getRepoFiles(selectedRepo.owner.login, selectedRepo.name, selectedBranch, path);+ setFiles(data.files || []);+ setCurrentPath(path);+ } catch {+ toast.error(t('app.git.failedToLoadDirectory', 'Failed to load directory'));+ }+ };++ const navigateUp = () => {+ if (!currentPath) return;+ const parts = currentPath.split('/');+ parts.pop();+ navigateToPath(parts.join('/'));+ };++ const changeBranch = async (branchName) => {+ if (!selectedRepo) return;+ setSelectedBranch(branchName);+ setCurrentPath('');+ try {+ const [commitsData, filesData] = await Promise.all([+ giteaApi.getCommits(selectedRepo.owner.login, selectedRepo.name, branchName),+ giteaApi.getRepoFiles(selectedRepo.owner.login, selectedRepo.name, branchName)+ ]);+ setCommits(commitsData.commits || []);+ setFiles(filesData.files || []);+ } catch {+ toast.error(t('app.git.failedToSwitchBranch', 'Failed to switch branch'));+ }+ };++ const loadMoreCommits = async () => {+ if (!selectedRepo) return;+ const currentPage = Math.ceil(commits.length / 30) + 1;+ try {+ const data = await giteaApi.getCommits(selectedRepo.owner.login, selectedRepo.name, selectedBranch, currentPage);+ if (data.commits?.length) setCommits([...commits, ...data.commits]);+ } catch {+ toast.error(t('app.git.failedToLoadMoreCommits', 'Failed to load more commits'));+ }+ };++ // Deployment functions+ const loadAllDeployments = async () => {+ setDeploymentsLoading(true);+ try {+ const 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.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));+ setDeployments(allDeployments);+ } catch (error) {+ console.error('Failed to load deployments:', error);+ } finally {+ setDeploymentsLoading(false);+ }+ };++ const loadWebhookDeployments = async (webhookId) => {+ try {+ const data = await api.getWebhookDeployments(webhookId, 20);+ return data.deployments || [];+ } catch (error) {+ console.error('Failed to load webhook deployments:', error);+ return [];+ }+ };++ const handleTriggerDeploy = async (appId) => {+ setDeployingAppId(appId);+ try {+ const result = await api.triggerGitDeploy(appId);+ if (result.success) {+ toast.success(t('app.git.deploymentStartedV', 'Deployment started: v{{version}}', { version: result.version }));+ await loadAllDeployments();+ } else {+ toast.error(result.error || t('app.git.failedToTriggerDeployment', 'Failed to trigger deployment'));+ }+ } catch (error) {+ toast.error(t('app.git.failedToDeploy', 'Failed to deploy: {{message}}', { message: error.message }));+ } finally {+ setDeployingAppId(null);+ }+ };++ const handleRollback = async (appId, targetVersion) => {+ setConfirmDialog({+ titleKey: 'app.git.rollbackDeployment', title: 'Rollback Deployment',+ message: `Rollback to version ${targetVersion}? This will restart the application with the previous code.`,+ confirmTextKey: 'app.git.rollback', confirmText: 'Rollback',+ variant: 'warning',+ onConfirm: async () => {+ try {+ const result = await api.rollbackDeployment(appId, targetVersion);+ if (result.success) {+ toast.success(result.message || t('app.git.rollbackCompleted', 'Rollback completed'));+ await loadAllDeployments();+ } else {+ toast.error(result.error || t('app.git.rollbackFailed', 'Rollback failed'));+ }+ } catch (error) {+ toast.error(t('app.git.rollbackFailed2', 'Rollback failed: {{message}}', { message: error.message }));+ } finally {+ setConfirmDialog(null);+ }+ },+ onCancel: () => setConfirmDialog(null)+ });+ };++ const viewDeploymentLogs = async (deploymentId) => {+ try {+ const data = await api.getDeployment(deploymentId, true);+ if (data.success) {+ setSelectedDeployment(data.deployment);+ setShowDeploymentLogs(true);+ } else {+ toast.error(t('app.git.failedToLoadDeploymentDetails', 'Failed to load deployment details'));+ }+ } catch (error) {+ toast.error(t('app.git.failedToLoadLogs', 'Failed to load logs: {{message}}', { message: error.message }));+ }+ };++ const formatFileSize = (bytes) => {+ if (bytes === 0) return '0 B';+ const k = 1024;+ const sizes = ['B', 'KB', 'MB', 'GB'];+ const i = Math.floor(Math.log(bytes) / Math.log(k));+ return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i];+ };++ const handleInstall = async () => {+ if (!installForm.adminEmail) {+ toast.error(t('app.git.adminEmailIsRequired', 'Admin email is required'));+ return;+ }+ setActionLoading(true);+ try {+ const result = await giteaApi.installGit(installForm);+ if (result.success) {+ toast.success(t('app.git.gitServerInstalledSuccessfully', 'Git server installed successfully'));+ setShowInstallModal(false);+ if (result.admin_password) {+ toast.info(t('app.git.adminPasswordSaveThis', 'Admin password: {{adminpassword}} (save this!)', { adminpassword: result.admin_password }));+ }+ await loadData();+ } else {+ toast.error(result.error || t('app.git.installationFailed', 'Installation failed'));+ }+ } catch (error) {+ toast.error(t('app.git.failedToInstall', 'Failed to install: {{message}}', { message: error.message }));+ } finally {+ setActionLoading(false);+ }+ };++ const handleUninstall = async () => {+ setConfirmDialog({+ titleKey: 'app.git.uninstallGitServer', title: 'Uninstall Git Server',+ messageKey: 'app.git.uninstallTheGiteaServerThisWill', message: 'Uninstall the Gitea server? This will stop the container but preserve your data.',+ confirmTextKey: 'app.git.uninstall', confirmText: 'Uninstall',+ variant: 'danger',+ onConfirm: async () => {+ setActionLoading(true);+ try {+ await giteaApi.uninstallGit(false);+ toast.success(t('app.git.gitServerUninstalled', 'Git server uninstalled'));+ await loadData();+ } catch (error) {+ toast.error(t('app.git.failedToUninstall', 'Failed to uninstall: {{message}}', { message: error.message }));+ } finally {+ setActionLoading(false);+ setConfirmDialog(null);+ }+ },+ onCancel: () => setConfirmDialog(null)+ });+ };++ const handleStart = async () => {+ setActionLoading(true);+ try {+ await giteaApi.startGit();+ toast.success(t('app.git.gitServerStarted', 'Git server started'));+ await loadStatus();+ } catch (error) {+ toast.error(t('app.git.failedToStart', 'Failed to start: {{message}}', { message: error.message }));+ } finally {+ setActionLoading(false);+ }+ };++ const handleStop = async () => {+ setConfirmDialog({+ titleKey: 'app.git.stopGitServer', title: 'Stop Git Server',+ messageKey: 'app.git.stopTheGitServer', message: 'Stop the Git server?',+ confirmTextKey: 'common.actions.stop', confirmText: 'Stop',+ variant: 'warning',+ onConfirm: async () => {+ setActionLoading(true);+ try {+ await giteaApi.stopGit();+ toast.success(t('app.git.gitServerStopped', 'Git server stopped'));+ await loadStatus();+ } catch (error) {+ toast.error(t('app.git.failedToStop', 'Failed to stop: {{message}}', { message: error.message }));+ } finally {+ setActionLoading(false);+ setConfirmDialog(null);+ }+ },+ onCancel: () => setConfirmDialog(null)+ });+ };++ const openGitea = () => {+ if (status?.url_path) {+ window.open(`${window.location.origin}${status.url_path}`, '_blank');+ } else if (status?.http_port) {+ window.open(`http://${window.location.hostname}:${status.http_port}`, '_blank');+ }+ };++ const getGiteaUrl = () => {+ if (status?.url_path) return `${window.location.origin}${status.url_path}`;+ return `http://${window.location.hostname}:${status?.http_port}`;+ };++ const getAppName = (appId) => {+ const app = applications.find(a => String(a.id) === String(appId));+ return app ? app.name : 'Unknown';+ };++ // ── Filters ───────────────────────────────────────────────+ // Repositories and Webhooks filter themselves now: their segment rows are+ // column rules, applied inside <DataTable> and counted by the chrome.+ // Deployments is still a card list rather than a table, so it keeps its own.+ 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 (+ <KpiBand>+ <MetricCard tone={status?.running ? 'green' : 'red'} icon={<Server size={16} />} value={status?.running ? 'Running' : 'Stopped'} label={t('app.git.serverStatus', 'Server status')} />+ <MetricCard tone="accent" icon={<Globe size={16} />} value={status?.url_path || '/gitea'} label={t('app.git.urlPath', 'URL path')} />+ <MetricCard tone="cyan" icon={<Terminal size={16} />} value={status?.ssh_port || 'N/A'} label={t('app.git.sshPort', 'SSH port')} />+ <MetricCard tone="violet" icon={<Tag size={16} />} value={status?.version || 'Unknown'} label={t('app.git.giteaVersion', 'Gitea version')} />+ </KpiBand>+ );+ case 'repositories':+ return (+ <KpiBand>+ <MetricCard tone="accent" icon={<FolderGit2 size={16} />} value={repositories.length} label={t('app.git.repositories', 'Repositories')} />+ <MetricCard tone="amber" icon={<Lock size={16} />} value={repoPrivateCount} label={t('app.git.private', 'Private')} />+ <MetricCard tone="cyan" icon={<GitBranch size={16} />} value={repoForkCount} label={t('app.git.forks', 'Forks')} />+ <MetricCard tone="green" icon={<Clock size={16} />} value={repoUpdatedCount} label={t('app.git.updated7d', 'Updated ≤7d')} />+ </KpiBand>+ );+ case 'webhooks':+ return (+ <KpiBand>+ <MetricCard tone="accent" icon={<Webhook size={16} />} value={webhooks.length} label={t('app.git.webhooks', 'Webhooks')} />+ <MetricCard tone="green" icon={<Server size={16} />} value={webhookActiveCount} label={t('app.git.active', 'Active')} />+ <MetricCard tone="gray" icon={<AlertCircle size={16} />} value={webhookInactiveCount} label={t('app.git.inactive', 'Inactive')} />+ <MetricCard tone="cyan" icon={<Rocket size={16} />} value={webhookDeployCount} label={t('app.git.deployOnPush', 'Deploy on push')} />+ </KpiBand>+ );+ case 'deployments':+ return (+ <KpiBand>+ <MetricCard tone="accent" icon={<Rocket size={16} />} value={deployments.length} label={t('app.git.deployments', 'Deployments')} />+ <MetricCard tone="green" icon={<Server size={16} />} value={deploymentSuccessCount} label={t('app.git.success', 'Success')} />+ <MetricCard tone="red" icon={<AlertTriangle size={16} />} value={deploymentFailedCount} label={t('common.state.failed', 'Failed')} />+ <MetricCard tone="amber" icon={<Clock size={16} />} value={deploymentRunningCount} label={t('app.git.running', 'Running')} />+ </KpiBand>+ );+ default:+ return null;+ }+ };++ // ── Tab content ───────────────────────────────────────────+ const renderOverview = () => (+ <>+ <ListToolbar title={t('app.git.serverOverview', 'Server overview')} />+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.httpUrl', 'HTTP URL')}</div>+ <div className="sk-spec-card__value git-url-value">{status?.running ? getGiteaUrl() : 'Server not running'}</div>+ <div className="sk-spec-card__sub">{t('app.git.webInterface', 'Web interface')}</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.sshCloneUrl', 'SSH Clone URL')}</div>+ <div className="sk-spec-card__value git-url-value">ssh://git@{window.location.hostname}:{status?.ssh_port}/user/repo.git</div>+ <div className="sk-spec-card__sub">{t('app.git.useYourSshKey', 'Use your SSH key')}</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.quickActions', 'Quick actions')}</div>+ <div className="git-quick-actions">+ <Button variant="outline" size="sm" onClick={openGitea} disabled={!status?.running}>{t('app.git.openGitea', 'Open Gitea')}</Button>+ <Button variant="outline" size="sm" onClick={() => { copyToClipboard(`git clone ssh://git@${window.location.hostname}:${status?.ssh_port}/user/repo.git`); toast.success(t('app.git.sshUrlCopied', 'SSH URL copied')); }}>+ {t('app.git.copySshUrl', 'Copy SSH URL')}+ </Button>+ </div>+ <div className="sk-spec-card__sub">{t('app.git.accessRepositories', 'Access repositories')}</div>+ </div>+ </div>+ </>+ );++ const renderRepositories = () => {+ if (!status?.running) {+ return (+ <EmptyState+ icon={AlertCircle}+ title={t('app.git.serverNotRunning', 'Server not running')}+ description={t('app.git.startTheGitServerToBrowse', 'Start the Git server to browse repositories.')}+ action={<Button onClick={handleStart}>{t('app.git.startServer', 'Start Server')}</Button>}+ />+ );+ }+ if (reposLoading) return <EmptyState loading loadingVariant="table" title={t('app.git.loadingRepositories', 'Loading repositories')} />;+ if (repositories.length === 0) {+ return (+ <EmptyState+ icon={FolderGit2}+ title={t('app.git.noRepositoriesYet', 'No repositories yet')}+ description={t('app.git.createYourFirstRepositoryInGitea', 'Create your first repository in Gitea.')}+ action={<Button onClick={openGitea}>{t('app.git.openGitea', 'Open Gitea')}</Button>}+ />+ );+ }+ return (+ <>+ {/* The view name replaces the old "Repositories" <h2>: it is the+ same heading slot, and it now says WHICH repositories you+ are looking at. The filter button and "⋮" ride that line —+ a ListToolbar here would be a second bar holding nothing+ else. */}+ <GridViewPicker+ views={repoChrome.views}+ label="repositories"+ onCreate={repoChrome.createView}+ actions={(+ <>+ <GridFilterButton+ count={repoChrome.filterCount}+ onClick={() => repoChrome.setDrawerOpen(true)}+ />+ <GridToolsMenu {...repoChrome.toolsProps} onRefresh={loadRepositories} />+ </>+ )}+ />++ <GridChips {...repoChrome.chipProps} />++ <div className="dom-card">+ <DataTable+ columns={repoChrome.columns}+ data={repositories}+ keyField="id"+ sorts={repoSorts}+ onSortsChange={setRepoSorts}+ {...repoChrome.tableProps}+ onRowClick={openRepoDrawer}+ tableClassName="git-repos-table"+ emptyTitle="No repositories match this view."+ emptyMessage=""+ footer={(+ <DataTableFooter+ // DataTable applies the column rules itself, so+ // the shown count comes from the chrome —+ // `repositories` is only ever the whole list.+ shown={repoChrome.shownCount}+ total={repositories.length}+ noun="repo"+ />+ )}+ />+ </div>++ <GridFilterDrawer {...repoChrome.drawerProps} />+ </>+ );+ };++ const renderAccess = () => (+ <>+ <ListToolbar title={t('app.git.accessInformation', 'Access information')} />+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.httpAccess', 'HTTP Access')}</div>+ <div className="sk-spec-card__value git-url-value">{getGiteaUrl()}</div>+ <div className="sk-spec-card__sub">{t('app.git.webBrowserAccess', 'Web browser access')}</div>+ <div className="git-quick-actions">+ <Button variant="outline" size="sm" onClick={() => { copyToClipboard(getGiteaUrl()); toast.success(t('app.git.urlCopied', 'URL copied')); }}>{t('app.git.copyUrl', 'Copy URL')}</Button>+ <Button variant="outline" size="sm" onClick={openGitea} disabled={!status?.running}>{t('app.git.openGitea', 'Open Gitea')}</Button>+ </div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.sshAccess', 'SSH Access')}</div>+ <div className="sk-spec-card__value git-url-value">ssh://git@{window.location.hostname}:{status?.ssh_port}/username/repo.git</div>+ <div className="sk-spec-card__sub">{t('app.git.cloneRepositoriesViaSsh', 'Clone repositories via SSH')}</div>+ <div className="git-quick-actions">+ <Button variant="outline" size="sm" onClick={() => { copyToClipboard(`ssh://git@${window.location.hostname}:${status?.ssh_port}/username/repo.git`); toast.success(t('app.git.sshUrlCopied', 'SSH URL copied')); }}>{t('app.git.copySshUrl', 'Copy SSH URL')}</Button>+ </div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.sshKeyRequirement', 'SSH key requirement')}</div>+ <div className="sk-spec-card__value git-url-value">{t('app.git.addYourPublicKeyInGitea', 'Add your public key in Gitea')}</div>+ <div className="sk-spec-card__sub">{t('app.git.requiredForSshClonePush', 'Required for SSH clone/push')}</div>+ </div>+ </div>+ </>+ );++ const renderWebhooks = () => {+ if (webhooksLoading) return <EmptyState loading loadingVariant="table" title={t('app.git.loadingWebhooks', 'Loading webhooks')} />;+ if (webhooks.length === 0) {+ return (+ <EmptyState+ icon={Webhook}+ title={t('app.git.noWebhooksConfigured', 'No webhooks configured')}+ description={t('app.git.addAWebhookToSyncRepositories', 'Add a webhook to sync repositories from external sources.')}+ action={<Button onClick={() => setShowWebhookModal(true)}>{t('app.git.addWebhook', 'Add Webhook')}</Button>}+ />+ );+ }+ return (+ <>+ <GridViewPicker+ views={webhookChrome.views}+ label="webhooks"+ onCreate={webhookChrome.createView}+ actions={(+ <>+ <GridFilterButton+ count={webhookChrome.filterCount}+ onClick={() => webhookChrome.setDrawerOpen(true)}+ />+ <GridToolsMenu {...webhookChrome.toolsProps} onRefresh={loadWebhooks} />+ </>+ )}+ />++ <GridChips {...webhookChrome.chipProps} />++ <div className="dom-card">+ <DataTable+ columns={webhookChrome.columns}+ data={webhooks}+ keyField="id"+ sorts={webhookSorts}+ onSortsChange={setWebhookSorts}+ {...webhookChrome.tableProps}+ onRowClick={setDrawerWebhook}+ rowClassName={(webhook) => (!webhook.is_active ? 'is-disabled' : '')}+ tableClassName="git-webhooks-table"+ emptyTitle="No webhooks match this view."+ emptyMessage=""+ footer={(+ <DataTableFooter+ shown={webhookChrome.shownCount}+ total={webhooks.length}+ noun="webhook"+ />+ )}+ />+ </div>++ <GridFilterDrawer {...webhookChrome.drawerProps} />+ </>+ );+ };++ const renderDeployments = () => {+ if (deploymentsLoading) return <EmptyState loading loadingVariant="table" title={t('app.git.loadingDeployments', 'Loading deployments')} />;+ if (deployments.length === 0) {+ return (+ <EmptyState+ icon={Rocket}+ title={t('app.git.noDeploymentsYet', 'No deployments yet')}+ description={t('app.git.configureAWebhookWithDeployOn', 'Configure a webhook with "Deploy on Push" enabled to see deployments here.')}+ action={<Button onClick={() => setActiveTab('webhooks')}>{t('app.git.configureWebhooks', 'Configure Webhooks')}</Button>}+ />+ );+ }+ return (+ <>+ <ListToolbar+ title={t('app.git.deploymentHistory', 'Deployment history')}+ filters={(+ <SegControl+ value={deploymentFilter}+ onChange={setDeploymentFilter}+ options={[+ { value: 'all', labelKey: 'common.labels.all', label: 'All', count: deployments.length },+ { value: 'success', labelKey: 'app.git.success', label: 'Success', count: deploymentSuccessCount },+ { value: 'failed', labelKey: 'common.state.failed', label: 'Failed', count: deploymentFailedCount },+ { value: 'running', labelKey: 'app.git.running', label: 'Running', count: deploymentRunningCount },+ ]}+ />+ )}+ />+ {filteredDeployments.length === 0 ? (+ <EmptyState icon={Rocket} title={t('app.git.noDeploymentsMatchThisFilter', 'No deployments match this filter.')} />+ ) : (+ <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--${statusKind(deployment.status)}`} />+ <div className="git-deploy-body">+ <div className="git-deploy-top">+ <span className="git-deploy-version">v{deployment.version}</span>+ <Pill kind={statusKind(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 = () => (+ <>+ <ListToolbar title={t('app.git.serverSettings', 'Server settings')} />+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.serverPower', 'Server power')}</div>+ <div className="git-quick-actions">+ {status?.running ? (+ <Button variant="secondary" onClick={handleStop} disabled={actionLoading}>{t('app.git.stopServer', 'Stop Server')}</Button>+ ) : (+ <Button onClick={handleStart} disabled={actionLoading}>{t('app.git.startServer', 'Start Server')}</Button>+ )}+ </div>+ <div className="sk-spec-card__sub">{t('app.git.startOrStopTheGiteaContainer', 'Start or stop the Gitea container')}</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.uninstall', 'Uninstall')}</div>+ <div className="git-quick-actions">+ <Button variant="destructive" onClick={handleUninstall} disabled={actionLoading}>{t('app.git.uninstallGitServer', 'Uninstall Git Server')}</Button>+ </div>+ <div className="sk-spec-card__sub">{t('app.git.stopsGiteaDataIsPreservedUnless', 'Stops Gitea; data is preserved unless removed manually')}</div>+ </div>+ </div>+ <div className="git-danger-zone-wrap">+ <DangerZone+ title={t('app.git.dangerZone', 'Danger Zone')}+ description={t('app.git.uninstallingWillStopTheGiteaContainer', '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 topbarActions = () => {+ if (!status?.installed) {+ return <Button onClick={() => setShowInstallModal(true)}>{t('app.git.installGitServer', 'Install Git Server')}</Button>;+ }+ const common = (+ <Button variant="outline" onClick={openGitea} disabled={!status?.running}>+ <ExternalLink size={15} /> {t('app.git.openGitea', 'Open Gitea')}+ </Button>+ );+ switch (activeTab) {+ case 'webhooks':+ return (+ <>+ {common}+ <Button onClick={() => setShowWebhookModal(true)}><Plus size={15} /> {t('app.git.addWebhook', 'Add Webhook')}</Button>+ </>+ );+ case 'deployments':+ return (+ <>+ {common}+ <Button variant="outline" onClick={loadAllDeployments} disabled={deploymentsLoading}>+ <RefreshCw size={15} /> {t('common.actions.refresh', 'Refresh')}+ </Button>+ </>+ );+ case 'repositories':+ return (+ <>+ {common}+ <Button variant="outline" onClick={loadRepositories} disabled={reposLoading}>+ <RefreshCw size={15} /> {t('common.actions.refresh', 'Refresh')}+ </Button>+ </>+ );+ default:+ return (+ <>+ {common}+ {status?.running ? (+ <Button variant="secondary" onClick={handleStop} disabled={actionLoading}>{t('app.git.stopServer', 'Stop Server')}</Button>+ ) : (+ <Button onClick={handleStart} disabled={actionLoading}>{t('app.git.startServer', 'Start Server')}</Button>+ )}+ </>+ );+ }+ };++ // Tabs live in the page top bar (like Domains/Services). The single Git page+ // renders all sections, keyed off the /git/:tab route via useTabParam — the+ // header title + icon mirror the active tab.+ const GIT_TABS = useMemo(() => [+ { slug: 'overview', to: basePath, labelKey: 'common.labels.overview', label: 'Overview', end: true, icon: <Server size={15} /> },+ { slug: 'repositories', to: `${basePath}/repositories`, labelKey: 'app.git.repositories', label: 'Repositories', icon: <FolderGit2 size={15} /> },+ { slug: 'webhooks', to: `${basePath}/webhooks`, labelKey: 'app.git.webhooks', label: 'Webhooks', icon: <Webhook size={15} /> },+ { slug: 'deployments', to: `${basePath}/deployments`, labelKey: 'app.git.deployments', label: 'Deployments', icon: <Rocket size={15} /> },+ { slug: 'access', to: `${basePath}/access`, labelKey: 'app.git.access', label: 'Access', icon: <Globe size={15} /> },+ { slug: 'settings', to: `${basePath}/settings`, labelKey: 'common.labels.settings', label: 'Settings', icon: <Settings size={15} /> },+ ], [basePath]);+ const activeGit = GIT_TABS.find((t) => t.slug === activeTab) || GIT_TABS[0];++ if (loading) {+ return (+ <PageLayout className="git-page domains-page" navLabel="Git" tabs={GIT_TABS}>+ <EmptyState loading loadingVariant="table" size="lg" title={t('app.git.loadingGit', 'Loading Git')} />+ </PageLayout>+ );+ }++ return (+ <PageLayout+ className="git-page domains-page"+ navLabel={activeGit.label}+ tabs={GIT_TABS}+ actions={topbarActions()}+ >+ {pageError && (+ <div className="error-banner">+ {pageError}+ <button type="button" className="git-error-dismiss" onClick={() => setPageError('')}>×</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"/>+ </svg>+ </div>+ <h2>{t('app.git.noGitServerInstalled', 'No Git Server Installed')}</h2>+ <p>{t('app.git.installGiteaToHostAndManage', 'Install Gitea to host and manage your Git repositories locally.')}</p>+ <div className="resource-warning">+ <div className="warning-header">+ <AlertTriangle size={20} />+ <strong>{t('app.git.resourceRequirements', 'Resource Requirements')}</strong>+ </div>+ <ul>+ <li><strong>{t('app.git.memory', 'Memory:')}</strong> {t('app.git.512mbMinimum1gbRecommended', '~512MB minimum (1GB recommended)')}</li>+ <li><strong>{t('app.git.storage', 'Storage:')}</strong> {t('app.git.5gbForDatabaseRepositories', '~5GB for database + repositories')}</li>+ <li><strong>{t('app.git.components', 'Components:')}</strong> {t('app.git.giteaPostgresqlDatabase', 'Gitea + PostgreSQL database')}</li>+ </ul>+ </div>+ <Button size="lg" onClick={() => setShowInstallModal(true)}>{t('app.git.installGitServer', 'Install Git Server')}</Button>+ </div>+ ) : (+ <div className="domains-body">+ {renderKpis()}+ {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 || t('app.git.noDescription', '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} /> {t('app.git.openInGitea', 'Open in Gitea')}+ </Button>+ <Button variant="outline" size="sm" onClick={() => {+ copyToClipboard(`${getGiteaUrl()}/${selectedRepo.owner.login}/${selectedRepo.name}`);+ toast.success(t('app.git.repositoryUrlCopied', 'Repository URL copied'));+ }}>+ {t('app.git.copyUrl', 'Copy URL')}+ </Button>+ </div>+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.defaultBranch', '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">{t('app.git.stars', '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">{t('app.git.visibility', '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 className="git-repo-detail-tabs">+ <div className="branch-selector">+ <Label>{t('common.labels.branch', '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')}>{t('app.git.files', 'Files')}</button>+ <button type="button" className={repoDetailTab === 'commits' ? 'active' : ''} onClick={() => setRepoDetailTab('commits')}>{t('app.git.commits', 'Commits')}</button>+ <button type="button" className={repoDetailTab === 'branches' ? 'active' : ''} onClick={() => setRepoDetailTab('branches')}>{t('app.git.branches', 'Branches')}</button>+ </div>+ </div>++ {repoDetailTab === 'files' && (+ <div className="files-browser">+ {currentPath && (+ <div className="breadcrumb">+ <button type="button" onClick={() => navigateToPath('')}>{selectedRepo.name}</button>+ {currentPath.split('/').map((part, i, arr) => (+ <span key={i}><span className="separator">/</span><button type="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>+ )}++ {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>+ ))}+ {commits.length >= 30 && (+ <Button variant="outline" className="btn-block" onClick={loadMoreCommits}>{t('app.git.loadMore', '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>+ {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)}>{t('app.git.switch', 'Switch')}</Button>+ </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)}>{t('app.git.copyUrl', 'Copy URL')}</Button>+ <Button variant="outline" size="sm" onClick={() => handleTestWebhook(drawerWebhook.id)}>{t('common.actions.test', '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} /> {t('common.actions.delete', 'Delete')}+ </Button>+ </div>+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('common.labels.source', '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">{t('common.labels.branch', '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">{t('common.labels.status', 'Status')}</div>+ <div className="git-pill-row"><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">{t('app.git.deployment', 'Deployment')}</h3>+ <div className="dom-specs">+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.application', 'Application')}</div>+ <div className="sk-spec-card__value">{getAppName(drawerWebhook.app_id)}</div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.deployOnPush', 'Deploy on push')}</div>+ <div className="git-pill-row"><Pill kind={drawerWebhook.deploy_on_push ? 'green' : 'gray'}>{drawerWebhook.deploy_on_push ? 'Enabled' : 'Disabled'}</Pill></div>+ </div>+ <div className="sk-spec-card">+ <div className="sk-spec-card__label">{t('app.git.zeroDowntime', 'Zero downtime')}</div>+ <div className="git-pill-row"><Pill kind={drawerWebhook.zero_downtime ? 'green' : 'gray'}>{drawerWebhook.zero_downtime ? 'Yes' : 'No'}</Pill></div>+ </div>+ </div>+ </div>+ )}+ <div className="dom-drawer__section">+ <h3 className="dom-drawer__sectiontitle">{t('app.git.recentDeployments', 'Recent deployments')}</h3>+ {webhookDeployments.length === 0 ? (+ <p className="dom-drawer__hint">{t('app.git.noDeploymentsForThisWebhook', 'No deployments for this webhook.')}</p>+ ) : (+ <div className="dom-dns__table">+ <DataTable+ columns={HOOK_DEPLOY_COLUMNS}+ data={webhookDeployments}+ keyField="id"+ storageKey="serverkit-table-git-hook-deploys"+ onRowClick={(d) => { setDrawerWebhook(null); viewDeploymentLogs(d.id); }}+ footer={(+ <DataTableFooter+ shown={webhookDeployments.length}+ total={webhookDeployments.length}+ noun="deployment"+ />+ )}+ />+ </div>+ )}+ </div>+ </div>+ )}+ </Drawer>++ {/* Deployment drawer */}+ <Drawer+ open={!!drawerDeployment}+ onOpenChange={(open) => { if (!open) setDrawerDeployment(null); }}+ icon={<Rocket size={18} />}+ iconColor="var(--accent-bright)"+ title={drawerDeployment ? t('app.git.deploymentV', 'Deployment v{{version}}', { version: drawerDeployment.version }) : ''}+ subtitle={drawerDeployment ? `${drawerDeployment.webhook_name || t('app.git.manual', 'Manual')} · ${drawerDeployment.status}` : ''}+ width={640}+ >+ {drawerDeployment && (+ <div className="dom-drawer">+ <div className="dom-drawer__actions">+ <Button variant="outline" size="sm" onClick={() => viewDeploymentLogs(drawerDeployment.id)}>{t('app.git.viewLogs', 'View Logs')}</Button>+ {drawerDeployment.status === 'success' && !drawerDeployment.is_rollback && (+ <Button variant="secondary" size="sm" onClick={() => handleRollback(drawerDeployment.app_id, drawerDeployment.version)}>{t('app.git.rollback', '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">{t('common.labels.status', 'Status')}</div>+ <div className="git-pill-row"><Pill kind={statusKind(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">{t('common.labels.branch', '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">{t('app.git.commit', '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">{t('app.git.commitMessage', '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">{t('app.git.error', 'Error')}</h3>+ <p className="dom-drawer__hint dom-dns__error">{drawerDeployment.error_message}</p>+ </div>+ )}+ </div>+ )}+ </Drawer>++ {/* Install Modal */}+ <Modal open={showInstallModal} onClose={() => setShowInstallModal(false)} title={t('app.git.installGitServer', 'Install Git Server')} size="lg">+ <div className="install-warning">+ <AlertTriangle size={20} />+ <div>+ <strong>{t('app.git.thisWillInstall', 'This will install:')}</strong>+ <ul>+ <li>{t('app.git.giteaGitServer300mbRam', 'Gitea (Git server) - ~300MB RAM')}</li>+ <li>{t('app.git.postgresqlDatabase200mbRam', 'PostgreSQL database - ~200MB RAM')}</li>+ </ul>+ </div>+ </div>+ <div className="form-group">+ <Label>{t('app.git.adminUsername', '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>{t('app.git.adminEmail', '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>{t('app.git.adminPasswordLeaveEmptyToAuto', 'Admin Password (leave empty to auto-generate)')}</Label>+ <Input type="password" value={installForm.adminPassword} onChange={(e) => setInstallForm({ ...installForm, adminPassword: e.target.value })} placeholder={t('app.git.autoGenerateSecurePassword', 'Auto-generate secure password')} />+ </div>+ <div className="modal-actions">+ <Button variant="outline" onClick={() => setShowInstallModal(false)}>{t('common.actions.cancel', 'Cancel')}</Button>+ <Button onClick={handleInstall} disabled={actionLoading || !installForm.adminEmail}>+ {actionLoading ? 'Installing...' : 'Install Git Server'}+ </Button>+ </div>+ </Modal>++ {/* Webhook Modal */}+ <Modal open={showWebhookModal} onClose={() => setShowWebhookModal(false)} title={t('app.git.addWebhook', 'Add Webhook')} size="lg">+ <div className="form-group">+ <Label>{t('common.labels.name', 'Name')} <span className="required">*</span></Label>+ <Input type="text" value={webhookForm.name} onChange={(e) => setWebhookForm({ ...webhookForm, name: e.target.value })} placeholder={t('app.git.myGithubRepo', 'My GitHub Repo')} />+ </div>+ <div className="form-group">+ <Label>{t('common.labels.source', 'Source')}</Label>+ <select value={webhookForm.source} onChange={(e) => setWebhookForm({ ...webhookForm, source: e.target.value })}>+ <option value="github">{t('app.git.github', 'GitHub')}</option>+ <option value="gitlab">{t('app.git.gitlab', 'GitLab')}</option>+ <option value="bitbucket">{t('app.git.bitbucket', 'Bitbucket')}</option>+ </select>+ </div>+ <div className="form-group">+ <Label>{t('app.git.repositoryUrl', '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>{t('common.labels.branch', 'Branch')}</Label>+ <Input type="text" value={webhookForm.sourceBranch} onChange={(e) => setWebhookForm({ ...webhookForm, sourceBranch: e.target.value })} placeholder="main" />+ </div>+ <div className="form-group">+ <Label>{t('app.git.syncDirection', 'Sync Direction')}</Label>+ <select value={webhookForm.syncDirection} onChange={(e) => setWebhookForm({ ...webhookForm, syncDirection: e.target.value })}>+ <option value="pull">{t('app.git.pullExternalLocal', 'Pull (External → Local)')}</option>+ <option value="push">{t('app.git.pushLocalExternal', 'Push (Local → External)')}</option>+ <option value="bidirectional">{t('app.git.bidirectional', 'Bidirectional')}</option>+ </select>+ </div>+ </div>+ <div className="form-group checkbox">+ <label>+ <input type="checkbox" checked={webhookForm.autoSync} onChange={(e) => setWebhookForm({ ...webhookForm, autoSync: e.target.checked })} />+ {t('app.git.autoSyncOnPushEvents', 'Auto-sync on push events')}+ </label>+ </div>+ <div className="form-group">+ <Label>{t('app.git.localRepositoryNameOptional', 'Local Repository Name (optional)')}</Label>+ <Input type="text" value={webhookForm.localRepoName} onChange={(e) => setWebhookForm({ ...webhookForm, localRepoName: e.target.value })} placeholder={t('app.git.leaveEmptyToUseSameName', 'Leave empty to use same name')} />+ </div>+ <div className="form-section">+ <h4>{t('app.git.deploymentSettings', 'Deployment Settings')}</h4>+ <p className="text-muted">{t('app.git.optionallyDeployAnApplicationWhenCode', 'Optionally deploy an application when code is pushed')}</p>+ <div className="form-group">+ <Label>{t('app.git.deployToApplication', '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="">{t('app.git.noneSyncOnly', 'None (sync only)')}</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 })} />+ {t('app.git.deployOnPush', 'Deploy on push')}+ </label>+ <span className="form-hint">{t('app.git.automaticallyDeployWhenCodeIsPushed', '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 })} />+ {t('app.git.zeroDowntimeDeployment', 'Zero-downtime deployment')}+ </label>+ </div>+ <div className="form-group">+ <Label>{t('app.git.preDeployScriptOptional', '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>{t('app.git.postDeployScriptOptional', '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 className="modal-actions">+ <Button variant="outline" onClick={() => setShowWebhookModal(false)}>{t('common.actions.cancel', 'Cancel')}</Button>+ <Button onClick={handleCreateWebhook} disabled={actionLoading || !webhookForm.name || !webhookForm.sourceRepoUrl}>+ {actionLoading ? 'Creating...' : 'Create Webhook'}+ </Button>+ </div>+ </Modal>++ {/* Webhook Secret Modal */}+ <Modal open={!!webhookSecret} onClose={() => setWebhookSecret(null)} title={t('app.git.webhookSecret', 'Webhook Secret')}>+ <div className="secret-warning">+ <AlertTriangle size={20} />+ <span>{t('app.git.saveThisSecretItWillNot', 'Save this secret! It will not be shown again.')}</span>+ </div>+ <div className="secret-display">+ <code>{webhookSecret}</code>+ <Button size="sm" variant="outline" onClick={() => { copyToClipboard(webhookSecret); toast.success(t('app.git.secretCopied', 'Secret copied')); }}>{t('common.actions.copy', 'Copy')}</Button>+ </div>+ <p className="text-muted">{t('app.git.useThisSecretWhenConfiguringThe', 'Use this secret when configuring the webhook in your repository settings.')}</p>+ <div className="modal-actions">+ <Button onClick={() => setWebhookSecret(null)}>{t('app.git.iVeSavedIt', 'I\'ve Saved It')}</Button>+ </div>+ </Modal>++ {/* Deployment Logs Modal */}+ <Modal+ open={showDeploymentLogs && !!selectedDeployment}+ onClose={() => setShowDeploymentLogs(false)}+ title={selectedDeployment ? t('app.git.deploymentVLogs', 'Deployment v{{version}} Logs', { version: selectedDeployment.version }) : ''}+ size="xl"+ >+ {selectedDeployment && (<>+ <div className="deployment-summary">+ <div className="summary-item"><span className="label">{t('app.git.status5', 'Status:')}</span><Pill kind={statusKind(selectedDeployment.status)}>{selectedDeployment.status}</Pill></div>+ {selectedDeployment.commit_sha && <div className="summary-item"><span className="label">{t('app.git.commit2', 'Commit:')}</span><code className="git-hash">{selectedDeployment.commit_sha.slice(0, 7)}</code></div>}+ <div className="summary-item"><span className="label">{t('app.git.branch7', 'Branch:')}</span><span>{selectedDeployment.branch}</span></div>+ <div className="summary-item"><span className="label">{t('app.git.triggeredBy', 'Triggered by:')}</span><span>{selectedDeployment.triggered_by}</span></div>+ {selectedDeployment.duration_seconds != null && <div className="summary-item"><span className="label">{t('app.git.duration', 'Duration:')}</span><span>{selectedDeployment.duration_seconds}s</span></div>}+ </div>+ {selectedDeployment.error_message && <div className="deployment-error"><strong>{t('app.git.error2', 'Error:')}</strong> {selectedDeployment.error_message}</div>}+ {selectedDeployment.pre_script_output && <div className="log-section"><h4>{t('app.git.preDeploymentScriptOutput', 'Pre-deployment Script Output')}</h4><pre className="log-output">{selectedDeployment.pre_script_output}</pre></div>}+ {selectedDeployment.deploy_output && <div className="log-section"><h4>{t('app.git.deploymentOutput', 'Deployment Output')}</h4><pre className="log-output">{selectedDeployment.deploy_output}</pre></div>}+ {selectedDeployment.post_script_output && <div className="log-section"><h4>{t('app.git.postDeploymentScriptOutput', '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>{t('app.git.noDeploymentLogsAvailable', 'No deployment logs available.')}</p></div>}+ </>)}+ <div className="modal-actions">+ <Button variant="outline" onClick={() => setShowDeploymentLogs(false)}>{t('common.actions.close', 'Close')}</Button>+ </div>+ </Modal>++ {confirmDialog && (+ <ConfirmDialog+ title={confirmDialog.title}+ message={confirmDialog.message}+ confirmText={confirmDialog.confirmText}+ variant={confirmDialog.variant}+ onConfirm={confirmDialog.onConfirm}+ onCancel={confirmDialog.onCancel}+ />+ )}+ </PageLayout>+ );+}++export default Git;diff --git a/frontend/src/plugins/serverkit-git/services/gitea.js b/frontend/src/plugins/serverkit-git/services/gitea.jsnew file mode 100644index 00000000..860b2d7e--- /dev/null+++ b/frontend/src/plugins/serverkit-git/services/gitea.js@@ -0,0 +1,45 @@+// The extension's own Gitea self-host client (/api/v1/git/* — server+// lifecycle + repo browsing), built on the panel's ApiClient via the SDK+// singleton — moved out of the host's services/api/files.js with the Git+// page (plan 52 Phase 6). The webhook + deployment endpoints stay CORE+// (they are the deploy pipeline); the page calls those through the core+// `api` object from serverkit-sdk.+import { api } from 'serverkit-sdk';++const giteaApi = {+ // Server lifecycle+ getGitServerStatus: () => api.request('/git/status'),+ getGitRequirements: () => api.request('/git/requirements'),+ installGit: (data) => api.request('/git/install', { method: 'POST', body: data }),+ uninstallGit: (removeData = false) => api.request('/git/uninstall', { method: 'POST', body: { removeData } }),+ startGit: () => api.request('/git/start', { method: 'POST' }),+ stopGit: () => api.request('/git/stop', { method: 'POST' }),+ restartGit: () => api.request('/git/restart', { method: 'POST' }),++ // Repositories+ getRepositories: (limit = 50) => api.request(`/git/repos?limit=${limit}`),+ getRepository: (owner, repo) => api.request(`/git/repos/${owner}/${repo}`),+ getRepoStats: (owner, repo) => api.request(`/git/repos/${owner}/${repo}/stats`),+ getBranches: (owner, repo) => api.request(`/git/repos/${owner}/${repo}/branches`),+ getBranch: (owner, repo, branch) => api.request(`/git/repos/${owner}/${repo}/branches/${branch}`),+ getCommits: (owner, repo, branch = null, page = 1, limit = 30) => {+ let url = `/git/repos/${owner}/${repo}/commits?page=${page}&limit=${limit}`;+ if (branch) url += `&branch=${branch}`;+ return api.request(url);+ },+ getCommit: (owner, repo, sha) => api.request(`/git/repos/${owner}/${repo}/commits/${sha}`),+ getRepoFiles: (owner, repo, ref = 'main', path = '') => {+ let url = `/git/repos/${owner}/${repo}/contents?ref=${ref}`;+ if (path) url += `&path=${path}`;+ return api.request(url);+ },+ getFileContent: (owner, repo, filepath, ref = 'main') => api.request(`/git/repos/${owner}/${repo}/contents/${filepath}?ref=${ref}`),+ getRepoReadme: (owner, repo, ref = null) => {+ let url = `/git/repos/${owner}/${repo}/readme`;+ if (ref) url += `?ref=${ref}`;+ return api.request(url);+ },+ getGiteaVersion: () => api.request('/git/version'),+};++export default giteaApi;diff --git a/frontend/src/plugins/serverkit-git/styles/git.scss b/frontend/src/plugins/serverkit-git/styles/git.scssnew file mode 100644index 00000000..5687c441--- /dev/null+++ b/frontend/src/plugins/serverkit-git/styles/git.scss@@ -0,0 +1,1236 @@+// Compiled through the extension's module graph (imported by index.jsx).+// The host's design-token partial is imported via a sync-safe relative+// path — the baked copy lives at frontend/src/plugins/serverkit-git/,+// so this resolves to frontend/src/styles/_variables.scss.+@import '../../../styles/variables';+@import '../../../styles/mixins';++// ============================================+// GIT PAGE (redesign — infra console look)+// ============================================+// Consumes the sk- design-system primitives (MetricCard, Pill, .sk-dtable,+// .sk-cell-*); page-specific atoms are prefixed `git-`. Everything stays+// scoped under .git-page. Provider-OAuth / Gitea-metrics prototype regions+// are intentionally absent (no backend — see docs/REDESIGN_MAP.md §5).++.git-page {+ .page-loading {+ display: flex;+ justify-content: center;+ align-items: center;+ min-height: 400px;+ }++ .loading-state {+ display: flex;+ justify-content: center;+ padding: $space-10;+ }++ // ── not-installed empty state ───────────────────────────+ .empty-state-large {+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ padding: 60px $space-6;+ background: var(--surface);+ border: 1px solid var(--border-soft);+ border-radius: var(--radius-lg);+ text-align: center;++ .empty-icon {+ width: 84px;+ height: 84px;+ border-radius: 20px;+ display: grid;+ place-items: center;+ @include status-variant(var(--accent-bright), var(--accent-bg));+ margin-bottom: $space-6;++ svg {+ width: 40px;+ height: 40px;+ }+ }++ h2 {+ margin: 0 0 $space-3 0;+ font-size: $font-size-2xl;+ font-weight: $font-weight-semibold;+ letter-spacing: -0.01em;+ }++ p {+ margin: 0 0 $space-6 0;+ color: var(--text-dim);+ max-width: 400px;+ }+ }++ .resource-warning {+ background: var(--amber-bg);+ border: 1px solid rgba(245, 185, 69, 0.3);+ border-radius: var(--radius);+ padding: $space-5;+ margin-bottom: $space-6;+ text-align: left;+ max-width: 500px;++ .warning-header {+ display: flex;+ align-items: center;+ gap: $space-2;+ margin-bottom: $space-3;+ color: var(--amber);++ strong {+ font-family: var(--mono);+ font-size: 11px;+ font-weight: $font-weight-semibold;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ color: var(--amber);+ }+ }++ ul {+ margin: 0;+ padding-left: $space-5;+ color: var(--text-dim);+ font-size: $font-size-sm;++ li {+ margin-bottom: $space-1;++ &:last-child {+ margin-bottom: 0;+ }++ strong {+ color: var(--text);+ }+ }+ }+ }++ // ── intro banner (accent-gradient explainer above the KPIs) ──+ .git-hint {+ display: flex;+ align-items: center;+ gap: 13px;+ padding: 15px 18px;+ margin-bottom: $space-5;+ border: 1px solid var(--border-soft);+ border-radius: var(--radius);+ background: linear-gradient(100deg, var(--accent-bg), transparent 80%);++ &__icon {+ width: 38px;+ height: 38px;+ border-radius: 10px;+ display: grid;+ place-items: center;+ flex-shrink: 0;+ background: var(--surface-2);+ color: var(--accent-bright);+ }++ &__body {+ flex: 1;+ min-width: 0;+ }++ &__title {+ font-weight: 550;+ font-size: 13.5px;+ color: var(--text);+ }++ &__sub {+ margin-top: 2px;+ font-size: 12.5px;+ color: var(--text-faint);+ }+ }++ // ── KPI strip (real `status` payload only) ──────────────+ .git-kpis {+ display: grid;+ grid-template-columns: repeat(4, 1fr);+ gap: $space-4;+ margin-bottom: $space-5;++ @media (max-width: $breakpoint-lg) { grid-template-columns: repeat(2, 1fr); }+ @media (max-width: $breakpoint-sm) { grid-template-columns: 1fr; }+ }++ // Text-valued KPIs ("Running", "/gitea", "1.21.x") read smaller than numerals+ .git-kpi-text .sk-kpi__val {+ display: flex;+ align-items: center;+ min-height: 27px;+ font-size: 18px;+ line-height: 1.25;+ overflow-wrap: anywhere;+ }++ // ── tab strip — accent wash on active (ids untouched) ───+ .tabs {+ gap: 2px;+ margin-bottom: $space-5;+ border-bottom: 1px solid var(--border-soft);+ }++ .tab {+ padding: 8px 13px;+ border-radius: 8px 8px 0 0;+ border-bottom: 2px solid transparent;+ margin-bottom: -1px;+ font-size: 13px;+ color: var(--text-dim);++ &:hover {+ color: var(--text);+ background: var(--surface-hover);+ }++ &.active,+ &[data-state="active"] {+ @include status-variant(var(--accent-bright), var(--accent-bg));+ border-bottom-color: var(--accent-bright);+ }+ }++ // ── shared page atoms ───────────────────────────────────+ // Count suffix inside an eyebrow heading ("Repositories · 4")+ .git-count {+ font-weight: $font-weight-medium;+ color: var(--text-faint);+ letter-spacing: 0;+ }++ // Mono category chip (private / fork / default / protected / rollback) —+ // %sk-state shape (_design-system.scss) with smaller local sizing kept+ .git-chip {+ // %sk-state shape inlined (the placeholder lives in the host's+ // _design-system.scss, a different compile unit than this+ // extension's module graph — @extend can't cross that boundary).+ display: inline-flex;+ align-items: center;+ padding: 3px 9px;+ border-radius: 6px;+ font-family: var(--mono);+ font-size: 10px;+ font-weight: 600;+ letter-spacing: 0.05em;+ text-transform: uppercase;+ white-space: nowrap;+ flex-shrink: 0;+ vertical-align: middle;+ margin-left: 7px;+ padding: 1px 6px;+ border-radius: 5px;+ color: var(--text-faint);+ background: var(--surface-3);++ &--amber { color: var(--amber); background: var(--amber-bg); }+ &--cyan { color: var(--cyan); background: var(--cyan-bg); }+ &--green { color: var(--green); background: var(--green-bg); }+ }++ // Branch chip (mono, bordered — prototype .branch-chip)+ .git-branch-chip {+ display: inline-flex;+ align-items: center;+ gap: 5px;+ padding: 2px 8px;+ border: 1px solid var(--border);+ border-radius: 6px;+ background: var(--surface-2);+ font-family: var(--mono);+ font-size: 11.5px;+ color: var(--text-dim);+ white-space: nowrap;++ svg {+ color: var(--text-faint);+ flex-shrink: 0;+ }+ }++ // Commit hash chip (prototype .commit .hash)+ .git-hash {+ font-family: var(--mono);+ font-size: 11px;+ @include status-variant(var(--accent-bright), var(--accent-bg));+ padding: 2px 7px;+ border-radius: 5px;+ flex-shrink: 0;+ white-space: nowrap;+ }++ // Card wrapping a .sk-dtable+ .git-table-card {+ background: var(--surface);+ border: 1px solid var(--border-soft);+ border-radius: var(--radius);+ overflow: hidden;+ }++ // Repo / webhook icon tiles+ .git-repo-ico {+ width: 28px;+ height: 28px;+ border-radius: 8px;+ display: grid;+ place-items: center;+ flex-shrink: 0;+ @include status-variant(var(--accent-bright), var(--accent-bg));+ }++ // Brand tiles are intentional categorical colors (solid, theme-stable)+ .git-src-tile {+ width: 28px;+ height: 28px;+ border-radius: 8px;+ display: grid;+ place-items: center;+ flex-shrink: 0;+ font-family: var(--mono);+ font-size: 10px;+ font-weight: 700;+ background: var(--surface-3);+ color: var(--text-dim);++ &--github { background: #24292f; color: #fff; }+ &--gitlab { background: #fc6d26; color: #fff; }+ &--bitbucket { background: #0052cc; color: #fff; }+ }++ .git-repocell {+ min-width: 0;+ }++ .git-reponame {+ font-weight: 550;+ color: var(--text);++ .own {+ color: var(--text-faint);+ font-weight: $font-weight-normal;+ }+ }++ // Repo description sub-line stays prose, not mono+ .git-repo-desc {+ font-family: $font-main;+ max-width: 420px;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ .git-chev {+ display: block;+ color: var(--text-ghost);+ }++ .git-row-actions {+ display: flex;+ justify-content: flex-end;+ gap: 2px;+ }++ .git-danger-btn {+ color: var(--red);++ &:hover {+ @include status-variant(var(--red), var(--red-bg));+ }+ }++ // ── quick-action button row used inside spec cards ──────+ .git-quick-actions {+ display: flex;+ flex-wrap: wrap;+ gap: $space-2;+ margin-top: $space-2;+ }++ // ── spec-card atoms ──────────────────────────────────────+ // Clone URLs render smaller than the default spec-card value+ .git-url-value {+ font-size: 13px;+ }++ // Status pill sits on its own row below the label+ .git-pill-row {+ margin-top: $space-2;+ }++ // Dismiss "×" in the page-level error banner+ .git-error-dismiss {+ float: right;+ background: none;+ border: none;+ cursor: pointer;+ }++ // ── 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);+ border: 1px solid var(--border-soft);+ border-radius: var(--radius);+ padding: $space-5;++ h3 {+ margin: 0 0 $space-4 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: $font-size-sm;+ margin: 0 0 $space-4 0;+ }+ }++ // ── Overview tab ─────────────────────────────────────────+ .overview-tab {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: $space-4;++ @media (max-width: $breakpoint-md) {+ grid-template-columns: 1fr;+ }++ .info-grid {+ display: grid;+ }++ .info-item {+ display: flex;+ justify-content: space-between;+ align-items: center;+ gap: $space-4;+ padding: 11px 0;+ border-bottom: 1px solid var(--border-soft);+ font-size: 13px;++ &:last-child {+ border-bottom: none;+ }++ .info-label {+ font-family: var(--mono);+ font-size: 12px;+ color: var(--text-faint);+ flex-shrink: 0;+ }++ .info-value {+ font-family: var(--mono);+ font-size: 12.5px;+ color: var(--text);+ text-align: right;+ min-width: 0;+ overflow-wrap: anywhere;++ &.text-success {+ color: var(--green);+ }++ &.text-danger {+ color: var(--red);+ }++ &.code {+ background: var(--bg-code);+ color: var(--text-code);+ border: 1px solid var(--border-soft);+ padding: 3px 8px;+ border-radius: $radius-sm;+ font-size: 11.5px;+ }++ a {+ color: var(--accent-bright);+ text-decoration: none;++ &:hover {+ text-decoration: underline;+ }+ }+ }+ }++ .quick-actions {+ display: flex;+ gap: $space-3;+ flex-wrap: wrap;+ }+ }++ // ── Access tab ───────────────────────────────────────────+ .access-tab {+ display: flex;+ flex-direction: column;+ gap: $space-4;++ .access-url {+ display: flex;+ align-items: center;+ gap: $space-3;+ background: var(--bg-code);+ border: 1px solid var(--border-soft);+ padding: $space-3 $space-4;+ border-radius: var(--radius-sm);+ margin-bottom: $space-3;++ code {+ flex: 1;+ font-family: var(--mono);+ font-size: 12.5px;+ color: var(--accent-bright);+ word-break: break-all;+ }+ }++ .ssh-note {+ font-size: $font-size-sm;+ color: var(--text-dim);+ padding: $space-3 $space-4;+ background: var(--cyan-bg);+ border: 1px solid rgba(73, 199, 240, 0.25);+ border-radius: var(--radius-sm);++ strong {+ color: var(--cyan);+ }+ }+ }++ // ── Settings tab ─────────────────────────────────────────+ .settings-tab {+ display: flex;+ flex-direction: column;+ gap: $space-4;++ .settings-actions {+ display: flex;+ gap: $space-3;+ flex-wrap: wrap;+ }+ }++ // Danger Zone block below the settings spec cards+ .git-danger-zone-wrap {+ margin-top: $space-6;+ }++ // ── Repositories tab ─────────────────────────────────────+ .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;+ }++ // files browser (mono tree)+ .files-browser {+ .breadcrumb {+ display: flex;+ align-items: center;+ 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;++ button {+ background: none;+ border: none;+ padding: 0;+ font: inherit;+ color: var(--accent-bright);+ cursor: pointer;++ &:hover {+ text-decoration: underline;+ }+ }++ .separator {+ margin: 0 6px;+ color: var(--text-ghost);+ }+ }++ .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);+ }++ .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);+ }+ }+ }+ }++ // 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;+ }++ .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-meta {+ margin-top: 3px;+ font-family: var(--mono);+ font-size: 11px;+ color: var(--text-faint);++ .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;+ }+ }++ // branches+ .branches-list {+ .branch-item {+ display: flex;+ align-items: center;+ gap: $space-4;+ padding: 11px $space-4;+ border-bottom: 1px solid var(--border-soft);++ &:last-child {+ border-bottom: none;+ }++ &.active {+ background: var(--accent-bg-soft);+ }++ .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;++ svg {+ color: var(--text-faint);+ flex-shrink: 0;+ }++ .git-chip {+ margin-left: 0;+ }+ }++ .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;+ }+ }+ }+ }+ }++ // ── Webhooks tab ─────────────────────────────────────────+ .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;+ }+ }++ // ── Deployments tab (feed-style history rows) ────────────++ .git-deploys-card {+ background: var(--surface);+ border: 1px solid var(--border-soft);+ border-radius: var(--radius);+ padding: 2px $space-5;+ }++ .git-deploy-row {+ display: flex;+ align-items: flex-start;+ gap: 13px;+ padding: 13px 0;+ border-top: 1px solid var(--border-soft);++ &:first-child {+ border-top: none;+ }++ @media (max-width: $breakpoint-sm) {+ flex-wrap: wrap;+ }+ }++ .git-deploy-dot {+ width: 8px;+ height: 8px;+ border-radius: 3px;+ margin-top: 6px;+ flex-shrink: 0;+ background: var(--text-ghost);++ &--green { background: var(--green); box-shadow: 0 0 6px var(--green); }+ &--red { background: var(--red); }+ &--amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }+ }++ .git-deploy-body {+ flex: 1;+ min-width: 0;+ }++ .git-deploy-top {+ display: flex;+ align-items: center;+ gap: 8px;+ flex-wrap: wrap;+ }++ .git-deploy-version {+ font-family: var(--mono);+ font-size: 13px;+ font-weight: $font-weight-semibold;+ color: var(--text);+ }++ .git-deploy-msg {+ margin-top: 4px;+ font-size: 13px;+ color: var(--text-dim);+ overflow-wrap: anywhere;+ }++ .git-deploy-meta {+ margin-top: 4px;+ display: flex;+ flex-wrap: wrap;+ gap: 4px;+ font-family: var(--mono);+ font-size: 11px;+ color: var(--text-faint);++ span + span::before {+ content: '·';+ margin-right: 4px;+ color: var(--text-ghost);+ }+ }++ .git-deploy-error {+ margin-top: 6px;+ padding: 6px 10px;+ border-radius: $radius-sm;+ @include status-variant(var(--red), var(--red-bg));+ font-size: 12px;+ overflow-wrap: anywhere;+ }++ .git-deploy-side {+ display: flex;+ flex-direction: column;+ align-items: flex-end;+ gap: $space-2;+ flex-shrink: 0;++ @media (max-width: $breakpoint-sm) {+ width: 100%;+ flex-direction: row;+ align-items: center;+ justify-content: space-between;+ padding-left: 21px;+ }+ }++ .git-deploy-time {+ font-family: var(--mono);+ font-size: 10.5px;+ color: var(--text-faint);+ }++ .git-deploy-actions {+ display: flex;+ gap: $space-1;+ flex-wrap: wrap;+ justify-content: flex-end;+ }++ // tables scroll instead of crushing on small screens+ @media (max-width: $breakpoint-md) {+ .git-table-card {+ overflow-x: auto;+ }++ .git-repos-table {+ min-width: 720px;+ }++ .git-webhooks-table {+ min-width: 960px;+ }+ }++ // ── Modals ───────────────────────────────────────────────+ .modal-lg {+ max-width: 500px;+ }++ .modal-xl {+ max-width: 800px;+ }++ .modal-header .btn-icon {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 30px;+ height: 30px;+ padding: 0;+ border: none;+ background: none;+ border-radius: $radius-md;+ color: var(--text-faint);+ cursor: pointer;+ transition: background $transition-fast, color $transition-fast;++ &:hover {+ background: var(--surface-hover);+ color: var(--text);+ }+ }++ // field labels → mono eyebrows (checkbox rows stay sentence-case)+ .modal {+ .form-group:not(.checkbox) > label {+ font-family: var(--mono);+ font-size: 10.5px;+ font-weight: $font-weight-semibold;+ letter-spacing: 0.08em;+ text-transform: uppercase;+ color: var(--text-faint);+ }+ }++ .required {+ color: var(--red);+ }++ .install-warning {+ display: flex;+ gap: $space-3;+ background: var(--accent-bg-soft);+ border: 1px solid var(--accent-dim);+ border-radius: var(--radius);+ padding: $space-4;+ margin-bottom: $space-5;+ font-size: $font-size-sm;++ svg {+ flex-shrink: 0;+ color: var(--accent-bright);+ }++ strong {+ display: block;+ margin-bottom: $space-2;+ color: var(--text);+ }++ ul {+ margin: 0;+ padding-left: $space-4;+ font-size: $font-size-sm;+ color: var(--text-dim);++ li {+ margin-bottom: $space-1;+ }+ }+ }++ .form-row {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: $space-4;++ @media (max-width: $breakpoint-sm) {+ grid-template-columns: 1fr;+ }+ }++ .form-group.checkbox {+ label {+ display: flex;+ align-items: center;+ gap: $space-2;+ cursor: pointer;+ font-size: 13px;+ font-weight: $font-weight-normal;+ color: var(--text);++ input[type="checkbox"] {+ width: 16px;+ height: 16px;+ cursor: pointer;+ accent-color: var(--accent);+ }+ }+ }++ .form-section {+ margin-top: $space-5;+ padding-top: $space-5;+ border-top: 1px solid var(--border-soft);++ h4 {+ margin: 0 0 $space-1 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: $font-size-sm;+ margin: 0 0 $space-4 0;+ }+ }++ .form-hint {+ display: block;+ font-family: var(--mono);+ font-size: 11px;+ color: var(--text-faint);+ margin-top: $space-1;+ }++ // deploy-script editors sit on the code surface+ .form-group textarea {+ width: 100%;+ min-height: 80px;+ padding: $space-3;+ font-family: var(--mono);+ font-size: 12px;+ line-height: 1.6;+ background: var(--bg-code);+ color: var(--text-code);+ border: 1px solid var(--border);+ border-radius: $radius-md;+ resize: vertical;++ &:focus {+ outline: none;+ border-color: var(--accent);+ }++ &::placeholder {+ color: var(--text-ghost);+ }+ }++ // ── webhook secret modal ──+ .secret-warning {+ display: flex;+ align-items: center;+ gap: $space-3;+ padding: $space-3 $space-4;+ background: var(--amber-bg);+ border: 1px solid rgba(245, 185, 69, 0.3);+ border-radius: var(--radius-sm);+ margin-bottom: $space-4;++ svg {+ color: var(--amber);+ flex-shrink: 0;+ }++ span {+ font-size: 13px;+ font-weight: $font-weight-medium;+ color: var(--text);+ }+ }++ .secret-display {+ display: flex;+ align-items: center;+ gap: $space-3;+ padding: $space-3 $space-4;+ background: var(--bg-code);+ border: 1px solid var(--border);+ border-radius: var(--radius-sm);+ margin-bottom: $space-4;++ code {+ flex: 1;+ font-family: var(--mono);+ font-size: 12.5px;+ color: var(--accent-bright);+ word-break: break-all;+ }+ }++ // ── deployment logs modal ──+ .deployment-summary {+ display: flex;+ flex-wrap: wrap;+ gap: $space-3 $space-5;+ padding: $space-3 $space-4;+ background: var(--surface-2);+ border: 1px solid var(--border-soft);+ border-radius: var(--radius-sm);+ margin-bottom: $space-4;++ .summary-item {+ display: flex;+ align-items: center;+ gap: $space-2;+ font-family: var(--mono);+ font-size: 12px;+ color: var(--text);++ .label {+ font-size: 10.5px;+ letter-spacing: 0.05em;+ text-transform: uppercase;+ color: var(--text-faint);+ }+ }+ }++ .deployment-error {+ padding: $space-3 $space-4;+ background: var(--red-bg);+ border: 1px solid rgba(251, 111, 111, 0.3);+ border-radius: var(--radius-sm);+ margin-bottom: $space-4;+ color: var(--red);+ font-size: 13px;+ overflow-wrap: anywhere;++ strong {+ margin-right: $space-2;+ }+ }++ .log-section {+ margin-bottom: $space-4;++ h4 {+ margin: 0 0 $space-2 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-owned console well (independent of any other page's partial)+ .log-output {+ margin: 0;+ padding: $space-3 $space-4;+ background: var(--bg-code);+ color: var(--text-code);+ border: 1px solid var(--border);+ border-radius: var(--radius-sm);+ font-family: var(--mono);+ font-size: 12px;+ line-height: 1.62;+ white-space: pre-wrap;+ word-break: break-all;+ max-height: 300px;+ overflow-y: auto;+ @include custom-scrollbar();+ }+ }++ .no-logs {+ padding: $space-6;+ text-align: center;+ color: var(--text-faint);+ font-size: 13px;+ }+}diff --git a/frontend/src/services/api/files.js b/frontend/src/services/api/files.jsindex 90647a56..198b0e7a 100644--- a/frontend/src/services/api/files.js+++ b/frontend/src/services/api/files.js@@ -272,40 +272,12 @@ export async function testFTPConnection(host = 'localhost', port = 21, username});}-// Git Server endpoints-export async function getGitServerStatus() {- return this.request('/git/status');-}--export async function getGitRequirements() {- return this.request('/git/requirements');-}--export async function installGit(data) {- return this.request('/git/install', {- method: 'POST',- body: data- });-}--export async function uninstallGit(removeData = false) {- return this.request('/git/uninstall', {- method: 'POST',- body: { removeData }- });-}--export async function startGit() {- return this.request('/git/start', { method: 'POST' });-}--export async function stopGit() {- return this.request('/git/stop', { method: 'POST' });-}--export async function restartGit() {- return this.request('/git/restart', { method: 'POST' });-}+// The Gitea self-host surface (server lifecycle + repo browsing) moved into+// the serverkit-git extension with the Git page (plan 52 Phase 6) - its own+// client lives there. Core keeps the webhook + deployment endpoints below+// (they ARE the deploy pipeline) and three fail-soft Gitea aliases the+// app-creation repo pickers probe; those return 404 when the extension is+// absent and the pickers already degrade to "not installed".// Git Webhooksexport async function getWebhooks() {@@ -346,57 +318,6 @@ export async function testWebhook(webhookId) {return this.request(`/git/webhooks/${webhookId}/test`, { method: 'POST' });}-// Git Repositories-export async function getRepositories(limit = 50) {- return this.request(`/git/repos?limit=${limit}`);-}--export async function getRepository(owner, repo) {- return this.request(`/git/repos/${owner}/${repo}`);-}--export async function getRepoStats(owner, repo) {- return this.request(`/git/repos/${owner}/${repo}/stats`);-}--export async function getBranches(owner, repo) {- return this.request(`/git/repos/${owner}/${repo}/branches`);-}--export async function getBranch(owner, repo, branch) {- return this.request(`/git/repos/${owner}/${repo}/branches/${branch}`);-}--export async function getCommits(owner, repo, branch = null, page = 1, limit = 30) {- let url = `/git/repos/${owner}/${repo}/commits?page=${page}&limit=${limit}`;- if (branch) url += `&branch=${branch}`;- return this.request(url);-}--export async function getCommit(owner, repo, sha) {- return this.request(`/git/repos/${owner}/${repo}/commits/${sha}`);-}--export async function getRepoFiles(owner, repo, ref = 'main', path = '') {- let url = `/git/repos/${owner}/${repo}/contents?ref=${ref}`;- if (path) url += `&path=${path}`;- return this.request(url);-}--export async function getFileContent(owner, repo, filepath, ref = 'main') {- return this.request(`/git/repos/${owner}/${repo}/contents/${filepath}?ref=${ref}`);-}--export async function getRepoReadme(owner, repo, ref = null) {- let url = `/git/repos/${owner}/${repo}/readme`;- if (ref) url += `?ref=${ref}`;- return this.request(url);-}--export async function getGiteaVersion() {- return this.request('/git/version');-}-// Self-documenting aliases for the local Gitea endpoints used by repo pickers.export async function getGiteaStatus() {return this.request('/git/status');diff --git a/frontend/src/styles/main.scss b/frontend/src/styles/main.scssindex c668d4b2..18a5afa5 100644--- a/frontend/src/styles/main.scss+++ b/frontend/src/styles/main.scss@@ -125,7 +125,6 @@@import 'pages/_cron';@import 'pages/_security';@import 'pages/_templates';-@import 'pages/_git';@import 'pages/_servers';@import 'pages/_server-survey';@import 'pages/_downloads';