gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit4fda244f4fda244fgitoria#22: RepoTabs wrapping component for the repo tabs (active tab, no content for a missing repo)mre4fda244f/components/repotabs.hl

4.8 KB

  1. // components/repotabs.hl — RepoTabs, THE WRAPPER OF EVERY REPO VIEW (gitoria#16, gitoria#22): the frame, the repo's name,
  2. // description and the nav (Readme · Code · Pull requests · Releases · Tickets · Settings) with aria-current = 'page' on the
  3. // active tab (`tab`), and the page's content (the slot) ONLY when the repo exists — else just "No such repository".
  4. // A page writes `RepoTabs { tab = 'code' CodeBrowser { … } }` (readme · code · branch · commit · pulls · releases · tickets · settings). The repo comes from the request's host
  5. // (`host = null`, hybriel#74) on the SERVER: this is in the first HTML and follows every hl:web navigation.
  6. import { NL, slugOfHost, publicUrl, hostOnly } from '../lib/util.hl'
  7. import { repoAt } from '../lib/repos.hl'
  8. import { isEmptyNow } from '../lib/git.hl'
  9. import { sshEnabled, sshUrl } from '../lib/sshkeys.hl'
  10. host = null
  11. slot = null
  12. // tab: 'readme' | 'code' | 'pulls' | 'releases' | 'tickets' | 'settings' ('' = none marked). gitoria#20: the "Add code" help
  13. // stands only on the code tab (Code, branch, commit pages) of an empty repository, never on the other tabs.
  14. tab = ''
  15. slug = slugOfHost(host)
  16. repo = repoAt(slug)
  17. hasRepo = repo != null
  18. // the active tab's aria-current: 'page', else null — NOTE Hybriel renders null as aria-current="" (empty = false for ARIA), repro .scratch/repro-null-attr; styles.hl matches [aria-current=page]
  19. curReadme = tab == 'readme' ? 'page' : null
  20. curCode = tab == 'code' ? 'page' : null
  21. curPulls = tab == 'pulls' ? 'page' : null
  22. curReleases = tab == 'releases' ? 'page' : null
  23. curTickets = tab == 'tickets' ? 'page' : null
  24. curSettings = tab == 'settings' ? 'page' : null
  25. isMissing = repo == null
  26. mainHref = publicUrl + '/'
  27. // HOW TO ADD CODE (gitoria#7, gitoria#20): the clone address and the exact git commands, for a new folder and for an
  28. // existing one; plain text on the Code page while nothing is pushed yet. The password is an access token (main page).
  29. cloneUrl = repo != null ? repo.address + repo.slug + '.git' : ''
  30. tokensHref = publicUrl + '/#tokens'
  31. sshKeysHref = publicUrl + '/#sshkeys'
  32. emptyRepo = repo != null && isEmptyNow(slug)
  33. showAddCode = tab == 'code' && emptyRepo
  34. newCommands = 'echo "# ' + slug + '" >> README.md' + NL + 'git init -b main' + NL + 'git add README.md' + NL + 'git commit -m "first commit"' + NL + 'git remote add origin ' + cloneUrl + NL + 'git push -u origin main'
  35. existingCommands = 'git remote add origin ' + cloneUrl + NL + 'git branch -M main' + NL + 'git push -u origin main'
  36. cloneCommand = 'git clone ' + cloneUrl
  37. // SSH (only when the sshd container is set up, sshkeys.hl): the same commands with the ssh address; the key comes from the main page
  38. showSsh = sshEnabled && repo != null
  39. sshAddress = repo != null ? sshUrl(hostOnly, repo.slug) : ''
  40. sshCloneCommand = 'git clone ' + sshAddress
  41. sshCommands = 'git remote add origin ' + sshAddress + NL + 'git push -u origin main'
  42. View {
  43. repoPage {
  44. repoHead {
  45. if (hasRepo) {
  46. h1 { id = "reponame" repo.slug }
  47. if (repo.described) { p { id = "repodescription" repo.description } }
  48. p { class = "muted" "All repositories: " a { id = "toall" href = mainHref "gitoria" } }
  49. repoNav { id = "reponav"
  50. a { id = "navhome" href = "/" "aria-current" = curReadme "Readme" }
  51. a { id = "navcode" href = "/code" "aria-current" = curCode "Code" }
  52. a { id = "navpulls" href = "/pulls" "aria-current" = curPulls "Pull requests" }
  53. a { id = "navreleases" href = "/releases" "aria-current" = curReleases "Releases" }
  54. a { id = "navtickets" href = "/tickets" "aria-current" = curTickets "Tickets" }
  55. a { id = "navsettings" href = "/settings" "aria-current" = curSettings "Settings" }
  56. }
  57. }
  58. if (showAddCode) {
  59. addCode { id = "addcode"
  60. h2 { "Add code to this repository" }
  61. h2 { "Clone it" }
  62. pre { id = "clonecommand" cloneCommand }
  63. h2 { "Push a new project" }
  64. pre { id = "newcommands" newCommands }
  65. h2 { "Push an existing project" }
  66. pre { id = "existingcommands" existingCommands }
  67. if (showSsh) {
  68. h2 { "Or over SSH" }
  69. pre { id = "sshclonecommand" sshCloneCommand }
  70. pre { id = "sshcommands" sshCommands }
  71. p { class = "muted" "Add your public key under " a { id = "tosshkeys" href = sshKeysHref "SSH keys" } " on the main page after you log in; only the owner can push." }
  72. }
  73. p { class = "muted" "Reading needs no login. To push you must be the owner of this repository: git asks for a user name (anything) and a password — that is an access token, made under " a { id = "totokens" href = tokensHref "Access tokens" } " on the main page after you log in." }
  74. }
  75. }
  76. if (isMissing) {
  77. h1 { id = "missing" "No such repository" }
  78. p { class = "muted" "Nobody has created this address yet. " a { id = "toall" href = mainHref "All repositories" } }
  79. }
  80. }
  81. if (hasRepo) { slot }
  82. }
  83. }

Branches

Latest commits

  • 4fda244fgitoria#22: RepoTabs wrapping component for the repo tabs (active tab, no content for a missing repo)mre
  • 0fd5e280mission brief 004mre
  • e1d425e7paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
  • e59ff114deploy.sh: wait up to DEPLOY_URL_WAIT (120 s) for 200 after the restart, as the other apps (cold compile, hybriel#148)mre
  • bcafcceb003: compose cache volume + tmpfs /tmp, gate start waits 120 s, report/LOG/STATUSmre
  • bed3f2d5Re-vendor Hybriel to the shared static build 0f396652 (plugins; bin/ is git-ignored)mre
  • 3207e128mission brief 003mre
  • 18ab71fbtests/ticketskit: wait up to 120 s for tickets (native Hybriel cold compile ~25 s, hybriel#148)mre
  • 4fffa966docker-compose: init: true (hybriel#156, PID 1 ignored SIGTERM, every restart waited 10 s)mre
  • 4f47843egate: ticket links use the tickets short URL (/<slug>/<n>, tickets#25)mre
  • 86605446mission 002 (code order) 4/4: README file map + import order + 'Same output' test + gate run with a tickets HEAD copy, STATUS (entry, lessons), LOG, report; tests/realdata-baseline.mjs + realdata-compare.py (a cleanup answers the same on live data: pages, modules, API, git over HTTPS and SSH, faces), tests/letcount.pymre
  • cc7bf7bamission 002 (code order) 3/4: let only where a variable is reassigned or re-bound in a loop body (289 lets → plain declarations; 213 left: 125 reassigned, 88 loop-bound; no member/import/param clash). gates 200/0, 46/0, 44/0; real-data reads + writes identical (browser modules: var → const only)mre
  • 090a20c6mission 002 (code order) 2/4: one lib/ file per topic — git.hl split into git (calls, branches, init, temp folder) / homepage / code / pulls / releases (+ git-helpers: paths, ids, |||PR/|||RL markers); repos-helpers, tickets-helpers, transport-helpers; util.hl = localtime + env, storage dir, addresses, lists, text checks, one newest-first sort (was 3 copies); the function routes out of project.hl into lib/api.hl (thin; plumbing in api-helpers.hl), sshgate.hl folded into api.hl + sshkeys.hl keyLine + repos.hl mayPush; 'Make main' and the merge answer out of the faces (code.hl makeMain, pulls.hl pullsView), one login helper (users.hl userOfLoginCode); project.hl is the map. Session-writing routes get &req + &server.sessions. gates 200/0, 46/0, 44/0; real-data identical except /login/failed now shows the parked reason for a browser that already had a session (the old copy-of-req lost it)mre
  • 110c2799mission 002 (code order) 1/4: .hl files out of the root — lib/ (api, git, localtime, markdown, repos, sshgate, sshkeys, tickets, tokens, transport, users), components/styles.hl; jsoncheck.hl removed (imported nowhere); import paths only. gates 200/0, 46/0, 44/0; real-data reads + writes identicalmre
  • fdfb4b1bgitoria: Hybriel master 06617221 (plugin allocators 3a781359 + 413f60e4, mpackdb 2cb7ae5e, http1 773de63e); gates 200/0, 46/0, 44/0mre
  • 5b46ac84antcolony#40: LOG.md — missions 069/072 are antcolony missions (report paths on Byrodin)mre
  • 5602ff41gitoria: Hybriel master 190aa11d (fc838894 GC correctness, #127 mountKids by reference, #126, #48) — tracker README flat; gates 200/0, 46/0, 44/0mre
  • e85eaf01gitoria: 069 round 2 — hybriel 1a096ad3 not adopted (Markdown SSR still grows); browser gate waits for the server-side logout before restartmre
  • 09ce4f3fgitoria: mission 069 re-vendor hybriel 8efba065 stopped (big SSR pages grow + slow down); lambda audit clean; old vendor keptmre
  • 3dc43108antcolony#40: mission references point to the moved missionsmre