gitoria
All repositories: gitoria
4.6 KB
// components/orglist.hl — THE ADDRESS OF AN ORGANIZATION (ticket gitoria#34, GO34): `/` on <org>.<domain> lists the organization's repos// (the ones the viewer may see), newest first; every repo opens at <org>.<domain>/<repo> and looks like a repo page on <repo>.<domain>.// The organization's owner sees whether it is private (every repo of it is then private, also new ones) and can switch that.// Composed into components/index.hl when the host is an organization the viewer may see.import { slugOfHost } from '../lib/util.hl'import { orgFor, orgRepoRows, setOrgPrivate, membersOf, changeMember } from '../lib/repos.hl'import { userIdOfSession } from '../lib/users.hl'host = nullsession = nullorg = slugOfHost(host)orgRow = orgFor(org, userIdOfSession(session))isOwner = orgRow != null && userIdOfSession(session) != null && orgRow.owner == userIdOfSession(session)isPrivate = orgRow != null && orgRow.priv == trueprivText = isPrivate ? 'This organization is private: only its owner and its members can see it and its repositories.' : 'This organization is public.'privButton = isPrivate ? 'Make public' : 'Make private'repos = orgRow != null ? orgRepoRows(org, userIdOfSession(session)) : []noRepos = repos.length == 0listed = isOwner ? membersOf('o', org, userIdOfSession(session)) : nullmembers = listed != null && listed.members != null ? listed.members : []noMembers = isOwner && members.length == 0orgError = ''View {orgPage {h1 { id = "orgname" org }p { id = "orgprivtext" class = "muted" privText }if (isOwner) { button { id = "toggleorgpriv" type = "button" privButton on click(e) { emit toggleOrgPriv() } } }h2 { "Repositories" }if (noRepos) { p { id = "empty" class = "empty" "No repository in this organization 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 (isOwner) {h2 { "Members" }p { class = "muted" "Members see the organization's repositories even when it is private, and may push to them. Add somebody by the display name they chose." }if (noMembers) { p { id = "nomembers" class = "empty" "No members yet." } }ul { id = "members"for (m of members) {li { span { class = "slug" m.name } button { class = "quiet" type = "button" "Remove" on click(e) { emit removeMember(m.name) } } }}}form { id = "memberform"on submit(e) {e.preventDefault()emit addMember(e)}label { "Display name"input { id = "membername" name = "membername" required = "required" maxlength = "60" autocomplete = "off" }}button { id = "memberadd" type = "submit" "Add member" }}}p { id = "orgerror" class = "message" orgError }}}on toggleOrgPriv() {orgError = ''r = emit server gitoriaSetOrgPrivate(org, !isPrivate)if (r == null || r.error != null) {orgError = r != null ? r.error : 'could not change the visibility'return null}isPrivate = !isPrivateprivText = isPrivate ? 'This organization is private: only its owner and its members can see it and its repositories.' : 'This organization is public.'privButton = isPrivate ? 'Make public' : 'Make private'}on addMember(e) {orgError = ''r = emit server gitoriaChangeOrgMember(org, e.target.elements.membername.value, true)if (r == null || r.error != null) {orgError = r != null ? r.error : 'could not add the member'return null}members = r.membersnoMembers = members.length == 0e.target.elements.membername.value = ''}on removeMember(name) {orgError = ''r = emit server gitoriaChangeOrgMember(org, name, false)if (r == null || r.error != null) {orgError = r != null ? r.error : 'could not remove the member'return null}members = r.membersnoMembers = members.length == 0}on server gitoriaSetOrgPrivate(orgSlug, priv, session) {return setOrgPrivate(userIdOfSession(session), orgSlug, priv)}on server gitoriaChangeOrgMember(orgSlug, name, add, session) {return changeMember(userIdOfSession(session), 'o', orgSlug, name, add)}Style {#members {listStyle = 'none'margin = '0'padding = '0'display = 'grid'gap = '.25rem'maxWidth = '32rem'li {display = 'flex'alignItems = 'center'justifyContent = 'space-between'gap = '.75rem'minHeight = '2.75rem'padding = '0 .5rem 0 1rem'background = 'var(--color-surface)'borderRadius = 'var(--radius-large)'}}#memberform {display = 'grid'gap = '.75rem'margin = '.75rem 0 1.5rem'maxWidth = '32rem'}#toggleorgpriv {justifySelf = 'start'}}
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