gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit74ec2af874ec2af8Merge branch 'w54-repo-rename-pr' into mainGitoria74ec2af8/components/settings.hl

25.7 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. // "Apps" (gitoria#41, lib/apps.hl): the owner connects outside apps to the repo — the confirm card of connect flow A (an app sent the browser
  6. // here; lib/api.hl appConnectStart parked the request in the session), the list (Remove, Rotate secret) and Add (the manual way). Key and secret
  7. // are shown ONCE, in the page state of the click that made them.
  8. // (The main branch is switched on the code page.)
  9. parent './repo.hl'
  10. import { navigate } from 'hl:web'
  11. import { siteName } from '../project.hl'
  12. import { slugOfRequest } from '../lib/orgs.hl'
  13. import { userOfSession, userIdOfSession } from '../lib/users.hl'
  14. import { renameRepo, setRepoTitle, titleSlug, repoAt, repoBySlug, ownsRepo, setTicketsConnection, setRepoPriv, membersOf, changeMember, setProtectMain, isProtectedMain } from '../lib/repos.hl'
  15. import { px } from '../lib/util.hl'
  16. import { pageTitle } from '../lib/repos-helpers.hl'
  17. import { ticketsUrl } from '../lib/tickets-helpers.hl'
  18. import { appRows, addApp, removeApp, rotateSecret, sendPing } from '../lib/apps.hl'
  19. import { hostOfUrl } from '../lib/apps-helpers.hl'
  20. import { announceRequirements } from '../lib/prpage.hl'
  21. import { latestAppContext, requiredRule, requiredList, requireContext, requirePerson, peopleOfRepo, dropRequired } from '../lib/statuses.hl'
  22. host = null
  23. orepo = ''
  24. session = null
  25. slug = slugOfRequest(host, orepo)
  26. repo = repoAt(slug, session)
  27. hasRepo = repo != null
  28. pre = px(slug)
  29. connectHref = pre + '/settings/connect'
  30. isOwner = repo != null && ownsRepo(slug, session)
  31. connected = repo != null && repo.ticketsOn
  32. notConnected = repo != null && !repo.ticketsOn
  33. projectTitle = repo != null ? repo.ticketsTitle : ''
  34. projectHref = repo != null && repo.ticketsOn ? ticketsUrl + '/projects/' + repo.ticketsProject : ''
  35. connectNote = session != null && session.data != null && session.data.connectNote != null ? session.data.connectNote : ''
  36. hasConnectNote = connectNote != ''
  37. notOwnerHint = repo != null && !isOwner
  38. settingsError = ''
  39. renameName = repo != null ? (repo.inOrg ? repo.slug.slice(repo.org.length + 1) : repo.slug) : ''
  40. displayName = repo != null ? repo.title : ''
  41. renameError = ''
  42. titleError = ''
  43. forgetClass = repo != null && repo.ticketsOn ? 'quiet' : 'nomerge'
  44. titleRepo = repoAt(slugOfRequest(host, orepo), session)
  45. __title = pageTitle(siteName, titleSlug(host, orepo, session), 'Settings')
  46. // VISIBILITY AND MEMBERS (GO34): the owner makes the repo private / public and keeps the member list (people who see a private repo and may push)
  47. isPrivate = repo != null && repo.isPrivate
  48. ownPriv = repo != null && repo.isPrivate && !repo.inOrg
  49. privText = repo == null ? '' : (repo.isPrivate ? 'This repository is private: only its owner and its members can see it.' : 'This repository is public: everybody can read it.')
  50. privButton = repo != null && repo.isPrivate ? 'Make public' : 'Make private'
  51. // REFUSE DIRECT PUSHES TO THE MAIN BRANCH (gitoria#50): the owner's switch; off by default
  52. isProtected = repo != null && isProtectedMain(slug)
  53. protectText = isProtected ? 'Direct pushes to the main branch are refused: push a branch with a |||PR commit and merge it on the pulls page.' : 'Anybody who may push can push to the main branch.'
  54. protectButton = isProtected ? 'Allow direct pushes' : 'Refuse direct pushes to the main branch'
  55. listed = isOwner ? membersOf('r', slug, userIdOfSession(session)) : null
  56. members = listed != null && listed.members != null ? listed.members : []
  57. noMembers = isOwner && members.length == 0
  58. memberName = ''
  59. memberError = ''
  60. // APPS (gitoria#41): the owner's list; the connect request an app parked in this session (for this repo only); what was just made (shown once)
  61. apps = isOwner ? appRows(repo.id) : []
  62. noApps = isOwner && apps.length == 0
  63. parked = session != null && session.data != null && session.data.appConnect != null && repo != null && session.data.appConnect.slug == slug ? session.data.appConnect : null
  64. hasParked = parked != null
  65. parkedApp = parked != null ? parked.app : ''
  66. parkedHost = parked != null ? hostOfUrl(parked.ret) : ''
  67. parkedNonce = parked != null ? parked.nonce : ''
  68. confirmAction = pre + '/settings/apps/confirm'
  69. parkedSignedOut = hasParked && session != null && userIdOfSession(session) == null
  70. parkedNotOwner = hasParked && userIdOfSession(session) != null && !isOwner
  71. parkedOwner = hasParked && isOwner
  72. // the Apps section is the owner's; a signed-in non-owner who came to connect an app still gets its message (gitoria#45)
  73. showApps = isOwner || hasParked
  74. appName = ''
  75. appHook = ''
  76. appError = ''
  77. hasShown = false
  78. shownName = ''
  79. shownKey = ''
  80. hasShownKey = false
  81. shownSecret = ''
  82. shownText = ''
  83. // REQUIRED BEFORE MERGE (gitoria#46): the contexts the owner requires to be success on a pull request's head
  84. required = isOwner ? requiredList(repo.id) : []
  85. noRequired = isOwner && required.length == 0
  86. hasRequired = required.length > 0
  87. mergeRule = requiredRule(required)
  88. requiredApp = apps.length > 0 ? apps[0].id : ''
  89. requiredContext = isOwner ? latestAppContext(repo.id, requiredApp) : ''
  90. requiredError = ''
  91. people = isOwner ? peopleOfRepo(slug) : []
  92. requiredPerson = people.length > 0 ? people[0].id : ''
  93. View {
  94. repoPage {
  95. if (hasRepo) {
  96. repoSettings { id = "settings"
  97. if (isOwner) {
  98. section { id = "repoIdentity"
  99. h2 { "Name" }
  100. form { id = "titleForm"
  101. on submit(Hybrid e) { emit saveTitle() }
  102. label { "Name"
  103. input { id = "displayName" name = "title" maxlength = "80" autocomplete = "off" value = displayName on input(Hybrid e) { displayName = e.target.value } }
  104. }
  105. button { id = "saveTitle" type = "submit" "Save name" }
  106. p { role = "status" titleError }
  107. }
  108. h2 { "Rename" }
  109. p { class = "muted" "The old address keeps a link here, and existing Git URLs keep working." }
  110. form { id = "renameForm"
  111. on submit(Hybrid e) { emit rename() }
  112. label { "New address name"
  113. input { id = "renameName" name = "name" required = "required" maxlength = "40" autocomplete = "off" autocapitalize = "none" spellcheck = "false" value = renameName on input(Hybrid e) { renameName = e.target.value } }
  114. }
  115. button { id = "renameRepo" type = "submit" "Rename" }
  116. p { id = "renameError" role = "status" renameError }
  117. }
  118. }
  119. }
  120. section { id = "visibility"
  121. h2 { "Visibility" }
  122. p { id = "privtext" privText }
  123. if (isOwner) { button { id = "togglepriv" type = "button" privButton on click(e) { emit togglePriv() } } }
  124. p { id = "protecttext" protectText }
  125. if (isOwner) { button { id = "toggleprotect" type = "button" protectButton on click(e) { emit toggleProtect() } } }
  126. if (isOwner) {
  127. h2 { "Members" }
  128. p { class = "muted" "Members see this repository even when it is private, and may push to it. Add somebody by the display name they chose." }
  129. if (noMembers) { p { id = "nomembers" class = "empty" "No members yet." } }
  130. ul { id = "members"
  131. for (m of members) {
  132. li { span { class = "slug" m.name } button { class = "quiet" type = "button" "Remove" on click(e) { emit removeMember(m.name) } } }
  133. }
  134. }
  135. form { id = "memberform"
  136. on submit(Hybrid e) {
  137. e.preventDefault()
  138. emit addMember(e)
  139. }
  140. label { "Display name"
  141. input { id = "membername" name = "membername" required = "required" maxlength = "60" autocomplete = "off" value = memberName on input(Hybrid e) { memberName = e.target.value } }
  142. }
  143. button { id = "memberadd" type = "submit" "Add member" }
  144. p { id = "membererror" memberError }
  145. }
  146. }
  147. }
  148. if (showApps) {
  149. section { id = "apps"
  150. h2 { "Apps" }
  151. if (parkedSignedOut) { p { id = "appsignin" "Sign in with the selector at the top to connect " + parkedApp + " to this repository." } }
  152. if (parkedNotOwner) { p { id = "appnotowner" "Only the owner of this repository can connect " + parkedApp + "." } }
  153. if (parkedOwner) {
  154. form { id = "connectapp" method = "post" action = confirmAction
  155. p { id = "connectask" "Connect " + parkedApp + " to " + slug + "?" }
  156. p { class = "muted" "It will get read access to this repository and may review its pull requests. When you say Yes you go back to " + parkedHost + "." }
  157. input { name = "nonce" type = "hidden" value = parkedNonce }
  158. button { id = "connectyes" type = "submit" name = "decision" value = "yes" "Yes, connect" }
  159. button { id = "connectno" class = "quiet" type = "submit" name = "decision" value = "no" "No" }
  160. }
  161. }
  162. if (hasShown) {
  163. div { id = "appshown"
  164. p { shownText }
  165. if (hasShownKey) { p { "Key: " code { id = "shownkey" shownKey } } }
  166. p { "Secret: " code { id = "shownsecret" shownSecret } }
  167. }
  168. }
  169. if (isOwner) {
  170. p { class = "muted" "An app is an outside program (for example a code reviewer) that works on this repository under its own name. Its key and secret are shown once." }
  171. if (noApps) { p { id = "noapps" class = "empty" "No apps connected." } }
  172. ul { id = "applist"
  173. for (a of apps) {
  174. li {
  175. span { class = "slug" a.name }
  176. span { class = "muted" a.host + " · added " + a.created + " · " + a.status }
  177. button { class = "quiet" type = "button" "Send ping" on click(e) { emit pingApp(a.id) } }
  178. button { class = "quiet" type = "button" "Rotate secret" on click(e) { emit rotateApp(a.id) } }
  179. button { class = "quiet" type = "button" "Remove" on click(e) { emit removeAppRow(a.id) } }
  180. }
  181. }
  182. }
  183. form { id = "appform"
  184. on submit(Hybrid e) {
  185. e.preventDefault()
  186. emit addAppRow(e)
  187. }
  188. label { "App name"
  189. input { id = "appname" name = "appname" required = "required" maxlength = "60" autocomplete = "off" value = appName on input(Hybrid e) { appName = e.target.value } }
  190. }
  191. label { "Receiver address"
  192. input { id = "apphook" name = "apphook" type = "url" required = "required" maxlength = "500" autocomplete = "off" placeholder = "https://…" value = appHook on input(Hybrid e) { appHook = e.target.value } }
  193. }
  194. button { id = "appadd" type = "submit" "Add app" }
  195. p { id = "apperror" appError }
  196. }
  197. }
  198. }
  199. }
  200. section { id = "required"
  201. if (isOwner) {
  202. h2 { "Required before merge" }
  203. p { class = "muted" "Require app contexts, people, or both. All required app contexts must succeed, or any one listed person must approve the current head. With only people listed, a person’s approval is needed. A push makes earlier approvals stale." }
  204. if (noRequired) { p { id = "norequired" class = "empty" "Nothing is required: every pull request can be merged." } }
  205. ul { id = "requiredlist"
  206. for (r of required) {
  207. li {
  208. span { class = "slug" r.name }
  209. button { class = "quiet" type = "button" "Remove" on click(e) { emit dropRequiredRow(r.id) } }
  210. }
  211. }
  212. }
  213. if (hasRequired) { p { id = "mergeRule" mergeRule } }
  214. form { id = "requiredPersonForm"
  215. h3 { "Allow a person to approve" }
  216. on submit(Hybrid e) { emit addRequiredPerson() }
  217. label { "Person"
  218. select { id = "requiredPerson" name = "person" value = requiredPerson on change(Hybrid e) { requiredPerson = e.target.value }
  219. for (person of people) { option { value = person.id person.name } }
  220. }
  221. }
  222. button { id = "requirePerson" type = "submit" "Require approval" }
  223. }
  224. form { id = "requiredform"
  225. h3 { "Require an app check" }
  226. on submit(Hybrid e) {
  227. e.preventDefault()
  228. emit addRequiredRow(e)
  229. }
  230. label { "App"
  231. select { id = "requiredapp" name = "requiredapp" value = requiredApp on change(Hybrid e) { requiredApp = e.target.value emit chooseRequiredApp() }
  232. for (a of apps) { option { value = a.id a.name } }
  233. }
  234. }
  235. label { "Status context the app sets"
  236. input { id = "requiredcontext" name = "requiredcontext" required = "required" maxlength = "100" autocomplete = "off" value = requiredContext on input(Hybrid e) { requiredContext = e.target.value } }
  237. }
  238. button { id = "requiredadd" type = "submit" "Require it" }
  239. p { id = "requirederror" requiredError }
  240. }
  241. }
  242. }
  243. section { id = "ticketsettings"
  244. h2 { "Tickets" }
  245. if (hasConnectNote) { p { id = "connectnote" connectNote } }
  246. if (connected) {
  247. p { id = "connectedto" "Connected to the tickets project " a { id = "projectlink" href = projectHref projectTitle } "." }
  248. }
  249. if (notConnected) { p { id = "notconnected" class = "muted" "This repository is not connected to a tickets project yet." } }
  250. if (isOwner) {
  251. p {
  252. a { id = "connecttickets" class = "button" href = connectHref "Tickets: connect" }
  253. }
  254. // Connection-state classes are computed and have no Style-rule selection form.
  255. button { id = "disconnecttickets" class = forgetClass type = "button" "Forget the connection" on click(e) { emit disconnect() } }
  256. p { class = "muted" "Connecting asks tickets which project (you must be its admin there). Tickets can also disconnect gitoria from its side." }
  257. }
  258. if (notOwnerHint) { p { id = "ownerhint" class = "muted" "Only the owner of this repository can connect it." } }
  259. p { id = "settingserror" settingsError }
  260. }
  261. }
  262. }
  263. }
  264. }
  265. on togglePriv() {
  266. memberError = ''
  267. r = emit server gitoriaSetPrivate(slug, !isPrivate)
  268. if (r == null || r.error != null) {
  269. memberError = r != null ? r.error : 'could not change the visibility'
  270. return null
  271. }
  272. isPrivate = r.repo.isPrivate
  273. privText = isPrivate ? 'This repository is private: only its owner and its members can see it.' : 'This repository is public: everybody can read it.'
  274. privButton = isPrivate ? 'Make public' : 'Make private'
  275. }
  276. on toggleProtect() {
  277. memberError = ''
  278. r = emit server gitoriaSetProtect(slug, !isProtected)
  279. if (r == null || r.error != null) {
  280. memberError = r != null ? r.error : 'could not change the setting'
  281. return null
  282. }
  283. isProtected = r.protect
  284. protectText = isProtected ? 'Direct pushes to the main branch are refused: push a branch with a |||PR commit and merge it on the pulls page.' : 'Anybody who may push can push to the main branch.'
  285. protectButton = isProtected ? 'Allow direct pushes' : 'Refuse direct pushes to the main branch'
  286. }
  287. on server gitoriaSetProtect(slugOf, wanted, session) {
  288. return setProtectMain(userIdOfSession(session), slugOf, wanted)
  289. }
  290. on addMember(e) {
  291. memberError = ''
  292. r = emit server gitoriaChangeMember(slug, memberName, true)
  293. if (r == null || r.error != null) {
  294. memberError = r != null ? r.error : 'could not add the member'
  295. return null
  296. }
  297. members = r.members
  298. noMembers = members.length == 0
  299. memberName = ''
  300. }
  301. on removeMember(name) {
  302. memberError = ''
  303. r = emit server gitoriaChangeMember(slug, name, false)
  304. if (r == null || r.error != null) {
  305. memberError = r != null ? r.error : 'could not remove the member'
  306. return null
  307. }
  308. members = r.members
  309. noMembers = members.length == 0
  310. }
  311. on server gitoriaSetPrivate(slugOf, priv, session) {
  312. return setRepoPriv(userIdOfSession(session), slugOf, priv)
  313. }
  314. on addAppRow(e) {
  315. appError = ''
  316. r = emit server gitoriaAppAdd(slug, appName, appHook)
  317. if (r == null || r.error != null) {
  318. appError = r != null ? r.error : 'could not add the app'
  319. return null
  320. }
  321. apps = r.rows
  322. noApps = apps.length == 0
  323. if (requiredApp == '' && apps.length > 0) { requiredApp = apps[0].id emit chooseRequiredApp() }
  324. hasShown = true
  325. shownText = 'Connected ' + r.name + '. Copy the key and the secret now: they are not shown again.'
  326. shownKey = r.key
  327. hasShownKey = true
  328. shownSecret = r.secret
  329. appName = ''
  330. appHook = ''
  331. }
  332. on removeAppRow(id) {
  333. appError = ''
  334. r = emit server gitoriaAppRemove(slug, id)
  335. if (r == null || r.error != null) {
  336. appError = r != null ? r.error : 'could not remove the app'
  337. return null
  338. }
  339. apps = r.rows
  340. noApps = apps.length == 0
  341. if (requiredApp == id) { requiredApp = apps.length > 0 ? apps[0].id : '' emit chooseRequiredApp() }
  342. hasShown = false
  343. }
  344. on pingApp(id) {
  345. appError = ''
  346. r = emit server gitoriaAppPing(slug, id)
  347. if (r == null || r.error != null) {
  348. appError = r != null ? r.error : 'could not send the ping'
  349. return null
  350. }
  351. appError = 'Ping to ' + r.name + ' is on its way. The status of the app shows the answer.'
  352. }
  353. on rotateApp(id) {
  354. appError = ''
  355. r = emit server gitoriaAppRotate(slug, id)
  356. if (r == null || r.error != null) {
  357. appError = r != null ? r.error : 'could not rotate the secret'
  358. return null
  359. }
  360. apps = r.rows
  361. hasShown = true
  362. shownText = 'New secret for ' + r.name + '. Copy it now: it is not shown again. The old secret no longer signs anything.'
  363. shownKey = ''
  364. hasShownKey = false
  365. shownSecret = r.secret
  366. }
  367. on client gitoriaRequiredChanged(String changedSlug) {
  368. if (changedSlug != slug || !isOwner) { return null }
  369. r = emit server gitoriaRequiredRead(slug)
  370. if (r == null) { return null }
  371. required = r.rows
  372. noRequired = required.length == 0
  373. hasRequired = required.length > 0
  374. mergeRule = requiredRule(required)
  375. }
  376. on server gitoriaRequiredRead(String slugOf, Hybrid session) {
  377. if (!ownsRepo(slugOf, session)) { return null }
  378. return { rows = requiredList(repoBySlug(slugOf).id) }
  379. }
  380. on addRequiredPerson() {
  381. requiredError = ''
  382. r = emit server gitoriaRequiredPersonAdd(slug, requiredPerson)
  383. if (r == null || r.error != null) {
  384. requiredError = r != null ? r.error : 'could not save the setting'
  385. return null
  386. }
  387. required = r.rows
  388. noRequired = required.length == 0
  389. hasRequired = required.length > 0
  390. mergeRule = requiredRule(required)
  391. }
  392. on server gitoriaRequiredPersonAdd(String slugOf, String personId, Hybrid session) {
  393. r = requirePerson(userIdOfSession(session), session, slugOf, personId)
  394. if (r.error == null) { announceRequirements(slugOf) }
  395. return r
  396. }
  397. on chooseRequiredApp() {
  398. selected = requiredApp
  399. before = requiredContext
  400. r = emit server gitoriaAppContext(slug, selected)
  401. // A slow reply must not replace a later selection or a context the owner typed.
  402. if (r != null && requiredApp == selected && requiredContext == before) { requiredContext = r.context }
  403. }
  404. on server gitoriaAppContext(String slugOf, String appId, Hybrid session) {
  405. if (!ownsRepo(slugOf, session)) { return null }
  406. return { context = latestAppContext(repoBySlug(slugOf).id, appId) }
  407. }
  408. on addRequiredRow(e) {
  409. requiredError = ''
  410. r = emit server gitoriaRequiredAdd(slug, requiredApp, requiredContext)
  411. if (r == null || r.error != null) {
  412. requiredError = r != null ? r.error : 'could not save the setting'
  413. return null
  414. }
  415. required = r.rows
  416. noRequired = required.length == 0
  417. hasRequired = required.length > 0
  418. mergeRule = requiredRule(required)
  419. requiredContext = ''
  420. }
  421. on dropRequiredRow(id) {
  422. requiredError = ''
  423. r = emit server gitoriaRequiredRemove(slug, id)
  424. if (r == null || r.error != null) {
  425. requiredError = r != null ? r.error : 'could not save the setting'
  426. return null
  427. }
  428. required = r.rows
  429. noRequired = required.length == 0
  430. hasRequired = required.length > 0
  431. mergeRule = requiredRule(required)
  432. }
  433. on server gitoriaRequiredAdd(slugOf, appId, ctxName, session) {
  434. r = requireContext(userIdOfSession(session), session, slugOf, appId, ctxName)
  435. if (r.error == null) { announceRequirements(slugOf) }
  436. return r
  437. }
  438. on server gitoriaRequiredRemove(slugOf, id, session) {
  439. r = dropRequired(userIdOfSession(session), session, slugOf, id)
  440. if (r.error == null) { announceRequirements(slugOf) }
  441. return r
  442. }
  443. on server gitoriaAppAdd(slugOf, name, hook, session) {
  444. return addApp(userIdOfSession(session), session, slugOf, name, hook)
  445. }
  446. on server gitoriaAppRemove(slugOf, id, session) {
  447. return removeApp(userIdOfSession(session), session, slugOf, id)
  448. }
  449. on server gitoriaAppPing(slugOf, id, session) {
  450. return sendPing(userIdOfSession(session), session, slugOf, id)
  451. }
  452. on server gitoriaAppRotate(slugOf, id, session) {
  453. return rotateSecret(userIdOfSession(session), session, slugOf, id)
  454. }
  455. on server gitoriaChangeMember(slugOf, name, add, session) {
  456. return changeMember(userIdOfSession(session), 'r', slugOf, name, add)
  457. }
  458. on disconnect() {
  459. settingsError = ''
  460. r = emit server gitoriaDisconnectTickets(slug)
  461. if (r == null || r.error != null) {
  462. settingsError = r != null ? r.error : 'could not disconnect'
  463. return null
  464. }
  465. connected = false
  466. notConnected = true
  467. forgetClass = 'nomerge'
  468. projectTitle = ''
  469. projectHref = ''
  470. }
  471. on server gitoriaDisconnectTickets(slugOf, session) {
  472. if (session == null || repoAt(slugOf, session) == null) { return { error = 'could not disconnect' } }
  473. if (userOfSession(session) == null || !ownsRepo(slugOf, session)) { return { error = 'only the owner can change this' } }
  474. r = setTicketsConnection(slugOf, '', '', '', '')
  475. if (r.error != null) { return { error = r.error } }
  476. return { ok = true }
  477. }
  478. Style {
  479. #repoIdentity {
  480. display = 'grid'
  481. gap = '.75rem'
  482. maxWidth = '32rem'
  483. form {
  484. display = 'grid'
  485. gap = '.75rem'
  486. justifyItems = 'start'
  487. }
  488. }
  489. #requiredPersonForm {
  490. display = 'grid'
  491. gap = '.75rem'
  492. maxWidth = '32rem'
  493. }
  494. repoSettings {
  495. display = 'grid'
  496. gap = '1rem'
  497. minWidth = '0'
  498. // Direct-child and sibling combinators have no bare language form.
  499. '> *' {
  500. margin = '0'
  501. }
  502. }
  503. #ticketsettings {
  504. display = 'grid'
  505. gap = '.75rem'
  506. justifyItems = 'start'
  507. // Direct-child and sibling combinators have no bare language form.
  508. '> *' {
  509. margin = '0'
  510. }
  511. }
  512. // Runtime and theme class predicates have no bare selector form.
  513. '#disconnecttickets.nomerge' {
  514. display = 'none'
  515. }
  516. #connecttickets {
  517. color = 'var(--color-accent-text)'
  518. background = 'var(--color-accent)'
  519. }
  520. #members {
  521. listStyle = 'none'
  522. margin = '0'
  523. padding = '0'
  524. display = 'grid'
  525. gap = '.25rem'
  526. maxWidth = '32rem'
  527. li {
  528. display = 'flex'
  529. alignItems = 'center'
  530. justifyContent = 'space-between'
  531. gap = '.75rem'
  532. minHeight = '2.75rem'
  533. padding = '0 .5rem 0 1rem'
  534. background = 'var(--color-surface)'
  535. borderRadius = 'var(--radius-large)'
  536. }
  537. }
  538. #memberform {
  539. display = 'grid'
  540. gap = '.75rem'
  541. margin = '.75rem 0 1.5rem'
  542. maxWidth = '32rem'
  543. }
  544. #apps {
  545. display = 'grid'
  546. gap = '.75rem'
  547. margin = '0 0 1.5rem'
  548. justifyItems = 'start'
  549. // Direct-child and sibling combinators have no bare language form.
  550. '> *' {
  551. margin = '0'
  552. }
  553. }
  554. #connectapp {
  555. display = 'grid'
  556. gap = '.75rem'
  557. maxWidth = '32rem'
  558. padding = '1rem'
  559. background = 'var(--color-surface)'
  560. borderRadius = 'var(--radius-large)'
  561. }
  562. #appshown {
  563. margin = '0'
  564. color = 'var(--color-danger)'
  565. empty { display = 'none' }
  566. display = 'grid'
  567. gap = '.5rem'
  568. maxWidth = '100%'
  569. code {
  570. overflowWrap = 'anywhere'
  571. }
  572. }
  573. #applist {
  574. listStyle = 'none'
  575. margin = '0'
  576. padding = '0'
  577. display = 'grid'
  578. gap = '.25rem'
  579. maxWidth = '40rem'
  580. width = '100%'
  581. li {
  582. display = 'flex'
  583. flexWrap = 'wrap'
  584. alignItems = 'center'
  585. gap = '.5rem .75rem'
  586. minHeight = '2.75rem'
  587. padding = '.25rem .5rem .25rem 1rem'
  588. background = 'var(--color-surface)'
  589. borderRadius = 'var(--radius-large)'
  590. }
  591. }
  592. #required {
  593. display = 'grid'
  594. gap = '.75rem'
  595. margin = '0 0 1.5rem'
  596. justifyItems = 'start'
  597. // Direct-child and sibling combinators have no bare language form.
  598. '> *' {
  599. margin = '0'
  600. }
  601. }
  602. #requiredlist {
  603. listStyle = 'none'
  604. margin = '0'
  605. padding = '0'
  606. display = 'grid'
  607. gap = '.25rem'
  608. maxWidth = '40rem'
  609. width = '100%'
  610. li {
  611. display = 'flex'
  612. flexWrap = 'wrap'
  613. alignItems = 'center'
  614. justifyContent = 'space-between'
  615. gap = '.5rem .75rem'
  616. minHeight = '2.75rem'
  617. padding = '.25rem .5rem .25rem 1rem'
  618. background = 'var(--color-surface)'
  619. borderRadius = 'var(--radius-large)'
  620. }
  621. }
  622. #requiredform {
  623. display = 'grid'
  624. gap = '.75rem'
  625. maxWidth = '32rem'
  626. }
  627. #appform {
  628. display = 'grid'
  629. gap = '.75rem'
  630. maxWidth = '32rem'
  631. }
  632. #toggleprotect {
  633. justifySelf = 'start'
  634. }
  635. #togglepriv {
  636. justifySelf = 'start'
  637. }
  638. #visibility {
  639. display = 'grid'
  640. gap = '.75rem'
  641. margin = '0 0 1.5rem'
  642. }
  643. #membererror {
  644. margin = '0'
  645. color = 'var(--color-danger)'
  646. empty { display = 'none' }
  647. }
  648. #appsignin {
  649. margin = '0'
  650. color = 'var(--color-danger)'
  651. empty { display = 'none' }
  652. }
  653. #appnotowner {
  654. margin = '0'
  655. color = 'var(--color-danger)'
  656. empty { display = 'none' }
  657. }
  658. #apperror {
  659. margin = '0'
  660. color = 'var(--color-danger)'
  661. empty { display = 'none' }
  662. }
  663. #requirederror {
  664. margin = '0'
  665. color = 'var(--color-danger)'
  666. empty { display = 'none' }
  667. }
  668. #connectnote {
  669. margin = '0'
  670. color = 'var(--color-danger)'
  671. empty { display = 'none' }
  672. }
  673. #settingserror {
  674. margin = '0'
  675. color = 'var(--color-danger)'
  676. empty { display = 'none' }
  677. }
  678. }
  679. on rename() {
  680. r = emit server gitoriaRenameRepo(slug, renameName)
  681. if (r == null || r.error != null) { renameError = r != null ? r.error : 'could not rename the repository' return null }
  682. navigate(r.repo.address + 'settings')
  683. }
  684. on server gitoriaRenameRepo(String slugOf, String name, Hybrid session) {
  685. return renameRepo(userIdOfSession(session), slugOf, name)
  686. }
  687. on saveTitle() {
  688. r = emit server gitoriaSetRepoTitle(slug, displayName)
  689. if (r == null || r.error != null) { titleError = r != null ? r.error : 'could not save the display name' return null }
  690. titleError = 'Saved.'
  691. displayName = r.repo.title
  692. __title = pageTitle(siteName, r.repo.heading, 'Settings')
  693. }
  694. on server gitoriaSetRepoTitle(String slugOf, String title, Hybrid session) {
  695. return setRepoTitle(userIdOfSession(session), slugOf, title)
  696. }
  697. on client repoChanged(Hybrid row) {
  698. if (titleRepo != null && row.id == titleRepo.id) { __title = pageTitle(siteName, row.heading, 'Settings') }
  699. }

Branches

Latest commits

  • 74ec2af8Merge branch 'w54-repo-rename-pr' into mainGitoria
  • 9f7ce8d8Preserve rename compatibility and live page titlesmre
  • c3d95b6e|||PR separate names and addresses, rename repositories in Settings (#53)mre
  • ce08920dMerge branch 'w52c-header-phone' into mainGitoria
  • 0bab9e46|||PR header: ident status wraps on phones instead of clippingmre
  • e7af3eceMerge branch 'w52b-approval-followup' into mainGitoria
  • c01e66c6|||PR approvals follow-up: live Merge after status writes, helpers (#52)mre
  • 841da497Merge branch 'w53-pulls-speed-pr' into mainGitoria
  • 80307ae2|||PR pulls page cache: live PR numbers, complete scans onlymre
  • 69141f65|||PR pulls page: cache the git part per repo by branch tipsmre
  • 155861f6Merge branch 'w52-person-approval' into mainGitoria
  • b5435de8|||PR person approvals: second Kunibert round (#52)mre
  • 3a8b2fb8|||PR person approvals: Kunibert review fixes (#52)mre
  • 2a89d8d0|||PR person approvals: Approve button for people; merge needs the required checks or a listed person's approval (#52)mre
  • 83f0c953Report person approval verificationmre
  • 3ae94b86Record browser failures and verify owned tab cleanupmre
  • 54eec687Gate person approvals and merge alternativesmre
  • 12b08829Add person approvals for pull request headsmre
  • 55c84779Merge branch 'gp-gate-ports' into mainGitoria
  • 57af42bbREADME: point to deploy.sh for the port listmre