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
- cd442066gitoria#43: app-auth unit test reads the apps table from its new filemre
- 5dccbe38gitoria#43: in-flight rows are left alone by the other process; gate in deploy.sh; READMEmre
- 8c8805f3merge main (gitoria#42), delivery log and redelivery routes, sweep fixmre
- 5a996ea8gitoria#42: short-lived app tokens, read-only git fetch with them (merge w42-app-token)mre
- afdb0cbfgitoria#43: rename the moved helper (name clash in the browser build)mre
- 15e01e94gitoria#43: tests/events.mjs and its probemre
- 77829b73gitoria#43: signed events to connected apps (deliveries table, sender timer, pull_request events, ping)mre
- b5d696fegitoria#42: app tokens (gat_, one hour), appOfRequest, app token as the git read passwordmre
- 1997e77dgitoria#40: stable PR numbers, refs/pull/N/head, ssh pushes reach the app (merge w40-pr-number)mre
- 9364fb16gitoria#40: ssh pushes call /__git/pushed before and after (ensurePulls, notifyPush, syncPulls); gate over the sshd imagemre
- fdb9ed28gitoria#41: repo owners can connect an app (merge w41-apps-connect)mre
- 2ef23df0gitoria#40: the browser gate reads the title without the #Nmre
- 9af07ecegitoria#41: connect an app to a repo (apps table, connect flow, manual add, allow-list, settings)mre
- b9137ff0gitoria#40: pull requests are stored with a number, refs/pull/N/head, syncPulls and pullObject; /pulls shows #Nmre
- 06d622daown image tag gitoria-runtime:debian12 for gitoria and standby (shared tag lost git)mre
- 20caa33agitoria#37: media queries in the language's @media block (minWidth = '60rem') in list, codebrowser and repomre
- 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