gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit9b0516fd9b0516fdgitoria#22: mark the tab underline functional (check-theme), chain E2E: serve/measure split, bring the lisbeth tab to frontmre9b0516fd/components/pulls.hl

3.9 KB

  1. // components/pulls.hl — THE PULL REQUESTS of a repo (gitoria#11, gitoria#16): `/pulls` on <slug>.<domain>, its
  2. // own route. The repo head is rendered on the server from the request's host. The list comes from git (the
  3. // commits whose message starts with |||PR) on the SERVER too
  4. // (lib/pulls.hl pullsNow — hl:proc run() waits, hybriel#80): it is in the first HTML and in every hl:web navigation.
  5. parent './repo.hl'
  6. import { siteName } from '../project.hl'
  7. import { slugOfHost } from '../lib/util.hl'
  8. import { userOfSession } from '../lib/users.hl'
  9. import { repoAt, ownsRepo } from '../lib/repos.hl'
  10. import { pageTitle } from '../lib/repos-helpers.hl'
  11. import { pullsNow, mergePullNow, withMerge, pullsView } from '../lib/pulls.hl'
  12. import { withPullParts } from '../lib/tickets-helpers.hl'
  13. import { notifyPush } from '../lib/tickets.hl'
  14. host = null
  15. session = null
  16. slug = slugOfHost(host)
  17. repo = repoAt(slug)
  18. hasRepo = repo != null
  19. isOwner = repo != null && ownsRepo(slug, session)
  20. mergeError = ''
  21. got = repo != null ? pullsNow(slug, repo.branch) : null
  22. pullsShown = got != null && !got.isMessage
  23. pullsMessage = got != null && got.isMessage
  24. pullsText = got != null && got.isMessage ? got.message : ''
  25. pullsNone = got != null && !got.isMessage && got.noPulls
  26. pullsList = got != null && !got.isMessage ? withPullParts(withMerge(got.pulls, isOwner), repo.ticketsProject) : []
  27. pullsDefault = got != null && !got.isMessage ? got.defaultName : ''
  28. __title = pageTitle(siteName, slug, 'Pull requests')
  29. View {
  30. repoPage {
  31. if (hasRepo) {
  32. repoPulls { id = "pulls"
  33. if (pullsMessage) { p { id = "pullsmessage" class = "empty" pullsText } }
  34. if (pullsShown) {
  35. p { id = "pullshelp" class = "muted" "A commit whose message starts with " code { "|||PR " } " opens a pull request; " code { "|||PR|branch] " } " sets the target (now: " strong { pullsDefault } " by default)." }
  36. if (pullsNone) { p { id = "nopulls" class = "empty" "No pull request yet." } }
  37. p { id = "mergeerror" class = "message" mergeError }
  38. ol { id = "pulllist"
  39. for (pr of pullsList) {
  40. li {
  41. span { class = "subject" for (pt of pr.parts) { if (pt.isText) { a { href = pr.href pt.text } } if (pt.isLink) { a { class = "ticketref" href = pt.href pt.text } } } }
  42. span { class = pr.state pr.state }
  43. span { class = "branches"
  44. if (pr.hasSource) { a { class = "source" href = pr.sourceHref pr.source } }
  45. if (pr.noSource) { span { class = "source muted" "(branch gone)" } }
  46. span { class = "muted" "→" }
  47. if (pr.targetLinked) { a { class = "target" href = pr.targetHref pr.target } }
  48. if (pr.targetMissing) { span { class = "target muted" pr.target " (no such branch)" } }
  49. }
  50. span { class = "muted" pr.author }
  51. time { pr.date }
  52. button { class = pr.mergeClass type = "button" value = pr.sha "Merge" on click(e) { emit mergePull(e.target.value) } }
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. // "Merge" (the owner, only when clicked): the face merges and answers with the list read again
  62. on mergePull(sha) {
  63. mergeError = ''
  64. r = emit server gitoriaMergePull(slug, sha)
  65. if (r == null || r.error != null) {
  66. mergeError = r != null ? r.error : 'could not merge'
  67. return null
  68. }
  69. got = r.result
  70. pullsList = r.list
  71. pullsNone = got.noPulls
  72. }
  73. on server gitoriaMergePull(slugOf, sha, session) {
  74. if (session == null || repoAt(slugOf) == null) { return { error = 'could not merge' } }
  75. u = userOfSession(session)
  76. if (u == null || !ownsRepo(slugOf, session)) { return { error = 'only the owner can merge a pull request' } }
  77. r = mergePullNow(slugOf, repoAt(slugOf).branch, sha, u.name)
  78. if (r.error != null) { return { error = r.error } }
  79. notifyPush(slugOf, false)
  80. // the list again, with its ticket links made here: tickets-helpers.hl reads the environment, which the browser has not
  81. return pullsView(slugOf, repoAt(slugOf).branch, true, repoAt(slugOf).ticketsProject)
  82. }

Branches

Latest commits

  • 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
  • 7f992d62gitoria#23: phone first on the shared theme — brand, branch and pull links 44 px, readme code 14 px; gate block "phone first" (15 pages at 390 + the three dropdowns, fails 20 on old), dropdown-aware login/logout clicks, check-theme in GATESmre
  • a2a840a5gitoria#23 WIP (quota stop): theme from layouts, styles inherit it, shell on the theme's header/menus/sidebar, phone measurement script; gates not runmre
  • 12b665b0mission brief 005mre