mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-03 21:29:59 -05:00
repos: add the Repos UI
* Repos table (CollectionTable), New Repo and Edit pages (frequency, mode, branch, description, tag, delete with an optional "also delete its files"). * A GitHub-like repo page: upstream, branch, latest commit, a status message when not yet downloaded or the last update failed, the file tree (directories through ?path=, files in the file preview), and each directory's README. * Global search: a Repos section under Other with escaped README headlines, Repos in the suggestions, and the search text sent to the Other estimate. * Settings: the Repos Directory field. * CollectionTable columns may `render` their cell. * Theme gallery: the repo summary, tree, and status icons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5506dc0a88
commit
0d1a988fa6
17 changed files with 1362 additions and 33 deletions
|
|
@ -49,6 +49,7 @@ import {contrastingColor} from './Common';
|
|||
import {navBarStyle, navColorNames, useNavColors} from '../themes/navColors';
|
||||
import {IconMenu2} from '@tabler/icons-react';
|
||||
import {BookmarkAddForms, BookmarkMenuItems, BookmarkTable} from './Bookmarks';
|
||||
import {RepoBreadcrumb, RepoStatusIcon, RepoSummary, RepoTreeTable} from './Repos';
|
||||
|
||||
/*
|
||||
* A gallery of every component in the library, in the current theme.
|
||||
|
|
@ -170,6 +171,23 @@ const sampleBookmarks = [
|
|||
];
|
||||
const noBookmarkActions = {edit: () => null, move: () => null, remove: () => null};
|
||||
|
||||
const sampleRepo = {
|
||||
id: 1, name: 'kiwix-tools', tag_name: null, url: 'https://github.com/kiwix/kiwix-tools',
|
||||
description: 'Command line tools for Kiwix and Zim files.', mode: 'full', branch: null, default_branch: 'main',
|
||||
head_sha: '3f9c2a1e7b', head_message: 'Serve Zim files with the correct mimetype', head_date: '2026-09-30T14:02:00Z',
|
||||
size: 18_400_000, directory: 'repos/kiwix-tools', download_error: null,
|
||||
};
|
||||
const sampleFailedRepo = {
|
||||
...sampleRepo, name: 'gone-upstream', branch: 'release', mode: 'snapshot',
|
||||
download_error: "git ls-remote failed (128): remote: Repository not found.\nfatal: repository " +
|
||||
"'https://github.com/example/gone-upstream/' not found",
|
||||
};
|
||||
const sampleRepoEntries = [
|
||||
{name: 'docs', path: 'src/docs', is_dir: true, size: null},
|
||||
{name: 'kiwix-serve.cpp', path: 'src/kiwix-serve.cpp', is_dir: false, size: 48_210},
|
||||
{name: 'README.md', path: 'src/README.md', is_dir: false, size: 2_104},
|
||||
];
|
||||
|
||||
export function ThemeSamplePage() {
|
||||
const {theme, mediaFilterEnabled} = useContext(ThemeContext);
|
||||
const [confirmOpen, setConfirmOpen] = useState(false);
|
||||
|
|
@ -1127,6 +1145,26 @@ export function ThemeSamplePage() {
|
|||
</Panel>
|
||||
</Section>
|
||||
|
||||
<Section label='Repos'>
|
||||
<Panel>
|
||||
<p style={{fontSize: '0.75rem', color: 'var(--muted)', marginTop: 0}}>
|
||||
A git repo's page: its summary, then its files. A repo whose last update failed keeps
|
||||
its files and explains why. The status icons appear beside a repo's name in the Repos
|
||||
table: <RepoStatusIcon repo={sampleFailedRepo}/> failed,{' '}
|
||||
<RepoStatusIcon repo={{...sampleRepo, head_sha: null}}/> not downloaded yet.
|
||||
</p>
|
||||
<RepoSummary repo={sampleRepo}/>
|
||||
<div style={{marginTop: 12}}>
|
||||
<RepoBreadcrumb name={sampleRepo.name} path='src' onNavigate={() => null}/>
|
||||
<RepoTreeTable path='src' entries={sampleRepoEntries} onOpenDirectory={() => null}
|
||||
onOpenFile={() => null}/>
|
||||
</div>
|
||||
<div style={{marginTop: 12}}>
|
||||
<RepoSummary repo={sampleFailedRepo}/>
|
||||
</div>
|
||||
</Panel>
|
||||
</Section>
|
||||
|
||||
<Section label='Danger zone'>
|
||||
<Panel danger>
|
||||
<h2 style={{color: 'var(--danger)', fontSize: '0.875rem', margin: '0 0 4px'}}>Danger zone</h2>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue