gitoria
All repositories: gitoria
7.8 KB
// components/list.hl — THE REPO LIST of the main address (ticket #6, gitoria#16): every repository, newest// first, and "Create a repository" (slug = its address, unique in the whole system) for a named user.// Composed into components/index.hl (route `/`) when the request's host is the main address. Rendered on// the server with its rows; a new repo from any session reaches every open list (push `repoCreated`).import { repoOrigin } from '../lib/util.hl'import Tokens from './tokens.hl'import SshKeys from './sshkeys.hl'import { repoRows, orgRows, createRepoIn, createOrg } from '../lib/repos.hl'import { infoOfSession, userOfSession, userIdOfSession } from '../lib/users.hl'session = nullme = infoOfSession(session)canCreate = me != null && me.namedneedsLogin = me == nullrepos = repoRows(userIdOfSession(session))orgs = orgRows(userIdOfSession(session))hasOrgs = orgs.length > 0noRepos = repos.length == 0createError = ''orgError = ''createdText = ''createdHref = ''hasCreated = false// THE LIST COMES FIRST (mobile first): the repositories are what this page is for; the create form, tokens and keys follow it.// (Before, a phone scrolled past three forms — 5 000 px — to reach the first repository.)View {repoList {h1 { id = "heading" "Repositories" }if (needsLogin) { p { id = "loginhint" class = "muted" "Log in with ident (top right) to create a repository." } }if (noRepos) { p { id = "empty" class = "empty" "No repository yet." } }ol { id = "repos"for (r of repos) {li {a { class = "slug" href = r.address r.slug }if (r.isPrivate) { span { class = "muted" "Private" } }if (r.described) { span { class = "about" r.description } }repoMeta { span { r.owner } time { r.created } }}}}if (hasOrgs) {h2 { "Organizations" }ul { id = "orgs"for (o of orgs) {li { a { class = "slug" href = o.address o.slug } if (o.isPrivate) { span { class = "muted" "Private" } } }}}}if (canCreate) {form { id = "createform"on submit(e) {e.preventDefault()emit createIt(e)}h2 { "Create a repository" }label { "Address — its name is unique in the whole system and becomes NAME.gitoria.worldapi.org"input { id = "slug" name = "slug" required = "required" minlength = "2" maxlength = "40" autocomplete = "off" autocapitalize = "none" spellcheck = "false" }}label { "Description (optional)"input { id = "description" name = "description" maxlength = "200" autocomplete = "off" }}label { "Organization (optional) — put the repository inside one of yours: ORG.gitoria.worldapi.org/NAME"input { id = "org" name = "org" maxlength = "40" autocomplete = "off" autocapitalize = "none" spellcheck = "false" }}label { "Visibility — a private repository is seen only by you and the members you add"select { id = "priv" name = "priv"option { value = "public" "Public" }option { value = "private" "Private" }}}button { id = "createsave" type = "submit" "Create repository" }p { id = "createerror" class = "message" createError }}}if (canCreate) {form { id = "orgform"on submit(e) {e.preventDefault()emit createOrgIt(e)}h2 { "Create an organization" }label { "Name — becomes NAME.gitoria.worldapi.org, its repositories live at NAME.gitoria.worldapi.org/REPO"input { id = "orgslug" name = "orgslug" required = "required" minlength = "2" maxlength = "40" autocomplete = "off" autocapitalize = "none" spellcheck = "false" }}label { "Visibility — a private organization makes every repository of it private, also new ones"select { id = "orgpriv" name = "orgpriv"option { value = "public" "Public" }option { value = "private" "Private" }}}button { id = "orgsave" type = "submit" "Create organization" }p { id = "orgerror" class = "message" orgError }}}if (hasCreated) { p { id = "created" class = "notice" createdText " " a { id = "createdlink" href = createdHref "Open it" } } }Tokens { }SshKeys { }}}on createIt(e) {f = e.target.elementsr = emit server gitoriaCreateRepo(f.slug.value, f.description.value, f.org.value, f.priv.value == 'private')if (r == null || r.error != null) {createError = r != null ? r.error : 'could not create the repository'return null}createError = ''f.slug.value = ''f.description.value = ''f.priv.value = 'public'createdText = "Created '" + r.repo.slug + "': "createdHref = r.repo.addresshasCreated = true}on createOrgIt(e) {f = e.target.elementsr = emit server gitoriaCreateOrg(f.orgslug.value, f.orgpriv.value == 'private')if (r == null || r.error != null) {orgError = r != null ? r.error : 'could not create the organization'return null}orgError = ''f.orgslug.value = ''f.orgpriv.value = 'public'createdText = "Created the organization '" + r.org.slug + "': "createdHref = r.addresshasCreated = trueorgs = [{ slug = r.org.slug isPrivate = r.org.isPrivate isPublic = !r.org.isPrivate address = r.address }].concat(orgs)hasOrgs = true}// this session's tabs follow a login / name / logout (the shell's faces push them)on client gitoriaSignedIn(tag, info) {canCreate = info.namedneedsLogin = false}on client gitoriaSignedOut(tag) {canCreate = falseneedsLogin = true}// a new repo, from any session: the list follows liveon client repoCreated(row) {next = [row]for (x of repos) { if (x.id != row.id) { next.push(x) } }repos = nextnoRepos = false}on server gitoriaCreate(slug, description, session) {return makeRepo(slug, description, '', false, session)}on server gitoriaCreateRepo(slug, description, org, priv, session) {return makeRepo(slug, description, org, priv, session)}on server gitoriaCreateOrg(slug, priv, session) {u = userOfSession(session)if (u == null) { return { error = 'log in with ident (top right) first' } }r = createOrg(u.id, slug, priv)if (r.error != null) { return { error = r.error } }return { org = r.org address = repoOrigin(r.org.slug) + '/' }}makeRepo = (slug, description, org, priv, session) => {u = userOfSession(session)if (u == null) { return { error = 'log in with ident (top right) to create a repository' } }r = createRepoIn(u.id, org, slug, description, priv)if (r.error != null) { return { error = r.error } }emit client repoCreated(r.repo)return r}Style {repoList {display = 'grid'gap = '1rem'minWidth = '0''> *' {margin = '0'}}#createform {display = 'grid'gap = '.75rem'padding = '1rem'background = 'var(--color-surface)'borderRadius = 'var(--radius-large)''> *' {margin = '0'}}#repos {display = 'grid'gap = '.5rem'margin = '0'padding = '0'listStyle = 'none'li {display = 'grid'gap = '.1rem'margin = '0'padding = '.25rem 1rem .6rem'background = 'var(--color-surface)'borderRadius = 'var(--radius-large)'}'.slug' {display = 'flex'alignItems = 'center'minHeight = '2.75rem'fontWeight = '700'fontSize = '1.05rem'overflowWrap = 'anywhere'}'.about' {color = 'var(--color-text)'}}repoMeta {display = 'flex'flexWrap = 'wrap'gap = '.2rem 1rem'fontSize = '.875rem'color = 'var(--color-text-muted)'}'@media (min-width: 60rem)' {#repos {li {gridTemplateColumns = 'minmax(10rem, 16rem) 1fr auto'alignItems = 'center'gap = '.15rem 1rem'padding = '.25rem 1rem'}}}#orgform {display = 'grid'gap = '.75rem'padding = '1rem'margin = '1rem 0'background = 'var(--color-surface)'borderRadius = 'var(--radius-large)'}#orgs {listStyle = 'none'margin = '0'padding = '0'display = 'grid'gap = '.1rem'li {display = 'flex'alignItems = 'center'gap = '.75rem'minHeight = '2.75rem'}}}
Branches
- f1-broken-json
- f2-api-bugs
- gp-gate-ports
- heap-revert
- hl25-records
- ident-chooser-selector
- mainmain branch
- p51-public-pr-reads
- records-1112
- s25-no-session-on-login-error
- v59
- w52-person-approval
- w52b-approval-followup
- w52c-header-phone
- w53-pulls-speed-pr
- w54-repo-rename-pr
- w55-rename-org
- w56-owner-members
- w62-pr-close
- w63-force-push
- w64-org-slash
Latest commits
- c4175e6dgitoria: a startup error prints its message before exit 1 (hybriel#247)mre
- c50d17efKeep function-route not-found style in shared stylesheetmre
- e42d78d3Preserve ticket state CSS and document function-route style gapmre
- c6b7154eWIP gitoria#26: move styles into nested component blocksmre
- 77a2c31cgitoria#31: plain declarations instead of needless let in lib/ and tools/ (103 let removed, 137 kept because reassigned); no other changemre
- 4b98ab62gitoria: an ident access key (idt_) works as the git password; read key clones only, bad key 401, ident down 503 (ident#27); gate tests/ident-access-gitoria.mjs in deploy.shmre
- 1185f686gitoria#36: a failed return from tickets shows a note on the settings page and leaves one log line per outcome; no code is exchangedmre
- 5d2c385agitoria: the sign-in callback keeps the session it finds and signs it in (same cookie, nothing signed out; ident#28); security gate 71+5 failing → 76 passed; deploy.sh runs tests/private.mjs toomre
- 241ef3f9deploy.sh: rebuild the sshd image before up -d (GO34c)mre
- 821cdbb1gitoria#34b: styles, create-repo tool, docs, push/ssh gates sign in through the selector, shots scriptmre
- a81abdc9gitoria#34: org page via function route, member-reachable orgs, selects, reportmre
- 17f031f0gitoria#34: private repos, organizations, members, move tool, gatemre
- 71b69343gitoria#23: the sidebar's Repositories link was a 404 after any in-page navigation (static menu re-evaluated publicUrl in the browser); the menu is an instance property now; gate taps it after a tab, folder, filemre
- 90b4f728gitoria#25: restore the homepage cache and the parsed-blocks cache (they store data under immutable keys, no HTML); the page key, the framework readme key and the textHash key stay removedmre
- a487248cgitoria#25: remove every cache that hid the page build (page key, Markdown render key, homepage cache, parsed-blocks cache) and the gate that only tested themmre
- 12f2f4fegitoria: re-vendor Hybriel set-day27b, a startup fault in on Error exits 1mre
- c21c084egitoria: write the standby service out in full so the boot gate can read the main servicemre
- e307d69agitoria: say what is per process during the hand-overmre
- f0cbe6a6gitoria: standby service on port 45014 and a deploy that hands over through it without a gapmre
- 727cd083gitoria#25: README: vendor notes for Hybriel c1b1010f and the page cachemre