gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitcd99d2fecd99d2feWIP gitoria#22: always render the repo level's slot (missing-repo boot hang), pages render nothing without a repo; hydration diagnosis in reports/G2-hydrate.mdmrecd99d2fe/components/settings.hl

3.3 KB

  1. // components/settings.hl — THE SETTINGS of a repo (gitoria#18): `/settings` on <slug>.<domain>. For now one section,
  2. // "Tickets": connect the repo to a tickets.worldapi.org project (the owner clicks "Tickets: connect", tickets asks which
  3. // project, and brings them back — lib/api.hl /settings/connect and /settings/connected; lib/tickets.hl). Anyone sees
  4. // whether the repo is connected; only the owner sees the buttons. Rendered on the server from the request's host.
  5. // (The main branch is switched on the code page.)
  6. parent './repo.hl'
  7. import { siteName } from '../project.hl'
  8. import { slugOfHost } from '../lib/util.hl'
  9. import { userOfSession } from '../lib/users.hl'
  10. import { repoAt, ownsRepo, setTicketsConnection } from '../lib/repos.hl'
  11. import { pageTitle } from '../lib/repos-helpers.hl'
  12. import { ticketsUrl } from '../lib/tickets-helpers.hl'
  13. host = null
  14. session = null
  15. slug = slugOfHost(host)
  16. repo = repoAt(slug)
  17. hasRepo = repo != null
  18. isOwner = repo != null && ownsRepo(slug, session)
  19. connected = repo != null && repo.ticketsOn
  20. notConnected = repo != null && !repo.ticketsOn
  21. projectTitle = repo != null ? repo.ticketsTitle : ''
  22. projectHref = repo != null && repo.ticketsOn ? ticketsUrl + '/projects/' + repo.ticketsProject : ''
  23. connectNote = session != null && session.data != null && session.data.connectNote != null ? session.data.connectNote : ''
  24. hasConnectNote = connectNote != ''
  25. notOwnerHint = repo != null && !isOwner
  26. settingsError = ''
  27. forgetClass = repo != null && repo.ticketsOn ? 'quiet' : 'nomerge'
  28. __title = pageTitle(siteName, slug, 'Settings')
  29. View {
  30. repoPage {
  31. if (hasRepo) {
  32. repoSettings { id = "settings"
  33. section { id = "ticketsettings"
  34. h2 { "Tickets" }
  35. if (hasConnectNote) { p { id = "connectnote" class = "message" connectNote } }
  36. if (connected) {
  37. p { id = "connectedto" "Connected to the tickets project " a { id = "projectlink" href = projectHref projectTitle } "." }
  38. }
  39. if (notConnected) { p { id = "notconnected" class = "muted" "This repository is not connected to a tickets project yet." } }
  40. if (isOwner) {
  41. p {
  42. a { id = "connecttickets" class = "button" href = "/settings/connect" "Tickets: connect" }
  43. }
  44. button { id = "disconnecttickets" class = forgetClass type = "button" "Forget the connection" on click(e) { emit disconnect() } }
  45. p { class = "muted" "Connecting asks tickets which project (you must be its admin there). Tickets can also disconnect gitoria from its side." }
  46. }
  47. if (notOwnerHint) { p { id = "ownerhint" class = "muted" "Only the owner of this repository can connect it." } }
  48. p { id = "settingserror" class = "message" settingsError }
  49. }
  50. }
  51. }
  52. }
  53. }
  54. on disconnect() {
  55. settingsError = ''
  56. r = emit server gitoriaDisconnectTickets(slug)
  57. if (r == null || r.error != null) {
  58. settingsError = r != null ? r.error : 'could not disconnect'
  59. return null
  60. }
  61. connected = false
  62. notConnected = true
  63. forgetClass = 'nomerge'
  64. projectTitle = ''
  65. projectHref = ''
  66. }
  67. on server gitoriaDisconnectTickets(slugOf, session) {
  68. if (session == null || repoAt(slugOf) == null) { return { error = 'could not disconnect' } }
  69. if (userOfSession(session) == null || !ownsRepo(slugOf, session)) { return { error = 'only the owner can change this' } }
  70. r = setTicketsConnection(slugOf, '', '', '', '')
  71. if (r.error != null) { return { error = r.error } }
  72. return { ok = true }
  73. }

Branches

Latest commits

  • cd99d2feWIP gitoria#22: always render the repo level's slot (missing-repo boot hang), pages render nothing without a repo; hydration diagnosis in reports/G2-hydrate.mdmre
  • e5404b9breport: commit idsmre
  • 63cfa21ereports/G2-repotabs.mdmre
  • 9b0516fdgitoria#22: mark the tab underline functional (check-theme), chain E2E: serve/measure split, bring the lisbeth tab to frontmre
  • 19bc1df8gitoria#22: all repo pages under ONE layout level (components/repo.hl, hl:web D-CHAIN): a tab click replaces only the page in the slot; head and tab nav stay the same DOM nodesmre
  • 40658417tests/browser.mjs: wait for the page to be live (hydrated) before clicking Merge — a click on the server-rendered button before the client mounted was lost (flaky 'Clashing change' under load)mre
  • 48a6154bre-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
  • e972e8d7tests: short-id-switch (GITORIA_SWITCH_IDENT_PORT/_PORT) and ssh tunnel (GITORIA_GATE_TUNNEL_PORT) ports from env, defaults unchangedmre
  • f06f5349re-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
  • c7d3cc87docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
  • f0e7ff8cdeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
  • fe5f707cgitoria 010: report, mission, comment on why current = true staysmre
  • 9705ca86gitoria 010: gate: menu marker in the server HTMLmre
  • 8cff663agitoria 010: main-menu.hl from layouts 0bcc629 (route marker)mre
  • 359c79f7gitoria 010: re-vendor Hybriel master f9614007 (plugins whole, bin/ git-ignored)mre
  • 6bd7fb3cgitoria 009: theme re-copied from layouts 76f99f6 (menu marks the current page), current = true on the menu item, e2e marker checks, reportmre
  • 44de915cidentkit: refuse a taken ident port, cold-start deadline, abort on dead ident, clear no-code error (as notes)mre
  • 2bf5343egitoria 007: theme re-copied from layouts dbe3de7 (44 px taps), redundant tap overrides dropped, crumbs class, real-browser walk test, reportmre
  • 18843648deploy.sh: a gate without a 'passed,' line (check-theme) no longer ends the script silently (grep under pipefail) — print check-theme's summary, as layouts doesmre
  • e6dff0cbgitoria#23: report 005, STATUS, LOGmre