gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit94f8a37394f8a373gc1: back out the kept episode-id set (no measurable gain on /my/unwatched: 4.69 -> 4.61 GB per 150 loads)mre94f8a373/components/franchiseedit.hl

4.3 KB

  1. // components/franchiseedit.hl — `/franchises/edit` (tracker.worldapi.org#19, mission 066): the creator's editor, step 1 —
  2. // a new franchise (name + summary → its index), a new timeline (name → its own editor, /timelines/<slug>/edit, where titles
  3. // are added and ordered and the franchise is attached), and a finder for the timelines that exist (by name → their editor).
  4. // Only the creator (franchises.hl isEditorSession: ident id az5b2, TRACKER_EDITORS) sees the forms; every face checks it again.
  5. //
  6. // HYBRIEL TRAPS (as components/search.hl): no member reads both a route param and `session`; every list is replaced whole.
  7. parent './main.hl'
  8. import { navigate } from 'hl:web'
  9. import { appTitle } from '../project.hl'
  10. import { isEditorSession, createFranchise, createTimeline, findTimelines } from '../lib/franchises.hl'
  11. import { warmReady, warmText } from '../lib/warm.hl'
  12. static editorOf = (&session) => { return isEditorSession(&session) }
  13. session = null
  14. isEditor = editorOf(&session)
  15. notEditor = isEditor == false
  16. message = ''
  17. hasMessage = message != ''
  18. found = []
  19. hasFound = found.length > 0
  20. __title = 'Edit franchises — ' + appTitle
  21. // mission T17 (boot time): the server listens while bootscan.hl still builds the lists / slug maps / search index (lib/warm.hl); until the 'all'
  22. // stage is there this page says so instead of showing half a map
  23. warming = !warmReady('all')
  24. warmNote = warming ? warmText() : ''
  25. View {
  26. franchiseEditPage {
  27. if (warming) { p { id = "warming" class = "message banner" warmNote } }
  28. h1 { "Edit franchises" }
  29. if (notEditor) { p { id = "edit-refused" class = "muted" "Only the creator can edit franchises and timelines." } }
  30. if (isEditor) {
  31. if (hasMessage) { p { id = "edit-message" class = "message" message } }
  32. editSection {
  33. h2 { class = "film-heading" "New franchise" }
  34. input { id = "fe-name" type = "text" placeholder = "Name, e.g. Star Trek" autocomplete = "off" "aria-label" = "Franchise name" }
  35. textarea { id = "fe-summary" rows = "3" placeholder = "A few words about it (optional)" "aria-label" = "Franchise summary" }
  36. button { id = "fe-create" type = "button" class = "primary" "Create franchise" on click(e) { emit newFranchise(e) } }
  37. }
  38. editSection {
  39. h2 { class = "film-heading" "New timeline" }
  40. input { id = "te-name" type = "text" placeholder = "Name, e.g. Star Trek — Prime" autocomplete = "off" "aria-label" = "Timeline name" }
  41. button { id = "te-create" type = "button" class = "primary" "Create timeline" on click(e) { emit newTimeline(e) } }
  42. }
  43. editSection {
  44. h2 { class = "film-heading" "Edit a timeline" }
  45. input { id = "tl-find" type = "search" placeholder = "Timeline name" autocomplete = "off" "aria-label" = "Find a timeline" on input(e) { emit findTyped(e) } }
  46. if (hasFound) {
  47. timelineList { id = "tl-found"
  48. for (t of found) {
  49. a { class = "timeline-link" href = t.href
  50. timelineLinkName { t.name }
  51. timelineLinkCount { t.countText }
  52. }
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
  60. on newFranchise(e) {
  61. r = emit server fedCreateFranchise(document.getElementById('fe-name').value, document.getElementById('fe-summary').value)
  62. if (r == null || r.error != null) { message = r != null ? r.error : 'Could not create it.' return null }
  63. navigate('/franchises/' + r.slug)
  64. }
  65. on newTimeline(e) {
  66. r = emit server fedCreateTimeline(document.getElementById('te-name').value)
  67. if (r == null || r.error != null) { message = r != null ? r.error : 'Could not create it.' return null }
  68. navigate('/timelines/' + r.slug + '/edit')
  69. }
  70. on findTyped(e) {
  71. v = e.target.value
  72. r = emit server fedFindTimelines(v)
  73. if (r == null || document.getElementById('tl-find').value != v) { return null }
  74. found = r.rows
  75. }
  76. // ---- the faces (unique names: hl:web dispatches by name across all files; the trailing `session` is the server's) ----
  77. on server fedCreateFranchise(name, summary, session) {
  78. if (!isEditorSession(&session)) { return { error = 'only the creator can do that' } }
  79. return createFranchise(name, summary)
  80. }
  81. on server fedCreateTimeline(name, session) {
  82. if (!isEditorSession(&session)) { return { error = 'only the creator can do that' } }
  83. return createTimeline(&name)
  84. }
  85. // timeline names are public (/franchises lists them all) — no session needed
  86. on server fedFindTimelines(text) {
  87. return { rows = findTimelines(&text) }
  88. }

Branches

Latest commits

  • 94f8a373gc1: back out the kept episode-id set (no measurable gain on /my/unwatched: 4.69 -> 4.61 GB per 150 loads)mre
  • a1a88bd4gc1: search skips the stale-key string while no entry is stale; /my/unwatched asks a kept id set instead of building a key string per episode rowmre
  • cd830744gc1: dbSearch: no split / map / list copy per candidate (scores from the stored text, top list touched only when the hit can enter)mre
  • 451db7cdgc1: show page and check clicks read the kept watched set instead of building one from a by-value copy of every watchmre
  • ddb4127egc1: TRACKER_QSTATS=1 logs queue and cache sizes every 10 s (measurement only)mre
  • da60547fstatus: GC1 done, backup bugmre
  • e4171021log: GC1 result, backup hard-link bugmre
  • f1597214deploy.sh backup: tar --hard-dereference (hot tar stored mpackdb sidecars as hard links to .sessions files)mre
  • 6b58571elog: GC windowmre
  • 5c8baa1fdeploy lock: hold only around deploy.shmre
  • b8dac822log: hybriel#309mre
  • bf676d9elog: GC1 startedmre
  • c7828541mission GC1mre
  • ef949994conductor: neutral ticket rulemre
  • 89e91ef3log: RV39 livemre
  • ee2b677alog: RV39 deployingmre
  • c1c4178cMerge branch 'rv39'mre
  • a016e9abReapply "Merge branch 'rv39'"mre
  • f29e2502log: RV39 gate fixmre
  • d9fce111browser gate #26: exact frame count incl. SL1 people step (hybriel#308)mre