Every settings, admin, organization and repo management page now follows the Security page: one pane of hairline rows with an icon, a label, a status and the action at the right, where adding a key, token, member, label or webhook opens in place from the first row, and no page keeps a side form or a half-empty stretched pane
Browse files at this commitb1c46950805393f0a86256ddbaec04adb03d500cParent: 1512ebbSome checks failed
Show checks
ci/buildjob was cancelledDetails
- style
- every settings, admin, organization and repo management page now follows the Security page: one pane of hairline rows with an icon, a label, a status and the action at the right, where adding a key, token, member, label or webhook opens in place from the first row, and no page keeps a side form or a half-empty stretched pane
- feat
- search reads the pages themselves, so every label, button, hint and link on settings, admin, organization and repo settings pages can be found, as the viewer and in their language, and picking a result opens what hides it, marks the row and puts you in its control
- a typo is only guessed at when nothing has the letters as typed, so play finds the sound setting and not display name
- fix
- opening a run keeps the runs list beside it
- mark all read answers at once without leaving the page
- inline disclosures open and shut with no animation
50 changed files +2850 -2552
- crates/forge-e2e/tests/e2e/ui_prefs_e2e.rs +2 -1
- crates/forge-web/assets/nav.js +200 -89
- crates/forge-web/src/pages/admin_backups.rs +79 -23
- crates/forge-web/src/pages/admin_health.rs +99 -44
- crates/forge-web/src/pages/admin_mail.rs +51 -20
- crates/forge-web/src/pages/admin_replication.rs +81 -39
- crates/forge-web/src/pages/admin_runners.rs +92 -84
- crates/forge-web/src/pages/admin_server.rs +48 -40
- crates/forge-web/src/pages/admin_user_detail.rs +118 -119
- crates/forge-web/src/pages/admin_users.rs +89 -53
- crates/forge-web/src/pages/ci_runs.rs +51 -31
- crates/forge-web/src/pages/ci_tests.rs +6 -5
- crates/forge-web/src/pages/discussion_settings.rs +11 -12
- crates/forge-web/src/pages/invites.rs +24 -12
- crates/forge-web/src/pages/labels_page.rs +86 -75
- crates/forge-web/src/pages/milestones_page.rs +69 -70
- crates/forge-web/src/pages/org_members.rs +70 -77
- crates/forge-web/src/pages/org_settings.rs +91 -71
- crates/forge-web/src/pages/org_teams.rs +211 -158
- crates/forge-web/src/pages/palette.rs +5 -3
- crates/forge-web/src/pages/passkeys.rs +15 -15
- crates/forge-web/src/pages/repo_collaborators.rs +94 -116
- crates/forge-web/src/pages/repo_mirrors.rs +91 -71
- crates/forge-web/src/pages/repo_rename.rs +53 -34
- crates/forge-web/src/pages/repo_secrets.rs +65 -66
- crates/forge-web/src/pages/repo_security.rs +46 -65
- crates/forge-web/src/pages/repo_settings.rs +124 -100
- crates/forge-web/src/pages/repo_webhooks.rs +127 -95
- crates/forge-web/src/pages/settings_appearance.rs +65 -45
- crates/forge-web/src/pages/settings_export.rs +46 -38
- crates/forge-web/src/pages/settings_gpg.rs +40 -36
- crates/forge-web/src/pages/settings_keys.rs +46 -41
- crates/forge-web/src/pages/settings_notifications.rs +79 -61
- crates/forge-web/src/pages/settings_profile.rs +74 -60
- crates/forge-web/src/pages/settings_security.rs +53 -53
- crates/forge-web/src/pages/settings_sessions.rs +19 -20
- crates/forge-web/src/pages/settings_tokens.rs +50 -45
- crates/forge-web/src/pages/wiki.rs +13 -10
- style/_account_admin.scss +0 -125
- style/_alive_settings.scss +0 -6
- style/_appearance.scss +0 -32
- style/_canvas_account.scss +1 -1
- style/_canvas_detail.scss +0 -90
- style/_fit_admin.scss +0 -59
- style/_lang_admin.scss +4 -18
- style/_lang_ci.scss +35 -2
- style/_look.scss +1 -2
- style/_palette.scss +19 -2
- style/_system.scss +0 -26
- style/main.scss +207 -192
crates/forge-e2e/tests/e2e/ui_prefs_e2e.rsmodified+2 -1
| @@ -196,7 +196,8 @@ async fn the_form_has_no_save_button_and_every_field_autosubmits() { | |||
| 196 | 196 | ||
| 197 | let form = scraper::Selector::parse("form[data-appearance]").expect("selector"); | 197 | let form = scraper::Selector::parse("form[data-appearance]").expect("selector"); |
| 198 | assert_eq!(doc.select(&form).count(), 1, "one appearance form"); | 198 | assert_eq!(doc.select(&form).count(), 1, "one appearance form"); |
| 199 | - let buttons = scraper::Selector::parse("form[data-appearance] button").expect("selector"); | 199 | + let buttons = scraper::Selector::parse("form[data-appearance] button:not([type=\"button\"])") |
| 200 | + .expect("selector"); | ||
| 200 | assert_eq!(doc.select(&buttons).count(), 0, "no Save button"); | 201 | assert_eq!(doc.select(&buttons).count(), 0, "no Save button"); |
| 201 | let submits = | 202 | let submits = |
| 202 | scraper::Selector::parse("form[data-appearance] input[type=\"submit\"]").expect("selector"); | 203 | scraper::Selector::parse("form[data-appearance] input[type=\"submit\"]").expect("selector"); |
crates/forge-web/assets/nav.jsmodified+200 -89
| @@ -505,6 +505,7 @@ | |||
| 505 | var keep = !!o.keep && res.url.pathname === o.target.pathname; | 505 | var keep = !!o.keep && res.url.pathname === o.target.pathname; |
| 506 | var finish = function () { | 506 | var finish = function () { |
| 507 | swap(res.html, dest, how, keep); | 507 | swap(res.html, dest, how, keep); |
| 508 | + if (pal.find) { paletteLand(); } | ||
| 508 | // Other parts of this file follow page changes through this event (list memory, say). | 509 | // Other parts of this file follow page changes through this event (list memory, say). |
| 509 | document.dispatchEvent(new CustomEvent('forge:swapped', { detail: { how: how, url: dest } })); | 510 | document.dispatchEvent(new CustomEvent('forge:swapped', { detail: { how: how, url: dest } })); |
| 510 | }; | 511 | }; |
| @@ -1191,6 +1192,25 @@ | |||
| 1191 | if (seq === peekSeq && isPeekOpen(pop)) { pop.classList.add('bell-ready'); } | 1192 | if (seq === peekSeq && isPeekOpen(pop)) { pop.classList.add('bell-ready'); } |
| 1192 | }); | 1193 | }); |
| 1193 | } | 1194 | } |
| 1195 | + // Mark all read from the bell: the post goes in the background, so the page under the popover is | ||
| 1196 | + // not fetched again. The list and the count change once the server has answered; the inbox page | ||
| 1197 | + // follows through its own stream. | ||
| 1198 | + document.addEventListener('submit', function (e) { | ||
| 1199 | + var form = e.target; | ||
| 1200 | + if (!form.matches || !form.matches('.bell-clear')) { return; } | ||
| 1201 | + e.preventDefault(); | ||
| 1202 | + if (form.classList.contains('is-busy')) { return; } | ||
| 1203 | + form.classList.add('is-busy'); | ||
| 1204 | + var pop = form.closest('.bell-pop'); | ||
| 1205 | + fetch(form.action, { method: 'POST', credentials: 'same-origin', redirect: 'manual', body: new URLSearchParams(new FormData(form)) }).then(function (r) { | ||
| 1206 | + form.classList.remove('is-busy'); | ||
| 1207 | + if (r.type !== 'opaqueredirect') { throw new Error('status ' + r.status); } | ||
| 1208 | + if (pop && isPeekOpen(pop)) { loadPeek(pop); } | ||
| 1209 | + }).catch(function () { | ||
| 1210 | + form.classList.remove('is-busy'); | ||
| 1211 | + form.submit(); | ||
| 1212 | + }); | ||
| 1213 | + }, true); | ||
| 1194 | var PEEK_SLOW = 300; // ms before a slow list shows its loading note | 1214 | var PEEK_SLOW = 300; // ms before a slow list shows its loading note |
| 1195 | var peekSeq = 0; // a fetch's number: only the newest answer is drawn | 1215 | var peekSeq = 0; // a fetch's number: only the newest answer is drawn |
| 1196 | 1216 | ||
| @@ -1404,70 +1424,11 @@ | |||
| 1404 | } | 1424 | } |
| 1405 | }, false); | 1425 | }, false); |
| 1406 | 1426 | ||
| 1407 | - // Inline disclosures (a branch rule, a review thread, a delivery, a <details> in markdown) slide | 1427 | + // Inline disclosures open and shut at once, with the browser's own details. Floating panels are the |
| 1408 | - // open and shut instead of jumping. The details' height is animated from where it is to where it | 1428 | + // ones a click drops in below. |
| 1409 | - // goes, clipped only while it moves, so an open one never clips what it holds. Closing keeps it open | ||
| 1410 | - // until the slide ends. A click during a slide turns it around. Floating panels (menus, popovers, | ||
| 1411 | - // inline confirms) are left to the browser, as is a reader who asks for reduced motion. | ||
| 1412 | var FLOATING = DROPDOWN + ', details.row-menu, details.confirm-inline, details.commit-status, details.reaction-picker'; | 1429 | var FLOATING = DROPDOWN + ', details.row-menu, details.confirm-inline, details.commit-status, details.reaction-picker'; |
| 1413 | var reducedMotion = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null; | 1430 | var reducedMotion = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : null; |
| 1414 | 1431 | ||
| 1415 | - function slideDetails(d) { | ||
| 1416 | - var opening = d.__closing || !d.open; | ||
| 1417 | - // An exclusive group (details[name]): the browser would shut the open sibling at once while this | ||
| 1418 | - // one slides, so the page jumps. This one leaves the group for the slide, the sibling slides shut | ||
| 1419 | - // alongside, and the name comes back once both have finished. | ||
| 1420 | - var group = opening ? d.getAttribute('name') : null; | ||
| 1421 | - var others = []; | ||
| 1422 | - if (group) { | ||
| 1423 | - document.querySelectorAll('details[name]').forEach(function (o) { | ||
| 1424 | - if (o !== d && o.getAttribute('name') === group && o.open && !o.__closing) { others.push(o); } | ||
| 1425 | - }); | ||
| 1426 | - if (others.length) { d.removeAttribute('name'); } else { group = null; } | ||
| 1427 | - } | ||
| 1428 | - var from = d.getBoundingClientRect().height; | ||
| 1429 | - if (d.__slide) { d.__slide.cancel(); } | ||
| 1430 | - d.open = false; | ||
| 1431 | - var shut = d.getBoundingClientRect().height; | ||
| 1432 | - d.open = true; | ||
| 1433 | - var to = opening ? d.getBoundingClientRect().height : shut; | ||
| 1434 | - d.__closing = !opening; | ||
| 1435 | - d.style.overflow = 'hidden'; | ||
| 1436 | - var slide = d.animate({ height: [from + 'px', to + 'px'] }, { duration: 200, easing: 'cubic-bezier(0.2, 0, 0, 1)' }); | ||
| 1437 | - d.__slide = slide; | ||
| 1438 | - slide.onfinish = function () { | ||
| 1439 | - d.__slide = null; | ||
| 1440 | - d.style.overflow = ''; | ||
| 1441 | - if (d.__closing) { d.__closing = false; d.open = false; } | ||
| 1442 | - }; | ||
| 1443 | - if (group) { | ||
| 1444 | - others.forEach(slideDetails); | ||
| 1445 | - var slides = others.map(function (o) { return o.__slide.finished; }).concat(slide.finished); | ||
| 1446 | - // `finished` settles before onfinish shuts a closing sibling, and the name must come back only | ||
| 1447 | - // once they are shut, or the browser would shut this one instead. A sibling the reader opened | ||
| 1448 | - // again meanwhile keeps this one out of the group. | ||
| 1449 | - Promise.allSettled(slides).then(function () { | ||
| 1450 | - others.forEach(function (o) { | ||
| 1451 | - if (o.__closing) { o.__closing = false; o.open = false; } | ||
| 1452 | - }); | ||
| 1453 | - if (others.every(function (o) { return !o.open; })) { d.setAttribute('name', group); } | ||
| 1454 | - }); | ||
| 1455 | - } | ||
| 1456 | - } | ||
| 1457 | - | ||
| 1458 | - document.addEventListener('click', function (e) { | ||
| 1459 | - if (e.defaultPrevented || !e.target || !e.target.closest) { return; } | ||
| 1460 | - var summary = e.target.closest('summary'); | ||
| 1461 | - var d = summary && summary.parentElement; | ||
| 1462 | - if (!d || d.tagName !== 'DETAILS' || d.querySelector('summary') !== summary) { return; } | ||
| 1463 | - if (d.matches(FLOATING) || (reducedMotion && reducedMotion.matches)) { return; } | ||
| 1464 | - // A link or control inside the summary does its own thing. | ||
| 1465 | - var control = e.target.closest('a, button, input, select, textarea'); | ||
| 1466 | - if (control && summary.contains(control)) { return; } | ||
| 1467 | - e.preventDefault(); | ||
| 1468 | - slideDetails(d); | ||
| 1469 | - }, false); | ||
| 1470 | - | ||
| 1471 | // Plays a one-shot motion class (see _motion.scss) on the reader's own action. | 1432 | // Plays a one-shot motion class (see _motion.scss) on the reader's own action. |
| 1472 | function play(el, cls) { | 1433 | function play(el, cls) { |
| 1473 | el.classList.remove(cls); | 1434 | el.classList.remove(cls); |
| @@ -4035,7 +3996,8 @@ | |||
| 4035 | // is on the wire. reload: the page a sent change answered with, shown once the palette closes. | 3996 | // is on the wire. reload: the page a sent change answered with, shown once the palette closes. |
| 4036 | var pal = { dlg: null, input: null, list: null, note: null, hits: [], sel: 0, str: null, | 3997 | var pal = { dlg: null, input: null, list: null, note: null, hits: [], sel: 0, str: null, |
| 4037 | data: null, request: null, failed: false, files: null, filesSrc: '', filesBusy: null, | 3998 | data: null, request: null, failed: false, files: null, filesSrc: '', filesBusy: null, |
| 4038 | - acts: [], busy: false, reload: null, prefill: '' }; | 3999 | + acts: [], busy: false, reload: null, prefill: '', find: '', |
| 4000 | + scan: { key: '', at: 0, texts: {} }, scanBusy: false, scanGen: 0 }; | ||
| 4039 | 4001 | ||
| 4040 | // The words the palette shows, read from the topbar button: the server writes them in the viewer's | 4002 | // The words the palette shows, read from the topbar button: the server writes them in the viewer's |
| 4041 | // language, so this script carries no text of its own. | 4003 | // language, so this script carries no text of its own. |
| @@ -4097,12 +4059,142 @@ | |||
| 4097 | 4059 | ||
| 4098 | // An item's label and other words, folded once. | 4060 | // An item's label and other words, folded once. |
| 4099 | function paletteMeta(item) { | 4061 | function paletteMeta(item) { |
| 4100 | - if (!item.meta) { | 4062 | + if (!item.meta || item.metaGen !== pal.scanGen) { |
| 4101 | - item.meta = { label: paletteParts(item.label), terms: (item.terms || []).map(paletteParts) }; | 4063 | + var read = (item.scan && pal.scan.texts[item.scan]) || []; |
| 4064 | + item.meta = { label: paletteParts(item.label), terms: (item.terms || []).concat(read).map(paletteParts) }; | ||
| 4065 | + item.metaGen = pal.scanGen; | ||
| 4102 | } | 4066 | } |
| 4103 | return item.meta; | 4067 | return item.meta; |
| 4104 | } | 4068 | } |
| 4105 | 4069 | ||
| 4070 | + // What a page says that a reader may search for. The same list reads a fetched page and, after a | ||
| 4071 | + // jump, finds the control on the page itself. A long list of options, such as time zones, is left out. | ||
| 4072 | + var PALETTE_TEXT = 'h1, h2, h3, h4, legend, label, summary, button, a, th, dt, dd, li, p, small, option, .row-title, .row-name, .row-status, .switch-title, .srv-label'; | ||
| 4073 | + var PALETTE_OPTIONS = 30; | ||
| 4074 | + function paletteTexts(root) { | ||
| 4075 | + var out = []; | ||
| 4076 | + Array.prototype.forEach.call(root.querySelectorAll(PALETTE_TEXT), function (el) { | ||
| 4077 | + if (el.tagName === 'OPTION' && el.parentNode.children.length > PALETTE_OPTIONS) { return; } | ||
| 4078 | + if (el.closest('nav, .repo-head')) { return; } | ||
| 4079 | + var copy = el.cloneNode(true); | ||
| 4080 | + Array.prototype.forEach.call(copy.querySelectorAll('select, textarea, svg, script, style'), function (n) { n.parentNode.removeChild(n); }); | ||
| 4081 | + var text = copy.textContent.replace(/\s+/g, ' ').trim(); | ||
| 4082 | + if (text.length >= 3 && text.length <= 160 && /\p{L}/u.test(text)) { out.push({ el: el, text: text }); } | ||
| 4083 | + }); | ||
| 4084 | + return out; | ||
| 4085 | + } | ||
| 4086 | + | ||
| 4087 | + // Reads the settings, admin and organization pages in the palette's list, and a repo's settings | ||
| 4088 | + // pages, so every label, button and hint on them can be searched and no word list is kept by hand. | ||
| 4089 | + // It fetches as this viewer, so it reads only what they may open, in their language. It runs on the | ||
| 4090 | + // first open and keeps the words for the tab, for an hour or until the viewer or the build changes. | ||
| 4091 | + var PALETTE_SCAN_KEY = 'forge-palette-scan'; | ||
| 4092 | + var PALETTE_SCAN_TTL = 3600000; | ||
| 4093 | + var PALETTE_SCAN_AT_ONCE = 4; | ||
| 4094 | + var PALETTE_SCAN_PAGES = 120; | ||
| 4095 | + var PALETTE_SCANNED = /^\/(settings|admin|org)(\/|\?|$)/; | ||
| 4096 | + function paletteScanJobs() { | ||
| 4097 | + var jobs = []; | ||
| 4098 | + pal.data.items.forEach(function (item) { | ||
| 4099 | + if (item.scan) { jobs.push({ key: item.scan, url: item.scan }); } | ||
| 4100 | + }); | ||
| 4101 | + var here = paletteRepoHere(); | ||
| 4102 | + var base = here && here.admin ? here.href : ''; | ||
| 4103 | + pal.data.items.some(function (item) { | ||
| 4104 | + if (!base && item.kind === 'repo' && item.admin) { base = item.href; } | ||
| 4105 | + return !!base; | ||
| 4106 | + }); | ||
| 4107 | + if (base) { | ||
| 4108 | + pal.data.pages.forEach(function (p) { | ||
| 4109 | + if (p.admin) { jobs.push({ key: 'repo:' + p.path, url: base + '/' + p.path }); } | ||
| 4110 | + }); | ||
| 4111 | + } | ||
| 4112 | + return jobs.slice(0, PALETTE_SCAN_PAGES); | ||
| 4113 | + } | ||
| 4114 | + | ||
| 4115 | + function paletteScanned(scan) { | ||
| 4116 | + pal.scan = scan; | ||
| 4117 | + pal.scanGen++; | ||
| 4118 | + if (pal.dlg.open) { renderPalette(); } | ||
| 4119 | + } | ||
| 4120 | + | ||
| 4121 | + function paletteScan() { | ||
| 4122 | + var key = pal.data.scanKey; | ||
| 4123 | + if (!key || pal.scanBusy || (pal.scan.key === key && Date.now() - pal.scan.at < PALETTE_SCAN_TTL)) { return; } | ||
| 4124 | + var saved = null; | ||
| 4125 | + try { saved = JSON.parse(sessionStorage.getItem(PALETTE_SCAN_KEY) || 'null'); } catch (err) { /* Read the pages again. */ } | ||
| 4126 | + if (saved && saved.key === key && Date.now() - saved.at < PALETTE_SCAN_TTL) { paletteScanned(saved); return; } | ||
| 4127 | + var jobs = paletteScanJobs(); | ||
| 4128 | + var left = jobs.length; | ||
| 4129 | + var texts = {}; | ||
| 4130 | + if (!left) { return; } | ||
| 4131 | + pal.scanBusy = true; | ||
| 4132 | + function done() { | ||
| 4133 | + left--; | ||
| 4134 | + if (left) { next(); return; } | ||
| 4135 | + pal.scanBusy = false; | ||
| 4136 | + var scan = { key: key, at: Date.now(), texts: texts }; | ||
| 4137 | + paletteScanned(scan); | ||
| 4138 | + try { sessionStorage.setItem(PALETTE_SCAN_KEY, JSON.stringify(scan)); } catch (err) { /* Too big to keep: read again next tab. */ } | ||
| 4139 | + } | ||
| 4140 | + function next() { | ||
| 4141 | + var job = jobs.shift(); | ||
| 4142 | + if (!job) { return; } | ||
| 4143 | + fetch(job.url, { headers: { accept: 'text/html' }, credentials: 'same-origin' }).then(function (r) { | ||
| 4144 | + return r.ok && !r.redirected ? r.text() : ''; | ||
| 4145 | + }).then(function (html) { | ||
| 4146 | + var main = html ? new DOMParser().parseFromString(html, 'text/html').querySelector('main') : null; | ||
| 4147 | + if (!main) { return; } | ||
| 4148 | + var seen = {}; | ||
| 4149 | + texts[job.key] = paletteTexts(main).map(function (t) { return t.text; }).filter(function (t) { | ||
| 4150 | + if (seen[t]) { return false; } | ||
| 4151 | + seen[t] = true; | ||
| 4152 | + return true; | ||
| 4153 | + }); | ||
| 4154 | + }).catch(function () { /* A page that fails is left out of this scan. */ }).then(done); | ||
| 4155 | + } | ||
| 4156 | + for (var i = 0; i < PALETTE_SCAN_AT_ONCE; i++) { next(); } | ||
| 4157 | + } | ||
| 4158 | + | ||
| 4159 | + // After a jump to words found on a page: opens what hides them, brings them into view and puts the | ||
| 4160 | + // reader in their control. The mark goes at the next key or click. | ||
| 4161 | + function paletteLand() { | ||
| 4162 | + var want = pal.find; | ||
| 4163 | + pal.find = ''; | ||
| 4164 | + var main = document.querySelector('main'); | ||
| 4165 | + if (!want || !main) { return; } | ||
| 4166 | + var hit = paletteTexts(main).filter(function (t) { return t.text === want; })[0]; | ||
| 4167 | + if (!hit) { return; } | ||
| 4168 | + for (var d = hit.el.closest('details'); d; d = d.parentElement && d.parentElement.closest('details')) { d.open = true; } | ||
| 4169 | + var row = hit.el.closest('.row-field, .row-line, .srv-field, .switch-row, label, fieldset') || hit.el; | ||
| 4170 | + var control = hit.el.matches('button') ? hit.el : row.querySelector('input:not([type="hidden"]), select, textarea, button'); | ||
| 4171 | + row.scrollIntoView({ block: 'center' }); | ||
| 4172 | + if (control) { control.focus({ preventScroll: true }); } | ||
| 4173 | + row.classList.add('palette-hit'); | ||
| 4174 | + function clear() { | ||
| 4175 | + row.classList.remove('palette-hit'); | ||
| 4176 | + document.removeEventListener('pointerdown', clear, true); | ||
| 4177 | + document.removeEventListener('keydown', clear, true); | ||
| 4178 | + } | ||
| 4179 | + document.addEventListener('pointerdown', clear, true); | ||
| 4180 | + document.addEventListener('keydown', clear, true); | ||
| 4181 | + } | ||
| 4182 | + | ||
| 4183 | + // The repo this page belongs to, read from its tabs. The first is its Code link, so its path starts | ||
| 4184 | + // with owner/name, and a Settings tab says the viewer may manage the repo. | ||
| 4185 | + function paletteRepoHere() { | ||
| 4186 | + var tabs = document.querySelectorAll('.repo-tabs a'); | ||
| 4187 | + if (!tabs.length) { return null; } | ||
| 4188 | + var parts = tabs[0].pathname.split('/'); | ||
| 4189 | + if (parts.length < 3) { return null; } | ||
| 4190 | + var name = parts[1] + '/' + parts[2]; | ||
| 4191 | + return { | ||
| 4192 | + name: name, | ||
| 4193 | + href: '/' + name, | ||
| 4194 | + admin: Array.prototype.some.call(tabs, function (a) { return a.pathname === '/' + name + '/settings'; }) | ||
| 4195 | + }; | ||
| 4196 | + } | ||
| 4197 | + | ||
| 4106 | // The fewest single-letter typos (a missing, extra or wrong letter, or two letters swapped) between | 4198 | // The fewest single-letter typos (a missing, extra or wrong letter, or two letters swapped) between |
| 4107 | // the token and the start of the word, or more than max when there are too many. | 4199 | // the token and the start of the word, or more than max when there are too many. |
| 4108 | function paletteTypos(t, w, max) { | 4200 | function paletteTypos(t, w, max) { |
| @@ -4171,16 +4263,23 @@ | |||
| 4171 | } | 4263 | } |
| 4172 | 4264 | ||
| 4173 | // How well one token matches an item: its label first, then its other words at four fifths of the | 4265 | // How well one token matches an item: its label first, then its other words at four fifths of the |
| 4174 | - // score. Sets item.why to the other word that matched, so the row can say why it is listed. | 4266 | + // score. Sets item.why to the other word that matched, so the row can say why it is listed, and |
| 4267 | + // item.near when the token only came close: a typo, scattered letters, or letters inside a longer | ||
| 4268 | + // word, as "play" is in "display". | ||
| 4269 | + var PALETTE_EXACT = 2; | ||
| 4270 | + var PALETTE_KEY = /^\S*[._]\S*$/; | ||
| 4175 | function paletteToken(t, item) { | 4271 | function paletteToken(t, item) { |
| 4176 | var m = paletteMeta(item); | 4272 | var m = paletteMeta(item); |
| 4177 | var best = paletteField(t, m.label), why = ''; | 4273 | var best = paletteField(t, m.label), why = ''; |
| 4274 | + var exact = best >= PALETTE_EXACT; | ||
| 4178 | m.terms.forEach(function (term) { | 4275 | m.terms.forEach(function (term) { |
| 4179 | - var v = paletteField(t, term) * 0.8; | 4276 | + var raw = paletteField(t, term); |
| 4180 | - if (v > best) { best = v; why = /[._]/.test(term.text) || m.label.s.indexOf(term.s) >= 0 ? '' : term.text; } | 4277 | + if (raw >= PALETTE_EXACT) { exact = true; } |
| 4278 | + if (raw * 0.8 > best) { best = raw * 0.8; why = PALETTE_KEY.test(term.text) || m.label.s.indexOf(term.s) >= 0 ? '' : term.text; } | ||
| 4181 | }); | 4279 | }); |
| 4182 | if (!best && paletteInOrder(t, m.label.s)) { best = 1; } | 4280 | if (!best && paletteInOrder(t, m.label.s)) { best = 1; } |
| 4183 | if (why) { item.why = why; } | 4281 | if (why) { item.why = why; } |
| 4282 | + if (!exact) { item.near = true; } | ||
| 4184 | return best; | 4283 | return best; |
| 4185 | } | 4284 | } |
| 4186 | 4285 | ||
| @@ -4189,6 +4288,7 @@ | |||
| 4189 | // wins within a tier: the bonus stays under 0.5. An empty query matches all. | 4288 | // wins within a tier: the bonus stays under 0.5. An empty query matches all. |
| 4190 | function paletteScore(q, item) { | 4289 | function paletteScore(q, item) { |
| 4191 | item.why = ''; | 4290 | item.why = ''; |
| 4291 | + item.near = false; | ||
| 4192 | if (!q) { return 1; } | 4292 | if (!q) { return 1; } |
| 4193 | var fq = paletteFold(q).trim(); | 4293 | var fq = paletteFold(q).trim(); |
| 4194 | var m = paletteMeta(item); | 4294 | var m = paletteMeta(item); |
| @@ -4205,7 +4305,17 @@ | |||
| 4205 | sum += v; | 4305 | sum += v; |
| 4206 | } | 4306 | } |
| 4207 | var best = sum / tokens.length; | 4307 | var best = sum / tokens.length; |
| 4208 | - if (tokens.length > 1) { best = Math.max(best, paletteField(fq, m.label)); } | 4308 | + if (tokens.length > 1) { |
| 4309 | + best = Math.max(best, paletteField(fq, m.label)); | ||
| 4310 | + // The words side by side in one sentence say more than the same words all over the page. | ||
| 4311 | + m.terms.some(function (term) { | ||
| 4312 | + if (term.s.indexOf(fq) < 0) { return false; } | ||
| 4313 | + best += 1; | ||
| 4314 | + item.why = term.text; | ||
| 4315 | + item.near = false; | ||
| 4316 | + return true; | ||
| 4317 | + }); | ||
| 4318 | + } | ||
| 4209 | return best + bonus; | 4319 | return best + bonus; |
| 4210 | } | 4320 | } |
| 4211 | 4321 | ||
| @@ -4219,7 +4329,7 @@ | |||
| 4219 | var href = base + '/' + p.path; | 4329 | var href = base + '/' + p.path; |
| 4220 | if ((p.admin && !admin) || seen[href]) { return; } | 4330 | if ((p.admin && !admin) || seen[href]) { return; } |
| 4221 | seen[href] = true; | 4331 | seen[href] = true; |
| 4222 | - out.push({ label: label + ' · ' + p.label, href: href, kind: 'repo', terms: p.terms }); | 4332 | + out.push({ label: label + ' · ' + p.label, href: href, kind: 'repo', terms: p.terms, scan: p.admin ? 'repo:' + p.path : '' }); |
| 4223 | }); | 4333 | }); |
| 4224 | } | 4334 | } |
| 4225 | if (current) { add(current.name, current.href, current.admin); } | 4335 | if (current) { add(current.name, current.href, current.admin); } |
| @@ -4237,22 +4347,14 @@ | |||
| 4237 | // The destinations to filter: the current repo's tabs first, its other pages, then the fetched list. | 4347 | // The destinations to filter: the current repo's tabs first, its other pages, then the fetched list. |
| 4238 | // The query picks which other repos' pages are worth building. | 4348 | // The query picks which other repos' pages are worth building. |
| 4239 | function paletteItems(q) { | 4349 | function paletteItems(q) { |
| 4240 | - var items = [], current = null; | 4350 | + var items = []; |
| 4241 | - var tabs = document.querySelectorAll('.repo-tabs a'); | 4351 | + var current = paletteRepoHere(); |
| 4242 | - if (tabs.length) { | 4352 | + if (current) { |
| 4243 | - // The first tab is the repo's Code link, so its path starts with owner/name. | 4353 | + Array.prototype.forEach.call(document.querySelectorAll('.repo-tabs a'), function (a) { |
| 4244 | - var parts = tabs[0].pathname.split('/'); | 4354 | + // Counts sit in a span at the end of the tab ("Issues 3"); the name is the rest. |
| 4245 | - var repo = parts.length >= 3 ? parts[1] + '/' + parts[2] : ''; | 4355 | + var name = a.textContent.replace(/\s+/g, ' ').trim().replace(/ \d+$/, ''); |
| 4246 | - if (repo) { | 4356 | + items.push({ label: current.name + ' · ' + name, href: a.getAttribute('href') || '', kind: 'repo' }); |
| 4247 | - var admin = false; | 4357 | + }); |
| 4248 | - Array.prototype.forEach.call(tabs, function (a) { | ||
| 4249 | - // Counts sit in a span at the end of the tab ("Issues 3"); the name is the rest. | ||
| 4250 | - var name = a.textContent.replace(/\s+/g, ' ').trim().replace(/ \d+$/, ''); | ||
| 4251 | - items.push({ label: repo + ' · ' + name, href: a.getAttribute('href') || '', kind: 'repo' }); | ||
| 4252 | - if (a.pathname === '/' + repo + '/settings') { admin = true; } | ||
| 4253 | - }); | ||
| 4254 | - current = { name: repo, href: '/' + repo, admin: admin }; | ||
| 4255 | - } | ||
| 4256 | } | 4358 | } |
| 4257 | var known = {}; | 4359 | var known = {}; |
| 4258 | items.forEach(function (i) { known[i.href] = true; }); | 4360 | items.forEach(function (i) { known[i.href] = true; }); |
| @@ -4327,13 +4429,17 @@ | |||
| 4327 | var s; | 4429 | var s; |
| 4328 | if (!pathMode) { s = paletteScore(q, item); } | 4430 | if (!pathMode) { s = paletteScore(q, item); } |
| 4329 | else if (item.label.toLowerCase().indexOf(q) === 0) { s = item.label.length === q.length ? 3.5 : 3; item.why = ''; } | 4431 | else if (item.label.toLowerCase().indexOf(q) === 0) { s = item.label.length === q.length ? 3.5 : 3; item.why = ''; } |
| 4330 | - else { s = words && item.kind !== 'file' && item.kind !== 'action' ? paletteScore(words, item) : 0; } | 4432 | + else { s = words && item.kind !== 'file' && item.kind !== 'action' ? Math.min(2.9, paletteScore(words, item)) : 0; } |
| 4331 | // Above a path match (3), which would otherwise fill the list and cut the actions off. Text typed | 4433 | // Above a path match (3), which would otherwise fill the list and cut the actions off. Text typed |
| 4332 | // after the opening path searches the page's actions by name. | 4434 | // after the opening path searches the page's actions by name. |
| 4333 | if (item.kind === 'action' && idle) { s = 4; } | 4435 | if (item.kind === 'action' && idle) { s = 4; } |
| 4334 | else if (item.kind === 'action' && typed) { var m = paletteScore(typed, item); s = m ? m + 3 : 0; } | 4436 | else if (item.kind === 'action' && typed) { var m = paletteScore(typed, item); s = m ? m + 3 : 0; } |
| 4335 | if (s > 0) { scored.push({ item: item, score: s, idx: idx }); } | 4437 | if (s > 0) { scored.push({ item: item, score: s, idx: idx }); } |
| 4336 | }); | 4438 | }); |
| 4439 | + // A typo is only guessed at when nothing has the letters as typed, or page text would drown the hits. | ||
| 4440 | + if (scored.some(function (h) { return !h.item.near; })) { | ||
| 4441 | + scored = scored.filter(function (h) { return !h.item.near; }); | ||
| 4442 | + } | ||
| 4337 | scored.sort(function (a, b) { return b.score - a.score || a.idx - b.idx; }); | 4443 | scored.sort(function (a, b) { return b.score - a.score || a.idx - b.idx; }); |
| 4338 | scored = scored.slice(0, PALETTE_MAX); | 4444 | scored = scored.slice(0, PALETTE_MAX); |
| 4339 | var kinds = [], groups = {}; | 4445 | var kinds = [], groups = {}; |
| @@ -4402,7 +4508,11 @@ | |||
| 4402 | if (!r.ok) { throw new Error('status ' + r.status); } | 4508 | if (!r.ok) { throw new Error('status ' + r.status); } |
| 4403 | return r.json(); | 4509 | return r.json(); |
| 4404 | }).then(function (json) { | 4510 | }).then(function (json) { |
| 4405 | - pal.data = { at: Date.now(), items: Array.isArray(json.items) ? json.items : [], pages: Array.isArray(json.repoPages) ? json.repoPages : [] }; | 4511 | + pal.data = { at: Date.now(), items: Array.isArray(json.items) ? json.items : [], pages: Array.isArray(json.repoPages) ? json.repoPages : [], scanKey: json.scanKey || '' }; |
| 4512 | + pal.data.items.forEach(function (item) { | ||
| 4513 | + if (item.kind === 'page' && PALETTE_SCANNED.test(item.href) && item.href.indexOf('#') < 0) { item.scan = item.href; } | ||
| 4514 | + }); | ||
| 4515 | + paletteScan(); | ||
| 4406 | pal.request = null; | 4516 | pal.request = null; |
| 4407 | if (pal.dlg.open) { renderPalette(); } | 4517 | if (pal.dlg.open) { renderPalette(); } |
| 4408 | }).catch(function () { | 4518 | }).catch(function () { |
| @@ -4414,8 +4524,9 @@ | |||
| 4414 | 4524 | ||
| 4415 | // Leaves the palette for a destination. The dialog closes first, then the page loads the same way | 4525 | // Leaves the palette for a destination. The dialog closes first, then the page loads the same way |
| 4416 | // a sidebar link does; a link the browser must handle itself goes through location. | 4526 | // a sidebar link does; a link the browser must handle itself goes through location. |
| 4417 | - function paletteGo(href) { | 4527 | + function paletteGo(href, find) { |
| 4418 | if (!href) { return; } | 4528 | if (!href) { return; } |
| 4529 | + pal.find = find || ''; | ||
| 4419 | pal.reload = null; | 4530 | pal.reload = null; |
| 4420 | pal.dlg.close(); | 4531 | pal.dlg.close(); |
| 4421 | var url = pageUrl(href); | 4532 | var url = pageUrl(href); |
| @@ -4465,7 +4576,7 @@ | |||
| 4465 | // A destructive control is never clicked from here: the palette closes on it, so the reader confirms. | 4576 | // A destructive control is never clicked from here: the palette closes on it, so the reader confirms. |
| 4466 | function paletteRun(item) { | 4577 | function paletteRun(item) { |
| 4467 | if (!item) { return; } | 4578 | if (!item) { return; } |
| 4468 | - if (item.kind !== 'action') { paletteGo(item.href); return; } | 4579 | + if (item.kind !== 'action') { paletteGo(item.href, item.why); return; } |
| 4469 | if (pal.busy) { return; } | 4580 | if (pal.busy) { return; } |
| 4470 | var el = item.el; | 4581 | var el = item.el; |
| 4471 | // A live update may have replaced the control while the palette was open: use the one there now. | 4582 | // A live update may have replaced the control while the palette was open: use the one there now. |
crates/forge-web/src/pages/admin_backups.rsmodified+79 -23
| @@ -24,7 +24,7 @@ use crate::live::{Topic, stream_changes}; | |||
| 24 | use crate::pages::admin_users::admin_only; | 24 | use crate::pages::admin_users::admin_only; |
| 25 | use crate::pages::issues_list::stamp_unix; | 25 | use crate::pages::issues_list::stamp_unix; |
| 26 | use crate::state::AppState; | 26 | use crate::state::AppState; |
| 27 | -use crate::views::{empty_state, enc, rel_time, shell}; | 27 | +use crate::views::{enc, rel_time, shell}; |
| 28 | 28 | ||
| 29 | /// Runs shown on the page. | 29 | /// Runs shown on the page. |
| 30 | const RUN_LIMIT: u32 = 20; | 30 | const RUN_LIMIT: u32 = 20; |
| @@ -137,6 +137,10 @@ async fn backups_view( | |||
| 137 | running: Option<RunKind>, | 137 | running: Option<RunKind>, |
| 138 | notice: Option<String>, | 138 | notice: Option<String>, |
| 139 | ) -> Result<impl View> { | 139 | ) -> Result<impl View> { |
| 140 | + let backup_running = | ||
| 141 | + matches!(running, Some(RunKind::Backup)).then(|| g::running_line(lang, RunKind::Backup)); | ||
| 142 | + let fsck_running = | ||
| 143 | + matches!(running, Some(RunKind::Fsck)).then(|| g::running_line(lang, RunKind::Fsck)); | ||
| 140 | Ok(view! { | 144 | Ok(view! { |
| 141 | <div data-live="/admin/backups/events"> | 145 | <div data-live="/admin/backups/events"> |
| 142 | <section class="page-head"> | 146 | <section class="page-head"> |
| @@ -148,40 +152,92 @@ async fn backups_view( | |||
| 148 | <p>(message.as_str())</p> | 152 | <p>(message.as_str())</p> |
| 149 | </section> | 153 | </section> |
| 150 | } | 154 | } |
| 151 | - <section class="card"> | 155 | + <section class="card rows-pane" aria-label=(g::t(lang, K::Settings))> |
| 152 | - <h2>(g::t(lang, K::Settings))</h2> | ||
| 153 | if settings.enabled { | 156 | if settings.enabled { |
| 154 | - <dl class="details"> | 157 | + <div class="row-line"> |
| 155 | - <dt>(g::t(lang, K::Directory))</dt><dd><code>(settings.dir.as_str())</code></dd> | 158 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg> |
| 156 | - <dt>(g::t(lang, K::BackupInterval))</dt><dd>(settings.interval.as_str())</dd> | 159 | + <div class="row-main"> |
| 157 | - <dt>(g::t(lang, K::Retention))</dt><dd>(settings.keep.as_str())</dd> | 160 | + <h2 class="row-title">(g::t(lang, K::Directory))</h2> |
| 158 | - <dt>(g::t(lang, K::Fsck))</dt><dd>(settings.fsck_interval.as_str())</dd> | 161 | + <p class="row-status"><code>(settings.dir.as_str())</code></p> |
| 159 | - <dt>(g::t(lang, K::Healthcheck))</dt><dd>(settings.healthcheck.as_str())</dd> | 162 | + </div> |
| 160 | - </dl> | 163 | + </div> |
| 164 | + <div class="row-line"> | ||
| 165 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg> | ||
| 166 | + <div class="row-main"> | ||
| 167 | + <h2 class="row-title">(g::t(lang, K::BackupInterval))</h2> | ||
| 168 | + <p class="row-status">(settings.interval.as_str())</p> | ||
| 169 | + </div> | ||
| 170 | + </div> | ||
| 171 | + <div class="row-line"> | ||
| 172 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="4" width="18" height="5" rx="1"/><path d="M5 9v10h14V9M10 13h4"/></svg> | ||
| 173 | + <div class="row-main"> | ||
| 174 | + <h2 class="row-title">(g::t(lang, K::Retention))</h2> | ||
| 175 | + <p class="row-status">(settings.keep.as_str())</p> | ||
| 176 | + </div> | ||
| 177 | + </div> | ||
| 178 | + <div class="row-line"> | ||
| 179 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l8 3v6c0 4.5-3.4 8.3-8 9-4.6-.7-8-4.5-8-9V6z"/><path d="M9 12l2 2 4-4"/></svg> | ||
| 180 | + <div class="row-main"> | ||
| 181 | + <h2 class="row-title">(g::t(lang, K::Fsck))</h2> | ||
| 182 | + <p class="row-status">(settings.fsck_interval.as_str())</p> | ||
| 183 | + </div> | ||
| 184 | + </div> | ||
| 185 | + <div class="row-line"> | ||
| 186 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12h4l2-5 4 10 2-5h6"/></svg> | ||
| 187 | + <div class="row-main"> | ||
| 188 | + <h2 class="row-title">(g::t(lang, K::Healthcheck))</h2> | ||
| 189 | + <p class="row-status">(settings.healthcheck.as_str())</p> | ||
| 190 | + </div> | ||
| 191 | + </div> | ||
| 161 | } else { | 192 | } else { |
| 162 | - <p>(g::t(lang, K::ScheduledBackupsOff))</p> | 193 | + <div class="row-line"> |
| 163 | - } | 194 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg> |
| 164 | - if let Some(kind) = running { | 195 | + <div class="row-main"> |
| 165 | - <p class="muted">(g::running_line(lang, kind))</p> | 196 | + <h2 class="row-title">(g::t(lang, K::Settings))</h2> |
| 197 | + <p class="row-status">(g::t(lang, K::ScheduledBackupsOff))</p> | ||
| 198 | + </div> | ||
| 199 | + </div> | ||
| 166 | } | 200 | } |
| 167 | - <div class="actions"> | 201 | + <div class="row-line"> |
| 168 | - <form id="run-backup" method="post" action="/admin/backups/run"> | 202 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M7 4l13 8-13 8z"/></svg> |
| 203 | + <div class="row-main"> | ||
| 204 | + <h2 class="row-title">(g::kind_name(lang, RunKind::Backup))</h2> | ||
| 205 | + if let Some(line) = backup_running { | ||
| 206 | + <p class="row-status">(line)</p> | ||
| 207 | + } | ||
| 208 | + </div> | ||
| 209 | + <form id="run-backup" method="post" action="/admin/backups/run" class="row-form"> | ||
| 169 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 210 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 170 | <button type="submit" class="primary">(g::t(lang, K::RunBackupNow))</button> | 211 | <button type="submit" class="primary">(g::t(lang, K::RunBackupNow))</button> |
| 171 | </form> | 212 | </form> |
| 172 | - <form method="post" action="/admin/backups/fsck"> | 213 | + </div> |
| 214 | + <div class="row-line"> | ||
| 215 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M7 4l13 8-13 8z"/></svg> | ||
| 216 | + <div class="row-main"> | ||
| 217 | + <h2 class="row-title">(g::kind_name(lang, RunKind::Fsck))</h2> | ||
| 218 | + if let Some(line) = fsck_running { | ||
| 219 | + <p class="row-status">(line)</p> | ||
| 220 | + } | ||
| 221 | + </div> | ||
| 222 | + <form method="post" action="/admin/backups/fsck" class="row-form"> | ||
| 173 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 223 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 174 | <button type="submit">(g::t(lang, K::RunFsckNow))</button> | 224 | <button type="submit">(g::t(lang, K::RunFsckNow))</button> |
| 175 | </form> | 225 | </form> |
| 176 | </div> | 226 | </div> |
| 177 | </section> | 227 | </section> |
| 228 | + if rows.is_empty() { | ||
| 229 | + <section class="card rows-pane" aria-label=(g::t(lang, K::RecentRuns))> | ||
| 230 | + <div class="row-line"> | ||
| 231 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg> | ||
| 232 | + <div class="row-main"> | ||
| 233 | + <h2 class="row-title">(g::t(lang, K::NoRunsYet))</h2> | ||
| 234 | + <p class="row-status">(g::t(lang, K::BackupsEmptyHint))</p> | ||
| 235 | + </div> | ||
| 236 | + </div> | ||
| 237 | + </section> | ||
| 238 | + } else { | ||
| 178 | <section class="card"> | 239 | <section class="card"> |
| 179 | <h2>(g::t(lang, K::RecentRuns))</h2> | 240 | <h2>(g::t(lang, K::RecentRuns))</h2> |
| 180 | - if rows.is_empty() { | ||
| 181 | - empty_state(title: g::t(lang, K::NoRunsYet), hint: Some(g::t(lang, K::BackupsEmptyHint))) { | ||
| 182 | - <a class="button" href="#run-backup">(g::t(lang, K::RunBackupNow))</a> | ||
| 183 | - } | ||
| 184 | - } else { | ||
| 185 | <div class="table-wrap"> | 241 | <div class="table-wrap"> |
| 186 | <table class="table queue-table"> | 242 | <table class="table queue-table"> |
| 187 | <thead> | 243 | <thead> |
| @@ -213,8 +269,8 @@ async fn backups_view( | |||
| 213 | </tbody> | 269 | </tbody> |
| 214 | </table> | 270 | </table> |
| 215 | </div> | 271 | </div> |
| 216 | - } | ||
| 217 | </section> | 272 | </section> |
| 273 | + } | ||
| 218 | </div> | 274 | </div> |
| 219 | }) | 275 | }) |
| 220 | } | 276 | } |
crates/forge-web/src/pages/admin_health.rsmodified+99 -44
| @@ -81,17 +81,63 @@ struct Usage { | |||
| 81 | bad: bool, | 81 | bad: bool, |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | -/// One fact in the storage card's row of columns. | 84 | +/// The icon a status row shows. |
| 85 | +#[derive(Clone, Copy)] | ||
| 86 | +enum Glyph { | ||
| 87 | + Disk, | ||
| 88 | + Database, | ||
| 89 | + Folder, | ||
| 90 | + Archive, | ||
| 91 | + Queue, | ||
| 92 | + Mail, | ||
| 93 | + Clock, | ||
| 94 | + Sync, | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +/// The row icon for one glyph: a 24 grid stroke icon, 20px. | ||
| 98 | +#[component] | ||
| 99 | +async fn glyph(kind: Glyph) -> Result<impl View> { | ||
| 100 | + Ok(view! { | ||
| 101 | + if matches!(kind, Glyph::Disk) { | ||
| 102 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="4" width="18" height="6" rx="1.5"/><rect x="3" y="14" width="18" height="6" rx="1.5"/><path d="M7 7h.01M7 17h.01"/></svg> | ||
| 103 | + } | ||
| 104 | + if matches!(kind, Glyph::Database) { | ||
| 105 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><ellipse cx="12" cy="6" rx="8" ry="3"/><path d="M4 6v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6"/><path d="M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3"/></svg> | ||
| 106 | + } | ||
| 107 | + if matches!(kind, Glyph::Folder) { | ||
| 108 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg> | ||
| 109 | + } | ||
| 110 | + if matches!(kind, Glyph::Archive) { | ||
| 111 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="4" width="18" height="5" rx="1"/><path d="M5 9v10h14V9M10 13h4"/></svg> | ||
| 112 | + } | ||
| 113 | + if matches!(kind, Glyph::Queue) { | ||
| 114 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01"/></svg> | ||
| 115 | + } | ||
| 116 | + if matches!(kind, Glyph::Mail) { | ||
| 117 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/></svg> | ||
| 118 | + } | ||
| 119 | + if matches!(kind, Glyph::Clock) { | ||
| 120 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg> | ||
| 121 | + } | ||
| 122 | + if matches!(kind, Glyph::Sync) { | ||
| 123 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h13l-3-3M20 17H7l3 3"/></svg> | ||
| 124 | + } | ||
| 125 | + }) | ||
| 126 | +} | ||
| 127 | + | ||
| 128 | +/// One fact in the storage pane: one row. | ||
| 85 | struct Fact { | 129 | struct Fact { |
| 86 | label: &'static str, | 130 | label: &'static str, |
| 131 | + glyph: Glyph, | ||
| 87 | value: String, | 132 | value: String, |
| 88 | detail: String, | 133 | detail: String, |
| 89 | dot: Dot, | 134 | dot: Dot, |
| 90 | } | 135 | } |
| 91 | 136 | ||
| 92 | -/// One row of the services card. | 137 | +/// One row of the services pane. |
| 93 | struct Service { | 138 | struct Service { |
| 94 | label: &'static str, | 139 | label: &'static str, |
| 140 | + glyph: Glyph, | ||
| 95 | dot: Dot, | 141 | dot: Dot, |
| 96 | value: String, | 142 | value: String, |
| 97 | detail: String, | 143 | detail: String, |
| @@ -258,6 +304,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 258 | 304 | ||
| 259 | let mut facts = vec![Fact { | 305 | let mut facts = vec![Fact { |
| 260 | label: at(lang, A::DatabaseFile), | 306 | label: at(lang, A::DatabaseFile), |
| 307 | + glyph: Glyph::Database, | ||
| 261 | value: db_bytes.map_or_else( | 308 | value: db_bytes.map_or_else( |
| 262 | || at(lang, A::Unavailable).to_owned(), | 309 | || at(lang, A::Unavailable).to_owned(), |
| 263 | |b| human_size(lang, b), | 310 | |b| human_size(lang, b), |
| @@ -267,6 +314,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 267 | }]; | 314 | }]; |
| 268 | facts.push(Fact { | 315 | facts.push(Fact { |
| 269 | label: at(lang, A::Repositories), | 316 | label: at(lang, A::Repositories), |
| 317 | + glyph: Glyph::Folder, | ||
| 270 | value: counts.repos.to_string(), | 318 | value: counts.repos.to_string(), |
| 271 | detail: match repo_bytes { | 319 | detail: match repo_bytes { |
| 272 | Some(b) => on_disk(lang, &human_size(lang, b)), | 320 | Some(b) => on_disk(lang, &human_size(lang, b)), |
| @@ -281,6 +329,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 281 | let (pct, text) = space(lang, total, avail); | 329 | let (pct, text) = space(lang, total, avail); |
| 282 | Fact { | 330 | Fact { |
| 283 | label: at(lang, A::BackupDirectory), | 331 | label: at(lang, A::BackupDirectory), |
| 332 | + glyph: Glyph::Archive, | ||
| 284 | value: text, | 333 | value: text, |
| 285 | detail: backup, | 334 | detail: backup, |
| 286 | dot: if pct >= 90 { Dot::Bad } else { Dot::Neutral }, | 335 | dot: if pct >= 90 { Dot::Bad } else { Dot::Neutral }, |
| @@ -288,6 +337,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 288 | } | 337 | } |
| 289 | None => Fact { | 338 | None => Fact { |
| 290 | label: at(lang, A::BackupDirectory), | 339 | label: at(lang, A::BackupDirectory), |
| 340 | + glyph: Glyph::Archive, | ||
| 291 | value: at(lang, A::Unavailable).to_owned(), | 341 | value: at(lang, A::Unavailable).to_owned(), |
| 292 | detail: backup, | 342 | detail: backup, |
| 293 | dot: Dot::Neutral, | 343 | dot: Dot::Neutral, |
| @@ -296,6 +346,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 296 | } else { | 346 | } else { |
| 297 | Fact { | 347 | Fact { |
| 298 | label: at(lang, A::BackupDirectory), | 348 | label: at(lang, A::BackupDirectory), |
| 349 | + glyph: Glyph::Archive, | ||
| 299 | value: at(lang, A::NotConfigured).to_owned(), | 350 | value: at(lang, A::NotConfigured).to_owned(), |
| 300 | detail: String::new(), | 351 | detail: String::new(), |
| 301 | dot: Dot::Off, | 352 | dot: Dot::Off, |
| @@ -305,6 +356,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 305 | let mut services = vec![ | 356 | let mut services = vec![ |
| 306 | Service { | 357 | Service { |
| 307 | label: at(lang, A::CiQueue), | 358 | label: at(lang, A::CiQueue), |
| 359 | + glyph: Glyph::Queue, | ||
| 308 | dot: Dot::Neutral, | 360 | dot: Dot::Neutral, |
| 309 | value: format!("{} {}", counts.queued_jobs, at(lang, A::QueuedJobs)), | 361 | value: format!("{} {}", counts.queued_jobs, at(lang, A::QueuedJobs)), |
| 310 | detail: format!( | 362 | detail: format!( |
| @@ -317,6 +369,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 317 | }, | 369 | }, |
| 318 | Service { | 370 | Service { |
| 319 | label: at(lang, A::MailQueue), | 371 | label: at(lang, A::MailQueue), |
| 372 | + glyph: Glyph::Mail, | ||
| 320 | dot: if failed > 0 { Dot::Bad } else { Dot::Neutral }, | 373 | dot: if failed > 0 { Dot::Bad } else { Dot::Neutral }, |
| 321 | value: format!("{pending} {}", at(lang, A::Pending)), | 374 | value: format!("{pending} {}", at(lang, A::Pending)), |
| 322 | detail: format!("{failed} {}", at(lang, A::Failed)), | 375 | detail: format!("{failed} {}", at(lang, A::Failed)), |
| @@ -338,6 +391,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 338 | }; | 391 | }; |
| 339 | Service { | 392 | Service { |
| 340 | label: at(lang, A::LastBackup), | 393 | label: at(lang, A::LastBackup), |
| 394 | + glyph: Glyph::Clock, | ||
| 341 | dot, | 395 | dot, |
| 342 | value: value.to_owned(), | 396 | value: value.to_owned(), |
| 343 | detail: String::new(), | 397 | detail: String::new(), |
| @@ -346,6 +400,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 346 | } | 400 | } |
| 347 | None if backup_on => Service { | 401 | None if backup_on => Service { |
| 348 | label: at(lang, A::LastBackup), | 402 | label: at(lang, A::LastBackup), |
| 403 | + glyph: Glyph::Clock, | ||
| 349 | dot: Dot::Neutral, | 404 | dot: Dot::Neutral, |
| 350 | value: at(lang, A::Never).to_owned(), | 405 | value: at(lang, A::Never).to_owned(), |
| 351 | detail: String::new(), | 406 | detail: String::new(), |
| @@ -353,6 +408,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 353 | }, | 408 | }, |
| 354 | None => Service { | 409 | None => Service { |
| 355 | label: at(lang, A::LastBackup), | 410 | label: at(lang, A::LastBackup), |
| 411 | + glyph: Glyph::Clock, | ||
| 356 | dot: Dot::Off, | 412 | dot: Dot::Off, |
| 357 | value: at(lang, A::NotConfigured).to_owned(), | 413 | value: at(lang, A::NotConfigured).to_owned(), |
| 358 | detail: String::new(), | 414 | detail: String::new(), |
| @@ -377,6 +433,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 377 | }; | 433 | }; |
| 378 | Service { | 434 | Service { |
| 379 | label: at(lang, A::Replication), | 435 | label: at(lang, A::Replication), |
| 436 | + glyph: Glyph::Sync, | ||
| 380 | dot, | 437 | dot, |
| 381 | value: value.to_owned(), | 438 | value: value.to_owned(), |
| 382 | detail: if ok_unix.is_some() { | 439 | detail: if ok_unix.is_some() { |
| @@ -389,6 +446,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 389 | } | 446 | } |
| 390 | None => Service { | 447 | None => Service { |
| 391 | label: at(lang, A::Replication), | 448 | label: at(lang, A::Replication), |
| 449 | + glyph: Glyph::Sync, | ||
| 392 | dot: Dot::Neutral, | 450 | dot: Dot::Neutral, |
| 393 | value: at(lang, A::Never).to_owned(), | 451 | value: at(lang, A::Never).to_owned(), |
| 394 | detail: String::new(), | 452 | detail: String::new(), |
| @@ -398,6 +456,7 @@ async fn gather(state: &AppState, lang: Lang) -> Result<Health> { | |||
| 398 | } else { | 456 | } else { |
| 399 | Service { | 457 | Service { |
| 400 | label: at(lang, A::Replication), | 458 | label: at(lang, A::Replication), |
| 459 | + glyph: Glyph::Sync, | ||
| 401 | dot: Dot::Off, | 460 | dot: Dot::Off, |
| 402 | value: at(lang, A::NotConfigured).to_owned(), | 461 | value: at(lang, A::NotConfigured).to_owned(), |
| 403 | detail: String::new(), | 462 | detail: String::new(), |
| @@ -524,54 +583,50 @@ async fn health_view( | |||
| 524 | <a class="small" href="/admin/server?tab=alerts">(alert_text::settings_link(lang))</a> | 583 | <a class="small" href="/admin/server?tab=alerts">(alert_text::settings_link(lang))</a> |
| 525 | </section> | 584 | </section> |
| 526 | } | 585 | } |
| 527 | - <section class="card health-storage"> | 586 | + <section class="card rows-pane" aria-label=(at(lang, A::Storage))> |
| 528 | - <h2>(at(lang, A::Storage))</h2> | 587 | + <div class="row-line"> |
| 529 | - if let Some(u) = usage { | 588 | + glyph(kind: Glyph::Disk) |
| 530 | - <div class="health-usage-head"> | 589 | + <div class="row-main"> |
| 531 | - <span><strong>(u.used.as_str())</strong> " " (at(lang, A::DiskUsed))</span> | 590 | + <h2 class="row-title">(at(lang, A::Storage))</h2> |
| 532 | - <span class="muted">(u.free_of_total.as_str())</span> | 591 | + if let Some(u) = usage { |
| 592 | + <p class="row-status"><strong>(u.used.as_str())</strong> " " (at(lang, A::DiskUsed)) " · " (u.free_of_total.as_str())</p> | ||
| 593 | + <progress class=(if u.bad { "meter bad" } else { "meter" }) max="100" value=(u.pct.to_string())></progress> | ||
| 594 | + <p class="row-status muted small health-path">(u.path.as_str())</p> | ||
| 595 | + } else { | ||
| 596 | + <p class="row-status">(at(lang, A::Unavailable))</p> | ||
| 597 | + } | ||
| 533 | </div> | 598 | </div> |
| 534 | - <progress class=(if u.bad { "meter bad" } else { "meter" }) max="100" value=(u.pct.to_string())></progress> | 599 | + </div> |
| 535 | - <div class="muted small health-path">(u.path.as_str())</div> | 600 | + for f in facts.into_iter() { |
| 536 | - } else { | 601 | + <div class="row-line"> |
| 537 | - <p class="muted">(at(lang, A::Unavailable))</p> | 602 | + glyph(kind: f.glyph) |
| 538 | - } | 603 | + <div class="row-main"> |
| 539 | - <div class="health-facts"> | 604 | + <h2 class="row-title">(f.label)</h2> |
| 540 | - for f in facts.into_iter() { | 605 | + <p class=(format!("row-status {}", f.dot.value_class()))>(f.value.as_str())</p> |
| 541 | - <div class="health-fact"> | ||
| 542 | - <div class="muted small">(f.label)</div> | ||
| 543 | - <div class=(format!("health-fact-value {}", f.dot.value_class()))>(f.value.as_str())</div> | ||
| 544 | if !f.detail.is_empty() { | 606 | if !f.detail.is_empty() { |
| 545 | - <div class="muted small health-path">(f.detail.as_str())</div> | 607 | + <p class="row-status muted small health-path">(f.detail.as_str())</p> |
| 546 | } | 608 | } |
| 547 | </div> | 609 | </div> |
| 548 | - } | 610 | + </div> |
| 549 | - </div> | 611 | + } |
| 550 | </section> | 612 | </section> |
| 551 | - <section class="card health-status"> | 613 | + <section class="card rows-pane" aria-label=(at(lang, A::Services))> |
| 552 | - <h2>(at(lang, A::Services))</h2> | 614 | + for s in services.into_iter() { |
| 553 | - <ul class="health-rows"> | 615 | + <div class="row-line"> |
| 554 | - for s in services.into_iter() { | 616 | + glyph(kind: s.glyph) |
| 555 | - <li class="health-row"> | 617 | + <div class="row-main"> |
| 556 | - <span class=(format!("health-dot {}", s.dot.class()))></span> | 618 | + <h2 class="row-title">(s.label)</h2> |
| 557 | - <div class="health-row-text"> | 619 | + <p class="row-status"><span class=(format!("health-dot {}", s.dot.class()))></span> <span class=(s.dot.value_class())>(s.value.as_str())</span> |
| 558 | - <div>(s.label)</div> | 620 | + if !s.detail.is_empty() { |
| 559 | - if !s.detail.is_empty() || s.stamp.is_some() { | 621 | + " · " (s.detail.as_str()) |
| 560 | - <div class="muted small"> | ||
| 561 | - (s.detail.as_str()) | ||
| 562 | - if let Some(stamp) = s.stamp.as_deref() { | ||
| 563 | - if !s.detail.is_empty() { | ||
| 564 | - " · " | ||
| 565 | - } | ||
| 566 | - rel_time(lang: lang, stamp: stamp) | ||
| 567 | - } | ||
| 568 | - </div> | ||
| 569 | } | 622 | } |
| 570 | - </div> | 623 | + if let Some(stamp) = s.stamp.as_deref() { |
| 571 | - <div class=(format!("health-row-value {}", s.dot.value_class()))>(s.value.as_str())</div> | 624 | + " · " rel_time(lang: lang, stamp: stamp) |
| 572 | - </li> | 625 | + } |
| 573 | - } | 626 | + </p> |
| 574 | - </ul> | 627 | + </div> |
| 628 | + </div> | ||
| 629 | + } | ||
| 575 | </section> | 630 | </section> |
| 576 | <p class="muted small health-meta">(meta.as_str())</p> | 631 | <p class="muted small health-meta">(meta.as_str())</p> |
| 577 | </div> | 632 | </div> |
crates/forge-web/src/pages/admin_mail.rsmodified+51 -20
| @@ -245,28 +245,59 @@ async fn mail_view( | |||
| 245 | // Saved by any admin session: the stream re-renders the settings with the same signal | 245 | // Saved by any admin session: the stream re-renders the settings with the same signal |
| 246 | // as the queue (the save bumps it too), and the form keeps what was typed. | 246 | // as the queue (the save bumps it too), and the form keeps what was typed. |
| 247 | <div data-live="/admin/mail/events"> | 247 | <div data-live="/admin/mail/events"> |
| 248 | - <section class="card fit-pane"> | 248 | + <section class="card rows-pane"> |
| 249 | - <h2>(g::t(lang, K::SmtpServer))</h2> | 249 | + <div class="row-line"> |
| 250 | - <p class="muted small">(g::t(lang, K::MailTransportNote))</p> | 250 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/></svg> |
| 251 | - <p class="small">(g::t(lang, K::MailTransportInUse)) " " <code>(data.transport)</code></p> | 251 | + <div class="row-main"> |
| 252 | - <form method="post" action="/admin/mail" class="stack"> | 252 | + <h2 class="row-title">(g::t(lang, K::SmtpServer))</h2> |
| 253 | + <p class="row-status">(g::t(lang, K::MailTransportNote))</p> | ||
| 254 | + <p class="row-status">(g::t(lang, K::MailTransportInUse)) " " <code>(data.transport)</code></p> | ||
| 255 | + </div> | ||
| 256 | + </div> | ||
| 257 | + <form method="post" action="/admin/mail"> | ||
| 253 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 258 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 254 | - <label>(g::t(lang, K::MailHost)) <input type="text" name="host" value=(data.host.as_str()) maxlength="253" autocomplete="off"></label> | 259 | + <label class="row-line row-field"> |
| 255 | - <label>(g::t(lang, K::MailPort)) <input type="number" name="port" value=(data.port.as_str()) min="1" max="65535"></label> | 260 | + <span class="row-main"><span class="row-title">(g::t(lang, K::MailHost))</span></span> |
| 256 | - <label>(i18n::t(lang, Key::Security)) | 261 | + <span class="row-control"><input type="text" name="host" value=(data.host.as_str()) maxlength="253" autocomplete="off"></span> |
| 257 | - <select name="security"> | 262 | + </label> |
| 258 | - <option value="starttls" selected=(starttls)>"STARTTLS"</option> | 263 | + <label class="row-line row-field"> |
| 259 | - <option value="tls" selected=(tls)>"TLS"</option> | 264 | + <span class="row-main"><span class="row-title">(g::t(lang, K::MailPort))</span></span> |
| 260 | - <option value="none" selected=(plain)>(g::t(lang, K::SecurityNone))</option> | 265 | + <span class="row-control"><input type="number" name="port" value=(data.port.as_str()) min="1" max="65535"></span> |
| 261 | - </select> | 266 | + </label> |
| 267 | + <label class="row-line row-field"> | ||
| 268 | + <span class="row-main"><span class="row-title">(i18n::t(lang, Key::Security))</span></span> | ||
| 269 | + <span class="row-control"> | ||
| 270 | + <select name="security"> | ||
| 271 | + <option value="starttls" selected=(starttls)>"STARTTLS"</option> | ||
| 272 | + <option value="tls" selected=(tls)>"TLS"</option> | ||
| 273 | + <option value="none" selected=(plain)>(g::t(lang, K::SecurityNone))</option> | ||
| 274 | + </select> | ||
| 275 | + </span> | ||
| 276 | + </label> | ||
| 277 | + <label class="row-line row-field"> | ||
| 278 | + <span class="row-main"><span class="row-title">(i18n::t(lang, Key::Username))</span></span> | ||
| 279 | + <span class="row-control"><input type="text" name="username" value=(data.username.as_str()) maxlength="256" autocomplete="off"></span> | ||
| 280 | + </label> | ||
| 281 | + <label class="row-line row-field"> | ||
| 282 | + <span class="row-main"> | ||
| 283 | + <span class="row-title">(i18n::t(lang, Key::Password))</span> | ||
| 284 | + <span class="row-status">(password_hint)</span> | ||
| 285 | + </span> | ||
| 286 | + <span class="row-control"><input type="password" name="password" autocomplete="new-password" maxlength="1024"></span> | ||
| 287 | + </label> | ||
| 288 | + <label class="row-line row-field"> | ||
| 289 | + <span class="row-main"><span class="row-title">(g::t(lang, K::FromAddress))</span></span> | ||
| 290 | + <span class="row-control"><input type="email" name="from_addr" value=(data.from_addr.as_str()) maxlength="254"></span> | ||
| 291 | + </label> | ||
| 292 | + <label class="row-line row-field"> | ||
| 293 | + <span class="row-main"><span class="row-title">(g::t(lang, K::FromName))</span></span> | ||
| 294 | + <span class="row-control"><input type="text" name="from_name" value=(data.from_name.as_str()) maxlength="100"></span> | ||
| 295 | + </label> | ||
| 296 | + <label class="row-line row-field"> | ||
| 297 | + <span class="row-main"><span class="row-title">(g::t(lang, K::SendMailCheckbox))</span></span> | ||
| 298 | + <span class="row-control"><input type="checkbox" name="enabled" value="on" checked=(data.enabled)></span> | ||
| 262 | </label> | 299 | </label> |
| 263 | - <label>(i18n::t(lang, Key::Username)) <input type="text" name="username" value=(data.username.as_str()) maxlength="256" autocomplete="off"></label> | 300 | + <div class="row-foot"> |
| 264 | - <label>(i18n::t(lang, Key::Password)) <input type="password" name="password" autocomplete="new-password" maxlength="1024"></label> | ||
| 265 | - <p class="muted small">(password_hint)</p> | ||
| 266 | - <label>(g::t(lang, K::FromAddress)) <input type="email" name="from_addr" value=(data.from_addr.as_str()) maxlength="254"></label> | ||
| 267 | - <label>(g::t(lang, K::FromName)) <input type="text" name="from_name" value=(data.from_name.as_str()) maxlength="100"></label> | ||
| 268 | - <label><input type="checkbox" name="enabled" value="on" checked=(data.enabled)>(g::t(lang, K::SendMailCheckbox))</label> | ||
| 269 | - <div class="actions"> | ||
| 270 | <button type="submit" class="primary">(i18n::t(lang, Key::Save))</button> | 301 | <button type="submit" class="primary">(i18n::t(lang, Key::Save))</button> |
| 271 | <button type="submit" form="mail-test">(g::t(lang, K::SendTestMailToMe))</button> | 302 | <button type="submit" form="mail-test">(g::t(lang, K::SendTestMailToMe))</button> |
| 272 | </div> | 303 | </div> |
crates/forge-web/src/pages/admin_replication.rsmodified+81 -39
| @@ -27,7 +27,7 @@ use crate::i18n::{self, Lang}; | |||
| 27 | use crate::live::{Topic, stream_changes}; | 27 | use crate::live::{Topic, stream_changes}; |
| 28 | use crate::pages::admin_users::admin_only; | 28 | use crate::pages::admin_users::admin_only; |
| 29 | use crate::state::AppState; | 29 | use crate::state::AppState; |
| 30 | -use crate::views::{empty_state, enc, rel_time_or_never, shell}; | 30 | +use crate::views::{enc, rel_time_or_never, shell}; |
| 31 | 31 | ||
| 32 | #[query_params(error = bad_request)] | 32 | #[query_params(error = bad_request)] |
| 33 | pub(crate) struct NoticeQuery { | 33 | pub(crate) struct NoticeQuery { |
| @@ -198,54 +198,96 @@ async fn replication_view( | |||
| 198 | <p>(message.as_str())</p> | 198 | <p>(message.as_str())</p> |
| 199 | </section> | 199 | </section> |
| 200 | } | 200 | } |
| 201 | - <section class="card"> | 201 | + <section class="card rows-pane" aria-label=(g::t(lang, K::Standby))> |
| 202 | - <h2>(g::t(lang, K::Standby))</h2> | ||
| 203 | if data.enabled { | 202 | if data.enabled { |
| 204 | - <dl class="details"> | 203 | + <div class="row-line"> |
| 205 | - <dt>(g::t(lang, K::ReplicationTarget))</dt><dd><code>(data.target.as_str())</code></dd> | 204 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h13l-3-3M20 17H7l3 3"/></svg> |
| 206 | - <dt>(g::t(lang, K::Interval))</dt><dd>(data.interval.as_str())</dd> | 205 | + <div class="row-main"> |
| 207 | - <dt>(g::t(lang, K::Healthcheck))</dt><dd>(data.healthcheck)</dd> | 206 | + <h2 class="row-title">(g::t(lang, K::ReplicationTarget))</h2> |
| 208 | - <dt>(g::t(lang, K::Database))</dt><dd><span class="admin-status"><span class=(data.db_dot) aria-hidden="true"></span>(data.db_health)</span></dd> | 207 | + <p class="row-status"><code>(data.target.as_str())</code></p> |
| 209 | - <dt>(g::t(lang, K::LastDbSnapshotShipped))</dt><dd class="small">rel_time_or_never(lang: lang, stamp: data.db_last_ok.as_deref())</dd> | 208 | + </div> |
| 210 | - <dt>(g::t(lang, K::LastDbAttempt))</dt><dd class="small">rel_time_or_never(lang: lang, stamp: data.db_last_attempt.as_deref())</dd> | 209 | + </div> |
| 211 | - </dl> | 210 | + <div class="row-line"> |
| 212 | - if !data.db_error.is_empty() { | 211 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg> |
| 213 | - <p class="error">(g::t(lang, K::DatabaseErrorPrefix))(data.db_error.as_str())</p> | 212 | + <div class="row-main"> |
| 214 | - } | 213 | + <h2 class="row-title">(g::t(lang, K::Interval))</h2> |
| 214 | + <p class="row-status">(data.interval.as_str())</p> | ||
| 215 | + </div> | ||
| 216 | + </div> | ||
| 217 | + <div class="row-line"> | ||
| 218 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12h4l2-5 4 10 2-5h6"/></svg> | ||
| 219 | + <div class="row-main"> | ||
| 220 | + <h2 class="row-title">(g::t(lang, K::Healthcheck))</h2> | ||
| 221 | + <p class="row-status">(data.healthcheck)</p> | ||
| 222 | + </div> | ||
| 223 | + </div> | ||
| 224 | + <div class="row-line"> | ||
| 225 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><ellipse cx="12" cy="6" rx="8" ry="3"/><path d="M4 6v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6"/><path d="M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3"/></svg> | ||
| 226 | + <div class="row-main"> | ||
| 227 | + <h2 class="row-title">(g::t(lang, K::Database))</h2> | ||
| 228 | + <p class="row-status"><span class=(data.db_dot) aria-hidden="true"></span> (data.db_health)</p> | ||
| 229 | + if !data.db_error.is_empty() { | ||
| 230 | + <p class="row-status bad">(g::t(lang, K::DatabaseErrorPrefix))(data.db_error.as_str())</p> | ||
| 231 | + } | ||
| 232 | + </div> | ||
| 233 | + </div> | ||
| 234 | + <div class="row-line"> | ||
| 235 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg> | ||
| 236 | + <div class="row-main"> | ||
| 237 | + <h2 class="row-title">(g::t(lang, K::LastDbSnapshotShipped))</h2> | ||
| 238 | + <p class="row-status">rel_time_or_never(lang: lang, stamp: data.db_last_ok.as_deref())</p> | ||
| 239 | + </div> | ||
| 240 | + </div> | ||
| 241 | + <div class="row-line"> | ||
| 242 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg> | ||
| 243 | + <div class="row-main"> | ||
| 244 | + <h2 class="row-title">(g::t(lang, K::LastDbAttempt))</h2> | ||
| 245 | + <p class="row-status">rel_time_or_never(lang: lang, stamp: data.db_last_attempt.as_deref())</p> | ||
| 246 | + </div> | ||
| 247 | + </div> | ||
| 215 | } else { | 248 | } else { |
| 216 | - <p>(g::t(lang, K::ReplicationOff))</p> | 249 | + <div class="row-line"> |
| 250 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h13l-3-3M20 17H7l3 3"/></svg> | ||
| 251 | + <div class="row-main"> | ||
| 252 | + <h2 class="row-title">(g::t(lang, K::Replication))</h2> | ||
| 253 | + <p class="row-status">(g::t(lang, K::ReplicationOff))</p> | ||
| 254 | + </div> | ||
| 255 | + </div> | ||
| 217 | } | 256 | } |
| 218 | - <div class="actions"> | 257 | + <div class="row-line"> |
| 219 | - <form method="post" action="/admin/replication/reconcile"> | 258 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h13l-3-3M20 17H7l3 3"/></svg> |
| 259 | + <div class="row-main"> | ||
| 260 | + <h2 class="row-title">(g::t(lang, K::Standby))</h2> | ||
| 261 | + </div> | ||
| 262 | + <form method="post" action="/admin/replication/reconcile" class="row-form"> | ||
| 220 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 263 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 221 | <button type="submit" class="primary">(g::t(lang, K::ReconcileNow))</button> | 264 | <button type="submit" class="primary">(g::t(lang, K::ReconcileNow))</button> |
| 222 | </form> | 265 | </form> |
| 223 | </div> | 266 | </div> |
| 224 | </section> | 267 | </section> |
| 225 | - <section class="card"> | 268 | + <section class="card rows-pane" aria-label=(g::t(lang, K::Repos))> |
| 226 | - <h2>(g::t(lang, K::Repos))</h2> | ||
| 227 | if data.repos.is_empty() { | 269 | if data.repos.is_empty() { |
| 228 | - empty_state(title: g::t(lang, K::NoReposYet), hint: Some(g::t(lang, K::ReposEmptyHint))) { | 270 | + <div class="row-line"> |
| 229 | - <p class="muted small">(g::t(lang, K::ReplicationConfigHint))</p> | 271 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg> |
| 230 | - } | 272 | + <div class="row-main"> |
| 273 | + <h2 class="row-title">(g::t(lang, K::NoReposYet))</h2> | ||
| 274 | + <p class="row-status">(g::t(lang, K::ReposEmptyHint))</p> | ||
| 275 | + <p class="row-status muted small">(g::t(lang, K::ReplicationConfigHint))</p> | ||
| 276 | + </div> | ||
| 277 | + </div> | ||
| 231 | } else { | 278 | } else { |
| 232 | - <ul class="admin-rows"> | 279 | + for row in data.repos.into_iter() { |
| 233 | - for row in data.repos.into_iter() { | 280 | + <div class="row-line"> |
| 234 | - <li class="admin-row"> | 281 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg> |
| 235 | - <div class="admin-row-main"> | 282 | + <div class="row-main"> |
| 236 | - <div class="runner-title"> | 283 | + <strong class="row-name">(row.name.as_str())</strong> |
| 237 | - <span class=(row.dot) aria-hidden="true"></span> | 284 | + <p class="row-status"><span class=(row.dot) aria-hidden="true"></span> <span class=(row.tone)>(row.health)</span> " · " (g::t(lang, K::LastSuccess)) ": " rel_time_or_never(lang: lang, stamp: row.last_ok.as_deref())</p> |
| 238 | - <span class="admin-row-name">(row.name.as_str())</span> | 285 | + if !row.error.is_empty() { |
| 239 | - </div> | 286 | + <p class="row-status bad">(row.error.as_str())</p> |
| 240 | - <p class="runner-meta muted">(g::t(lang, K::LastSuccess))": " rel_time_or_never(lang: lang, stamp: row.last_ok.as_deref())</p> | 287 | + } |
| 241 | - if !row.error.is_empty() { | 288 | + </div> |
| 242 | - <p class="admin-row-error">(row.error.as_str())</p> | 289 | + </div> |
| 243 | - } | 290 | + } |
| 244 | - </div> | ||
| 245 | - <span class=(format!("admin-row-state {}", row.tone))>(row.health)</span> | ||
| 246 | - </li> | ||
| 247 | - } | ||
| 248 | - </ul> | ||
| 249 | } | 291 | } |
| 250 | </section> | 292 | </section> |
| 251 | </div> | 293 | </div> |
crates/forge-web/src/pages/admin_runners.rsmodified+92 -84
| @@ -37,7 +37,7 @@ use crate::pages::ci_runs::{age_text, duration_text, events_response, run_href, | |||
| 37 | use crate::pages::repo_mirrors::stamp_in_tz; | 37 | use crate::pages::repo_mirrors::stamp_in_tz; |
| 38 | use crate::state::AppState; | 38 | use crate::state::AppState; |
| 39 | use crate::views::repo_list::{PageLink, pager, pager_links}; | 39 | use crate::views::repo_list::{PageLink, pager, pager_links}; |
| 40 | -use crate::views::{empty_state, enc, now_unix, relative_time, shell}; | 40 | +use crate::views::{enc, now_unix, relative_time, shell}; |
| 41 | 41 | ||
| 42 | path_param!(runner_id); | 42 | path_param!(runner_id); |
| 43 | 43 | ||
| @@ -345,18 +345,33 @@ async fn runners_view( | |||
| 345 | <section class="card notice" role="status">(text)</section> | 345 | <section class="card notice" role="status">(text)</section> |
| 346 | } | 346 | } |
| 347 | } | 347 | } |
| 348 | - <div class="fit-split"> | 348 | + <section class="card rows-pane"> |
| 349 | - <section class="card fit-pane fit-card fit-main"> | 349 | + <div class="row-line"> |
| 350 | - <h2>(g::t(lang, K::Runners))</h2> | 350 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 351 | - if rows.is_empty() { | 351 | + <div class="row-main"> |
| 352 | - empty_state(title: g::t(lang, K::NoRunnersYet), hint: Some(g::t(lang, K::RunnersEmptyHint))) { | 352 | + <h2 class="row-title">(g::t(lang, K::AddARunner))</h2> |
| 353 | - <pre><code>"forge runner register --url <forge-url> --token <token> --name <name> --labels linux,x86_64"</code></pre> | 353 | + if rows.is_empty() { |
| 354 | - } | 354 | + <p class="row-status">(g::t(lang, K::NoRunnersYet))</p> |
| 355 | - } else { | 355 | + } |
| 356 | - <div class="fit-scroll fit-bleed"> | 356 | + </div> |
| 357 | - <ul class="runner-list"> | 357 | + <details class="row-action" id="add-runner"> |
| 358 | - for row in rows.iter() { | 358 | + <summary>(g::t(lang, K::CreateRegistrationToken))</summary> |
| 359 | - <li class="runner-row is-linked"> | 359 | + <div class="row-panel"> |
| 360 | + <p class="muted small">(note.as_str())</p> | ||
| 361 | + if rows.is_empty() { | ||
| 362 | + <p class="muted small">(g::t(lang, K::RunnersEmptyHint))</p> | ||
| 363 | + <pre><code>"forge runner register --url <forge-url> --token <token> --name <name> --labels linux,x86_64"</code></pre> | ||
| 364 | + } | ||
| 365 | + <form method="post" action="/admin/runners/tokens" class="stack"> | ||
| 366 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 367 | + <button type="submit" class="primary">(g::t(lang, K::CreateRegistrationToken))</button> | ||
| 368 | + </form> | ||
| 369 | + </div> | ||
| 370 | + </details> | ||
| 371 | + </div> | ||
| 372 | + for row in rows.iter() { | ||
| 373 | + <div class="row-line runner-row is-linked"> | ||
| 374 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="4" width="18" height="6" rx="1.5"/><rect x="3" y="14" width="18" height="6" rx="1.5"/><path d="M7 7h.01M7 17h.01"/></svg> | ||
| 360 | <div class="runner-id"> | 375 | <div class="runner-id"> |
| 361 | <div class="runner-title"> | 376 | <div class="runner-title"> |
| 362 | <span class=(row.dot_class) role="img" aria-label=(row.state_text) title=(row.state_text)></span> | 377 | <span class=(row.dot_class) role="img" aria-label=(row.state_text) title=(row.state_text)></span> |
| @@ -404,22 +419,12 @@ async fn runners_view( | |||
| 404 | confirm_post(lang: lang, csrf: csrf.as_str(), action: row.delete_action.as_str(), label: i18n::t(lang, Key::Delete), message: delete_message(lang, row.name.as_str()), confirm: s(lang, "Yes, delete", "Evet, sil"), danger: true, fields: vec![]) | 419 | confirm_post(lang: lang, csrf: csrf.as_str(), action: row.delete_action.as_str(), label: i18n::t(lang, Key::Delete), message: delete_message(lang, row.name.as_str()), confirm: s(lang, "Yes, delete", "Evet, sil"), danger: true, fields: vec![]) |
| 405 | </div> | 420 | </div> |
| 406 | </details> | 421 | </details> |
| 407 | - </li> | ||
| 408 | - } | ||
| 409 | - </ul> | ||
| 410 | </div> | 422 | </div> |
| 423 | + } | ||
| 424 | + if !rows.is_empty() { | ||
| 411 | pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang) | 425 | pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang) |
| 412 | } | 426 | } |
| 413 | </section> | 427 | </section> |
| 414 | - <section class="card fit-side"> | ||
| 415 | - <h2>(g::t(lang, K::AddARunner))</h2> | ||
| 416 | - <p class="muted small">(note.as_str())</p> | ||
| 417 | - <form method="post" action="/admin/runners/tokens" class="inline-form"> | ||
| 418 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 419 | - <button type="submit" class="primary">(g::t(lang, K::CreateRegistrationToken))</button> | ||
| 420 | - </form> | ||
| 421 | - </section> | ||
| 422 | - </div> | ||
| 423 | </div> | 428 | </div> |
| 424 | }) | 429 | }) |
| 425 | } | 430 | } |
| @@ -882,6 +887,7 @@ const TABS: [(&str, &[&str]); 7] = [ | |||
| 882 | ("logs", &[]), | 887 | ("logs", &[]), |
| 883 | ]; | 888 | ]; |
| 884 | 889 | ||
| 890 | +/// The tab's label in the page's own tab row. | ||
| 885 | fn tab_label(lang: Lang, slug: &str) -> &'static str { | 891 | fn tab_label(lang: Lang, slug: &str) -> &'static str { |
| 886 | match slug { | 892 | match slug { |
| 887 | "general" => s(lang, "General", "Genel"), | 893 | "general" => s(lang, "General", "Genel"), |
| @@ -894,17 +900,29 @@ fn tab_label(lang: Lang, slug: &str) -> &'static str { | |||
| 894 | } | 900 | } |
| 895 | } | 901 | } |
| 896 | 902 | ||
| 897 | -/// The tab slug from `?tab=`; anything unknown is the first tab. | 903 | +/// The config keys a tab saves. |
| 904 | +fn tab_keys(tab: &str) -> Vec<&'static str> { | ||
| 905 | + TABS.iter() | ||
| 906 | + .filter(|(slug, _)| *slug == tab) | ||
| 907 | + .flat_map(|(_, keys)| keys.iter().copied()) | ||
| 908 | + .collect() | ||
| 909 | +} | ||
| 910 | + | ||
| 911 | +/// The tab a name stands for; anything unknown is the first tab. | ||
| 912 | +fn tab_slug(wanted: Option<&str>) -> &'static str { | ||
| 913 | + TABS.iter() | ||
| 914 | + .find(|(slug, _)| Some(*slug) == wanted) | ||
| 915 | + .map_or("general", |(slug, _)| *slug) | ||
| 916 | +} | ||
| 917 | + | ||
| 918 | +/// The tab slug from `?tab=`. | ||
| 898 | fn tab_from_query(cx: &Cx) -> &'static str { | 919 | fn tab_from_query(cx: &Cx) -> &'static str { |
| 899 | let wanted = uri(cx).query().and_then(|query| { | 920 | let wanted = uri(cx).query().and_then(|query| { |
| 900 | form_urlencoded::parse(query.as_bytes()) | 921 | form_urlencoded::parse(query.as_bytes()) |
| 901 | .find(|(key, _)| key == "tab") | 922 | .find(|(key, _)| key == "tab") |
| 902 | .map(|(_, value)| value.into_owned()) | 923 | .map(|(_, value)| value.into_owned()) |
| 903 | }); | 924 | }); |
| 904 | - TABS.iter() | 925 | + tab_slug(wanted.as_deref()) |
| 905 | - .map(|(slug, _)| *slug) | ||
| 906 | - .find(|slug| Some(*slug) == wanted.as_deref()) | ||
| 907 | - .unwrap_or("general") | ||
| 908 | } | 926 | } |
| 909 | 927 | ||
| 910 | /// The human label and the one-line hint of a config field. | 928 | /// The human label and the one-line hint of a config field. |
| @@ -1078,12 +1096,9 @@ struct DetailField { | |||
| 1078 | } | 1096 | } |
| 1079 | 1097 | ||
| 1080 | fn detail_fields(lang: Lang, tab: &str, fields: &[FieldRow]) -> Vec<DetailField> { | 1098 | fn detail_fields(lang: Lang, tab: &str, fields: &[FieldRow]) -> Vec<DetailField> { |
| 1081 | - let keys = TABS | 1099 | + tab_keys(tab) |
| 1082 | - .iter() | 1100 | + .into_iter() |
| 1083 | - .find(|(slug, _)| *slug == tab) | 1101 | + .filter_map(|key| fields.iter().find(|f| f.key == key)) |
| 1084 | - .map_or(&[][..], |(_, keys)| *keys); | ||
| 1085 | - keys.iter() | ||
| 1086 | - .filter_map(|key| fields.iter().find(|f| f.key == *key)) | ||
| 1087 | .map(|f| { | 1102 | .map(|f| { |
| 1088 | let (label, hint) = field_text(lang, f.key); | 1103 | let (label, hint) = field_text(lang, f.key); |
| 1089 | let (kind_label, kind_class) = if f.kind == FieldKind::Live { | 1104 | let (kind_label, kind_class) = if f.kind == FieldKind::Live { |
| @@ -1634,7 +1649,7 @@ async fn runner_detail_view( | |||
| 1634 | }; | 1649 | }; |
| 1635 | let shown = detail_fields(lang, tab, &fields); | 1650 | let shown = detail_fields(lang, tab, &fields); |
| 1636 | let identity = identity_rows(lang, &fields); | 1651 | let identity = identity_rows(lang, &fields); |
| 1637 | - let editing = !matches!(tab, "identity" | "logs" | "jobs"); | 1652 | + let editing = !matches!(tab, "logs" | "jobs"); |
| 1638 | let jobs_href = format!("{}?tab=jobs", row.detail_href); | 1653 | let jobs_href = format!("{}?tab=jobs", row.detail_href); |
| 1639 | let save_action = format!("{}/settings", row.detail_href); | 1654 | let save_action = format!("{}/settings", row.detail_href); |
| 1640 | let reset_action = row.config_action.clone(); | 1655 | let reset_action = row.config_action.clone(); |
| @@ -1766,22 +1781,24 @@ async fn runner_detail_view( | |||
| 1766 | <a class=(tab_class(*slug == tab)) href=(format!("{}?tab={}", row.detail_href, slug))>(tab_label(lang, slug))</a> | 1781 | <a class=(tab_class(*slug == tab)) href=(format!("{}?tab={}", row.detail_href, slug))>(tab_label(lang, slug))</a> |
| 1767 | } | 1782 | } |
| 1768 | </nav> | 1783 | </nav> |
| 1769 | - <section class="card"> | 1784 | + if editing { |
| 1770 | - if editing { | 1785 | + <section class="card rows-pane"> |
| 1771 | - <form method="post" action=(save_action.as_str()) class="srv-form"> | 1786 | + <form method="post" action=(save_action.as_str())> |
| 1772 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 1787 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 1773 | <input type="hidden" name="tab" value=(tab)> | 1788 | <input type="hidden" name="tab" value=(tab)> |
| 1774 | - <div class="srv-grid"> | 1789 | + for f in shown.iter() { |
| 1775 | - for f in shown.iter() { | 1790 | + <div class="row-line row-field"> |
| 1776 | - <div class="srv-field"> | 1791 | + <div class="row-main"> |
| 1777 | - <div class="srv-head"> | 1792 | + <label class="row-title" for=(format!("rf-{}", f.key))>(f.label) |
| 1778 | - <label class="srv-label" for=(format!("rf-{}", f.key))>(f.label)</label> | ||
| 1779 | <span class=(f.kind_class)>(f.kind_label)</span> | 1793 | <span class=(f.kind_class)>(f.kind_label)</span> |
| 1780 | <span class="badge srv-source">(f.source_label)</span> | 1794 | <span class="badge srv-source">(f.source_label)</span> |
| 1781 | if !f.pending_label.is_empty() { | 1795 | if !f.pending_label.is_empty() { |
| 1782 | <span class="badge srv-pending">(f.pending_label)</span> | 1796 | <span class="badge srv-pending">(f.pending_label)</span> |
| 1783 | } | 1797 | } |
| 1784 | - </div> | 1798 | + </label> |
| 1799 | + <p class="row-status">(f.hint)</p> | ||
| 1800 | + </div> | ||
| 1801 | + <div class="row-control"> | ||
| 1785 | if f.input == "select" { | 1802 | if f.input == "select" { |
| 1786 | <select id=(format!("rf-{}", f.key)) name=(f.key)> | 1803 | <select id=(format!("rf-{}", f.key)) name=(f.key)> |
| 1787 | for (value, text, on) in f.options.iter() { | 1804 | for (value, text, on) in f.options.iter() { |
| @@ -1793,18 +1810,28 @@ async fn runner_detail_view( | |||
| 1793 | } else { | 1810 | } else { |
| 1794 | <input id=(format!("rf-{}", f.key)) type="text" name=(f.key) value=(f.value.as_str()) placeholder=(s(lang, "(from runner.toml)", "(runner.toml'dan)")) autocomplete="off" spellcheck="false"> | 1811 | <input id=(format!("rf-{}", f.key)) type="text" name=(f.key) value=(f.value.as_str()) placeholder=(s(lang, "(from runner.toml)", "(runner.toml'dan)")) autocomplete="off" spellcheck="false"> |
| 1795 | } | 1812 | } |
| 1796 | - <p class="muted small">(f.hint)</p> | ||
| 1797 | if f.has_override { | 1813 | if f.has_override { |
| 1798 | - <p class="small srv-reset"> | 1814 | + <button type="submit" form="rn-reset" name="key" value=(f.key)>(s(lang, "Reset to runner.toml", "runner.toml değerine sıfırla"))</button> |
| 1799 | - <button type="submit" form="rn-reset" name="key" value=(f.key)>(s(lang, "Reset to runner.toml", "runner.toml değerine sıfırla"))</button> | ||
| 1800 | - </p> | ||
| 1801 | } | 1815 | } |
| 1802 | </div> | 1816 | </div> |
| 1803 | - } | 1817 | + </div> |
| 1804 | - </div> | 1818 | + } |
| 1805 | - <div class="actions"> | 1819 | + for (i, (label, value)) in identity.iter().enumerate().filter(|_| tab == "identity") { |
| 1806 | - <button type="submit" class="primary">(i18n::t(lang, Key::Save))</button> | 1820 | + <div class="row-line row-field"> |
| 1807 | - </div> | 1821 | + <div class="row-main"> |
| 1822 | + <span class="row-title">(*label)<span class="badge srv-ro">(g::t(lang, K::SrvKindReadOnly))</span></span> | ||
| 1823 | + if i == 0 { | ||
| 1824 | + <p class="row-status">(s(lang, "Set when the runner registered. These cannot be changed from the forge.", "Çalıştırıcı kaydolurken belirlenir. Forge üzerinden değiştirilemez."))</p> | ||
| 1825 | + } | ||
| 1826 | + </div> | ||
| 1827 | + <div class="row-control"><code class="srv-fixed">(value.as_str())</code></div> | ||
| 1828 | + </div> | ||
| 1829 | + } | ||
| 1830 | + if tab != "identity" { | ||
| 1831 | + <div class="row-foot"> | ||
| 1832 | + <button type="submit" class="primary">(i18n::t(lang, Key::Save))</button> | ||
| 1833 | + </div> | ||
| 1834 | + } | ||
| 1808 | </form> | 1835 | </form> |
| 1809 | <form id="rn-reset" method="post" action=(reset_action.as_str())> | 1836 | <form id="rn-reset" method="post" action=(reset_action.as_str())> |
| 1810 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 1837 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| @@ -1812,7 +1839,10 @@ async fn runner_detail_view( | |||
| 1812 | <input type="hidden" name="tab" value=(tab)> | 1839 | <input type="hidden" name="tab" value=(tab)> |
| 1813 | <input type="hidden" name="reset" value="1"> | 1840 | <input type="hidden" name="reset" value="1"> |
| 1814 | </form> | 1841 | </form> |
| 1815 | - } else if tab == "logs" { | 1842 | + </section> |
| 1843 | + } else { | ||
| 1844 | + <section class="card"> | ||
| 1845 | + if tab == "logs" { | ||
| 1816 | if log.is_empty() { | 1846 | if log.is_empty() { |
| 1817 | <p class="muted small">(s(lang, "No log lines yet. Only a runner from the version that sends its log does so; an older runner sends nothing.", "Henüz günlük satırı yok. Günlüğünü yalnızca bunu destekleyen sürüm gönderir; eski sürüm hiçbir şey göndermez."))</p> | 1847 | <p class="muted small">(s(lang, "No log lines yet. Only a runner from the version that sends its log does so; an older runner sends nothing.", "Henüz günlük satırı yok. Günlüğünü yalnızca bunu destekleyen sürüm gönderir; eski sürüm hiçbir şey göndermez."))</p> |
| 1818 | } else { | 1848 | } else { |
| @@ -1870,21 +1900,9 @@ async fn runner_detail_view( | |||
| 1870 | </table> | 1900 | </table> |
| 1871 | </div> | 1901 | </div> |
| 1872 | } | 1902 | } |
| 1873 | - } else { | ||
| 1874 | - <p class="muted small">(s(lang, "Set when the runner registered. These cannot be changed from the forge.", "Çalıştırıcı kaydolurken belirlenir. Forge üzerinden değiştirilemez."))</p> | ||
| 1875 | - <div class="srv-grid"> | ||
| 1876 | - for (label, value) in identity.iter() { | ||
| 1877 | - <div class="srv-field"> | ||
| 1878 | - <div class="srv-head"> | ||
| 1879 | - <span class="srv-label">(*label)</span> | ||
| 1880 | - <span class="badge srv-ro">(g::t(lang, K::SrvKindReadOnly))</span> | ||
| 1881 | - </div> | ||
| 1882 | - <code class="srv-fixed">(value.as_str())</code> | ||
| 1883 | - </div> | ||
| 1884 | - } | ||
| 1885 | - </div> | ||
| 1886 | } | 1903 | } |
| 1887 | </section> | 1904 | </section> |
| 1905 | + } | ||
| 1888 | </div> | 1906 | </div> |
| 1889 | }) | 1907 | }) |
| 1890 | } | 1908 | } |
| @@ -1935,10 +1953,7 @@ async fn runner_save_settings( | |||
| 1935 | } | 1953 | } |
| 1936 | let id = path_param::<RunnerId>(cx); | 1954 | let id = path_param::<RunnerId>(cx); |
| 1937 | let state = app_context::<AppState>(cx); | 1955 | let state = app_context::<AppState>(cx); |
| 1938 | - let tab = TABS | 1956 | + let tab = tab_slug(form.get("tab").map(String::as_str)); |
| 1939 | - .iter() | ||
| 1940 | - .find(|(slug, _)| Some(*slug) == form.get("tab").map(String::as_str)) | ||
| 1941 | - .map_or("general", |(slug, _)| *slug); | ||
| 1942 | let back = |notice: &str| { | 1957 | let back = |notice: &str| { |
| 1943 | see_other(format!( | 1958 | see_other(format!( |
| 1944 | "/admin/runners/{}?tab={tab}¬ice={}", | 1959 | "/admin/runners/{}?tab={tab}¬ice={}", |
| @@ -1950,17 +1965,13 @@ async fn runner_save_settings( | |||
| 1950 | return Ok(back_to_list("missing")); | 1965 | return Ok(back_to_list("missing")); |
| 1951 | }; | 1966 | }; |
| 1952 | let current = field_rows(&runner); | 1967 | let current = field_rows(&runner); |
| 1953 | - let keys = TABS | ||
| 1954 | - .iter() | ||
| 1955 | - .find(|(slug, _)| *slug == tab) | ||
| 1956 | - .map_or(&[][..], |(_, keys)| *keys); | ||
| 1957 | let mut saved_live = false; | 1968 | let mut saved_live = false; |
| 1958 | let mut saved_restart = false; | 1969 | let mut saved_restart = false; |
| 1959 | - for key in keys { | 1970 | + for key in tab_keys(tab) { |
| 1960 | let (Some(field), Some(posted), Some(now)) = ( | 1971 | let (Some(field), Some(posted), Some(now)) = ( |
| 1961 | runner_field(key), | 1972 | runner_field(key), |
| 1962 | - form.get(*key), | 1973 | + form.get(key), |
| 1963 | - current.iter().find(|f| f.key == *key), | 1974 | + current.iter().find(|f| f.key == key), |
| 1964 | ) else { | 1975 | ) else { |
| 1965 | continue; | 1976 | continue; |
| 1966 | }; | 1977 | }; |
| @@ -2037,10 +2048,7 @@ async fn runner_set_config(cx: &Cx, Form(form): Form<ConfigForm>) -> Result<SeeO | |||
| 2037 | let state = app_context::<AppState>(cx); | 2048 | let state = app_context::<AppState>(cx); |
| 2038 | let back = |notice: &str| { | 2049 | let back = |notice: &str| { |
| 2039 | if form.back == "detail" { | 2050 | if form.back == "detail" { |
| 2040 | - let tab = TABS | 2051 | + let tab = tab_slug(Some(form.tab.as_str())); |
| 2041 | - .iter() | ||
| 2042 | - .find(|(slug, _)| *slug == form.tab) | ||
| 2043 | - .map_or("general", |(slug, _)| *slug); | ||
| 2044 | see_other(format!( | 2052 | see_other(format!( |
| 2045 | "/admin/runners/{}?tab={tab}¬ice={}", | 2053 | "/admin/runners/{}?tab={tab}¬ice={}", |
| 2046 | enc(id), | 2054 | enc(id), |
crates/forge-web/src/pages/admin_server.rsmodified+48 -40
| @@ -257,23 +257,34 @@ async fn server_view( | |||
| 257 | <p>(message.as_str())</p> | 257 | <p>(message.as_str())</p> |
| 258 | </section> | 258 | </section> |
| 259 | } | 259 | } |
| 260 | - <section class="card fit-pane"> | 260 | + <section class="card rows-pane"> |
| 261 | <form method="post" action="/admin/server" class="srv-form"> | 261 | <form method="post" action="/admin/server" class="srv-form"> |
| 262 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 262 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 263 | <input type="hidden" name="tab" value=(tab)> | 263 | <input type="hidden" name="tab" value=(tab)> |
| 264 | - <div class="srv-grid"> | 264 | + for r in rows.iter() { |
| 265 | - for r in rows.iter() { | 265 | + <div class="row-line row-field srv-field" id=(format!("srv-{}", r.key))> |
| 266 | - <div class="srv-field" id=(format!("srv-{}", r.key))> | 266 | + <div class="row-main"> |
| 267 | - <div class="srv-head"> | 267 | + <span class="row-title"> |
| 268 | <span class="srv-label" title=(r.label)>(r.label)</span> | 268 | <span class="srv-label" title=(r.label)>(r.label)</span> |
| 269 | <span class=(r.kind_class)>(r.kind_label)</span> | 269 | <span class=(r.kind_class)>(r.kind_label)</span> |
| 270 | <span class="badge srv-source">(r.source_label)</span> | 270 | <span class="badge srv-source">(r.source_label)</span> |
| 271 | if r.pending { | 271 | if r.pending { |
| 272 | <span class="badge srv-pending">(g::t(lang, K::SrvRestartNeeded))</span> | 272 | <span class="badge srv-pending">(g::t(lang, K::SrvRestartNeeded))</span> |
| 273 | } | 273 | } |
| 274 | - </div> | 274 | + </span> |
| 275 | + if !r.help.is_empty() { | ||
| 276 | + <p class="row-status">(r.help)</p> | ||
| 277 | + } | ||
| 278 | + if r.is_secret { | ||
| 279 | + <p class="row-status"><strong>(r.secret_state)</strong> ". " (g::t(lang, K::SrvSecretHint))</p> | ||
| 280 | + } | ||
| 281 | + if r.has_override && r.show_file_value { | ||
| 282 | + <p class="row-status">(g::t(lang, K::SrvFileValue)) ": " <code>(r.file_value.as_str())</code></p> | ||
| 283 | + } | ||
| 284 | + </div> | ||
| 285 | + <div class="row-control"> | ||
| 275 | if r.is_bool { | 286 | if r.is_bool { |
| 276 | - <label class="inline"><input type="checkbox" name=(r.key) value="true" checked=(r.checked)><span>(r.label)</span></label> | 287 | + <input type="checkbox" name=(r.key) value="true" checked=(r.checked) aria-label=(r.label)> |
| 277 | } else if r.is_select { | 288 | } else if r.is_select { |
| 278 | <select name=(r.key) aria-label=(r.label)> | 289 | <select name=(r.key) aria-label=(r.label)> |
| 279 | for option in r.options.iter() { | 290 | for option in r.options.iter() { |
| @@ -291,28 +302,19 @@ async fn server_view( | |||
| 291 | <input type="number" name=(r.key) value=(r.value.as_str()) min=(r.min.as_str()) max=(r.max.as_str()) aria-label=(r.label)> | 302 | <input type="number" name=(r.key) value=(r.value.as_str()) min=(r.min.as_str()) max=(r.max.as_str()) aria-label=(r.label)> |
| 292 | } else if r.is_secret { | 303 | } else if r.is_secret { |
| 293 | <input type="password" name=(r.key) autocomplete="new-password" maxlength="1024" aria-label=(r.label)> | 304 | <input type="password" name=(r.key) autocomplete="new-password" maxlength="1024" aria-label=(r.label)> |
| 294 | - <p class="muted small"><strong>(r.secret_state)</strong> ". " (g::t(lang, K::SrvSecretHint))</p> | ||
| 295 | } else if r.fixed { | 305 | } else if r.fixed { |
| 296 | <code class="srv-fixed" title=(r.value.as_str())>(r.value.as_str())</code> | 306 | <code class="srv-fixed" title=(r.value.as_str())>(r.value.as_str())</code> |
| 297 | } else { | 307 | } else { |
| 298 | <input type="text" name=(r.key) value=(r.value.as_str()) maxlength="1024" autocomplete="off" aria-label=(r.label)> | 308 | <input type="text" name=(r.key) value=(r.value.as_str()) maxlength="1024" autocomplete="off" aria-label=(r.label)> |
| 299 | } | 309 | } |
| 300 | - if !r.help.is_empty() { | ||
| 301 | - <p class="muted small">(r.help)</p> | ||
| 302 | - } | ||
| 303 | if r.has_override { | 310 | if r.has_override { |
| 304 | - <p class="small srv-reset"> | 311 | + <button type="submit" form="srv-reset" name="key" value=(r.key)>(g::t(lang, K::SrvResetToFile))</button> |
| 305 | - if r.show_file_value { | ||
| 306 | - <span class="muted">(g::t(lang, K::SrvFileValue)) ": " <code>(r.file_value.as_str())</code></span> | ||
| 307 | - } | ||
| 308 | - <button type="submit" form="srv-reset" name="key" value=(r.key)>(g::t(lang, K::SrvResetToFile))</button> | ||
| 309 | - </p> | ||
| 310 | } | 312 | } |
| 311 | </div> | 313 | </div> |
| 312 | - } | 314 | + </div> |
| 313 | - </div> | 315 | + } |
| 314 | if any_editable { | 316 | if any_editable { |
| 315 | - <div class="actions"> | 317 | + <div class="row-foot"> |
| 316 | <button type="submit" class="primary">(i18n::t(lang, Key::Save))</button> | 318 | <button type="submit" class="primary">(i18n::t(lang, Key::Save))</button> |
| 317 | </div> | 319 | </div> |
| 318 | } | 320 | } |
| @@ -322,25 +324,31 @@ async fn server_view( | |||
| 322 | <input type="hidden" name="tab" value=(tab)> | 324 | <input type="hidden" name="tab" value=(tab)> |
| 323 | </form> | 325 | </form> |
| 324 | </section> | 326 | </section> |
| 325 | - <section class="card"> | 327 | + <section class="card rows-pane"> |
| 326 | - <h2>(s(lang, "Restart server", "Sunucuyu yeniden başlat"))</h2> | 328 | + <div class="row-line"> |
| 327 | - <p class="muted small">(s(lang, "Stops gracefully and starts again, so a newly installed binary and every setting marked restart needed take effect. Needs a supervisor such as systemd to start it again.", "Düzgünce durdurup yeniden başlatır; böylece yeni kurulan ikili ve \"yeniden başlatma gerekli\" işaretli her ayar devreye girer. Yeniden başlatmak için systemd gibi bir gözetmen gerekir."))</p> | 329 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.3-5.7"/><path d="M20 4v5h-5"/></svg> |
| 328 | - if restart == Restart::Pending { | 330 | + <div class="row-main"> |
| 329 | - <p class="muted small">(s(lang, "A restart is in progress.", "Yeniden başlatma sürüyor."))</p> | 331 | + <h2 class="row-title">(s(lang, "Restart server", "Sunucuyu yeniden başlat"))</h2> |
| 330 | - } else { | 332 | + <p class="row-status">(s(lang, "Stops gracefully and starts again, so a newly installed binary and every setting marked restart needed take effect. Needs a supervisor such as systemd to start it again.", "Düzgünce durdurup yeniden başlatır; böylece yeni kurulan ikili ve \"yeniden başlatma gerekli\" işaretli her ayar devreye girer. Yeniden başlatmak için systemd gibi bir gözetmen gerekir."))</p> |
| 331 | - <details class="confirm-inline"> | 333 | + if restart == Restart::Pending { |
| 332 | - <summary class="button danger">(s(lang, "Restart server", "Sunucuyu yeniden başlat"))</summary> | 334 | + <p class="row-status">(s(lang, "A restart is in progress.", "Yeniden başlatma sürüyor."))</p> |
| 333 | - <div class="confirm-pop"> | 335 | + } |
| 334 | - <p>(s(lang, "Restart the server now? Requests in flight finish first, and the site is unavailable for a few seconds.", "Sunucu şimdi yeniden başlatılsın mı? Süren istekler önce biter, site birkaç saniye kullanılamaz."))</p> | 336 | + </div> |
| 335 | - <form method="post" action="/admin/server/restart"> | 337 | + if restart != Restart::Pending { |
| 336 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | 338 | + <details class="row-action danger"> |
| 337 | - <input type="hidden" name="tab" value=(tab)> | 339 | + <summary>(s(lang, "Restart server", "Sunucuyu yeniden başlat"))</summary> |
| 338 | - <button type="submit" class="danger">(s(lang, "Yes, restart", "Evet, yeniden başlat"))</button> | 340 | + <div class="row-panel"> |
| 339 | - <button type="button" data-close-details="">(s(lang, "Cancel", "Vazgeç"))</button> | 341 | + <p>(s(lang, "Restart the server now? Requests in flight finish first, and the site is unavailable for a few seconds.", "Sunucu şimdi yeniden başlatılsın mı? Süren istekler önce biter, site birkaç saniye kullanılamaz."))</p> |
| 340 | - </form> | 342 | + <form method="post" action="/admin/server/restart"> |
| 341 | - </div> | 343 | + <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 342 | - </details> | 344 | + <input type="hidden" name="tab" value=(tab)> |
| 343 | - } | 345 | + <button type="submit" class="danger">(s(lang, "Yes, restart", "Evet, yeniden başlat"))</button> |
| 346 | + <button type="button" data-close-details="">(s(lang, "Cancel", "Vazgeç"))</button> | ||
| 347 | + </form> | ||
| 348 | + </div> | ||
| 349 | + </details> | ||
| 350 | + } | ||
| 351 | + </div> | ||
| 344 | </section> | 352 | </section> |
| 345 | </div> | 353 | </div> |
| 346 | }) | 354 | }) |
| @@ -886,7 +894,7 @@ mod tests { | |||
| 886 | // The page offers the button with a confirm step. | 894 | // The page offers the button with a confirm step. |
| 887 | let page = admin_get(&fx, "/admin/server").await; | 895 | let page = admin_get(&fx, "/admin/server").await; |
| 888 | assert!(page.contains("Restart server")); | 896 | assert!(page.contains("Restart server")); |
| 889 | - assert!(page.contains("confirm-inline")); | 897 | + assert!(page.contains("/admin/server/restart")); |
| 890 | assert!(!page.contains("Restarting...")); | 898 | assert!(!page.contains("Restarting...")); |
| 891 | 899 | ||
| 892 | let form = format!("csrf={CSRF}&tab=general"); | 900 | let form = format!("csrf={CSRF}&tab=general"); |
crates/forge-web/src/pages/admin_user_detail.rsmodified+118 -119
| @@ -193,140 +193,139 @@ async fn detail_body( | |||
| 193 | <div><dt>(s(lang, "Passkeys", "Geçiş anahtarları"))</dt><dd>(passkey_count.as_str())</dd></div> | 193 | <div><dt>(s(lang, "Passkeys", "Geçiş anahtarları"))</dt><dd>(passkey_count.as_str())</dd></div> |
| 194 | </dl> | 194 | </dl> |
| 195 | </section> | 195 | </section> |
| 196 | - <section class="card user-actions"> | 196 | + if let Some(message) = done { |
| 197 | - <h2>(at(lang, A::Actions))</h2> | 197 | + <section class="card notice" role="status"> |
| 198 | - if let Some(message) = done { | 198 | + <p>(message)</p> |
| 199 | - <p class="notice" role="status">(message)</p> | 199 | + </section> |
| 200 | - } | 200 | + } |
| 201 | - if let Some(message) = error { | 201 | + if let Some(message) = error { |
| 202 | - alert(message: message.as_str()) | 202 | + alert(message: message.as_str()) |
| 203 | - } | 203 | + } |
| 204 | - if let Some(link) = link { | 204 | + <section class="card rows-pane"> |
| 205 | - <p>(at(lang, A::ResetLinkReady))</p> | 205 | + if suspended { |
| 206 | - <code class="reset-link">(link.as_str())</code> | 206 | + <div class="row-line"> |
| 207 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0"/></svg> | ||
| 208 | + <div class="row-main"> | ||
| 209 | + <h2 class="row-title">(at(lang, A::Unsuspend))</h2> | ||
| 210 | + <p class="row-status">(suspended_note.as_str())</p> | ||
| 211 | + </div> | ||
| 212 | + <form method="post" action=(unsuspend_action.as_str()) class="row-form"> | ||
| 213 | + <input type="hidden" name="csrf" value=(csrf)> | ||
| 214 | + <button type="submit">(at(lang, A::Unsuspend))</button> | ||
| 215 | + </form> | ||
| 216 | + </div> | ||
| 207 | } | 217 | } |
| 208 | - <ul class="action-list"> | 218 | + <div class="row-line"> |
| 209 | - if suspended { | 219 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l8 3v6c0 4.5-3.4 8.3-8 9-4.6-.7-8-4.5-8-9V6z"/><path d="M9 12l2 2 4-4"/></svg> |
| 210 | - <li class="action-row"> | 220 | + <div class="row-main"> |
| 211 | - <div class="action-text"> | 221 | + <h2 class="row-title">(at(lang, A::Administrator))</h2> |
| 212 | - <h3>(at(lang, A::Unsuspend))</h3> | 222 | + <p class="row-status">(s(lang, "Opens the admin area: accounts, runners and server settings.", "Yönetim alanını açar: hesaplar, çalıştırıcılar ve sunucu ayarları."))</p> |
| 213 | - <p class="muted small">(suspended_note.as_str())</p> | 223 | + if last_admin { |
| 214 | - </div> | 224 | + <p class="row-status">(at(lang, A::AdminHelp))</p> |
| 215 | - <div class="action-control"> | 225 | + } |
| 216 | - <form method="post" action=(unsuspend_action.as_str())> | 226 | + </div> |
| 217 | - <input type="hidden" name="csrf" value=(csrf)> | 227 | + if !last_admin { |
| 218 | - <button type="submit">(at(lang, A::Unsuspend))</button> | 228 | + <form method="post" action=(admin_action.as_str()) class="row-form"> |
| 219 | - </form> | 229 | + <input type="hidden" name="csrf" value=(csrf)> |
| 220 | - </div> | 230 | + <input type="hidden" name="admin" value=(if is_admin { "0" } else { "1" })> |
| 221 | - </li> | 231 | + <button type="submit">(if is_admin { at(lang, A::RevokeAdmin) } else { at(lang, A::GrantAdmin) })</button> |
| 232 | + </form> | ||
| 222 | } | 233 | } |
| 223 | - <li class="action-row"> | 234 | + </div> |
| 224 | - <div class="action-text"> | 235 | + <div class="row-line"> |
| 225 | - <h3>(at(lang, A::Administrator))</h3> | 236 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></svg> |
| 226 | - <p class="muted small">(s(lang, "Opens the admin area: accounts, runners and server settings.", "Yönetim alanını açar: hesaplar, çalıştırıcılar ve sunucu ayarları."))</p> | 237 | + <div class="row-main"> |
| 227 | - </div> | 238 | + <h2 class="row-title">(at(lang, A::ResetPassword))</h2> |
| 228 | - <div class="action-control"> | 239 | + <p class="row-status">(at(lang, A::ResetHelp))</p> |
| 229 | - if last_admin { | 240 | + if let Some(link) = link { |
| 230 | - <p class="muted small">(at(lang, A::AdminHelp))</p> | 241 | + <p class="row-status">(at(lang, A::ResetLinkReady))</p> |
| 231 | - } else { | 242 | + <code class="reset-link">(link.as_str())</code> |
| 232 | - <form method="post" action=(admin_action.as_str())> | 243 | + } |
| 233 | - <input type="hidden" name="csrf" value=(csrf)> | 244 | + </div> |
| 234 | - <input type="hidden" name="admin" value=(if is_admin { "0" } else { "1" })> | 245 | + <form method="post" action=(reset_action.as_str()) class="row-form"> |
| 235 | - <button type="submit">(if is_admin { at(lang, A::RevokeAdmin) } else { at(lang, A::GrantAdmin) })</button> | 246 | + <input type="hidden" name="csrf" value=(csrf)> |
| 236 | - </form> | 247 | + <button type="submit">(at(lang, A::GenerateLink))</button> |
| 248 | + </form> | ||
| 249 | + </div> | ||
| 250 | + </section> | ||
| 251 | + <section class="card rows-pane security-danger"> | ||
| 252 | + <p class="security-danger-label">(i18n::t(lang, Key::DangerZone))</p> | ||
| 253 | + if !suspended { | ||
| 254 | + <div class="row-line"> | ||
| 255 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M10 9v6M14 9v6"/></svg> | ||
| 256 | + <div class="row-main"> | ||
| 257 | + <h2 class="row-title">(at(lang, A::Suspend))</h2> | ||
| 258 | + <p class="row-status">(at(lang, A::SuspendHelp))</p> | ||
| 259 | + if own { | ||
| 260 | + <p class="row-status">(at(lang, A::ErrSelf))</p> | ||
| 237 | } | 261 | } |
| 238 | </div> | 262 | </div> |
| 239 | - </li> | 263 | + if !own { |
| 240 | - <li class="action-row"> | 264 | + <details class="row-action danger"> |
| 241 | - <div class="action-text"> | 265 | + <summary>(at(lang, A::Suspend))</summary> |
| 242 | - <h3>(at(lang, A::ResetPassword))</h3> | 266 | + <div class="row-panel"> |
| 243 | - <p class="muted small">(at(lang, A::ResetHelp))</p> | 267 | + <form method="post" action=(suspend_action.as_str()) class="stack"> |
| 244 | - </div> | ||
| 245 | - <div class="action-control"> | ||
| 246 | - <form method="post" action=(reset_action.as_str())> | ||
| 247 | - <input type="hidden" name="csrf" value=(csrf)> | ||
| 248 | - <button type="submit">(at(lang, A::GenerateLink))</button> | ||
| 249 | - </form> | ||
| 250 | - </div> | ||
| 251 | - </li> | ||
| 252 | - </ul> | ||
| 253 | - </section> | ||
| 254 | - <section class="card user-danger"> | ||
| 255 | - <h2>(i18n::t(lang, Key::DangerZone))</h2> | ||
| 256 | - <ul class="action-list"> | ||
| 257 | - if !suspended { | ||
| 258 | - <li class="action-row"> | ||
| 259 | - <div class="action-text"> | ||
| 260 | - <h3>(at(lang, A::Suspend))</h3> | ||
| 261 | - <p class="muted small">(at(lang, A::SuspendHelp))</p> | ||
| 262 | - </div> | ||
| 263 | - <div class="action-control"> | ||
| 264 | - if own { | ||
| 265 | - <p class="action-note muted small">(at(lang, A::ErrSelf))</p> | ||
| 266 | - } else { | ||
| 267 | - <form method="post" action=(suspend_action.as_str()) class="action-form"> | ||
| 268 | <input type="hidden" name="csrf" value=(csrf)> | 268 | <input type="hidden" name="csrf" value=(csrf)> |
| 269 | - <label class="action-field"> | 269 | + <label> |
| 270 | <span>(at(lang, A::SuspendReason))</span> | 270 | <span>(at(lang, A::SuspendReason))</span> |
| 271 | <input type="text" name="reason" maxlength="300" autocomplete="off"> | 271 | <input type="text" name="reason" maxlength="300" autocomplete="off"> |
| 272 | </label> | 272 | </label> |
| 273 | <button type="submit" class="danger">(at(lang, A::Suspend))</button> | 273 | <button type="submit" class="danger">(at(lang, A::Suspend))</button> |
| 274 | </form> | 274 | </form> |
| 275 | - } | 275 | + </div> |
| 276 | - </div> | 276 | + </details> |
| 277 | - </li> | 277 | + } |
| 278 | + </div> | ||
| 279 | + } | ||
| 280 | + <div class="row-line"> | ||
| 281 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l8 3v6c0 4.5-3.4 8.3-8 9-4.6-.7-8-4.5-8-9V6z"/><path d="M9 9l6 6M15 9l-6 6"/></svg> | ||
| 282 | + <div class="row-main"> | ||
| 283 | + <h2 class="row-title">(at(lang, A::Disable2fa))</h2> | ||
| 284 | + <p class="row-status">(at(lang, A::Disable2faHelp))</p> | ||
| 285 | + if !tfa_on { | ||
| 286 | + <p class="row-status">(at(lang, A::TwoFactorNotOn))</p> | ||
| 287 | + } | ||
| 288 | + </div> | ||
| 289 | + if tfa_on { | ||
| 290 | + <form method="post" action=(tfa_action.as_str()) class="row-form"> | ||
| 291 | + <input type="hidden" name="csrf" value=(csrf)> | ||
| 292 | + <button type="submit" class="danger">(g::t(lang, K::Disable))</button> | ||
| 293 | + </form> | ||
| 278 | } | 294 | } |
| 279 | - <li class="action-row"> | 295 | + </div> |
| 280 | - <div class="action-text"> | 296 | + <div class="row-line"> |
| 281 | - <h3>(at(lang, A::Disable2fa))</h3> | 297 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="8" cy="15" r="4"/><path d="M11 12l9-9M17 6l3 3M14 9l3 3"/></svg> |
| 282 | - <p class="muted small">(at(lang, A::Disable2faHelp))</p> | 298 | + <div class="row-main"> |
| 283 | - </div> | 299 | + <h2 class="row-title">(s(lang, "Remove all passkeys", "Tüm geçiş anahtarlarını kaldır"))</h2> |
| 284 | - <div class="action-control"> | 300 | + <p class="row-status">(s(lang, "For a user who lost their devices. They can still sign in with a password.", "Cihazlarını kaybeden kullanıcı için. Parolayla girmeye devam edebilir."))</p> |
| 285 | - if tfa_on { | 301 | + if passkeys == 0 { |
| 286 | - <form method="post" action=(tfa_action.as_str())> | 302 | + <p class="row-status">(at(lang, A::NoPasskeysToRemove))</p> |
| 303 | + } | ||
| 304 | + </div> | ||
| 305 | + if passkeys > 0 { | ||
| 306 | + <details class="row-action danger"> | ||
| 307 | + <summary>(s(lang, "Remove", "Kaldır"))</summary> | ||
| 308 | + <div class="row-panel"> | ||
| 309 | + <p>(s(lang, "Remove every passkey of this user?", "Bu kullanıcının tüm geçiş anahtarları kaldırılsın mı?"))</p> | ||
| 310 | + <form method="post" action=(passkeys_action.as_str()) class="row-form"> | ||
| 287 | <input type="hidden" name="csrf" value=(csrf)> | 311 | <input type="hidden" name="csrf" value=(csrf)> |
| 288 | - <button type="submit" class="danger">(g::t(lang, K::Disable))</button> | 312 | + <button type="submit" class="danger">(s(lang, "Remove all", "Hepsini kaldır"))</button> |
| 313 | + <button type="button" data-close-details="">(s(lang, "Cancel", "Vazgeç"))</button> | ||
| 289 | </form> | 314 | </form> |
| 290 | - } else { | ||
| 291 | - <p class="action-note muted small">(at(lang, A::TwoFactorNotOn))</p> | ||
| 292 | - } | ||
| 293 | - </div> | ||
| 294 | - </li> | ||
| 295 | - <li class="action-row"> | ||
| 296 | - <div class="action-text"> | ||
| 297 | - <h3>(s(lang, "Remove all passkeys", "Tüm geçiş anahtarlarını kaldır"))</h3> | ||
| 298 | - <p class="muted small">(s(lang, "For a user who lost their devices. They can still sign in with a password.", "Cihazlarını kaybeden kullanıcı için. Parolayla girmeye devam edebilir."))</p> | ||
| 299 | - </div> | ||
| 300 | - <div class="action-control"> | ||
| 301 | - if passkeys > 0 { | ||
| 302 | - <details class="confirm-inline"> | ||
| 303 | - <summary class="button danger">(s(lang, "Remove", "Kaldır"))</summary> | ||
| 304 | - <div class="confirm-pop"> | ||
| 305 | - <p>(s(lang, "Remove every passkey of this user?", "Bu kullanıcının tüm geçiş anahtarları kaldırılsın mı?"))</p> | ||
| 306 | - <form method="post" action=(passkeys_action.as_str())> | ||
| 307 | - <input type="hidden" name="csrf" value=(csrf)> | ||
| 308 | - <button type="submit" class="danger">(s(lang, "Remove all", "Hepsini kaldır"))</button> | ||
| 309 | - <button type="button" data-close-details="">(s(lang, "Cancel", "Vazgeç"))</button> | ||
| 310 | - </form> | ||
| 311 | - </div> | ||
| 312 | - </details> | ||
| 313 | - } else { | ||
| 314 | - <p class="action-note muted small">(at(lang, A::NoPasskeysToRemove))</p> | ||
| 315 | - } | ||
| 316 | - </div> | ||
| 317 | - </li> | ||
| 318 | - if !own { | ||
| 319 | - <li class="action-row"> | ||
| 320 | - <div class="action-text"> | ||
| 321 | - <h3>(g::t(lang, K::DeleteUser))</h3> | ||
| 322 | - <p class="muted small">(at(lang, A::DeleteHelp))</p> | ||
| 323 | </div> | 315 | </div> |
| 324 | - <div class="action-control"> | 316 | + </details> |
| 325 | - <a class="button danger" href=(delete_href.as_str())>(i18n::t(lang, Key::Delete))</a> | ||
| 326 | - </div> | ||
| 327 | - </li> | ||
| 328 | } | 317 | } |
| 329 | - </ul> | 318 | + </div> |
| 319 | + if !own { | ||
| 320 | + <div class="row-line"> | ||
| 321 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4l9 16H3z"/><path d="M12 10v4M12 17v.5"/></svg> | ||
| 322 | + <div class="row-main"> | ||
| 323 | + <h2 class="row-title">(g::t(lang, K::DeleteUser))</h2> | ||
| 324 | + <p class="row-status">(at(lang, A::DeleteHelp))</p> | ||
| 325 | + </div> | ||
| 326 | + <a class="button danger" href=(delete_href.as_str())>(i18n::t(lang, Key::Delete))</a> | ||
| 327 | + </div> | ||
| 328 | + } | ||
| 330 | </section> | 329 | </section> |
| 331 | </div> | 330 | </div> |
| 332 | }) | 331 | }) |
crates/forge-web/src/pages/admin_users.rsmodified+89 -53
| @@ -52,6 +52,20 @@ fn is_ghost(user: &User) -> bool { | |||
| 52 | normalize_name(&user.username) == GHOST_USERNAME | 52 | normalize_name(&user.username) == GHOST_USERNAME |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | +/// One account row of the list, with the text and links it shows already decided. | ||
| 56 | +struct UserRow { | ||
| 57 | + href: String, | ||
| 58 | + delete_href: String, | ||
| 59 | + username: String, | ||
| 60 | + /// Organizations and the ghost account have no detail page to link to. | ||
| 61 | + linkable: bool, | ||
| 62 | + /// Nobody deletes their own account here, and the ghost account is never deleted. | ||
| 63 | + deletable: bool, | ||
| 64 | + email: String, | ||
| 65 | + role: String, | ||
| 66 | + created_at: String, | ||
| 67 | +} | ||
| 68 | + | ||
| 55 | #[component] | 69 | #[component] |
| 56 | async fn users_view( | 70 | async fn users_view( |
| 57 | lang: Lang, | 71 | lang: Lang, |
| @@ -60,67 +74,89 @@ async fn users_view( | |||
| 60 | users: Vec<User>, | 74 | users: Vec<User>, |
| 61 | error: Option<String>, | 75 | error: Option<String>, |
| 62 | ) -> Result<impl View> { | 76 | ) -> Result<impl View> { |
| 77 | + let rows: Vec<UserRow> = users | ||
| 78 | + .iter() | ||
| 79 | + .map(|user| UserRow { | ||
| 80 | + href: format!("/admin/users/{}", enc(&user.id)), | ||
| 81 | + delete_href: format!("/admin/users/{}/delete", enc(&user.id)), | ||
| 82 | + username: user.username.clone(), | ||
| 83 | + linkable: !(user.is_org() || is_ghost(user)), | ||
| 84 | + deletable: user.id != viewer_id && !is_ghost(user), | ||
| 85 | + email: user.email.clone().unwrap_or_default(), | ||
| 86 | + role: if user.is_org() { | ||
| 87 | + g::t(lang, K::RoleOrganization).to_owned() | ||
| 88 | + } else if user.is_admin { | ||
| 89 | + g::t(lang, K::RoleAdmin).to_owned() | ||
| 90 | + } else { | ||
| 91 | + g::t(lang, K::RoleUser).to_owned() | ||
| 92 | + }, | ||
| 93 | + created_at: user.created_at.clone(), | ||
| 94 | + }) | ||
| 95 | + .collect(); | ||
| 63 | Ok(view! { | 96 | Ok(view! { |
| 64 | <div data-live="/admin/users/events"> | 97 | <div data-live="/admin/users/events"> |
| 65 | <section class="page-head"> | 98 | <section class="page-head"> |
| 66 | <h1>(g::t(lang, K::Users))</h1> | 99 | <h1>(g::t(lang, K::Users))</h1> |
| 67 | </section> | 100 | </section> |
| 68 | - <section class="card fit-pane"> | 101 | + <section class="card rows-pane"> |
| 69 | - <div class="table-wrap"> | 102 | + <div class="row-line"> |
| 70 | - <table class="table queue-table"> | 103 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 71 | - <thead> | 104 | + <div class="row-main"> |
| 72 | - <tr><th>(i18n::t(lang, Key::Username))</th><th>(i18n::t(lang, Key::Email))</th><th>(g::t(lang, K::Role))</th><th>(i18n::t(lang, Key::Created))</th><th></th></tr> | 105 | + <h2 class="row-title">(g::t(lang, K::CreateAUser))</h2> |
| 73 | - </thead> | 106 | + </div> |
| 74 | - <tbody> | 107 | + <details class="row-action" open=(error.is_some())> |
| 75 | - for user in users.into_iter() { | 108 | + <summary>(g::t(lang, K::CreateUser))</summary> |
| 76 | - <tr> | 109 | + <div class="row-panel"> |
| 77 | - <td class="nowrap" data-label=(i18n::t(lang, Key::Username))> | 110 | + if let Some(message) = error { |
| 78 | - if user.is_org() || is_ghost(&user) { | 111 | + alert(message: message.as_str()) |
| 79 | - (user.username.clone()) | ||
| 80 | - } else { | ||
| 81 | - <a href=(format!("/admin/users/{}", enc(&user.id)))>(user.username.clone())</a> | ||
| 82 | - } | ||
| 83 | - </td> | ||
| 84 | - <td data-label=(i18n::t(lang, Key::Email))>(user.email.clone().unwrap_or_default())</td> | ||
| 85 | - <td data-label=(g::t(lang, K::Role))>(if user.is_org() { g::t(lang, K::RoleOrganization) } else if user.is_admin { g::t(lang, K::RoleAdmin) } else { g::t(lang, K::RoleUser) })</td> | ||
| 86 | - <td class="small nowrap" data-label=(i18n::t(lang, Key::Created))>rel_time(lang: lang, stamp: user.created_at.as_str())</td> | ||
| 87 | - <td> | ||
| 88 | - if user.id != viewer_id && !is_ghost(&user) { | ||
| 89 | - <a class="danger" href=(format!("/admin/users/{}/delete", enc(&user.id)))>(i18n::t(lang, Key::Delete))</a> | ||
| 90 | - } | ||
| 91 | - </td> | ||
| 92 | - </tr> | ||
| 93 | } | 112 | } |
| 94 | - </tbody> | 113 | + <form method="post" action="/admin/users" class="stack"> |
| 95 | - </table> | 114 | + <input type="hidden" name="csrf" value=(csrf)> |
| 115 | + <label> | ||
| 116 | + <span>(i18n::t(lang, Key::Username))</span> | ||
| 117 | + <input type="text" name="username" required=(true) autocomplete="off"> | ||
| 118 | + </label> | ||
| 119 | + <label> | ||
| 120 | + <span>(i18n::t(lang, Key::EmailOptional))</span> | ||
| 121 | + <input type="email" name="email" autocomplete="off"> | ||
| 122 | + </label> | ||
| 123 | + <label> | ||
| 124 | + <span>(i18n::t(lang, Key::Password))</span> | ||
| 125 | + <input type="password" name="password" required=(true) autocomplete="new-password"> | ||
| 126 | + <small class="muted">(g::t(lang, K::AtLeast12Chars))</small> | ||
| 127 | + </label> | ||
| 128 | + <label class="inline"> | ||
| 129 | + <input type="checkbox" name="is_admin" value="yes"> | ||
| 130 | + <span>(g::t(lang, K::Administrator))</span> | ||
| 131 | + </label> | ||
| 132 | + <button type="submit" class="primary">(g::t(lang, K::CreateUser))</button> | ||
| 133 | + </form> | ||
| 134 | + </div> | ||
| 135 | + </details> | ||
| 96 | </div> | 136 | </div> |
| 97 | - </section> | 137 | + for row in rows.into_iter() { |
| 98 | - <section class="card"> | 138 | + <div class="row-line"> |
| 99 | - <h2>(g::t(lang, K::CreateAUser))</h2> | 139 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 3.6-7 8-7s8 3 8 7"/></svg> |
| 100 | - if let Some(message) = error { | 140 | + <div class="row-main"> |
| 101 | - alert(message: message.as_str()) | 141 | + <strong class="row-name"> |
| 142 | + if row.linkable { | ||
| 143 | + <a href=(row.href.as_str())>(row.username.as_str())</a> | ||
| 144 | + } else { | ||
| 145 | + (row.username.as_str()) | ||
| 146 | + } | ||
| 147 | + </strong> | ||
| 148 | + <p class="row-status"> | ||
| 149 | + if !row.email.is_empty() { | ||
| 150 | + (row.email.as_str()) " · " | ||
| 151 | + } | ||
| 152 | + (row.role.as_str()) " · " rel_time(lang: lang, stamp: row.created_at.as_str()) | ||
| 153 | + </p> | ||
| 154 | + </div> | ||
| 155 | + if row.deletable { | ||
| 156 | + <a class="button danger" href=(row.delete_href.as_str())>(i18n::t(lang, Key::Delete))</a> | ||
| 157 | + } | ||
| 158 | + </div> | ||
| 102 | } | 159 | } |
| 103 | - <form method="post" action="/admin/users" class="stack"> | ||
| 104 | - <input type="hidden" name="csrf" value=(csrf)> | ||
| 105 | - <label> | ||
| 106 | - <span>(i18n::t(lang, Key::Username))</span> | ||
| 107 | - <input type="text" name="username" required=(true) autocomplete="off"> | ||
| 108 | - </label> | ||
| 109 | - <label> | ||
| 110 | - <span>(i18n::t(lang, Key::EmailOptional))</span> | ||
| 111 | - <input type="email" name="email" autocomplete="off"> | ||
| 112 | - </label> | ||
| 113 | - <label> | ||
| 114 | - <span>(i18n::t(lang, Key::Password))</span> | ||
| 115 | - <input type="password" name="password" required=(true) autocomplete="new-password"> | ||
| 116 | - <small class="muted">(g::t(lang, K::AtLeast12Chars))</small> | ||
| 117 | - </label> | ||
| 118 | - <label class="inline"> | ||
| 119 | - <input type="checkbox" name="is_admin" value="yes"> | ||
| 120 | - <span>(g::t(lang, K::Administrator))</span> | ||
| 121 | - </label> | ||
| 122 | - <button type="submit" class="primary">(g::t(lang, K::CreateUser))</button> | ||
| 123 | - </form> | ||
| 124 | </section> | 160 | </section> |
| 125 | </div> | 161 | </div> |
| 126 | }) | 162 | }) |
crates/forge-web/src/pages/ci_runs.rsmodified+51 -31
| @@ -1815,17 +1815,10 @@ fn query_value(cx: &Cx, key: &str) -> Option<String> { | |||
| 1815 | .map(|(_, value)| value.into_owned()) | 1815 | .map(|(_, value)| value.into_owned()) |
| 1816 | } | 1816 | } |
| 1817 | 1817 | ||
| 1818 | -/// The runs page body. The header (the Run workflow and badge menus, the count) is the list's, and the | 1818 | +/// The runs list: its head with the Run workflow and badge menus, the rows and the pager. The list page |
| 1819 | -/// split view sits in the live region. The selected run is marked in the list and drawn on the right. | 1819 | +/// and a run's page both keep it at the left, so moving between runs never loses it. |
| 1820 | #[component] | 1820 | #[component] |
| 1821 | -async fn runs_body( | 1821 | +async fn run_side(lang: Lang, list: ListView) -> Result<impl View> { |
| 1822 | - head: RepoHead, | ||
| 1823 | - lang: Lang, | ||
| 1824 | - notice: Option<(&'static str, bool)>, | ||
| 1825 | - live: Option<String>, | ||
| 1826 | - list: ListView, | ||
| 1827 | - detail: Option<RunDetail>, | ||
| 1828 | -) -> Result<impl View> { | ||
| 1829 | let ListView { | 1822 | let ListView { |
| 1830 | manual, | 1823 | manual, |
| 1831 | badge, | 1824 | badge, |
| @@ -1837,24 +1830,7 @@ async fn runs_body( | |||
| 1837 | page_label, | 1830 | page_label, |
| 1838 | next_scheduled, | 1831 | next_scheduled, |
| 1839 | } = list; | 1832 | } = list; |
| 1840 | - let (fm, fs) = duration_templates(lang); | ||
| 1841 | Ok(view! { | 1833 | Ok(view! { |
| 1842 | - repo_head(head: RepoHead { live: String::new(), ..head }) | ||
| 1843 | - if let Some((text, is_error)) = notice { | ||
| 1844 | - if is_error { | ||
| 1845 | - alert(message: text) | ||
| 1846 | - } else { | ||
| 1847 | - <section class="card notice" role="status">(text)</section> | ||
| 1848 | - } | ||
| 1849 | - } | ||
| 1850 | - <div data-live=(live.as_deref()) class="ci-split fit-pane" data-now=(now_unix().to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())> | ||
| 1851 | - <svg class="ci-defs" width="0" height="0" focusable="false" aria-hidden="true"> | ||
| 1852 | - <defs> | ||
| 1853 | - <pattern id="ci-hatch" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"> | ||
| 1854 | - <rect class="ci-hatch-ink" width="3" height="6"/> | ||
| 1855 | - </pattern> | ||
| 1856 | - </defs> | ||
| 1857 | - </svg> | ||
| 1858 | <section class="card ci-side"> | 1834 | <section class="card ci-side"> |
| 1859 | <div class="ci-side-head"> | 1835 | <div class="ci-side-head"> |
| 1860 | <h2 class="ci-side-title">(g::t(lang, K::Runs)) <span class="ci-count">(total)</span></h2> | 1836 | <h2 class="ci-side-title">(g::t(lang, K::Runs)) <span class="ci-count">(total)</span></h2> |
| @@ -1941,6 +1917,39 @@ async fn runs_body( | |||
| 1941 | </nav> | 1917 | </nav> |
| 1942 | } | 1918 | } |
| 1943 | </section> | 1919 | </section> |
| 1920 | + }) | ||
| 1921 | +} | ||
| 1922 | + | ||
| 1923 | +/// The runs page body. The header (the Run workflow and badge menus, the count) is the list's, and the | ||
| 1924 | +/// split view sits in the live region. The selected run is marked in the list and drawn on the right. | ||
| 1925 | +#[component] | ||
| 1926 | +async fn runs_body( | ||
| 1927 | + head: RepoHead, | ||
| 1928 | + lang: Lang, | ||
| 1929 | + notice: Option<(&'static str, bool)>, | ||
| 1930 | + live: Option<String>, | ||
| 1931 | + list: ListView, | ||
| 1932 | + detail: Option<RunDetail>, | ||
| 1933 | +) -> Result<impl View> { | ||
| 1934 | + let (fm, fs) = duration_templates(lang); | ||
| 1935 | + Ok(view! { | ||
| 1936 | + repo_head(head: RepoHead { live: String::new(), ..head }) | ||
| 1937 | + if let Some((text, is_error)) = notice { | ||
| 1938 | + if is_error { | ||
| 1939 | + alert(message: text) | ||
| 1940 | + } else { | ||
| 1941 | + <section class="card notice" role="status">(text)</section> | ||
| 1942 | + } | ||
| 1943 | + } | ||
| 1944 | + <div data-live=(live.as_deref()) class="ci-split fit-pane" data-now=(now_unix().to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())> | ||
| 1945 | + <svg class="ci-defs" width="0" height="0" focusable="false" aria-hidden="true"> | ||
| 1946 | + <defs> | ||
| 1947 | + <pattern id="ci-hatch" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"> | ||
| 1948 | + <rect class="ci-hatch-ink" width="3" height="6"/> | ||
| 1949 | + </pattern> | ||
| 1950 | + </defs> | ||
| 1951 | + </svg> | ||
| 1952 | + run_side(lang: lang, list: list) | ||
| 1944 | <section class="ci-detail"> | 1953 | <section class="ci-detail"> |
| 1945 | if let Some(run) = detail { | 1954 | if let Some(run) = detail { |
| 1946 | run_head(lang: lang, run: &run, all_href: None) | 1955 | run_head(lang: lang, run: &run, all_href: None) |
| @@ -2091,7 +2100,7 @@ async fn run_head(lang: Lang, run: &RunDetail, all_href: Option<String>) -> Resu | |||
| 2091 | } | 2100 | } |
| 2092 | <time class="muted" datetime=(run.when_at.as_str()) data-rel="true">(run.when.as_str())</time> | 2101 | <time class="muted" datetime=(run.when_at.as_str()) data-rel="true">(run.when.as_str())</time> |
| 2093 | if let Some(href) = all_href { | 2102 | if let Some(href) = all_href { |
| 2094 | - <a class="small" href=(href.as_str())>(tl::t(lang, TK::AllRuns))</a> | 2103 | + <a class="small ci-all-runs" href=(href.as_str())>(tl::t(lang, TK::AllRuns))</a> |
| 2095 | } | 2104 | } |
| 2096 | </div> | 2105 | </div> |
| 2097 | if let Some(est) = run.est.as_ref() { | 2106 | if let Some(est) = run.est.as_ref() { |
| @@ -2261,6 +2270,7 @@ async fn run_body( | |||
| 2261 | bars: Vec<StripBar>, | 2270 | bars: Vec<StripBar>, |
| 2262 | timeline: bool, | 2271 | timeline: bool, |
| 2263 | all_href: String, | 2272 | all_href: String, |
| 2273 | + list: ListView, | ||
| 2264 | ) -> Result<impl View> { | 2274 | ) -> Result<impl View> { |
| 2265 | let (fm, fs) = duration_templates(lang); | 2275 | let (fm, fs) = duration_templates(lang); |
| 2266 | Ok(view! { | 2276 | Ok(view! { |
| @@ -2272,7 +2282,16 @@ async fn run_body( | |||
| 2272 | <section class="card notice" role="status">(text)</section> | 2282 | <section class="card notice" role="status">(text)</section> |
| 2273 | } | 2283 | } |
| 2274 | } | 2284 | } |
| 2275 | - <div data-live=(live.as_deref()) class="ci-run fit-pane" data-run=(run.number) data-now=(now_unix().to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())> | 2285 | + <div data-live=(live.as_deref()) class="ci-split fit-pane" data-now=(now_unix().to_string()) data-fm=(fm.as_str()) data-fs=(fs.as_str())> |
| 2286 | + <svg class="ci-defs" width="0" height="0" focusable="false" aria-hidden="true"> | ||
| 2287 | + <defs> | ||
| 2288 | + <pattern id="ci-hatch" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"> | ||
| 2289 | + <rect class="ci-hatch-ink" width="3" height="6"/> | ||
| 2290 | + </pattern> | ||
| 2291 | + </defs> | ||
| 2292 | + </svg> | ||
| 2293 | + run_side(lang: lang, list: list) | ||
| 2294 | + <div class="ci-run" data-run=(run.number)> | ||
| 2276 | run_head(lang: lang, run: &run, all_href: Some(all_href)) | 2295 | run_head(lang: lang, run: &run, all_href: Some(all_href)) |
| 2277 | <div class="ci-tl-main"> | 2296 | <div class="ci-tl-main"> |
| 2278 | run_jobs(lang: lang, run: &run) | 2297 | run_jobs(lang: lang, run: &run) |
| @@ -2284,6 +2303,7 @@ async fn run_body( | |||
| 2284 | history_strip(lang: lang, owner: owner, repo: repo, bars: bars) | 2303 | history_strip(lang: lang, owner: owner, repo: repo, bars: bars) |
| 2285 | </div> | 2304 | </div> |
| 2286 | </section> | 2305 | </section> |
| 2306 | + </div> | ||
| 2287 | </div> | 2307 | </div> |
| 2288 | }) | 2308 | }) |
| 2289 | } | 2309 | } |
| @@ -2321,7 +2341,7 @@ async fn run_page(cx: &Cx) -> Result<impl View> { | |||
| 2321 | notice, | 2341 | notice, |
| 2322 | live, | 2342 | live, |
| 2323 | page_title, | 2343 | page_title, |
| 2324 | - list: _, | 2344 | + list, |
| 2325 | detail, | 2345 | detail, |
| 2326 | } = runs_split(cx, Some(&number), wanted.as_deref()).await?; | 2346 | } = runs_split(cx, Some(&number), wanted.as_deref()).await?; |
| 2327 | let Some(run) = detail else { | 2347 | let Some(run) = detail else { |
| @@ -2335,7 +2355,7 @@ async fn run_page(cx: &Cx) -> Result<impl View> { | |||
| 2335 | let all_href = ci_href(&title_of(&ctx)); | 2355 | let all_href = ci_href(&title_of(&ctx)); |
| 2336 | Ok(view! { | 2356 | Ok(view! { |
| 2337 | shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(), | 2357 | shell(title: page_title.as_str(), viewer: ctx.viewer.as_ref(), |
| 2338 | - run_body(head: head, lang: lang, notice: notice, live: live, run: run, owner: owner, repo: repo, bars: bars, timeline: timeline, all_href: all_href)) | 2358 | + run_body(head: head, lang: lang, notice: notice, live: live, run: run, owner: owner, repo: repo, bars: bars, list: list, timeline: timeline, all_href: all_href)) |
| 2339 | }) | 2359 | }) |
| 2340 | } | 2360 | } |
| 2341 | 2361 | ||
crates/forge-web/src/pages/ci_tests.rsmodified+6 -5
| @@ -572,13 +572,13 @@ async fn split_view_draws_the_newest_run_or_the_one_named() { | |||
| 572 | .await | 572 | .await |
| 573 | .text(); | 573 | .text(); |
| 574 | assert!(named.contains(&format!("data-run=\"{}\"", first.number))); | 574 | assert!(named.contains(&format!("data-run=\"{}\"", first.number))); |
| 575 | - // The run page is the focused view now: it links back to the list, and its one aria-current is the | 575 | + // The run page keeps the list beside it, so the run row and the selected job are both marked. On a |
| 576 | - // selected job, not a run row. | 576 | + // phone the list gives way to the All runs link. |
| 577 | assert!( | 577 | assert!( |
| 578 | named.contains(&format!("href=\"{RUN_BASE}\"")), | 578 | named.contains(&format!("href=\"{RUN_BASE}\"")), |
| 579 | "All runs link" | 579 | "All runs link" |
| 580 | ); | 580 | ); |
| 581 | - assert_eq!(named.matches("aria-current=\"true\"").count(), 1); | 581 | + assert_eq!(named.matches("aria-current=\"true\"").count(), 2); |
| 582 | 582 | ||
| 583 | // Thirty runs make two pages. Run 1 is on page 2, so page 1 marks no row and draws run 1. | 583 | // Thirty runs make two pages. Run 1 is on page 2, so page 1 marks no row and draws run 1. |
| 584 | for _ in 0..28 { | 584 | for _ in 0..28 { |
| @@ -592,8 +592,9 @@ async fn split_view_draws_the_newest_run_or_the_one_named() { | |||
| 592 | .await | 592 | .await |
| 593 | .text(); | 593 | .text(); |
| 594 | assert!(off_page.contains(&format!("data-run=\"{}\"", first.number))); | 594 | assert!(off_page.contains(&format!("data-run=\"{}\"", first.number))); |
| 595 | - // The focused run page draws no run list, so no row can be marked there. | 595 | + // The list shows the newest page, which does not hold this run: only its selected job is marked. |
| 596 | - assert!(!off_page.contains("ci-run-list")); | 596 | + assert!(off_page.contains("ci-run-list")); |
| 597 | + assert_eq!(off_page.matches("aria-current=\"true\"").count(), 1); | ||
| 597 | assert!(off_page.contains(&format!("data-live=\"{RUN_BASE}/events\""))); | 598 | assert!(off_page.contains(&format!("data-live=\"{RUN_BASE}/events\""))); |
| 598 | let rows = get(&fx.app, &format!("{RUN_BASE}?page=2"), tahinli.as_deref()) | 599 | let rows = get(&fx.app, &format!("{RUN_BASE}?page=2"), tahinli.as_deref()) |
| 599 | .await | 600 | .await |
crates/forge-web/src/pages/discussion_settings.rsmodified+11 -12
| @@ -23,7 +23,8 @@ use crate::views::repo_href; | |||
| 23 | path_param!(owner); | 23 | path_param!(owner); |
| 24 | path_param!(repo); | 24 | path_param!(repo); |
| 25 | 25 | ||
| 26 | -/// The settings card with the on/off button. `enabled` is the current state. | 26 | +/// The settings card: one switch row. `enabled` is the current state. The switch submits the form |
| 27 | +/// on change (`data-autosubmit`); an unchecked box sends no `enabled`, which the handler reads as off. | ||
| 27 | #[component] | 28 | #[component] |
| 28 | pub(crate) async fn discussions_card( | 29 | pub(crate) async fn discussions_card( |
| 29 | lang: Lang, | 30 | lang: Lang, |
| @@ -32,18 +33,16 @@ pub(crate) async fn discussions_card( | |||
| 32 | enabled: bool, | 33 | enabled: bool, |
| 33 | ) -> Result<impl View> { | 34 | ) -> Result<impl View> { |
| 34 | Ok(view! { | 35 | Ok(view! { |
| 35 | - <section class="settings-section" id="discussions"> | 36 | + <section class="card rows-pane" id="discussions"> |
| 36 | - <h2>(g::t(lang, K::Discussions))</h2> | 37 | + <form method="post" action=(action.as_str()) class="row-line row-field"> |
| 37 | - <p class="muted small">(g::t(lang, K::DiscussionsDescription))</p> | ||
| 38 | - <form method="post" action=(action.as_str()) class="inline-form"> | ||
| 39 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 38 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 40 | - if enabled { | 39 | + <span class="row-main"> |
| 41 | - <input type="hidden" name="enabled" value="0"> | 40 | + <span class="row-title" id="discussions-switch-label">(g::t(lang, K::Discussions))</span> |
| 42 | - <button type="submit">(g::t(lang, K::TurnOffDiscussions))</button> | 41 | + <span class="row-status">(g::t(lang, K::DiscussionsDescription))</span> |
| 43 | - } else { | 42 | + </span> |
| 44 | - <input type="hidden" name="enabled" value="1"> | 43 | + <span class="row-control"> |
| 45 | - <button type="submit">(g::t(lang, K::TurnOnDiscussions))</button> | 44 | + <input type="checkbox" name="enabled" value="1" checked=(enabled) data-autosubmit="true" aria-labelledby="discussions-switch-label"> |
| 46 | - } | 45 | + </span> |
| 47 | </form> | 46 | </form> |
| 48 | </section> | 47 | </section> |
| 49 | }) | 48 | }) |
crates/forge-web/src/pages/invites.rsmodified+24 -12
| @@ -16,6 +16,7 @@ use crate::auth::check_csrf; | |||
| 16 | use crate::i18n::{self, Key, Lang, t}; | 16 | use crate::i18n::{self, Key, Lang, t}; |
| 17 | use crate::mail::account; | 17 | use crate::mail::account; |
| 18 | use crate::pages::admin_users::admin_only; | 18 | use crate::pages::admin_users::admin_only; |
| 19 | +use crate::pages::passkeys::s; | ||
| 19 | use crate::state::AppState; | 20 | use crate::state::AppState; |
| 20 | use crate::views::{alert, shell, user_facing_message}; | 21 | use crate::views::{alert, shell, user_facing_message}; |
| 21 | 22 | ||
| @@ -44,18 +45,29 @@ async fn invite_body( | |||
| 44 | <p>(message)</p> | 45 | <p>(message)</p> |
| 45 | </section> | 46 | </section> |
| 46 | } | 47 | } |
| 47 | - <section class="card"> | 48 | + <section class="card rows-pane"> |
| 48 | - if let Some(message) = error { | 49 | + <div class="row-line"> |
| 49 | - alert(message: message.as_str()) | 50 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 50 | - } | 51 | + <div class="row-main"> |
| 51 | - <form method="post" action="/admin/invites" class="stack"> | 52 | + <h2 class="row-title">(s(lang, "Invite by email", "E-posta ile davet et"))</h2> |
| 52 | - <input type="hidden" name="csrf" value=(csrf)> | 53 | + </div> |
| 53 | - <label> | 54 | + <details class="row-action" open=(error.is_some())> |
| 54 | - <span>(t(lang, Key::Email))</span> | 55 | + <summary>(t(lang, Key::InvitesSubmit))</summary> |
| 55 | - <input type="email" name="email" autocomplete="off" maxlength="254" required=(true)> | 56 | + <div class="row-panel"> |
| 56 | - </label> | 57 | + if let Some(message) = error { |
| 57 | - <button type="submit" class="primary">(t(lang, Key::InvitesSubmit))</button> | 58 | + alert(message: message.as_str()) |
| 58 | - </form> | 59 | + } |
| 60 | + <form method="post" action="/admin/invites" class="stack"> | ||
| 61 | + <input type="hidden" name="csrf" value=(csrf)> | ||
| 62 | + <label> | ||
| 63 | + <span>(t(lang, Key::Email))</span> | ||
| 64 | + <input type="email" name="email" autocomplete="off" maxlength="254" required=(true)> | ||
| 65 | + </label> | ||
| 66 | + <button type="submit" class="primary">(t(lang, Key::InvitesSubmit))</button> | ||
| 67 | + </form> | ||
| 68 | + </div> | ||
| 69 | + </details> | ||
| 70 | + </div> | ||
| 59 | </section> | 71 | </section> |
| 60 | }) | 72 | }) |
| 61 | } | 73 | } |
crates/forge-web/src/pages/labels_page.rsmodified+86 -75
| @@ -22,7 +22,7 @@ use crate::pages::repo::repo_head; | |||
| 22 | use crate::pages::repo_ctx::load_repo; | 22 | use crate::pages::repo_ctx::load_repo; |
| 23 | use crate::state::AppState; | 23 | use crate::state::AppState; |
| 24 | use crate::views::repo_list::{PageLink, pager, pager_links}; | 24 | use crate::views::repo_list::{PageLink, pager, pager_links}; |
| 25 | -use crate::views::{empty_state, enc, shell}; | 25 | +use crate::views::{enc, shell}; |
| 26 | 26 | ||
| 27 | path_param!(owner); | 27 | path_param!(owner); |
| 28 | path_param!(repo); | 28 | path_param!(repo); |
| @@ -98,88 +98,99 @@ async fn labels_body( | |||
| 98 | if archived { | 98 | if archived { |
| 99 | <section class="card notice" role="status">(g::t(lang, K::LabelsArchived))</section> | 99 | <section class="card notice" role="status">(g::t(lang, K::LabelsArchived))</section> |
| 100 | } | 100 | } |
| 101 | - <div class="fit-split"> | 101 | + <div class="list-bar"> |
| 102 | - <section class="card fit-pane fit-card fit-main lang-list" data-live=(live.as_str()) data-live-now=""> | 102 | + issue_subnav(lang: lang, title: frame.title.clone(), active: "labels".to_owned()) |
| 103 | + </div> | ||
| 104 | + <section class="card rows-pane lang-list" data-live=(live.as_str()) data-live-now=""> | ||
| 103 | <h2 class="sr-only">(g::t(lang, K::Labels))</h2> | 105 | <h2 class="sr-only">(g::t(lang, K::Labels))</h2> |
| 104 | - <div class="list-bar"> | 106 | + if can_triage { |
| 105 | - issue_subnav(lang: lang, title: frame.title.clone(), active: "labels".to_owned()) | 107 | + <div class="row-line"> |
| 106 | - </div> | 108 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 107 | - if empty { | 109 | + <div class="row-main"> |
| 108 | - empty_state(title: g::t(lang, K::NoLabelsYet), | 110 | + <h2 class="row-title">(g::t(lang, K::NewLabel))</h2> |
| 109 | - if can_triage && !archived { | 111 | + if empty { |
| 110 | - <form method="post" action=(defaults_action.as_str()) class="stack"> | 112 | + <p class="row-status">(g::t(lang, K::NoLabelsYet))</p> |
| 113 | + } | ||
| 114 | + </div> | ||
| 115 | + if empty && !archived { | ||
| 116 | + <form method="post" action=(defaults_action.as_str()) class="row-form"> | ||
| 111 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 117 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 112 | - <div> | 118 | + <button type="submit">(g::t(lang, K::AddDefaultLabels))</button> |
| 113 | - <button type="submit">(g::t(lang, K::AddDefaultLabels))</button> | 119 | + </form> |
| 120 | + } | ||
| 121 | + <details class="row-action"> | ||
| 122 | + <summary>(g::t(lang, K::CreateLabel))</summary> | ||
| 123 | + <div class="row-panel"> | ||
| 124 | + <form method="post" action=(labels_action.as_str()) class="stack"> | ||
| 125 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 126 | + <label> | ||
| 127 | + <span>(g::t(lang, K::Name))</span> | ||
| 128 | + <input type="text" name="name" autocomplete="off" required=(true) maxlength="50"> | ||
| 129 | + </label> | ||
| 130 | + <label> | ||
| 131 | + <span>(g::t(lang, K::Color))</span> | ||
| 132 | + <input type="color" name="color" value="#ededed"> | ||
| 133 | + </label> | ||
| 134 | + <label> | ||
| 135 | + <span>(g::t(lang, K::Description))</span> | ||
| 136 | + <input type="text" name="description" autocomplete="off" maxlength="500"> | ||
| 137 | + </label> | ||
| 138 | + <button type="submit" class="primary">(g::t(lang, K::CreateLabel))</button> | ||
| 139 | + </form> | ||
| 140 | + </div> | ||
| 141 | + </details> | ||
| 142 | + </div> | ||
| 143 | + } else if empty { | ||
| 144 | + <div class="row-line"> | ||
| 145 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> | ||
| 146 | + <div class="row-main"> | ||
| 147 | + <h2 class="row-title">(g::t(lang, K::NoLabelsYet))</h2> | ||
| 148 | + </div> | ||
| 149 | + </div> | ||
| 150 | + } | ||
| 151 | + for row in rows.iter() { | ||
| 152 | + <div class="row-line" data-kb-row=""> | ||
| 153 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M20.6 13.4 13.4 20.6a2 2 0 0 1-2.8 0L3 13V3h10l7.6 7.6a2 2 0 0 1 0 2.8z"/><circle cx="7.5" cy="7.5" r="1.5"/></svg> | ||
| 154 | + <div class="row-main"> | ||
| 155 | + <strong class="row-name"><a class=(row.chip_class.as_str()) href=(row.issues_href.as_str())>(row.name.as_str())</a></strong> | ||
| 156 | + <p class="row-status"> | ||
| 157 | + if !row.description.is_empty() { | ||
| 158 | + <span>(row.description.as_str())</span> " \u{b7} " | ||
| 159 | + } | ||
| 160 | + <a class="label-open" href=(row.issues_href.as_str())>(row.open_text.as_str())</a> | ||
| 161 | + </p> | ||
| 162 | + </div> | ||
| 163 | + if can_triage { | ||
| 164 | + <details class="row-action"> | ||
| 165 | + <summary>(g::t(lang, K::Edit))</summary> | ||
| 166 | + <div class="row-panel"> | ||
| 167 | + <form method="post" action=(row.edit_action.as_str()) class="label-edit-form"> | ||
| 168 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 169 | + <label> | ||
| 170 | + <span>(g::t(lang, K::Name))</span> | ||
| 171 | + <input type="text" name="name" value=(row.name.as_str()) autocomplete="off" required=(true)> | ||
| 172 | + </label> | ||
| 173 | + <label> | ||
| 174 | + <span>(g::t(lang, K::Color))</span> | ||
| 175 | + <input type="color" name="color" value=(row.color.as_str())> | ||
| 176 | + </label> | ||
| 177 | + <label> | ||
| 178 | + <span>(g::t(lang, K::Description))</span> | ||
| 179 | + <input type="text" name="description" value=(row.description.as_str()) autocomplete="off" maxlength="500"> | ||
| 180 | + </label> | ||
| 181 | + <button type="submit">(g::t(lang, K::SaveLabel))</button> | ||
| 182 | + </form> | ||
| 114 | </div> | 183 | </div> |
| 184 | + </details> | ||
| 185 | + <form method="post" action=(row.delete_action.as_str()) class="row-form"> | ||
| 186 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 187 | + <button type="submit" class="danger">(g::t(lang, K::Delete))</button> | ||
| 115 | </form> | 188 | </form> |
| 116 | } | 189 | } |
| 117 | - ) | 190 | + </div> |
| 118 | } | 191 | } |
| 119 | - <div class="fit-scroll"> | ||
| 120 | - <ul class="label-list"> | ||
| 121 | - for row in rows.iter() { | ||
| 122 | - <li class="label-row" data-kb-row=""> | ||
| 123 | - <a class=(row.chip_class.as_str()) href=(row.issues_href.as_str())>(row.name.as_str())</a> | ||
| 124 | - <p class="muted small label-desc" title=(row.description.as_str())>(row.description.as_str())</p> | ||
| 125 | - <a class="small label-open" href=(row.issues_href.as_str())>(row.open_text.as_str())</a> | ||
| 126 | - if can_triage { | ||
| 127 | - <details class="label-edit"> | ||
| 128 | - <summary>(g::t(lang, K::Edit))</summary> | ||
| 129 | - <div class="label-edit-body"> | ||
| 130 | - <form method="post" action=(row.edit_action.as_str()) class="label-edit-form"> | ||
| 131 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 132 | - <label> | ||
| 133 | - <span>(g::t(lang, K::Name))</span> | ||
| 134 | - <input type="text" name="name" value=(row.name.as_str()) autocomplete="off" required=(true)> | ||
| 135 | - </label> | ||
| 136 | - <label> | ||
| 137 | - <span>(g::t(lang, K::Color))</span> | ||
| 138 | - <input type="color" name="color" value=(row.color.as_str())> | ||
| 139 | - </label> | ||
| 140 | - <label> | ||
| 141 | - <span>(g::t(lang, K::Description))</span> | ||
| 142 | - <input type="text" name="description" value=(row.description.as_str()) autocomplete="off" maxlength="500"> | ||
| 143 | - </label> | ||
| 144 | - <button type="submit">(g::t(lang, K::SaveLabel))</button> | ||
| 145 | - </form> | ||
| 146 | - <form method="post" action=(row.delete_action.as_str()) class="remove-form"> | ||
| 147 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 148 | - <button type="submit" class="danger">(g::t(lang, K::Delete))</button> | ||
| 149 | - </form> | ||
| 150 | - </div> | ||
| 151 | - </details> | ||
| 152 | - } | ||
| 153 | - </li> | ||
| 154 | - } | ||
| 155 | - </ul> | ||
| 156 | - </div> | ||
| 157 | pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang) | 192 | pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang) |
| 158 | </section> | 193 | </section> |
| 159 | - if can_triage { | ||
| 160 | - <section class="card fit-side lang-side"> | ||
| 161 | - <h2>(g::t(lang, K::NewLabel))</h2> | ||
| 162 | - <form method="post" action=(labels_action.as_str()) class="stack"> | ||
| 163 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 164 | - <label> | ||
| 165 | - <span>(g::t(lang, K::Name))</span> | ||
| 166 | - <input type="text" name="name" autocomplete="off" required=(true) maxlength="50"> | ||
| 167 | - </label> | ||
| 168 | - <label> | ||
| 169 | - <span>(g::t(lang, K::Color))</span> | ||
| 170 | - <input type="color" name="color" value="#ededed"> | ||
| 171 | - </label> | ||
| 172 | - <label> | ||
| 173 | - <span>(g::t(lang, K::Description))</span> | ||
| 174 | - <input type="text" name="description" autocomplete="off" maxlength="500"> | ||
| 175 | - </label> | ||
| 176 | - <div> | ||
| 177 | - <button type="submit" class="primary">(g::t(lang, K::CreateLabel))</button> | ||
| 178 | - </div> | ||
| 179 | - </form> | ||
| 180 | - </section> | ||
| 181 | - } | ||
| 182 | - </div> | ||
| 183 | }) | 194 | }) |
| 184 | } | 195 | } |
| 185 | 196 | ||
crates/forge-web/src/pages/milestones_page.rsmodified+69 -70
| @@ -26,7 +26,7 @@ use crate::pages::repo_ctx::load_repo; | |||
| 26 | use crate::render::markdown::render_markdown; | 26 | use crate::render::markdown::render_markdown; |
| 27 | use crate::state::AppState; | 27 | use crate::state::AppState; |
| 28 | use crate::views::repo_list::{PageLink, pager, pager_links}; | 28 | use crate::views::repo_list::{PageLink, pager, pager_links}; |
| 29 | -use crate::views::{empty_state, enc, shell}; | 29 | +use crate::views::{enc, shell}; |
| 30 | 30 | ||
| 31 | path_param!(owner); | 31 | path_param!(owner); |
| 32 | path_param!(repo); | 32 | path_param!(repo); |
| @@ -133,64 +133,38 @@ async fn milestone_row( | |||
| 133 | let open_text = g::open_milestone_count(lang, row.open); | 133 | let open_text = g::open_milestone_count(lang, row.open); |
| 134 | let closed_text = g::closed_milestone_count(lang, row.closed); | 134 | let closed_text = g::closed_milestone_count(lang, row.closed); |
| 135 | Ok(view! { | 135 | Ok(view! { |
| 136 | - <li class="milestone-row" data-kb-row=""> | 136 | + <div class="row-line" data-kb-row=""> |
| 137 | - <h3><a href=(row.edit_href.as_str())>(row.title.as_str())</a></h3> | 137 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 21V4"/><path d="M5 4h11l-2 4 2 4H5"/></svg> |
| 138 | - <p class="muted small"> | 138 | + <div class="row-main"> |
| 139 | - if let Some(due) = row.due.as_deref() { | 139 | + <strong class="row-name">(row.title.as_str())</strong> |
| 140 | - (g::due_text(lang, due)) | 140 | + <p class="row-status"> |
| 141 | - if row.overdue { | 141 | + if let Some(due) = row.due.as_deref() { |
| 142 | - " " <span class="badge overdue">(g::t(lang, K::Overdue))</span> | 142 | + (g::due_text(lang, due)) |
| 143 | + if row.overdue { | ||
| 144 | + " " <span class="badge overdue">(g::t(lang, K::Overdue))</span> | ||
| 145 | + } | ||
| 146 | + } else { | ||
| 147 | + (g::t(lang, K::NoDueDate)) | ||
| 143 | } | 148 | } |
| 144 | - } else { | 149 | + " \u{b7} " |
| 145 | - (g::t(lang, K::NoDueDate)) | 150 | + <progress value=(row.closed) max=(max)></progress> |
| 146 | - } | 151 | + " " |
| 147 | - </p> | ||
| 148 | - if !row.description_html.is_empty() { | ||
| 149 | - <div class="markdown-body">(Unescaped::new_unchecked(row.description_html.clone()))</div> | ||
| 150 | - } | ||
| 151 | - <div class="milestone-progress"> | ||
| 152 | - <progress value=(row.closed) max=(max)></progress> | ||
| 153 | - <span class="small"> | ||
| 154 | <a href=(row.open_href.as_str())>(open_text.as_str())</a> | 152 | <a href=(row.open_href.as_str())>(open_text.as_str())</a> |
| 155 | " \u{b7} " | 153 | " \u{b7} " |
| 156 | <a href=(row.closed_href.as_str())>(closed_text.as_str())</a> | 154 | <a href=(row.closed_href.as_str())>(closed_text.as_str())</a> |
| 157 | - </span> | 155 | + </p> |
| 156 | + if !row.description_html.is_empty() { | ||
| 157 | + <div class="markdown-body">(Unescaped::new_unchecked(row.description_html.clone()))</div> | ||
| 158 | + } | ||
| 158 | </div> | 159 | </div> |
| 159 | if can_triage { | 160 | if can_triage { |
| 160 | - <form method="post" action=(row.delete_action.as_str()) class="remove-form"> | 161 | + <a href=(row.edit_href.as_str())>(g::t(lang, K::Edit))</a> |
| 162 | + <form method="post" action=(row.delete_action.as_str()) class="row-form"> | ||
| 161 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 163 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 162 | <button type="submit" class="danger">(g::t(lang, K::Delete))</button> | 164 | <button type="submit" class="danger">(g::t(lang, K::Delete))</button> |
| 163 | </form> | 165 | </form> |
| 164 | } | 166 | } |
| 165 | - </li> | 167 | + </div> |
| 166 | - }) | ||
| 167 | -} | ||
| 168 | - | ||
| 169 | -/// The create form for triage holders. | ||
| 170 | -#[component] | ||
| 171 | -async fn milestone_create_form(lang: Lang, csrf: String, action: String) -> Result<impl View> { | ||
| 172 | - Ok(view! { | ||
| 173 | - <section class="card lang-side"> | ||
| 174 | - <h2>(g::t(lang, K::NewMilestone))</h2> | ||
| 175 | - <form method="post" action=(action.as_str()) class="stack"> | ||
| 176 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 177 | - <label> | ||
| 178 | - <span>(g::t(lang, K::Title))</span> | ||
| 179 | - <input type="text" name="title" autocomplete="off" required=(true) maxlength="256"> | ||
| 180 | - </label> | ||
| 181 | - <label> | ||
| 182 | - <span>(g::t(lang, K::Description))</span> | ||
| 183 | - <textarea name="description" rows="4"></textarea> | ||
| 184 | - </label> | ||
| 185 | - <label> | ||
| 186 | - <span>(g::t(lang, K::DueDate))</span> | ||
| 187 | - <input type="date" name="due_on"> | ||
| 188 | - </label> | ||
| 189 | - <div> | ||
| 190 | - <button type="submit" class="primary">(g::t(lang, K::CreateMilestone))</button> | ||
| 191 | - </div> | ||
| 192 | - </form> | ||
| 193 | - </section> | ||
| 194 | }) | 168 | }) |
| 195 | } | 169 | } |
| 196 | 170 | ||
| @@ -295,30 +269,55 @@ async fn milestones_body( | |||
| 295 | if frame.archived { | 269 | if frame.archived { |
| 296 | <section class="card notice" role="status">(g::t(lang, K::MilestonesArchived))</section> | 270 | <section class="card notice" role="status">(g::t(lang, K::MilestonesArchived))</section> |
| 297 | } | 271 | } |
| 298 | - <div class="fit-split"> | 272 | + <div class="list-bar"> |
| 299 | - <section class="card fit-pane fit-card fit-main lang-list" data-live=(live.as_str()) data-live-now=""> | 273 | + issue_subnav(lang: lang, title: title.clone(), active: "milestones".to_owned()) |
| 300 | - <div class="list-bar"> | 274 | + state_tabs(lang: lang, title: title.clone(), closed: closed) |
| 301 | - issue_subnav(lang: lang, title: title.clone(), active: "milestones".to_owned()) | 275 | + </div> |
| 302 | - state_tabs(lang: lang, title: title.clone(), closed: closed) | 276 | + <section class="card rows-pane lang-list" data-live=(live.as_str()) data-live-now=""> |
| 303 | - </div> | 277 | + if can_create { |
| 304 | - if empty { | 278 | + <div class="row-line"> |
| 305 | - empty_state(title: empty_text) | 279 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 280 | + <div class="row-main"> | ||
| 281 | + <h2 class="row-title">(g::t(lang, K::NewMilestone))</h2> | ||
| 282 | + if empty { | ||
| 283 | + <p class="row-status">(empty_text)</p> | ||
| 284 | + } | ||
| 285 | + </div> | ||
| 286 | + <details class="row-action"> | ||
| 287 | + <summary>(g::t(lang, K::CreateMilestone))</summary> | ||
| 288 | + <div class="row-panel"> | ||
| 289 | + <form method="post" action=(create_action.as_str()) class="stack"> | ||
| 290 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 291 | + <label> | ||
| 292 | + <span>(g::t(lang, K::Title))</span> | ||
| 293 | + <input type="text" name="title" autocomplete="off" required=(true) maxlength="256"> | ||
| 294 | + </label> | ||
| 295 | + <label> | ||
| 296 | + <span>(g::t(lang, K::Description))</span> | ||
| 297 | + <textarea name="description" rows="4"></textarea> | ||
| 298 | + </label> | ||
| 299 | + <label> | ||
| 300 | + <span>(g::t(lang, K::DueDate))</span> | ||
| 301 | + <input type="date" name="due_on"> | ||
| 302 | + </label> | ||
| 303 | + <button type="submit" class="primary">(g::t(lang, K::CreateMilestone))</button> | ||
| 304 | + </form> | ||
| 305 | + </div> | ||
| 306 | + </details> | ||
| 307 | + </div> | ||
| 308 | + } else if empty { | ||
| 309 | + <div class="row-line"> | ||
| 310 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 21V4"/><path d="M5 4h11l-2 4 2 4H5"/></svg> | ||
| 311 | + <div class="row-main"> | ||
| 312 | + <h2 class="row-title">(empty_text)</h2> | ||
| 313 | + </div> | ||
| 314 | + </div> | ||
| 315 | + } | ||
| 316 | + for row in rows.into_iter() { | ||
| 317 | + milestone_row(lang: lang, row: row, csrf: row_csrf.clone(), can_triage: can_triage) | ||
| 306 | } | 318 | } |
| 307 | - <div class="fit-scroll"> | ||
| 308 | - <ul class="milestone-list"> | ||
| 309 | - for row in rows.into_iter() { | ||
| 310 | - milestone_row(lang: lang, row: row, csrf: row_csrf.clone(), can_triage: can_triage) | ||
| 311 | - } | ||
| 312 | - </ul> | ||
| 313 | - </div> | ||
| 314 | pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang) | 319 | pager(page: page, pages: pages, links: links, prev: prev, next: next, lang: lang) |
| 315 | </section> | 320 | </section> |
| 316 | - if can_create { | ||
| 317 | - <div class="fit-side"> | ||
| 318 | - milestone_create_form(lang: lang, csrf: csrf.clone(), action: create_action) | ||
| 319 | - </div> | ||
| 320 | - } | ||
| 321 | - </div> | ||
| 322 | }) | 321 | }) |
| 323 | } | 322 | } |
| 324 | 323 | ||
crates/forge-web/src/pages/org_members.rsmodified+70 -77
| @@ -90,85 +90,78 @@ async fn members_body( | |||
| 90 | org_head(name: name.clone(), description: description) | 90 | org_head(name: name.clone(), description: description) |
| 91 | org_tabs(lang: lang, name: name, current: "members".to_owned(), repo_count: repo_count, package_count: package_count) | 91 | org_tabs(lang: lang, name: name, current: "members".to_owned(), repo_count: repo_count, package_count: package_count) |
| 92 | org_notice(notice: notice) | 92 | org_notice(notice: notice) |
| 93 | - <div class="org-split"> | 93 | + <section class="card rows-pane"> |
| 94 | - <section class="card"> | 94 | + if owner { |
| 95 | - <div class="table-wrap"> | 95 | + <div class="row-line"> |
| 96 | - <table class="table collaborators members-table"> | 96 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 97 | - <thead> | 97 | + <div class="row-main"> |
| 98 | - <tr> | 98 | + <h2 class="row-title">(g::t(lang, K::AddMember))</h2> |
| 99 | - <th>(g::t(lang, K::MemberHeader))</th> | 99 | + <p class="row-status">(g::t(lang, K::OwnersHelp))</p> |
| 100 | - <th>(g::t(lang, K::Role))</th> | 100 | + </div> |
| 101 | - <th><span class="muted small">(g::t(lang, K::Remove))</span></th> | 101 | + <details class="row-action"> |
| 102 | - </tr> | 102 | + <summary>(g::t(lang, K::AddMemberButton))</summary> |
| 103 | - </thead> | 103 | + <div class="row-panel"> |
| 104 | - <tbody> | 104 | + <form method="post" action=(add_action.as_str()) class="stack"> |
| 105 | - for row in rows.iter() { | 105 | + <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 106 | - <tr> | 106 | + <label> |
| 107 | - <td> | 107 | + <span>(g::t(lang, K::Username))</span> |
| 108 | - <a class="user-link" href=(format!("/{}", row.username.as_str()))> | 108 | + <input type="text" name="username" autocomplete="off" spellcheck="false" required=(true)> |
| 109 | - <img class="avatar avatar-sm" src=(row.avatar.as_str()) alt="" width="24" height="24"> | 109 | + </label> |
| 110 | - <span>(row.label.as_str())</span> | 110 | + <label> |
| 111 | - </a> | 111 | + <span>(g::t(lang, K::Role))</span> |
| 112 | - </td> | 112 | + <select name="role"> |
| 113 | - <td> | 113 | + <option value="member" selected=(true)>(g::t(lang, K::RoleMember))</option> |
| 114 | - if owner { | 114 | + <option value="owner">(g::t(lang, K::RoleOwner))</option> |
| 115 | - <form method="post" action=(role_action.as_str()) class="inline-form"> | 115 | + </select> |
| 116 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | 116 | + </label> |
| 117 | - <input type="hidden" name="user_id" value=(row.user_id.as_str())> | 117 | + <button type="submit" class="primary">(g::t(lang, K::AddMemberButton))</button> |
| 118 | - <select name="role" aria-label=(g::role_for(lang, row.username.as_str()))> | 118 | + </form> |
| 119 | - <option value="owner" selected=(row.is_owner)>(g::t(lang, K::RoleOwner))</option> | 119 | + </div> |
| 120 | - <option value="member" selected=(!row.is_owner)>(g::t(lang, K::RoleMember))</option> | 120 | + </details> |
| 121 | - </select> | 121 | + </div> |
| 122 | - <button type="submit">(g::t(lang, K::Save))</button> | 122 | + } |
| 123 | - </form> | 123 | + for row in rows.iter() { |
| 124 | - } else { | 124 | + <div class="row-line"> |
| 125 | - <span>(if row.is_owner { g::t(lang, K::RoleOwner) } else { g::t(lang, K::RoleMember) })</span> | 125 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 3.6-7 8-7s8 3 8 7"/></svg> |
| 126 | - } | 126 | + <div class="row-main"> |
| 127 | - </td> | 127 | + <strong class="row-name"> |
| 128 | - <td> | 128 | + <a class="user-link" href=(format!("/{}", row.username.as_str()))> |
| 129 | - if owner || row.is_self { | 129 | + <img class="avatar avatar-sm" src=(row.avatar.as_str()) alt="" width="24" height="24"> |
| 130 | - <details class="row-menu"> | 130 | + <span>(row.label.as_str())</span> |
| 131 | - <summary class="button row-menu-btn" aria-label=(passkeys::s(lang, "Actions", "İşlemler")) aria-haspopup="menu">"⋯"</summary> | 131 | + </a> |
| 132 | - <div class="row-menu-panel" role="menu"> | 132 | + </strong> |
| 133 | - <form method="post" action=(remove_action.as_str()) class="inline-form"> | 133 | + if !owner { |
| 134 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | 134 | + <p class="row-status">(if row.is_owner { g::t(lang, K::RoleOwner) } else { g::t(lang, K::RoleMember) })</p> |
| 135 | - <input type="hidden" name="user_id" value=(row.user_id.as_str())> | ||
| 136 | - <button type="submit" class="danger">(if row.is_self { g::t(lang, K::Leave) } else { g::t(lang, K::Remove) })</button> | ||
| 137 | - </form> | ||
| 138 | - </div> | ||
| 139 | - </details> | ||
| 140 | - } | ||
| 141 | - </td> | ||
| 142 | - </tr> | ||
| 143 | } | 135 | } |
| 144 | - </tbody> | ||
| 145 | - </table> | ||
| 146 | - </div> | ||
| 147 | - </section> | ||
| 148 | - if owner { | ||
| 149 | - <section class="card"> | ||
| 150 | - <h3>(g::t(lang, K::AddMember))</h3> | ||
| 151 | - <form method="post" action=(add_action.as_str()) class="stack"> | ||
| 152 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 153 | - <label> | ||
| 154 | - <span>(g::t(lang, K::Username))</span> | ||
| 155 | - <input type="text" name="username" autocomplete="off" spellcheck="false" required=(true)> | ||
| 156 | - </label> | ||
| 157 | - <label> | ||
| 158 | - <span>(g::t(lang, K::Role))</span> | ||
| 159 | - <select name="role"> | ||
| 160 | - <option value="member" selected=(true)>(g::t(lang, K::RoleMember))</option> | ||
| 161 | - <option value="owner">(g::t(lang, K::RoleOwner))</option> | ||
| 162 | - </select> | ||
| 163 | - </label> | ||
| 164 | - <p class="muted small">(g::t(lang, K::OwnersHelp))</p> | ||
| 165 | - <div> | ||
| 166 | - <button type="submit" class="primary">(g::t(lang, K::AddMemberButton))</button> | ||
| 167 | </div> | 136 | </div> |
| 168 | - </form> | 137 | + if owner || row.is_self { |
| 169 | - </section> | 138 | + <div class="row-actions"> |
| 170 | - } | 139 | + if owner { |
| 171 | - </div> | 140 | + <form method="post" action=(role_action.as_str()) class="row-form"> |
| 141 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 142 | + <input type="hidden" name="user_id" value=(row.user_id.as_str())> | ||
| 143 | + <select name="role" aria-label=(g::role_for(lang, row.username.as_str()))> | ||
| 144 | + <option value="owner" selected=(row.is_owner)>(g::t(lang, K::RoleOwner))</option> | ||
| 145 | + <option value="member" selected=(!row.is_owner)>(g::t(lang, K::RoleMember))</option> | ||
| 146 | + </select> | ||
| 147 | + <button type="submit">(g::t(lang, K::Save))</button> | ||
| 148 | + </form> | ||
| 149 | + } | ||
| 150 | + <details class="row-menu"> | ||
| 151 | + <summary class="button row-menu-btn" aria-label=(passkeys::s(lang, "Actions", "İşlemler")) aria-haspopup="menu">"⋯"</summary> | ||
| 152 | + <div class="row-menu-panel" role="menu"> | ||
| 153 | + <form method="post" action=(remove_action.as_str()) class="inline-form"> | ||
| 154 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 155 | + <input type="hidden" name="user_id" value=(row.user_id.as_str())> | ||
| 156 | + <button type="submit" class="danger">(if row.is_self { g::t(lang, K::Leave) } else { g::t(lang, K::Remove) })</button> | ||
| 157 | + </form> | ||
| 158 | + </div> | ||
| 159 | + </details> | ||
| 160 | + </div> | ||
| 161 | + } | ||
| 162 | + </div> | ||
| 163 | + } | ||
| 164 | + </section> | ||
| 172 | </div> | 165 | </div> |
| 173 | }) | 166 | }) |
| 174 | } | 167 | } |
crates/forge-web/src/pages/org_settings.rsmodified+91 -71
| @@ -88,80 +88,100 @@ async fn settings_body( | |||
| 88 | <div data-live=(live.as_str())> | 88 | <div data-live=(live.as_str())> |
| 89 | org_head(name: name, description: description.clone()) | 89 | org_head(name: name, description: description.clone()) |
| 90 | org_notice(notice: notice) | 90 | org_notice(notice: notice) |
| 91 | - <div class="org-settings-grid"> | 91 | + <section class="card rows-pane"> |
| 92 | - <section class="card"> | 92 | + <form id="org-settings-form" method="post" action=(save_action.as_str())> |
| 93 | - <h2>(g::t(lang, K::Settings))</h2> | 93 | + <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 94 | - <form method="post" action=(save_action.as_str()) class="stack"> | 94 | + </form> |
| 95 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | 95 | + <label class="row-line row-field"> |
| 96 | - <label> | 96 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="5" y="3" width="14" height="18" rx="1"/><path d="M9 7h2M13 7h2M9 11h2M13 11h2M10 21v-4h4v4"/></svg> |
| 97 | - <span>(g::t(lang, K::DisplayNameLabel))</span> | 97 | + <span class="row-main"> |
| 98 | - <input type="text" name="display_name" maxlength="80" value=(display_name.as_str())> | 98 | + <span class="row-title">(g::t(lang, K::DisplayNameLabel))</span> |
| 99 | - </label> | 99 | + </span> |
| 100 | - <label> | 100 | + <span class="row-control"> |
| 101 | - <span>(g::t(lang, K::Description))</span> | 101 | + <input form="org-settings-form" type="text" name="display_name" maxlength="80" value=(display_name.as_str())> |
| 102 | - <textarea name="description" rows="2" maxlength="2000">(description.as_str())</textarea> | 102 | + </span> |
| 103 | - </label> | 103 | + </label> |
| 104 | - <label> | 104 | + <label class="row-line row-field"> |
| 105 | - <span>(g::t(lang, K::DefaultRoleLabel))</span> | 105 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 5h14v10H9l-4 4z"/></svg> |
| 106 | - <select name="default_repo_role"> | 106 | + <span class="row-main"> |
| 107 | - for choice in DEFAULT_ROLES.iter() { | 107 | + <span class="row-title">(g::t(lang, K::Description))</span> |
| 108 | - <option value=(*choice) selected=(*choice == default_role.as_str())>(g::role_name(lang, choice))</option> | 108 | + </span> |
| 109 | - } | 109 | + <span class="row-control"> |
| 110 | - </select> | 110 | + <textarea form="org-settings-form" name="description" rows="2" maxlength="2000">(description.as_str())</textarea> |
| 111 | - </label> | 111 | + </span> |
| 112 | - <p class="muted small">(g::t(lang, K::DefaultRoleHelp))</p> | 112 | + </label> |
| 113 | - <label class="inline"> | 113 | + <label class="row-line row-field"> |
| 114 | - <input type="checkbox" name="members_can_create" value="on" checked=(members_can_create)> | 114 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l8 3v6c0 4.5-3.4 8.3-8 9-4.6-.7-8-4.5-8-9V6z"/></svg> |
| 115 | - <span>(g::t(lang, K::MembersCanCreate))</span> | 115 | + <span class="row-main"> |
| 116 | - </label> | 116 | + <span class="row-title">(g::t(lang, K::DefaultRoleLabel))</span> |
| 117 | - <div> | 117 | + <span class="row-status">(g::t(lang, K::DefaultRoleHelp))</span> |
| 118 | - <button type="submit" class="primary">(g::t(lang, K::SaveSettings))</button> | 118 | + </span> |
| 119 | - </div> | 119 | + <span class="row-control"> |
| 120 | - </form> | 120 | + <select form="org-settings-form" name="default_repo_role"> |
| 121 | - </section> | 121 | + for choice in DEFAULT_ROLES.iter() { |
| 122 | - <div class="stack"> | 122 | + <option value=(*choice) selected=(*choice == default_role.as_str())>(g::role_name(lang, choice))</option> |
| 123 | - <section class="card"> | 123 | + } |
| 124 | - <h2>(t(lang, Key::Avatar))</h2> | 124 | + </select> |
| 125 | - <aside class="profile-settings-avatar" aria-label=(t(lang, Key::Avatar))> | 125 | + </span> |
| 126 | - <div class="profile-settings-avatar-frame"> | 126 | + </label> |
| 127 | - <img class="avatar profile-settings-avatar-img" src=(avatar_src.as_str()) alt=(t(lang, Key::AvatarAlt)) width="180" height="180"> | 127 | + <label class="row-line row-field"> |
| 128 | - <details class="menu profile-settings-avatar-menu"> | 128 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 12l5 5L20 6"/></svg> |
| 129 | - <summary>(t(lang, Key::Edit))</summary> | 129 | + <span class="row-main"> |
| 130 | - <div class="menu-list profile-settings-avatar-list"> | 130 | + <span class="row-title">(g::t(lang, K::MembersCanCreate))</span> |
| 131 | - <form method="post" action=(avatar_action.as_str()) enctype="multipart/form-data" class="profile-settings-avatar-upload"> | 131 | + </span> |
| 132 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | 132 | + <span class="row-control"> |
| 133 | - <input class="profile-settings-avatar-file" type="file" id="org-settings-avatar-file" name="avatar" aria-label=(t(lang, Key::Image)) accept="image/png,image/jpeg,image/webp,image/gif" required=(true)> | 133 | + <input form="org-settings-form" type="checkbox" name="members_can_create" value="on" checked=(members_can_create)> |
| 134 | - <label class="profile-settings-avatar-item" for="org-settings-avatar-file">(t(lang, Key::UploadPhoto))</label> | 134 | + </span> |
| 135 | - <button type="submit" class="primary">(t(lang, Key::Upload))</button> | 135 | + </label> |
| 136 | - </form> | 136 | + <div class="row-foot"> |
| 137 | - if has_avatar { | 137 | + <button type="submit" class="primary" form="org-settings-form">(g::t(lang, K::SaveSettings))</button> |
| 138 | - <form method="post" action=(avatar_remove_action.as_str()) class="profile-settings-avatar-remove"> | 138 | + </div> |
| 139 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | 139 | + </section> |
| 140 | - <button type="submit" class="link-button">(t(lang, Key::RemovePhoto))</button> | 140 | + <section class="card rows-pane"> |
| 141 | - </form> | 141 | + <div class="row-line"> |
| 142 | - } | 142 | + <img class="avatar profile-settings-avatar-img" src=(avatar_src.as_str()) alt=(t(lang, Key::AvatarAlt)) width="40" height="40"> |
| 143 | - </div> | 143 | + <div class="row-main"> |
| 144 | - </details> | 144 | + <h2 class="row-title">(t(lang, Key::Avatar))</h2> |
| 145 | - </div> | 145 | + <p class="row-status">(t(lang, Key::AvatarHint))</p> |
| 146 | - <small class="muted">(t(lang, Key::AvatarHint))</small> | 146 | + </div> |
| 147 | - </aside> | 147 | + <div class="row-actions"> |
| 148 | - </section> | 148 | + <form method="post" action=(avatar_action.as_str()) enctype="multipart/form-data" class="row-form profile-settings-avatar-upload"> |
| 149 | - <section class="card"> | ||
| 150 | - <h2>(g::t(lang, K::DeleteOrg))</h2> | ||
| 151 | - <p class="muted small">(g::t(lang, K::DeleteOrgIntro))</p> | ||
| 152 | - <form method="post" action=(delete_action.as_str()) class="stack"> | ||
| 153 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 149 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 154 | - <label> | 150 | + <input class="profile-settings-avatar-file" type="file" id="org-settings-avatar-file" name="avatar" aria-label=(t(lang, Key::Image)) accept="image/png,image/jpeg,image/webp,image/gif" required=(true)> |
| 155 | - <span>(confirm_label.as_str())</span> | 151 | + <label class="profile-settings-avatar-item" for="org-settings-avatar-file">(t(lang, Key::UploadPhoto))</label> |
| 156 | - <input type="text" name="confirm" autocomplete="off" spellcheck="false" required=(true)> | 152 | + <button type="submit" class="primary">(t(lang, Key::Upload))</button> |
| 157 | - </label> | ||
| 158 | - <div> | ||
| 159 | - <button type="submit" class="danger">(g::t(lang, K::DeleteOrg))</button> | ||
| 160 | - </div> | ||
| 161 | </form> | 153 | </form> |
| 162 | - </section> | 154 | + if has_avatar { |
| 155 | + <form method="post" action=(avatar_remove_action.as_str()) class="row-form"> | ||
| 156 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 157 | + <button type="submit" class="link-button">(t(lang, Key::RemovePhoto))</button> | ||
| 158 | + </form> | ||
| 159 | + } | ||
| 160 | + </div> | ||
| 161 | + </div> | ||
| 162 | + </section> | ||
| 163 | + <section class="card rows-pane security-danger"> | ||
| 164 | + <div class="row-line"> | ||
| 165 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4l9 16H3z"/><path d="M12 10v4M12 17v.5"/></svg> | ||
| 166 | + <div class="row-main"> | ||
| 167 | + <h2 class="row-title">(g::t(lang, K::DeleteOrg))</h2> | ||
| 168 | + <p class="row-status">(g::t(lang, K::DeleteOrgIntro))</p> | ||
| 169 | + </div> | ||
| 170 | + <details class="row-action danger"> | ||
| 171 | + <summary>(g::t(lang, K::DeleteOrg))</summary> | ||
| 172 | + <div class="row-panel"> | ||
| 173 | + <form method="post" action=(delete_action.as_str()) class="stack"> | ||
| 174 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 175 | + <label> | ||
| 176 | + <span>(confirm_label.as_str())</span> | ||
| 177 | + <input type="text" name="confirm" autocomplete="off" spellcheck="false" required=(true)> | ||
| 178 | + </label> | ||
| 179 | + <button type="submit" class="danger">(g::t(lang, K::DeleteOrg))</button> | ||
| 180 | + </form> | ||
| 181 | + </div> | ||
| 182 | + </details> | ||
| 163 | </div> | 183 | </div> |
| 164 | - </div> | 184 | + </section> |
| 165 | </div> | 185 | </div> |
| 166 | }) | 186 | }) |
| 167 | } | 187 | } |
crates/forge-web/src/pages/org_teams.rsmodified+211 -158
| @@ -24,7 +24,7 @@ use crate::pages::org_ctx::{ | |||
| 24 | }; | 24 | }; |
| 25 | use crate::pages::passkeys; | 25 | use crate::pages::passkeys; |
| 26 | use crate::state::AppState; | 26 | use crate::state::AppState; |
| 27 | -use crate::views::{avatar_url, display_name, empty_state, repo_href, shell}; | 27 | +use crate::views::{avatar_url, display_name, repo_href, shell}; |
| 28 | 28 | ||
| 29 | path_param!(org); | 29 | path_param!(org); |
| 30 | path_param!(team); | 30 | path_param!(team); |
| @@ -201,59 +201,61 @@ async fn teams_body( | |||
| 201 | org_head(name: name.clone(), description: description) | 201 | org_head(name: name.clone(), description: description) |
| 202 | org_tabs(lang: lang, name: name, current: "teams".to_owned(), repo_count: repo_count, package_count: package_count) | 202 | org_tabs(lang: lang, name: name, current: "teams".to_owned(), repo_count: repo_count, package_count: package_count) |
| 203 | org_notice(notice: notice) | 203 | org_notice(notice: notice) |
| 204 | - <div class="org-split"> | 204 | + <section class="card rows-pane"> |
| 205 | - <section class="card"> | 205 | + <div class="row-line"> |
| 206 | - if rows.is_empty() { | 206 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="8" r="3"/><circle cx="17" cy="9" r="2.5"/><path d="M3 20c0-3.3 2.7-6 6-6s6 2.7 6 6M15 14.2c2.7.2 6 2 6 5.8"/></svg> |
| 207 | - empty_state(title: g::t(lang, K::NoTeamsYet)) | 207 | + <div class="row-main"> |
| 208 | - } else { | 208 | + <h2 class="row-title">(if owner { g::t(lang, K::NewTeam) } else { g::t(lang, K::Teams) })</h2> |
| 209 | - <ul class="item-list"> | 209 | + <p class="row-status">(g::t(lang, K::TeamsIntro))</p> |
| 210 | - for row in rows.iter() { | 210 | + if rows.is_empty() { |
| 211 | - <li class="item"> | 211 | + <p class="row-status">(g::t(lang, K::NoTeamsYet))</p> |
| 212 | - <div class="item-main"> | ||
| 213 | - <a href=(row.href.as_str())><strong>(row.name.as_str())</strong></a> | ||
| 214 | - <span class="muted small">(g::coverage_text(lang, row.role, row.all_repos))</span> | ||
| 215 | - if !row.description.is_empty() { | ||
| 216 | - <span class="muted small">(row.description.as_str())</span> | ||
| 217 | - } | ||
| 218 | - </div> | ||
| 219 | - </li> | ||
| 220 | } | 212 | } |
| 221 | - </ul> | 213 | + </div> |
| 214 | + if owner { | ||
| 215 | + <details class="row-action" id="new-team"> | ||
| 216 | + <summary>(g::t(lang, K::CreateTeam))</summary> | ||
| 217 | + <div class="row-panel"> | ||
| 218 | + <form method="post" action=(create_action.as_str()) class="stack"> | ||
| 219 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 220 | + <label> | ||
| 221 | + <span>(g::t(lang, K::Name))</span> | ||
| 222 | + <input type="text" name="name" autocomplete="off" required=(true) maxlength="64"> | ||
| 223 | + </label> | ||
| 224 | + <label> | ||
| 225 | + <span>(g::t(lang, K::DescriptionOptional))</span> | ||
| 226 | + <textarea name="description" rows="2" maxlength="350"></textarea> | ||
| 227 | + </label> | ||
| 228 | + <label> | ||
| 229 | + <span>(g::t(lang, K::Role))</span> | ||
| 230 | + <select name="role"> | ||
| 231 | + for role in TEAM_ROLES.iter() { | ||
| 232 | + <option value=(role.as_str()) selected=(*role == Role::Read)>(g::role_name(lang, role.as_str()))</option> | ||
| 233 | + } | ||
| 234 | + </select> | ||
| 235 | + </label> | ||
| 236 | + <label class="inline"> | ||
| 237 | + <input type="checkbox" name="all_repos" value="on"> | ||
| 238 | + <span>(g::t(lang, K::CoversAllRepos))</span> | ||
| 239 | + </label> | ||
| 240 | + <button type="submit" class="primary">(g::t(lang, K::CreateTeam))</button> | ||
| 241 | + </form> | ||
| 242 | + </div> | ||
| 243 | + </details> | ||
| 244 | + } | ||
| 245 | + </div> | ||
| 246 | + for row in rows.iter() { | ||
| 247 | + <div class="row-line"> | ||
| 248 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="8" r="3"/><circle cx="17" cy="9" r="2.5"/><path d="M3 20c0-3.3 2.7-6 6-6s6 2.7 6 6M15 14.2c2.7.2 6 2 6 5.8"/></svg> | ||
| 249 | + <div class="row-main"> | ||
| 250 | + <strong class="row-name"><a href=(row.href.as_str())>(row.name.as_str())</a></strong> | ||
| 251 | + <p class="row-status">(g::coverage_text(lang, row.role, row.all_repos))</p> | ||
| 252 | + if !row.description.is_empty() { | ||
| 253 | + <p class="row-status">(row.description.as_str())</p> | ||
| 254 | + } | ||
| 255 | + </div> | ||
| 256 | + </div> | ||
| 222 | } | 257 | } |
| 223 | - <p class="muted small">(g::t(lang, K::TeamsIntro))</p> | ||
| 224 | </section> | 258 | </section> |
| 225 | - if owner { | ||
| 226 | - <section class="card" id="new-team"> | ||
| 227 | - <h3>(g::t(lang, K::NewTeam))</h3> | ||
| 228 | - <form method="post" action=(create_action.as_str()) class="stack"> | ||
| 229 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 230 | - <label> | ||
| 231 | - <span>(g::t(lang, K::Name))</span> | ||
| 232 | - <input type="text" name="name" autocomplete="off" required=(true) maxlength="64"> | ||
| 233 | - </label> | ||
| 234 | - <label> | ||
| 235 | - <span>(g::t(lang, K::DescriptionOptional))</span> | ||
| 236 | - <textarea name="description" rows="2" maxlength="350"></textarea> | ||
| 237 | - </label> | ||
| 238 | - <label> | ||
| 239 | - <span>(g::t(lang, K::Role))</span> | ||
| 240 | - <select name="role"> | ||
| 241 | - for role in TEAM_ROLES.iter() { | ||
| 242 | - <option value=(role.as_str()) selected=(*role == Role::Read)>(g::role_name(lang, role.as_str()))</option> | ||
| 243 | - } | ||
| 244 | - </select> | ||
| 245 | - </label> | ||
| 246 | - <label class="inline"> | ||
| 247 | - <input type="checkbox" name="all_repos" value="on"> | ||
| 248 | - <span>(g::t(lang, K::CoversAllRepos))</span> | ||
| 249 | - </label> | ||
| 250 | - <div> | ||
| 251 | - <button type="submit" class="primary">(g::t(lang, K::CreateTeam))</button> | ||
| 252 | - </div> | ||
| 253 | - </form> | ||
| 254 | - </section> | ||
| 255 | - } | ||
| 256 | - </div> | ||
| 257 | </div> | 259 | </div> |
| 258 | }) | 260 | }) |
| 259 | } | 261 | } |
| @@ -315,130 +317,181 @@ async fn team_body( | |||
| 315 | org_head(name: data.org_name.clone(), description: data.org_description.clone()) | 317 | org_head(name: data.org_name.clone(), description: data.org_description.clone()) |
| 316 | org_tabs(lang: lang, name: data.org_name.clone(), current: "teams".to_owned(), repo_count: data.repo_count, package_count: data.package_count) | 318 | org_tabs(lang: lang, name: data.org_name.clone(), current: "teams".to_owned(), repo_count: data.repo_count, package_count: data.package_count) |
| 317 | org_notice(notice: notice) | 319 | org_notice(notice: notice) |
| 318 | - <div class="org-split team-split"> | 320 | + <section class="card rows-pane"> |
| 319 | - <section class="card"> | 321 | + <div class="row-line"> |
| 320 | - <h2>(data.team_name.as_str())</h2> | 322 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="8" r="3"/><circle cx="17" cy="9" r="2.5"/><path d="M3 20c0-3.3 2.7-6 6-6s6 2.7 6 6M15 14.2c2.7.2 6 2 6 5.8"/></svg> |
| 321 | - if has_description { | 323 | + <div class="row-main"> |
| 322 | - <p class="muted">(data.team_description.as_str())</p> | 324 | + <h2 class="row-title">(data.team_name.as_str())</h2> |
| 323 | - } | 325 | + if has_description { |
| 324 | - <p class="muted small">(g::coverage_text(lang, data.team_role, data.team_all_repos))</p> | 326 | + <p class="row-status">(data.team_description.as_str())</p> |
| 327 | + } | ||
| 328 | + <p class="row-status">(g::coverage_text(lang, data.team_role, data.team_all_repos))</p> | ||
| 329 | + </div> | ||
| 330 | + </div> | ||
| 325 | if owner { | 331 | if owner { |
| 326 | - <form method="post" action=(update_action.as_str()) class="stack"> | 332 | + <form id="team-settings-form" method="post" action=(update_action.as_str())> |
| 327 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 333 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 328 | - <label> | 334 | + </form> |
| 329 | - <span>(g::t(lang, K::Name))</span> | 335 | + <label class="row-line row-field"> |
| 330 | - <input type="text" name="name" value=(data.team_name.as_str()) autocomplete="off" required=(true) maxlength="64"> | 336 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16M4 12h10M4 17h7"/></svg> |
| 331 | - </label> | 337 | + <span class="row-main"> |
| 332 | - <label> | 338 | + <span class="row-title">(g::t(lang, K::Name))</span> |
| 333 | - <span>(g::t(lang, K::DescriptionOptional))</span> | 339 | + </span> |
| 334 | - <textarea name="description" rows="2" maxlength="350">(data.team_description.as_str())</textarea> | 340 | + <span class="row-control"> |
| 335 | - </label> | 341 | + <input form="team-settings-form" type="text" name="name" value=(data.team_name.as_str()) autocomplete="off" required=(true) maxlength="64"> |
| 336 | - <label> | 342 | + </span> |
| 337 | - <span>(g::t(lang, K::Role))</span> | 343 | + </label> |
| 338 | - <select name="role"> | 344 | + <label class="row-line row-field"> |
| 345 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 5h14v10H9l-4 4z"/></svg> | ||
| 346 | + <span class="row-main"> | ||
| 347 | + <span class="row-title">(g::t(lang, K::DescriptionOptional))</span> | ||
| 348 | + </span> | ||
| 349 | + <span class="row-control"> | ||
| 350 | + <textarea form="team-settings-form" name="description" rows="2" maxlength="350">(data.team_description.as_str())</textarea> | ||
| 351 | + </span> | ||
| 352 | + </label> | ||
| 353 | + <label class="row-line row-field"> | ||
| 354 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l8 3v6c0 4.5-3.4 8.3-8 9-4.6-.7-8-4.5-8-9V6z"/></svg> | ||
| 355 | + <span class="row-main"> | ||
| 356 | + <span class="row-title">(g::t(lang, K::Role))</span> | ||
| 357 | + </span> | ||
| 358 | + <span class="row-control"> | ||
| 359 | + <select form="team-settings-form" name="role"> | ||
| 339 | for role in TEAM_ROLES.iter() { | 360 | for role in TEAM_ROLES.iter() { |
| 340 | <option value=(role.as_str()) selected=(role.as_str() == data.team_role)>(g::role_name(lang, role.as_str()))</option> | 361 | <option value=(role.as_str()) selected=(role.as_str() == data.team_role)>(g::role_name(lang, role.as_str()))</option> |
| 341 | } | 362 | } |
| 342 | </select> | 363 | </select> |
| 343 | - </label> | 364 | + </span> |
| 344 | - <label class="inline"> | 365 | + </label> |
| 345 | - <input type="checkbox" name="all_repos" value="on" checked=(data.team_all_repos)> | 366 | + <label class="row-line row-field"> |
| 346 | - <span>(g::t(lang, K::CoversAllRepos))</span> | 367 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 12l5 5L20 6"/></svg> |
| 347 | - </label> | 368 | + <span class="row-main"> |
| 348 | - <div> | 369 | + <span class="row-title">(g::t(lang, K::CoversAllRepos))</span> |
| 349 | - <button type="submit" class="primary">(g::t(lang, K::SaveTeam))</button> | 370 | + </span> |
| 350 | - </div> | 371 | + <span class="row-control"> |
| 351 | - </form> | 372 | + <input form="team-settings-form" type="checkbox" name="all_repos" value="on" checked=(data.team_all_repos)> |
| 352 | - <form method="post" action=(delete_action.as_str()) class="team-form"> | 373 | + </span> |
| 353 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | 374 | + </label> |
| 354 | - <button type="submit" class="danger">(g::t(lang, K::DeleteTeam))</button> | 375 | + <div class="row-foot"> |
| 355 | - </form> | 376 | + <button type="submit" class="primary" form="team-settings-form">(g::t(lang, K::SaveTeam))</button> |
| 377 | + </div> | ||
| 356 | } | 378 | } |
| 357 | </section> | 379 | </section> |
| 358 | - <section class="card"> | 380 | + <section class="card rows-pane"> |
| 359 | - <h3>(g::t(lang, K::Members))</h3> | 381 | + <div class="row-line"> |
| 360 | - if data.members.is_empty() { | 382 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 361 | - empty_state(title: g::t(lang, K::NoTeamMembers), | 383 | + <div class="row-main"> |
| 384 | + <h2 class="row-title">(if owner { g::t(lang, K::AddMember) } else { g::t(lang, K::Members) })</h2> | ||
| 385 | + if data.members.is_empty() { | ||
| 386 | + <p class="row-status">(g::t(lang, K::NoTeamMembers))</p> | ||
| 387 | + } | ||
| 388 | + </div> | ||
| 389 | + if owner { | ||
| 390 | + <details class="row-action" id="add-member"> | ||
| 391 | + <summary>(g::t(lang, K::AddToTeam))</summary> | ||
| 392 | + <div class="row-panel"> | ||
| 393 | + <form method="post" action=(add_member_action.as_str()) class="stack"> | ||
| 394 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 395 | + <label> | ||
| 396 | + <span>(g::t(lang, K::Username))</span> | ||
| 397 | + <input type="text" name="username" autocomplete="off" spellcheck="false" required=(true)> | ||
| 398 | + </label> | ||
| 399 | + <button type="submit" class="primary">(g::t(lang, K::AddToTeam))</button> | ||
| 400 | + </form> | ||
| 401 | + </div> | ||
| 402 | + </details> | ||
| 403 | + } | ||
| 404 | + </div> | ||
| 405 | + for member in data.members.iter() { | ||
| 406 | + <div class="row-line"> | ||
| 407 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 3.6-7 8-7s8 3 8 7"/></svg> | ||
| 408 | + <div class="row-main"> | ||
| 409 | + <strong class="row-name"> | ||
| 410 | + <a class="user-link" href=(format!("/{}", member.username.as_str()))> | ||
| 411 | + <img class="avatar avatar-sm" src=(member.avatar.as_str()) alt="" width="24" height="24"> | ||
| 412 | + <span>(member.label.as_str())</span> | ||
| 413 | + </a> | ||
| 414 | + </strong> | ||
| 415 | + </div> | ||
| 362 | if owner { | 416 | if owner { |
| 363 | - <a class="button" href="#add-member">(g::t(lang, K::AddMember))</a> | 417 | + <details class="row-menu"> |
| 364 | - }) | 418 | + <summary class="button row-menu-btn" aria-label=(passkeys::s(lang, "Actions", "İşlemler")) aria-haspopup="menu">"⋯"</summary> |
| 365 | - } else { | 419 | + <div class="row-menu-panel" role="menu"> |
| 366 | - <ul class="item-list"> | 420 | + <form method="post" action=(remove_member_action.as_str()) class="inline-form"> |
| 367 | - for member in data.members.iter() { | 421 | + <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 368 | - <li class="item"> | 422 | + <input type="hidden" name="user_id" value=(member.user_id.as_str())> |
| 369 | - <div class="item-main"> | 423 | + <button type="submit" class="danger">(g::t(lang, K::Remove))</button> |
| 370 | - <a class="user-link" href=(format!("/{}", member.username.as_str()))> | 424 | + </form> |
| 371 | - <img class="avatar avatar-sm" src=(member.avatar.as_str()) alt="" width="24" height="24"> | ||
| 372 | - <span>(member.label.as_str())</span> | ||
| 373 | - </a> | ||
| 374 | </div> | 425 | </div> |
| 375 | - if owner { | 426 | + </details> |
| 376 | - <details class="row-menu"> | ||
| 377 | - <summary class="button row-menu-btn" aria-label=(passkeys::s(lang, "Actions", "İşlemler")) aria-haspopup="menu">"⋯"</summary> | ||
| 378 | - <div class="row-menu-panel" role="menu"> | ||
| 379 | - <form method="post" action=(remove_member_action.as_str()) class="inline-form"> | ||
| 380 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 381 | - <input type="hidden" name="user_id" value=(member.user_id.as_str())> | ||
| 382 | - <button type="submit" class="danger">(g::t(lang, K::Remove))</button> | ||
| 383 | - </form> | ||
| 384 | - </div> | ||
| 385 | - </details> | ||
| 386 | - } | ||
| 387 | - </li> | ||
| 388 | } | 427 | } |
| 389 | - </ul> | 428 | + </div> |
| 390 | - } | ||
| 391 | - if owner { | ||
| 392 | - <form method="post" action=(add_member_action.as_str()) class="team-form" id="add-member"> | ||
| 393 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 394 | - <input type="text" name="username" placeholder=(g::t(lang, K::Username)) aria-label=(g::t(lang, K::Username)) autocomplete="off" spellcheck="false" required=(true)> | ||
| 395 | - <button type="submit">(g::t(lang, K::AddToTeam))</button> | ||
| 396 | - </form> | ||
| 397 | } | 429 | } |
| 398 | </section> | 430 | </section> |
| 399 | - <section class="card"> | 431 | + <section class="card rows-pane"> |
| 400 | - <h3>(g::t(lang, K::Repositories))</h3> | 432 | + <div class="row-line"> |
| 401 | - if data.repos.is_empty() { | 433 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 402 | - empty_state(title: g::t(lang, K::NoTeamRepos), | 434 | + <div class="row-main"> |
| 403 | - if owner && has_choices { | 435 | + <h2 class="row-title">(if owner && has_choices { g::t(lang, K::LinkRepository) } else { g::t(lang, K::Repositories) })</h2> |
| 404 | - <a class="button" href="#link-repository">(g::t(lang, K::LinkRepository))</a> | 436 | + if data.repos.is_empty() { |
| 405 | - }) | 437 | + <p class="row-status">(g::t(lang, K::NoTeamRepos))</p> |
| 406 | - } else { | 438 | + } |
| 407 | - <ul class="item-list"> | 439 | + </div> |
| 408 | - for repo in data.repos.iter() { | 440 | + if owner && has_choices { |
| 409 | - <li class="item"> | 441 | + <details class="row-action" id="link-repository"> |
| 410 | - <div class="item-main"> | 442 | + <summary>(g::t(lang, K::LinkRepository))</summary> |
| 411 | - <a href=(repo.href.as_str())>(repo.title.as_str())</a> | 443 | + <div class="row-panel"> |
| 444 | + <form method="post" action=(add_repo_action.as_str()) class="stack"> | ||
| 445 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 446 | + <label> | ||
| 447 | + <span>(g::t(lang, K::Repository))</span> | ||
| 448 | + <select name="repo_id"> | ||
| 449 | + for choice in data.choices.iter() { | ||
| 450 | + <option value=(choice.id.as_str())>(choice.title.as_str())</option> | ||
| 451 | + } | ||
| 452 | + </select> | ||
| 453 | + </label> | ||
| 454 | + <button type="submit" class="primary">(g::t(lang, K::LinkRepository))</button> | ||
| 455 | + </form> | ||
| 456 | + </div> | ||
| 457 | + </details> | ||
| 458 | + } | ||
| 459 | + </div> | ||
| 460 | + for repo in data.repos.iter() { | ||
| 461 | + <div class="row-line"> | ||
| 462 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 4h11a3 3 0 0 1 3 3v13H8a3 3 0 0 1-3-3z"/><path d="M5 17a3 3 0 0 1 3-3h11"/></svg> | ||
| 463 | + <div class="row-main"> | ||
| 464 | + <strong class="row-name"><a href=(repo.href.as_str())>(repo.title.as_str())</a></strong> | ||
| 465 | + </div> | ||
| 466 | + if owner { | ||
| 467 | + <details class="row-menu"> | ||
| 468 | + <summary class="button row-menu-btn" aria-label=(passkeys::s(lang, "Actions", "İşlemler")) aria-haspopup="menu">"⋯"</summary> | ||
| 469 | + <div class="row-menu-panel" role="menu"> | ||
| 470 | + <form method="post" action=(remove_repo_action.as_str()) class="inline-form"> | ||
| 471 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 472 | + <input type="hidden" name="repo_id" value=(repo.repo_id.as_str())> | ||
| 473 | + <button type="submit" class="danger">(g::t(lang, K::Unlink))</button> | ||
| 474 | + </form> | ||
| 412 | </div> | 475 | </div> |
| 413 | - if owner { | 476 | + </details> |
| 414 | - <details class="row-menu"> | ||
| 415 | - <summary class="button row-menu-btn" aria-label=(passkeys::s(lang, "Actions", "İşlemler")) aria-haspopup="menu">"⋯"</summary> | ||
| 416 | - <div class="row-menu-panel" role="menu"> | ||
| 417 | - <form method="post" action=(remove_repo_action.as_str()) class="inline-form"> | ||
| 418 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 419 | - <input type="hidden" name="repo_id" value=(repo.repo_id.as_str())> | ||
| 420 | - <button type="submit" class="danger">(g::t(lang, K::Unlink))</button> | ||
| 421 | - </form> | ||
| 422 | - </div> | ||
| 423 | - </details> | ||
| 424 | - } | ||
| 425 | - </li> | ||
| 426 | } | 477 | } |
| 427 | - </ul> | 478 | + </div> |
| 428 | - } | ||
| 429 | - if owner && has_choices { | ||
| 430 | - <form method="post" action=(add_repo_action.as_str()) class="team-form" id="link-repository"> | ||
| 431 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 432 | - <select name="repo_id" aria-label=(g::t(lang, K::Repository))> | ||
| 433 | - for choice in data.choices.iter() { | ||
| 434 | - <option value=(choice.id.as_str())>(choice.title.as_str())</option> | ||
| 435 | - } | ||
| 436 | - </select> | ||
| 437 | - <button type="submit">(g::t(lang, K::LinkRepository))</button> | ||
| 438 | - </form> | ||
| 439 | } | 479 | } |
| 440 | </section> | 480 | </section> |
| 441 | - </div> | 481 | + if owner { |
| 482 | + <section class="card rows-pane security-danger"> | ||
| 483 | + <div class="row-line"> | ||
| 484 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4l9 16H3z"/><path d="M12 10v4M12 17v.5"/></svg> | ||
| 485 | + <div class="row-main"> | ||
| 486 | + <h2 class="row-title">(g::t(lang, K::DeleteTeam))</h2> | ||
| 487 | + </div> | ||
| 488 | + <form method="post" action=(delete_action.as_str()) class="row-form"> | ||
| 489 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 490 | + <button type="submit" class="danger">(g::t(lang, K::DeleteTeam))</button> | ||
| 491 | + </form> | ||
| 492 | + </div> | ||
| 493 | + </section> | ||
| 494 | + } | ||
| 442 | </div> | 495 | </div> |
| 443 | }) | 496 | }) |
| 444 | } | 497 | } |
crates/forge-web/src/pages/palette.rsmodified+5 -3
| @@ -6,8 +6,9 @@ | |||
| 6 | //! `views::global_items`, `views::settings_items`, `views::admin_items`), so a page the sidebar or a | 6 | //! `views::global_items`, `views::settings_items`, `views::admin_items`), so a page the sidebar or a |
| 7 | //! tab bar links to is found here too. Each href is listed once, the first time it appears. | 7 | //! tab bar links to is found here too. Each href is listed once, the first time it appears. |
| 8 | //! | 8 | //! |
| 9 | -//! An item may carry `terms`: what is on that page and other words for it, in both languages, so | 9 | +//! An item may carry `terms`: other words for that page, in both languages, so "2fa" finds Security. |
| 10 | -//! "password" finds Security. `repoPages` lists the pages of a repo as paths: `assets/nav.js` applies | 10 | +//! What a page itself says needs no listing: the palette reads the pages behind these items, as the |
| 11 | +//! viewer, using `scanKey` to know when what it read is out of date. `repoPages` lists the pages of a repo as paths: `assets/nav.js` applies | ||
| 11 | //! them to the current repo, and to a repo named in the query. The palette itself, its typo-tolerant | 12 | //! them to the current repo, and to a repo named in the query. The palette itself, its typo-tolerant |
| 12 | //! matching and keys live in `assets/nav.js`. The actions of the page it is opened on are not listed | 13 | //! matching and keys live in `assets/nav.js`. The actions of the page it is opened on are not listed |
| 13 | //! here: a control marked `data-palette-action` is rendered only for a viewer who may use it, and the | 14 | //! here: a control marked `data-palette-action` is rendered only for a viewer who may use it, and the |
| @@ -413,7 +414,8 @@ async fn palette(cx: &Cx) -> Result<Response> { | |||
| 413 | } | 414 | } |
| 414 | } | 415 | } |
| 415 | 416 | ||
| 416 | - let body = json!({ "items": items, "repoPages": repo_pages(lang) }); | 417 | + let scan_key = format!("{}:{lang:?}:{}", user.id, forge_ci::build::display()); |
| 418 | + let body = json!({ "items": items, "repoPages": repo_pages(lang), "scanKey": scan_key }); | ||
| 417 | let mut response = Response::new(Body::from(body.to_string().into_bytes())); | 419 | let mut response = Response::new(Body::from(body.to_string().into_bytes())); |
| 418 | let headers = response.headers_mut(); | 420 | let headers = response.headers_mut(); |
| 419 | headers.insert( | 421 | headers.insert( |
crates/forge-web/src/pages/passkeys.rsmodified+15 -15
| @@ -669,33 +669,33 @@ pub async fn passkeys_panel(lang: Lang, csrf: &str, panel: PasskeyPanel) -> Resu | |||
| 669 | let usable = problem.is_none(); | 669 | let usable = problem.is_none(); |
| 670 | let problem_text = problem.map(|why| why.message(lang)); | 670 | let problem_text = problem.map(|why| why.message(lang)); |
| 671 | Ok(view! { | 671 | Ok(view! { |
| 672 | - <div class="security-block" data-passkeys=""> | 672 | + <div class="rows-block" data-passkeys=""> |
| 673 | - <div class="security-row"> | 673 | + <div class="row-line"> |
| 674 | - <svg class="security-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="8" r="4"/><path d="M2 21v-1a6 6 0 0 1 6-6h2"/><circle cx="18" cy="14" r="2.5"/><path d="M18 16.5V22M18 19h2"/></svg> | 674 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="8" r="4"/><path d="M2 21v-1a6 6 0 0 1 6-6h2"/><circle cx="18" cy="14" r="2.5"/><path d="M18 16.5V22M18 19h2"/></svg> |
| 675 | - <div class="security-row-main"> | 675 | + <div class="row-main"> |
| 676 | - <h2 class="security-row-title"> | 676 | + <h2 class="row-title"> |
| 677 | <span>(s(lang, "Passkeys", "Geçiş anahtarları"))</span> | 677 | <span>(s(lang, "Passkeys", "Geçiş anahtarları"))</span> |
| 678 | <span class=(pill_class)>(pill_text.as_str())</span> | 678 | <span class=(pill_class)>(pill_text.as_str())</span> |
| 679 | </h2> | 679 | </h2> |
| 680 | if let Some(text) = problem_text { | 680 | if let Some(text) = problem_text { |
| 681 | - <p class="security-row-status warn">(text)</p> | 681 | + <p class="row-status warn">(text)</p> |
| 682 | } else { | 682 | } else { |
| 683 | - <p class="security-row-status">(s(lang, "Sign in with your fingerprint, face or device PIN. A passkey counts as two factors, so it skips the code step.", "Parmak izi, yüz veya cihaz PIN'inizle giriş yapın. Geçiş anahtarı iki doğrulama sayılır, bu yüzden kod adımı atlanır."))</p> | 683 | + <p class="row-status">(s(lang, "Sign in with your fingerprint, face or device PIN. A passkey counts as two factors, so it skips the code step.", "Parmak izi, yüz veya cihaz PIN'inizle giriş yapın. Geçiş anahtarı iki doğrulama sayılır, bu yüzden kod adımı atlanır."))</p> |
| 684 | } | 684 | } |
| 685 | </div> | 685 | </div> |
| 686 | </div> | 686 | </div> |
| 687 | if !items.is_empty() { | 687 | if !items.is_empty() { |
| 688 | <ul class="security-devices"> | 688 | <ul class="security-devices"> |
| 689 | for item in items.into_iter() { | 689 | for item in items.into_iter() { |
| 690 | - <li class="security-row security-device"> | 690 | + <li class="row-line security-device"> |
| 691 | - <svg class="security-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="8" r="4"/><path d="M2 21v-1a6 6 0 0 1 6-6h2"/><circle cx="18" cy="14" r="2.5"/></svg> | 691 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="9" cy="8" r="4"/><path d="M2 21v-1a6 6 0 0 1 6-6h2"/><circle cx="18" cy="14" r="2.5"/></svg> |
| 692 | - <div class="security-row-main"> | 692 | + <div class="row-main"> |
| 693 | - <p class="security-row-title">(item.name.as_str())</p> | 693 | + <p class="row-title">(item.name.as_str())</p> |
| 694 | - <p class="security-row-status">added_status(lang: lang, added: Some(item.created_at.as_str()), used: item.last_used_at.as_deref())</p> | 694 | + <p class="row-status">added_status(lang: lang, added: Some(item.created_at.as_str()), used: item.last_used_at.as_deref())</p> |
| 695 | </div> | 695 | </div> |
| 696 | - <details class="security-action"> | 696 | + <details class="row-action"> |
| 697 | <summary>(s(lang, "Rename", "Yeniden adlandır"))</summary> | 697 | <summary>(s(lang, "Rename", "Yeniden adlandır"))</summary> |
| 698 | - <div class="security-panel"> | 698 | + <div class="row-panel"> |
| 699 | <form method="post" action=(format!("/settings/security/passkeys/{}/rename", item.id)) class="stack"> | 699 | <form method="post" action=(format!("/settings/security/passkeys/{}/rename", item.id)) class="stack"> |
| 700 | <input type="hidden" name="csrf" value=(csrf)> | 700 | <input type="hidden" name="csrf" value=(csrf)> |
| 701 | <label> | 701 | <label> |
| @@ -722,7 +722,7 @@ pub async fn passkeys_panel(lang: Lang, csrf: &str, panel: PasskeyPanel) -> Resu | |||
| 722 | </ul> | 722 | </ul> |
| 723 | } | 723 | } |
| 724 | if usable { | 724 | if usable { |
| 725 | - <form data-hard="true" data-passkey-add="" hidden=(true) class="security-panel passkey-add stack" action="/settings/security" method="get"> | 725 | + <form data-hard="true" data-passkey-add="" hidden=(true) class="row-panel passkey-add stack" action="/settings/security" method="get"> |
| 726 | <input type="hidden" name="csrf" value=(csrf)> | 726 | <input type="hidden" name="csrf" value=(csrf)> |
| 727 | <label> | 727 | <label> |
| 728 | <span>(s(lang, "Name for the new passkey", "Yeni geçiş anahtarının adı"))</span> | 728 | <span>(s(lang, "Name for the new passkey", "Yeni geçiş anahtarının adı"))</span> |
crates/forge-web/src/pages/repo_collaborators.rsmodified+94 -116
| @@ -31,7 +31,7 @@ use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; | |||
| 31 | use crate::pages::repo_settings::settings_frame; | 31 | use crate::pages::repo_settings::settings_frame; |
| 32 | use crate::pages::repo_settings_live::settings_head; | 32 | use crate::pages::repo_settings_live::settings_head; |
| 33 | use crate::state::AppState; | 33 | use crate::state::AppState; |
| 34 | -use crate::views::{alert, avatar_url, display_name, empty_state, shell}; | 34 | +use crate::views::{alert, avatar_url, display_name, shell}; |
| 35 | 35 | ||
| 36 | path_param!(owner); | 36 | path_param!(owner); |
| 37 | path_param!(repo); | 37 | path_param!(repo); |
| @@ -156,118 +156,104 @@ fn collaborators_redirect(title: &str) -> SeeOther { | |||
| 156 | see_other(format!("/{title}/settings/collaborators")) | 156 | see_other(format!("/{title}/settings/collaborators")) |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | -/// The role legend: what each role may do. | 159 | +/// The add row, then one row per collaborator. The role legend sits in the add panel. |
| 160 | #[component] | 160 | #[component] |
| 161 | -async fn role_legend(lang: Lang) -> Result<impl View> { | 161 | +async fn collaborators_pane( |
| 162 | - Ok(view! { | ||
| 163 | - <section class="card"> | ||
| 164 | - <h3>(g::t(lang, K::Roles))</h3> | ||
| 165 | - <dl class="role-list"> | ||
| 166 | - for entry in LEGEND.iter() { | ||
| 167 | - <dt>(entry.0.as_str())</dt> | ||
| 168 | - <dd>(g::t(lang, entry.1))</dd> | ||
| 169 | - } | ||
| 170 | - </dl> | ||
| 171 | - </section> | ||
| 172 | - }) | ||
| 173 | -} | ||
| 174 | - | ||
| 175 | -/// The collaborators table. Each row has a role form (Save) and a remove form (Remove). | ||
| 176 | -#[component] | ||
| 177 | -async fn collaborators_table( | ||
| 178 | lang: Lang, | 162 | lang: Lang, |
| 179 | rows: Vec<CollabRow>, | 163 | rows: Vec<CollabRow>, |
| 180 | role_action: String, | 164 | role_action: String, |
| 181 | remove_action: String, | 165 | remove_action: String, |
| 166 | + add_action: String, | ||
| 182 | csrf: String, | 167 | csrf: String, |
| 168 | + add_open: bool, | ||
| 183 | ) -> Result<impl View> { | 169 | ) -> Result<impl View> { |
| 184 | Ok(view! { | 170 | Ok(view! { |
| 185 | - if rows.is_empty() { | 171 | + <section class="card rows-pane"> |
| 186 | - empty_state(title: g::t(lang, K::NoCollaborators), | 172 | + <div class="row-line"> |
| 187 | - <a class="button" href="#add-collaborator">(g::t(lang, K::AddCollaboratorHeading))</a>) | 173 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 188 | - } else { | 174 | + <div class="row-main"> |
| 189 | - <div class="table-wrap"> | 175 | + <h2 class="row-title">(g::t(lang, K::AddCollaboratorHeading))</h2> |
| 190 | - <table class="table collaborators members-table"> | 176 | + if rows.is_empty() { |
| 191 | - <thead> | 177 | + <p class="row-status">(g::t(lang, K::NoCollaborators))</p> |
| 192 | - <tr> | 178 | + } else { |
| 193 | - <th>(g::t(lang, K::ColUser))</th> | 179 | + <p class="row-status">(g::t(lang, K::CollaboratorsHelp))</p> |
| 194 | - <th>(g::t(lang, K::Role))</th> | ||
| 195 | - <th><span class="muted small">(g::t(lang, K::Remove))</span></th> | ||
| 196 | - </tr> | ||
| 197 | - </thead> | ||
| 198 | - <tbody> | ||
| 199 | - for row in rows.iter() { | ||
| 200 | - <tr> | ||
| 201 | - <td> | ||
| 202 | - if row.label == row.username { | ||
| 203 | - <a class="user-link" href=(format!("/{}", row.username.as_str()))> | ||
| 204 | - <img class="avatar avatar-sm" src=(row.avatar.as_str()) alt="" width="24" height="24"> | ||
| 205 | - <span>(row.label.as_str())</span> | ||
| 206 | - </a> | ||
| 207 | - } else { | ||
| 208 | - <span class="user-link"> | ||
| 209 | - <img class="avatar avatar-sm" src=(row.avatar.as_str()) alt="" width="24" height="24"> | ||
| 210 | - <span>(row.label.as_str())</span> | ||
| 211 | - </span> | ||
| 212 | - } | ||
| 213 | - </td> | ||
| 214 | - <td> | ||
| 215 | - <form method="post" action=(role_action.as_str()) class="inline-form"> | ||
| 216 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 217 | - <input type="hidden" name="user_id" value=(row.user_id.as_str())> | ||
| 218 | - <select name="role" aria-label=(g::role_for(lang, row.username.as_str()))> | ||
| 219 | - for role in ROLES.iter() { | ||
| 220 | - <option value=(role.as_str()) selected=(*role == row.role)>(role.as_str())</option> | ||
| 221 | - } | ||
| 222 | - </select> | ||
| 223 | - <button type="submit">(g::t(lang, K::SaveRole))</button> | ||
| 224 | - </form> | ||
| 225 | - </td> | ||
| 226 | - <td> | ||
| 227 | - <details class="row-menu"> | ||
| 228 | - <summary class="button row-menu-btn" aria-label=(passkeys::s(lang, "Actions", "İşlemler")) aria-haspopup="menu">"⋯"</summary> | ||
| 229 | - <div class="row-menu-panel" role="menu"> | ||
| 230 | - <form method="post" action=(remove_action.as_str()) class="inline-form"> | ||
| 231 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 232 | - <input type="hidden" name="user_id" value=(row.user_id.as_str())> | ||
| 233 | - <button type="submit" class="danger">(g::t(lang, K::Remove))</button> | ||
| 234 | - </form> | ||
| 235 | - </div> | ||
| 236 | - </details> | ||
| 237 | - </td> | ||
| 238 | - </tr> | ||
| 239 | - } | ||
| 240 | - </tbody> | ||
| 241 | - </table> | ||
| 242 | - </div> | ||
| 243 | - } | ||
| 244 | - }) | ||
| 245 | -} | ||
| 246 | - | ||
| 247 | -/// The add form: a username and a role. Re-adding an existing collaborator updates the role. | ||
| 248 | -#[component] | ||
| 249 | -async fn add_form(lang: Lang, add_action: String, csrf: String) -> Result<impl View> { | ||
| 250 | - Ok(view! { | ||
| 251 | - <h3>(g::t(lang, K::AddCollaboratorHeading))</h3> | ||
| 252 | - <form method="post" action=(add_action.as_str()) class="stack" id="add-collaborator"> | ||
| 253 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 254 | - <label> | ||
| 255 | - <span>(g::t(lang, K::Username))</span> | ||
| 256 | - <input type="text" name="username" autocomplete="off" spellcheck="false" required=(true)> | ||
| 257 | - </label> | ||
| 258 | - <label> | ||
| 259 | - <span>(g::t(lang, K::Role))</span> | ||
| 260 | - <select name="role"> | ||
| 261 | - for role in ROLES.iter() { | ||
| 262 | - <option value=(role.as_str()) selected=(*role == Role::Read)>(role.as_str())</option> | ||
| 263 | } | 180 | } |
| 264 | - </select> | 181 | + </div> |
| 265 | - </label> | 182 | + <details class="row-action" open=(add_open)> |
| 266 | - <p class="muted small">(g::t(lang, K::AddCollaboratorHelp))</p> | 183 | + <summary>(g::t(lang, K::AddCollaboratorButton))</summary> |
| 267 | - <div> | 184 | + <div class="row-panel"> |
| 268 | - <button type="submit" class="primary">(g::t(lang, K::AddCollaboratorButton))</button> | 185 | + <h3>(g::t(lang, K::Roles))</h3> |
| 186 | + <dl class="role-list"> | ||
| 187 | + for entry in LEGEND.iter() { | ||
| 188 | + <dt>(entry.0.as_str())</dt> | ||
| 189 | + <dd>(g::t(lang, entry.1))</dd> | ||
| 190 | + } | ||
| 191 | + </dl> | ||
| 192 | + <form method="post" action=(add_action.as_str()) class="stack" id="add-collaborator"> | ||
| 193 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 194 | + <label> | ||
| 195 | + <span>(g::t(lang, K::Username))</span> | ||
| 196 | + <input type="text" name="username" autocomplete="off" spellcheck="false" required=(true)> | ||
| 197 | + </label> | ||
| 198 | + <label> | ||
| 199 | + <span>(g::t(lang, K::Role))</span> | ||
| 200 | + <select name="role"> | ||
| 201 | + for role in ROLES.iter() { | ||
| 202 | + <option value=(role.as_str()) selected=(*role == Role::Read)>(role.as_str())</option> | ||
| 203 | + } | ||
| 204 | + </select> | ||
| 205 | + </label> | ||
| 206 | + <p class="muted small">(g::t(lang, K::AddCollaboratorHelp))</p> | ||
| 207 | + <div> | ||
| 208 | + <button type="submit" class="primary">(g::t(lang, K::AddCollaboratorButton))</button> | ||
| 209 | + </div> | ||
| 210 | + </form> | ||
| 211 | + </div> | ||
| 212 | + </details> | ||
| 269 | </div> | 213 | </div> |
| 270 | - </form> | 214 | + for row in rows.iter() { |
| 215 | + <div class="row-line"> | ||
| 216 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 4-6 8-6s8 2 8 6"/></svg> | ||
| 217 | + <div class="row-main"> | ||
| 218 | + <strong class="row-name"> | ||
| 219 | + if row.label == row.username { | ||
| 220 | + <a class="user-link" href=(format!("/{}", row.username.as_str()))> | ||
| 221 | + <img class="avatar avatar-sm" src=(row.avatar.as_str()) alt="" width="24" height="24"> | ||
| 222 | + <span>(row.label.as_str())</span> | ||
| 223 | + </a> | ||
| 224 | + } else { | ||
| 225 | + <span class="user-link"> | ||
| 226 | + <img class="avatar avatar-sm" src=(row.avatar.as_str()) alt="" width="24" height="24"> | ||
| 227 | + <span>(row.label.as_str())</span> | ||
| 228 | + </span> | ||
| 229 | + } | ||
| 230 | + </strong> | ||
| 231 | + </div> | ||
| 232 | + <div class="row-actions"> | ||
| 233 | + <form method="post" action=(role_action.as_str()) class="inline-form"> | ||
| 234 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 235 | + <input type="hidden" name="user_id" value=(row.user_id.as_str())> | ||
| 236 | + <select name="role" aria-label=(g::role_for(lang, row.username.as_str()))> | ||
| 237 | + for role in ROLES.iter() { | ||
| 238 | + <option value=(role.as_str()) selected=(*role == row.role)>(role.as_str())</option> | ||
| 239 | + } | ||
| 240 | + </select> | ||
| 241 | + <button type="submit">(g::t(lang, K::SaveRole))</button> | ||
| 242 | + </form> | ||
| 243 | + <details class="row-menu"> | ||
| 244 | + <summary class="button row-menu-btn" aria-label=(passkeys::s(lang, "Actions", "İşlemler")) aria-haspopup="menu">"⋯"</summary> | ||
| 245 | + <div class="row-menu-panel" role="menu"> | ||
| 246 | + <form method="post" action=(remove_action.as_str()) class="inline-form"> | ||
| 247 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 248 | + <input type="hidden" name="user_id" value=(row.user_id.as_str())> | ||
| 249 | + <button type="submit" class="danger">(g::t(lang, K::Remove))</button> | ||
| 250 | + </form> | ||
| 251 | + </div> | ||
| 252 | + </details> | ||
| 253 | + </div> | ||
| 254 | + </div> | ||
| 255 | + } | ||
| 256 | + </section> | ||
| 271 | }) | 257 | }) |
| 272 | } | 258 | } |
| 273 | 259 | ||
| @@ -289,7 +275,7 @@ impl FrameData { | |||
| 289 | } | 275 | } |
| 290 | } | 276 | } |
| 291 | 277 | ||
| 292 | -/// The page body: repo header with Settings active, the notice, the table, the legend and the add form. | 278 | +/// The page body: repo header with Settings active, the notice, then the rows pane. |
| 293 | #[component] | 279 | #[component] |
| 294 | async fn collaborators_body( | 280 | async fn collaborators_body( |
| 295 | lang: Lang, | 281 | lang: Lang, |
| @@ -303,6 +289,8 @@ async fn collaborators_body( | |||
| 303 | let add_action = format!("/{}/settings/collaborators/add", frame.title); | 289 | let add_action = format!("/{}/settings/collaborators/add", frame.title); |
| 304 | let header = frame.head; | 290 | let header = frame.head; |
| 305 | let nav_title = frame.title.clone(); | 291 | let nav_title = frame.title.clone(); |
| 292 | + // A refused add (or role change) reopens the add panel; a missing collaborator does not. | ||
| 293 | + let add_open = matches!(notice, Some((key, true)) if !matches!(key, K::NotCollaborator)); | ||
| 306 | let notice = notice.map(|(key, is_error)| (g::t(lang, key), is_error)); | 294 | let notice = notice.map(|(key, is_error)| (g::t(lang, key), is_error)); |
| 307 | let can_delete = header.can_delete; | 295 | let can_delete = header.can_delete; |
| 308 | Ok(view! { | 296 | Ok(view! { |
| @@ -315,18 +303,8 @@ async fn collaborators_body( | |||
| 315 | <section class="card notice" role="status">(text)</section> | 303 | <section class="card notice" role="status">(text)</section> |
| 316 | } | 304 | } |
| 317 | } | 305 | } |
| 318 | - <div class="fit-pane settings-split"> | 306 | + collaborators_pane(lang: lang, rows: rows, role_action: role_action, |
| 319 | - <section class="card"> | 307 | + remove_action: remove_action, add_action: add_action, csrf: csrf, add_open: add_open) |
| 320 | - <h2>(g::t(lang, K::Collaborators))</h2> | ||
| 321 | - <p class="muted small">(g::t(lang, K::CollaboratorsHelp))</p> | ||
| 322 | - collaborators_table(lang: lang, rows: rows, role_action: role_action, | ||
| 323 | - remove_action: remove_action, csrf: csrf.clone()) | ||
| 324 | - </section> | ||
| 325 | - <section class="card"> | ||
| 326 | - add_form(lang: lang, add_action: add_action, csrf: csrf) | ||
| 327 | - </section> | ||
| 328 | - role_legend(lang: lang) | ||
| 329 | - </div> | ||
| 330 | ) | 308 | ) |
| 331 | }) | 309 | }) |
| 332 | } | 310 | } |
crates/forge-web/src/pages/repo_mirrors.rsmodified+91 -71
| @@ -37,7 +37,7 @@ use crate::pages::repo_settings::settings_frame; | |||
| 37 | use crate::pages::repo_settings_live::settings_head; | 37 | use crate::pages::repo_settings_live::settings_head; |
| 38 | use crate::state::AppState; | 38 | use crate::state::AppState; |
| 39 | use crate::views::{ | 39 | use crate::views::{ |
| 40 | - alert, empty_state, enc, now_unix, rel_time_or_never, relative_time, shell, user_facing_message, | 40 | + alert, enc, now_unix, rel_time_or_never, relative_time, shell, user_facing_message, |
| 41 | }; | 41 | }; |
| 42 | use crate::webhooks::client::{WebhookPolicy, validate_url}; | 42 | use crate::webhooks::client::{WebhookPolicy, validate_url}; |
| 43 | 43 | ||
| @@ -497,6 +497,8 @@ async fn mirror_form( | |||
| 497 | }) | 497 | }) |
| 498 | } | 498 | } |
| 499 | 499 | ||
| 500 | +/// The add rows (pull, then push), then one row per mirror. Each add row opens its form in place. | ||
| 501 | +/// Archived repos show no add rows. | ||
| 500 | #[component] | 502 | #[component] |
| 501 | async fn mirrors_list_body( | 503 | async fn mirrors_list_body( |
| 502 | head: RepoHead, | 504 | head: RepoHead, |
| @@ -510,79 +512,100 @@ async fn mirrors_list_body( | |||
| 510 | lang: Lang, | 512 | lang: Lang, |
| 511 | ) -> Result<impl View> { | 513 | ) -> Result<impl View> { |
| 512 | let add_action = mirrors_href(&title); | 514 | let add_action = mirrors_href(&title); |
| 515 | + let empty = rows.is_empty(); | ||
| 513 | let can_pull = pull_form.is_some(); | 516 | let can_pull = pull_form.is_some(); |
| 517 | + let pull_open = pull_form.as_ref().is_some_and(|pull| pull.error.is_some()); | ||
| 518 | + let push_open = draft.error.is_some(); | ||
| 514 | Ok(view! { | 519 | Ok(view! { |
| 515 | frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang, | 520 | frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang, |
| 516 | - <div class="fit-pane settings-split"> | 521 | + <section class="card rows-pane"> |
| 517 | - <section class="card"> | ||
| 518 | - <h2>(g::t(lang, K::Mirrors))</h2> | ||
| 519 | - <p class="muted small">(g::t(lang, K::MirrorsIntro))</p> | ||
| 520 | - if rows.is_empty() { | ||
| 521 | - empty_state(title: g::t(lang, K::NoMirrors), | ||
| 522 | - if !archived { | ||
| 523 | - if can_pull { | ||
| 524 | - <a class="button" href="#add-pull-mirror">(g::t(lang, K::AddPullMirror))</a> | ||
| 525 | - } | ||
| 526 | - <a class="button" href="#add-push-mirror">(g::t(lang, K::AddPushMirror))</a> | ||
| 527 | - }) | ||
| 528 | - } else { | ||
| 529 | - <ul class="runner-list mirror-list"> | ||
| 530 | - for row in rows.iter() { | ||
| 531 | - <li class="runner-row"> | ||
| 532 | - <div class="runner-id"> | ||
| 533 | - <div class="runner-title"> | ||
| 534 | - <span class=(row.dot_class) role="img" aria-label=(row.status_text) title=(row.status_text)></span> | ||
| 535 | - <a class="runner-name mirror-url" href=(row.href.as_str())>(row.url.as_str())</a> | ||
| 536 | - </div> | ||
| 537 | - <p class="runner-meta muted"> | ||
| 538 | - (row.direction)" · "(row.interval.as_str()) | ||
| 539 | - if !row.enabled { | ||
| 540 | - " · "(adm::t(lang, adm::K::Disabled)) | ||
| 541 | - } | ||
| 542 | - " · " | ||
| 543 | - if row.last_sync_at.is_empty() { | ||
| 544 | - (g::t(lang, K::StatusNotRun)) | ||
| 545 | - } else { | ||
| 546 | - (row.sync_prefix)<time data-rel="true" datetime=(row.last_sync_at.as_str()) title=(row.last_sync.as_str())>(row.last_sync_rel.as_str())</time>(row.sync_suffix) | ||
| 547 | - } | ||
| 548 | - </p> | ||
| 549 | - if !row.error.is_empty() { | ||
| 550 | - <details class="mirror-failure"> | ||
| 551 | - <summary>(g::t(lang, K::ErrorLabel))</summary> | ||
| 552 | - <pre class="mirror-error">(row.error.as_str())</pre> | ||
| 553 | - </details> | ||
| 554 | - } | ||
| 555 | - </div> | ||
| 556 | - if !archived { | ||
| 557 | - <form method="post" action=(row.sync_action.as_str()) class="inline-form"> | ||
| 558 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 559 | - <button type="submit" class="hook-sync">(g::t(lang, K::SyncNow))</button> | ||
| 560 | - </form> | ||
| 561 | - } | ||
| 562 | - </li> | ||
| 563 | - } | ||
| 564 | - </ul> | ||
| 565 | - } | ||
| 566 | - </section> | ||
| 567 | if !archived { | 522 | if !archived { |
| 568 | if let Some(pull) = pull_form { | 523 | if let Some(pull) = pull_form { |
| 569 | - <section class="card" id="add-pull-mirror"> | 524 | + <div class="row-line" id="add-pull-mirror"> |
| 570 | - <h2>(g::t(lang, K::AddPullMirror))</h2> | 525 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 571 | - <p class="muted small">(g::t(lang, K::AddPullIntro))</p> | 526 | + <div class="row-main"> |
| 572 | - mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: true, current_url: String::new(), | 527 | + <h2 class="row-title">(g::t(lang, K::AddPullMirror))</h2> |
| 573 | - url: pull.url, username: pull.username, has_secret: false, interval: pull.interval, | 528 | + <p class="row-status">(g::t(lang, K::MirrorsIntro))</p> |
| 574 | - enabled: None, error: pull.error, submit: g::t(lang, K::AddPullMirror), direction: "pull", lang: lang) | 529 | + if empty { |
| 575 | - </section> | 530 | + <p class="row-status">(g::t(lang, K::NoMirrors))</p> |
| 531 | + } else { | ||
| 532 | + <p class="row-status">(g::t(lang, K::AddPullIntro))</p> | ||
| 533 | + } | ||
| 534 | + </div> | ||
| 535 | + <details class="row-action" open=(pull_open)> | ||
| 536 | + <summary>(g::t(lang, K::AddPullMirror))</summary> | ||
| 537 | + <div class="row-panel"> | ||
| 538 | + mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: true, current_url: String::new(), | ||
| 539 | + url: pull.url, username: pull.username, has_secret: false, interval: pull.interval, | ||
| 540 | + enabled: None, error: pull.error, submit: g::t(lang, K::AddPullMirror), direction: "pull", lang: lang) | ||
| 541 | + </div> | ||
| 542 | + </details> | ||
| 543 | + </div> | ||
| 576 | } | 544 | } |
| 577 | - <section class="card" id="add-push-mirror"> | 545 | + <div class="row-line" id="add-push-mirror"> |
| 578 | - <h2>(g::t(lang, K::AddPushMirror))</h2> | 546 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 579 | - <p class="muted small">(g::t(lang, K::AddPushIntro))</p> | 547 | + <div class="row-main"> |
| 580 | - mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: false, current_url: String::new(), | 548 | + <h2 class="row-title">(g::t(lang, K::AddPushMirror))</h2> |
| 581 | - url: draft.url, username: draft.username, has_secret: false, interval: draft.interval, | 549 | + if empty && !can_pull { |
| 582 | - enabled: None, error: draft.error, submit: g::t(lang, K::AddPushMirror), direction: "", lang: lang) | 550 | + <p class="row-status">(g::t(lang, K::NoMirrors))</p> |
| 583 | - </section> | 551 | + } else { |
| 552 | + <p class="row-status">(g::t(lang, K::AddPushIntro))</p> | ||
| 553 | + } | ||
| 554 | + </div> | ||
| 555 | + <details class="row-action" open=(push_open)> | ||
| 556 | + <summary>(g::t(lang, K::AddPushMirror))</summary> | ||
| 557 | + <div class="row-panel"> | ||
| 558 | + mirror_form(action: add_action.clone(), csrf: csrf.clone(), pull: false, current_url: String::new(), | ||
| 559 | + url: draft.url, username: draft.username, has_secret: false, interval: draft.interval, | ||
| 560 | + enabled: None, error: draft.error, submit: g::t(lang, K::AddPushMirror), direction: "", lang: lang) | ||
| 561 | + </div> | ||
| 562 | + </details> | ||
| 563 | + </div> | ||
| 584 | } | 564 | } |
| 585 | - </div> | 565 | + if archived && empty { |
| 566 | + <div class="row-line"> | ||
| 567 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/><path d="M3 21v-5h5"/></svg> | ||
| 568 | + <div class="row-main"> | ||
| 569 | + <h2 class="row-title">(g::t(lang, K::NoMirrors))</h2> | ||
| 570 | + </div> | ||
| 571 | + </div> | ||
| 572 | + } | ||
| 573 | + for row in rows.iter() { | ||
| 574 | + <div class="row-line"> | ||
| 575 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 0 1 15-6.7L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-15 6.7L3 16"/><path d="M3 21v-5h5"/></svg> | ||
| 576 | + <div class="row-main"> | ||
| 577 | + <strong class="row-name"> | ||
| 578 | + <span class=(row.dot_class) role="img" aria-label=(row.status_text) title=(row.status_text)></span> | ||
| 579 | + <a class="mirror-url" href=(row.href.as_str())>(row.url.as_str())</a> | ||
| 580 | + </strong> | ||
| 581 | + <p class="row-status"> | ||
| 582 | + (row.direction)" · "(row.interval.as_str()) | ||
| 583 | + if !row.enabled { | ||
| 584 | + " · "(adm::t(lang, adm::K::Disabled)) | ||
| 585 | + } | ||
| 586 | + " · " | ||
| 587 | + if row.last_sync_at.is_empty() { | ||
| 588 | + (g::t(lang, K::StatusNotRun)) | ||
| 589 | + } else { | ||
| 590 | + (row.sync_prefix)<time data-rel="true" datetime=(row.last_sync_at.as_str()) title=(row.last_sync.as_str())>(row.last_sync_rel.as_str())</time>(row.sync_suffix) | ||
| 591 | + } | ||
| 592 | + </p> | ||
| 593 | + if !row.error.is_empty() { | ||
| 594 | + <details class="mirror-failure"> | ||
| 595 | + <summary>(g::t(lang, K::ErrorLabel))</summary> | ||
| 596 | + <pre class="mirror-error">(row.error.as_str())</pre> | ||
| 597 | + </details> | ||
| 598 | + } | ||
| 599 | + </div> | ||
| 600 | + if !archived { | ||
| 601 | + <form method="post" action=(row.sync_action.as_str()) class="row-form"> | ||
| 602 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 603 | + <button type="submit" class="hook-sync">(g::t(lang, K::SyncNow))</button> | ||
| 604 | + </form> | ||
| 605 | + } | ||
| 606 | + </div> | ||
| 607 | + } | ||
| 608 | + </section> | ||
| 586 | ) | 609 | ) |
| 587 | }) | 610 | }) |
| 588 | } | 611 | } |
| @@ -1268,10 +1291,7 @@ mod tests { | |||
| 1268 | let (status, _, body) = | 1291 | let (status, _, body) = |
| 1269 | send(&app, "GET", "/tahinli/proj/settings/mirrors", &cookie, &[]).await; | 1292 | send(&app, "GET", "/tahinli/proj/settings/mirrors", &cookie, &[]).await; |
| 1270 | assert_eq!(status, 200, "{body}"); | 1293 | assert_eq!(status, 200, "{body}"); |
| 1271 | - assert!( | 1294 | + assert!(body.contains("Yansılar"), "Turkish title missing"); |
| 1272 | - body.contains("<h2>Yansılar</h2>"), | ||
| 1273 | - "Turkish heading missing" | ||
| 1274 | - ); | ||
| 1275 | } | 1295 | } |
| 1276 | 1296 | ||
| 1277 | /// The push form refuses a loopback destination and stores nothing, then adds a good mirror | 1297 | /// The push form refuses a loopback destination and stores nothing, then adds a good mirror |
crates/forge-web/src/pages/repo_rename.rsmodified+53 -34
| @@ -118,50 +118,69 @@ async fn rename_body( | |||
| 118 | transfer_owner, | 118 | transfer_owner, |
| 119 | transfer_error, | 119 | transfer_error, |
| 120 | } = forms; | 120 | } = forms; |
| 121 | + // A form whose submit was refused opens in place, so its message is visible. | ||
| 122 | + let rename_open = rename_error.is_some(); | ||
| 123 | + let transfer_open = transfer_error.is_some(); | ||
| 121 | Ok(view! { | 124 | Ok(view! { |
| 122 | repo_head(head: head) | 125 | repo_head(head: head) |
| 123 | settings_frame(lang: lang, title: nav_title, current: "rename", can_delete: can_delete, | 126 | settings_frame(lang: lang, title: nav_title, current: "rename", can_delete: can_delete, |
| 124 | if let Some(key) = notice { | 127 | if let Some(key) = notice { |
| 125 | <section class="card notice" role="status">(g::t(lang, key))</section> | 128 | <section class="card notice" role="status">(g::t(lang, key))</section> |
| 126 | } | 129 | } |
| 127 | - <section class="card"> | 130 | + <section class="card rows-pane"> |
| 128 | - <h2>(g::t(lang, K::RenameRepo))</h2> | 131 | + <div class="row-line"> |
| 129 | - <p class="muted small">(g::t(lang, K::RenameHelp))</p> | 132 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20h4L19 9l-4-4L4 16z"/><path d="M14 6l4 4"/></svg> |
| 130 | - <form method="post" action=(rename_action.as_str()) class="stack"> | 133 | + <div class="row-main"> |
| 131 | - if let Some(message) = rename_error { | 134 | + <h2 class="row-title">(g::t(lang, K::RenameRepo))</h2> |
| 132 | - alert(message: message.as_str()) | 135 | + <p class="row-status">(g::t(lang, K::RenameHelp))</p> |
| 133 | - } | ||
| 134 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 135 | - <label> | ||
| 136 | - <span>(g::t(lang, K::NewName))</span> | ||
| 137 | - <input type="text" name="name" value=(rename_name.as_str()) autocomplete="off" spellcheck="false" required=(true)> | ||
| 138 | - </label> | ||
| 139 | - <div> | ||
| 140 | - <button type="submit">(g::t(lang, K::RenameRepo))</button> | ||
| 141 | </div> | 136 | </div> |
| 142 | - </form> | 137 | + <details class="row-action" open=(rename_open)> |
| 138 | + <summary>(g::t(lang, K::RenameRepo))</summary> | ||
| 139 | + <div class="row-panel"> | ||
| 140 | + if let Some(message) = rename_error { | ||
| 141 | + alert(message: message.as_str()) | ||
| 142 | + } | ||
| 143 | + <form method="post" action=(rename_action.as_str()) class="stack"> | ||
| 144 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 145 | + <label> | ||
| 146 | + <span>(g::t(lang, K::NewName))</span> | ||
| 147 | + <input type="text" name="name" value=(rename_name.as_str()) autocomplete="off" spellcheck="false" required=(true)> | ||
| 148 | + </label> | ||
| 149 | + <button type="submit">(g::t(lang, K::RenameRepo))</button> | ||
| 150 | + </form> | ||
| 151 | + </div> | ||
| 152 | + </details> | ||
| 153 | + </div> | ||
| 143 | </section> | 154 | </section> |
| 144 | if can_delete { | 155 | if can_delete { |
| 145 | - <section class="card"> | 156 | + <section class="card rows-pane"> |
| 146 | - <h2>(g::t(lang, K::TransferRepo))</h2> | 157 | + <div class="row-line"> |
| 147 | - <p class="muted small">(g::t(lang, K::TransferHelp))<a href=(status_href.as_str())>(g::t(lang, K::PendingTransfers))</a></p> | 158 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M7 7h11l-3-3M17 17H6l3 3"/></svg> |
| 148 | - <form method="post" action=(transfer_action.as_str()) class="stack"> | 159 | + <div class="row-main"> |
| 149 | - if let Some(message) = transfer_error { | 160 | + <h2 class="row-title">(g::t(lang, K::TransferRepo))</h2> |
| 150 | - alert(message: message.as_str()) | 161 | + <p class="row-status">(g::t(lang, K::TransferHelp))<a href=(status_href.as_str())>(g::t(lang, K::PendingTransfers))</a></p> |
| 151 | - } | ||
| 152 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 153 | - <label> | ||
| 154 | - <span>(g::t(lang, K::NewOwnerLabel))</span> | ||
| 155 | - <input type="text" name="new_owner" value=(transfer_owner.as_str()) autocomplete="off" spellcheck="false" required=(true)> | ||
| 156 | - </label> | ||
| 157 | - <label> | ||
| 158 | - <span>(g::t(lang, K::TypeToConfirmBefore))<code>(title.clone())</code>(g::t(lang, K::TypeToConfirmAfter))</span> | ||
| 159 | - <input type="text" name="confirm" autocomplete="off" spellcheck="false" required=(true)> | ||
| 160 | - </label> | ||
| 161 | - <div> | ||
| 162 | - <button type="submit" class="danger">(g::t(lang, K::TransferRepo))</button> | ||
| 163 | </div> | 162 | </div> |
| 164 | - </form> | 163 | + <details class="row-action danger" open=(transfer_open)> |
| 164 | + <summary>(g::t(lang, K::TransferRepo))</summary> | ||
| 165 | + <div class="row-panel"> | ||
| 166 | + if let Some(message) = transfer_error { | ||
| 167 | + alert(message: message.as_str()) | ||
| 168 | + } | ||
| 169 | + <form method="post" action=(transfer_action.as_str()) class="stack"> | ||
| 170 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 171 | + <label> | ||
| 172 | + <span>(g::t(lang, K::NewOwnerLabel))</span> | ||
| 173 | + <input type="text" name="new_owner" value=(transfer_owner.as_str()) autocomplete="off" spellcheck="false" required=(true)> | ||
| 174 | + </label> | ||
| 175 | + <label> | ||
| 176 | + <span>(g::t(lang, K::TypeToConfirmBefore))<code>(title.clone())</code>(g::t(lang, K::TypeToConfirmAfter))</span> | ||
| 177 | + <input type="text" name="confirm" autocomplete="off" spellcheck="false" required=(true)> | ||
| 178 | + </label> | ||
| 179 | + <button type="submit" class="danger">(g::t(lang, K::TransferRepo))</button> | ||
| 180 | + </form> | ||
| 181 | + </div> | ||
| 182 | + </details> | ||
| 183 | + </div> | ||
| 165 | </section> | 184 | </section> |
| 166 | } | 185 | } |
| 167 | ) | 186 | ) |
crates/forge-web/src/pages/repo_secrets.rsmodified+65 -66
| @@ -23,7 +23,7 @@ use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; | |||
| 23 | use crate::pages::repo_settings::settings_frame; | 23 | use crate::pages::repo_settings::settings_frame; |
| 24 | use crate::pages::repo_settings_live::settings_head; | 24 | use crate::pages::repo_settings_live::settings_head; |
| 25 | use crate::state::AppState; | 25 | use crate::state::AppState; |
| 26 | -use crate::views::{alert, empty_state, enc, rel_time, shell}; | 26 | +use crate::views::{alert, enc, rel_time, shell}; |
| 27 | 27 | ||
| 28 | path_param!(owner); | 28 | path_param!(owner); |
| 29 | path_param!(repo); | 29 | path_param!(repo); |
| @@ -177,8 +177,8 @@ async fn frame_top( | |||
| 177 | }) | 177 | }) |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | -/// The list, the add form and the delete buttons. `draft_name` and `error` come from a refused add; | 180 | +/// The add row, then one row per secret with its delete button. Archived repos show no add row. |
| 181 | -/// the value is never passed back, so the textarea is always empty. | 181 | +/// `draft_name` and `error` come from a refused add; the value is never passed back, so the textarea is always empty. |
| 182 | #[component] | 182 | #[component] |
| 183 | async fn secrets_body( | 183 | async fn secrets_body( |
| 184 | lang: Lang, | 184 | lang: Lang, |
| @@ -193,74 +193,73 @@ async fn secrets_body( | |||
| 193 | ) -> Result<impl View> { | 193 | ) -> Result<impl View> { |
| 194 | let set_action = secrets_href(&title); | 194 | let set_action = secrets_href(&title); |
| 195 | let delete_action = format!("{set_action}/delete"); | 195 | let delete_action = format!("{set_action}/delete"); |
| 196 | + let add_open = error.is_some(); | ||
| 196 | Ok(view! { | 197 | Ok(view! { |
| 197 | frame_top(lang: lang, head: head, title: title.clone(), notice: notice, archived: archived, | 198 | frame_top(lang: lang, head: head, title: title.clone(), notice: notice, archived: archived, |
| 198 | - <div class="fit-pane settings-split"> | 199 | + <section class="card rows-pane"> |
| 199 | - <section class="card"> | ||
| 200 | - <h2>(g::t(lang, K::Secrets))</h2> | ||
| 201 | - <p class="muted small">(g::t(lang, K::SecretsHelp))</p> | ||
| 202 | - if rows.is_empty() { | ||
| 203 | - empty_state(title: g::t(lang, K::NoSecrets), | ||
| 204 | - if !archived { | ||
| 205 | - <a class="button" href="#add-secret">(g::t(lang, K::AddOrUpdate))</a> | ||
| 206 | - }) | ||
| 207 | - } else { | ||
| 208 | - <div class="table-wrap"> | ||
| 209 | - <table class="table secrets"> | ||
| 210 | - <thead> | ||
| 211 | - <tr> | ||
| 212 | - <th>(g::t(lang, K::Name))</th> | ||
| 213 | - <th>(g::t(lang, K::LastUpdated))</th> | ||
| 214 | - <th></th> | ||
| 215 | - </tr> | ||
| 216 | - </thead> | ||
| 217 | - <tbody> | ||
| 218 | - for row in rows.iter() { | ||
| 219 | - <tr> | ||
| 220 | - <td><code>(row.name.as_str())</code></td> | ||
| 221 | - <td class="small">rel_time(lang: lang, stamp: row.updated_at.as_str())</td> | ||
| 222 | - <td> | ||
| 223 | - if !archived { | ||
| 224 | - <form method="post" action=(delete_action.as_str()) class="inline-form"> | ||
| 225 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 226 | - <input type="hidden" name="name" value=(row.name.as_str())> | ||
| 227 | - <button type="submit" class="danger">(g::t(lang, K::Delete))</button> | ||
| 228 | - </form> | ||
| 229 | - } | ||
| 230 | - </td> | ||
| 231 | - </tr> | ||
| 232 | - } | ||
| 233 | - </tbody> | ||
| 234 | - </table> | ||
| 235 | - </div> | ||
| 236 | - } | ||
| 237 | - </section> | ||
| 238 | if !archived { | 200 | if !archived { |
| 239 | - <section class="card" id="add-secret"> | 201 | + <div class="row-line" id="add-secret"> |
| 240 | - <h2>(g::t(lang, K::AddOrUpdate))</h2> | 202 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 241 | - if let Some(message) = error { | 203 | + <div class="row-main"> |
| 242 | - <p class="alert" role="alert">(message.as_str())</p> | 204 | + <h2 class="row-title">(g::t(lang, K::AddOrUpdate))</h2> |
| 243 | - } | 205 | + if rows.is_empty() { |
| 244 | - <form method="post" action=(set_action.as_str()) class="stack"> | 206 | + <p class="row-status">(g::t(lang, K::NoSecrets))</p> |
| 245 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | 207 | + } else { |
| 246 | - <label> | 208 | + <p class="row-status">(g::t(lang, K::SecretsHelp))</p> |
| 247 | - (g::t(lang, K::Name)) | 209 | + } |
| 248 | - <input type="text" name="name" value=(draft_name.as_str()) required=(true) maxlength="64" | 210 | + </div> |
| 249 | - pattern="[A-Z_][A-Z0-9_]{0,63}" autocomplete="off" spellcheck="false" | 211 | + <details class="row-action" open=(add_open)> |
| 250 | - placeholder="DEPLOY_TOKEN"> | 212 | + <summary>(g::t(lang, K::SaveSecret))</summary> |
| 251 | - </label> | 213 | + <div class="row-panel"> |
| 252 | - <label> | 214 | + if let Some(message) = error { |
| 253 | - (g::t(lang, K::Value)) | 215 | + <p class="alert" role="alert">(message.as_str())</p> |
| 254 | - <textarea name="value" required=(true) rows="6" autocomplete="off" spellcheck="false"></textarea> | 216 | + } |
| 255 | - </label> | 217 | + <form method="post" action=(set_action.as_str()) class="stack"> |
| 256 | - <p class="muted small">(g::t(lang, K::SecretLimits))</p> | 218 | + <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 257 | - <div class="actions"> | 219 | + <label> |
| 258 | - <button type="submit" class="primary">(g::t(lang, K::SaveSecret))</button> | 220 | + (g::t(lang, K::Name)) |
| 221 | + <input type="text" name="name" value=(draft_name.as_str()) required=(true) maxlength="64" | ||
| 222 | + pattern="[A-Z_][A-Z0-9_]{0,63}" autocomplete="off" spellcheck="false" | ||
| 223 | + placeholder="DEPLOY_TOKEN"> | ||
| 224 | + </label> | ||
| 225 | + <label> | ||
| 226 | + (g::t(lang, K::Value)) | ||
| 227 | + <textarea name="value" required=(true) rows="6" autocomplete="off" spellcheck="false"></textarea> | ||
| 228 | + </label> | ||
| 229 | + <p class="muted small">(g::t(lang, K::SecretLimits))</p> | ||
| 230 | + <div class="actions"> | ||
| 231 | + <button type="submit" class="primary">(g::t(lang, K::SaveSecret))</button> | ||
| 232 | + </div> | ||
| 233 | + </form> | ||
| 259 | </div> | 234 | </div> |
| 260 | - </form> | 235 | + </details> |
| 261 | - </section> | 236 | + </div> |
| 237 | + } | ||
| 238 | + if archived && rows.is_empty() { | ||
| 239 | + <div class="row-line"> | ||
| 240 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg> | ||
| 241 | + <div class="row-main"> | ||
| 242 | + <h2 class="row-title">(g::t(lang, K::NoSecrets))</h2> | ||
| 243 | + </div> | ||
| 244 | + </div> | ||
| 245 | + } | ||
| 246 | + for row in rows.iter() { | ||
| 247 | + <div class="row-line"> | ||
| 248 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg> | ||
| 249 | + <div class="row-main"> | ||
| 250 | + <strong class="row-name"><code>(row.name.as_str())</code></strong> | ||
| 251 | + <p class="row-status">rel_time(lang: lang, stamp: row.updated_at.as_str())</p> | ||
| 252 | + </div> | ||
| 253 | + if !archived { | ||
| 254 | + <form method="post" action=(delete_action.as_str()) class="row-form"> | ||
| 255 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 256 | + <input type="hidden" name="name" value=(row.name.as_str())> | ||
| 257 | + <button type="submit" class="danger">(g::t(lang, K::Delete))</button> | ||
| 258 | + </form> | ||
| 259 | + } | ||
| 260 | + </div> | ||
| 262 | } | 261 | } |
| 263 | - </div> | 262 | + </section> |
| 264 | ) | 263 | ) |
| 265 | }) | 264 | }) |
| 266 | } | 265 | } |
crates/forge-web/src/pages/repo_security.rsmodified+46 -65
| @@ -23,7 +23,7 @@ use crate::pages::repo::repo_head; | |||
| 23 | use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; | 23 | use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; |
| 24 | use crate::pages::repo_settings_live::security_live_url; | 24 | use crate::pages::repo_settings_live::security_live_url; |
| 25 | use crate::state::AppState; | 25 | use crate::state::AppState; |
| 26 | -use crate::views::{empty_state, rel_time, shell}; | 26 | +use crate::views::{rel_time, shell}; |
| 27 | 27 | ||
| 28 | path_param!(owner); | 28 | path_param!(owner); |
| 29 | path_param!(repo); | 29 | path_param!(repo); |
| @@ -121,73 +121,54 @@ async fn security_body( | |||
| 121 | let open_count = rows.iter().filter(|r| r.open).count(); | 121 | let open_count = rows.iter().filter(|r| r.open).count(); |
| 122 | Ok(view! { | 122 | Ok(view! { |
| 123 | repo_head(head: head) | 123 | repo_head(head: head) |
| 124 | - <section class="card lang-list fit-pane"> | 124 | + <section class="card rows-pane"> |
| 125 | - <div class="list-bar"> | 125 | + <div class="row-line"> |
| 126 | - <h2>(i18n::t(lang, Key::Security))</h2> | 126 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l8 3v6c0 4.5-3.4 8.3-8 9-4.6-.7-8-4.5-8-9V6z"/><path d="M9 12l2 2 4-4"/></svg> |
| 127 | - if !enabled { | 127 | + <div class="row-main"> |
| 128 | - <p class="muted small">(g::t(lang, K::SecurityOff))</p> | 128 | + <h2 class="row-title">(i18n::t(lang, Key::Security))</h2> |
| 129 | - } else { | 129 | + if !enabled { |
| 130 | - <p class="muted small">(g::dependencies_summary(lang, dependencies, open_count))</p> | 130 | + <p class="row-status">(g::t(lang, K::SecurityOff))</p> |
| 131 | - <p class="muted small">(g::t(lang, K::LockfilesRead))</p> | 131 | + } else { |
| 132 | - } | 132 | + <p class="row-status">(g::dependencies_summary(lang, dependencies, open_count))</p> |
| 133 | + <p class="row-status">(g::t(lang, K::LockfilesRead))</p> | ||
| 134 | + } | ||
| 135 | + if rows.is_empty() { | ||
| 136 | + <p class="row-status">(g::t(lang, K::NoAlerts))</p> | ||
| 137 | + } | ||
| 138 | + </div> | ||
| 133 | </div> | 139 | </div> |
| 134 | - <div class="list-scroll"> | 140 | + for row in rows.iter() { |
| 135 | - if rows.is_empty() { | 141 | + <div class="row-line" data-kb-row=""> |
| 136 | - empty_state(title: g::t(lang, K::NoAlerts)) | 142 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4l9 16H3z"/><path d="M12 10v4M12 17v.5"/></svg> |
| 137 | - } else { | 143 | + <div class="row-main"> |
| 138 | - <div class="table-wrap"> | 144 | + <strong class="row-name"><a href=(row.osv_href.as_str()) rel="noopener noreferrer">(row.advisory.as_str())</a></strong> |
| 139 | - <table class="table security-alerts"> | 145 | + <p class="row-status"> |
| 140 | - <thead> | 146 | + <code>(row.package.as_str())</code> " " <code>(row.version.as_str())</code> " · " (row.severity.as_str()) " · " <span class=(row.state_class)>(row.state_text)</span> " · " rel_time(lang: lang, stamp: row.created_at.as_str()) |
| 141 | - <tr> | 147 | + </p> |
| 142 | - <th>(g::t(lang, K::ColAdvisory))</th> | 148 | + <p class="row-status">(row.summary.as_str())</p> |
| 143 | - <th>(g::t(lang, K::ColPackage))</th> | 149 | + </div> |
| 144 | - <th>(g::t(lang, K::ColVersion))</th> | 150 | + if row.open { |
| 145 | - <th>(g::t(lang, K::ColSeverity))</th> | 151 | + <form method="post" action=(row.dismiss_action.as_str()) class="row-form"> |
| 146 | - <th>(g::t(lang, K::ColSummary))</th> | 152 | + <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 147 | - <th>(g::t(lang, K::ColState))</th> | 153 | + <input type="hidden" name="advisory" value=(row.fields[0].1.as_str())> |
| 148 | - <th>(g::t(lang, K::ColOpened))</th> | 154 | + <input type="hidden" name="ecosystem" value=(row.fields[1].1.as_str())> |
| 149 | - <th></th> | 155 | + <input type="hidden" name="package" value=(row.fields[2].1.as_str())> |
| 150 | - </tr> | 156 | + <input type="hidden" name="version" value=(row.fields[3].1.as_str())> |
| 151 | - </thead> | 157 | + <button type="submit">(g::t(lang, K::Dismiss))</button> |
| 152 | - <tbody> | 158 | + </form> |
| 153 | - for row in rows.iter() { | 159 | + } |
| 154 | - <tr data-kb-row=""> | 160 | + if row.dismissed { |
| 155 | - <td><a href=(row.osv_href.as_str()) rel="noopener noreferrer"><code>(row.advisory.as_str())</code></a></td> | 161 | + <form method="post" action=(row.reopen_action.as_str()) class="row-form"> |
| 156 | - <td><code>(row.package.as_str())</code></td> | 162 | + <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 157 | - <td><code>(row.version.as_str())</code></td> | 163 | + <input type="hidden" name="advisory" value=(row.fields[0].1.as_str())> |
| 158 | - <td>(row.severity.as_str())</td> | 164 | + <input type="hidden" name="ecosystem" value=(row.fields[1].1.as_str())> |
| 159 | - <td>(row.summary.as_str())</td> | 165 | + <input type="hidden" name="package" value=(row.fields[2].1.as_str())> |
| 160 | - <td><span class=(row.state_class)>(row.state_text)</span></td> | 166 | + <input type="hidden" name="version" value=(row.fields[3].1.as_str())> |
| 161 | - <td>rel_time(lang: lang, stamp: row.created_at.as_str())</td> | 167 | + <button type="submit">(g::t(lang, K::Reopen))</button> |
| 162 | - <td> | 168 | + </form> |
| 163 | - if row.open { | 169 | + } |
| 164 | - <form method="post" action=(row.dismiss_action.as_str()) class="inline-form"> | ||
| 165 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 166 | - <input type="hidden" name="advisory" value=(row.fields[0].1.as_str())> | ||
| 167 | - <input type="hidden" name="ecosystem" value=(row.fields[1].1.as_str())> | ||
| 168 | - <input type="hidden" name="package" value=(row.fields[2].1.as_str())> | ||
| 169 | - <input type="hidden" name="version" value=(row.fields[3].1.as_str())> | ||
| 170 | - <button type="submit">(g::t(lang, K::Dismiss))</button> | ||
| 171 | - </form> | ||
| 172 | - } | ||
| 173 | - if row.dismissed { | ||
| 174 | - <form method="post" action=(row.reopen_action.as_str()) class="inline-form"> | ||
| 175 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 176 | - <input type="hidden" name="advisory" value=(row.fields[0].1.as_str())> | ||
| 177 | - <input type="hidden" name="ecosystem" value=(row.fields[1].1.as_str())> | ||
| 178 | - <input type="hidden" name="package" value=(row.fields[2].1.as_str())> | ||
| 179 | - <input type="hidden" name="version" value=(row.fields[3].1.as_str())> | ||
| 180 | - <button type="submit">(g::t(lang, K::Reopen))</button> | ||
| 181 | - </form> | ||
| 182 | - } | ||
| 183 | - </td> | ||
| 184 | - </tr> | ||
| 185 | - } | ||
| 186 | - </tbody> | ||
| 187 | - </table> | ||
| 188 | </div> | 170 | </div> |
| 189 | } | 171 | } |
| 190 | - </div> | ||
| 191 | </section> | 172 | </section> |
| 192 | }) | 173 | }) |
| 193 | } | 174 | } |
crates/forge-web/src/pages/repo_settings.rsmodified+124 -100
| @@ -270,22 +270,34 @@ async fn danger_zone( | |||
| 270 | error: Option<String>, | 270 | error: Option<String>, |
| 271 | ) -> Result<impl View> { | 271 | ) -> Result<impl View> { |
| 272 | let action = format!("/{title}/settings/delete"); | 272 | let action = format!("/{title}/settings/delete"); |
| 273 | + let open = error.is_some(); | ||
| 273 | Ok(view! { | 274 | Ok(view! { |
| 274 | - <section class="settings-section"> | 275 | + <section class="card rows-pane security-danger"> |
| 275 | - <h2>(g::t(lang, K::DangerZone))</h2> | 276 | + <p class="security-danger-label">(g::t(lang, K::DangerZone))</p> |
| 276 | - <p class="settings-intro">(g::t(lang, K::DeleteRepoHelp))</p> | 277 | + <div class="row-line"> |
| 277 | - <p class="muted small">(g::t(lang, K::DeleteTrashHelp))</p> | 278 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4l9 16H3z"/><path d="M12 10v4M12 17v.5"/></svg> |
| 278 | - if let Some(message) = error { | 279 | + <div class="row-main"> |
| 279 | - alert(message: message.as_str()) | 280 | + <h2 class="row-title">(g::t(lang, K::DeleteRepo))</h2> |
| 280 | - } | 281 | + <p class="row-status">(g::t(lang, K::DeleteRepoHelp))</p> |
| 281 | - <form method="post" action=(action) class="stack"> | 282 | + <p class="row-status">(g::t(lang, K::DeleteTrashHelp))</p> |
| 282 | - <input type="hidden" name="csrf" value=(csrf)> | 283 | + </div> |
| 283 | - <label> | 284 | + <details class="row-action danger" open=(open)> |
| 284 | - <span>(g::t(lang, K::TypeToConfirmBefore))<code>(title.clone())</code>(g::t(lang, K::TypeToConfirmAfter))</span> | 285 | + <summary>(g::t(lang, K::DeleteRepo))</summary> |
| 285 | - <input type="text" name="confirm" autocomplete="off" spellcheck="false" required=(true)> | 286 | + <div class="row-panel"> |
| 286 | - </label> | 287 | + if let Some(message) = error { |
| 287 | - <button type="submit" class="danger">(g::t(lang, K::DeleteRepo))</button> | 288 | + alert(message: message.as_str()) |
| 288 | - </form> | 289 | + } |
| 290 | + <form method="post" action=(action) class="stack"> | ||
| 291 | + <input type="hidden" name="csrf" value=(csrf)> | ||
| 292 | + <label> | ||
| 293 | + <span>(g::t(lang, K::TypeToConfirmBefore))<code>(title.clone())</code>(g::t(lang, K::TypeToConfirmAfter))</span> | ||
| 294 | + <input type="text" name="confirm" autocomplete="off" spellcheck="false" required=(true)> | ||
| 295 | + </label> | ||
| 296 | + <button type="submit" class="danger">(g::t(lang, K::DeleteRepo))</button> | ||
| 297 | + </form> | ||
| 298 | + </div> | ||
| 299 | + </details> | ||
| 300 | + </div> | ||
| 289 | </section> | 301 | </section> |
| 290 | }) | 302 | }) |
| 291 | } | 303 | } |
| @@ -428,87 +440,95 @@ async fn general_section( | |||
| 428 | }) | 440 | }) |
| 429 | .collect(); | 441 | .collect(); |
| 430 | Ok(view! { | 442 | Ok(view! { |
| 431 | - <section class="settings-section"> | 443 | + <form method="post" action=(general_action) class="card rows-pane"> |
| 432 | - <h2>(g::t(lang, K::General))</h2> | 444 | + <label class="row-line row-field"> |
| 433 | - <form method="post" action=(general_action) class="stack"> | 445 | + <span class="row-main"> |
| 434 | - <input type="hidden" name="csrf" value=(csrf.clone())> | 446 | + <span class="row-title">(g::t(lang, K::Description))</span> |
| 435 | - <label> | 447 | + <span class="row-status">(g::t(lang, K::DescriptionHelp))</span> |
| 436 | - <span>(g::t(lang, K::Description))</span> | 448 | + </span> |
| 449 | + <span class="row-control"> | ||
| 437 | <input type="text" name="description" value=(description) maxlength="350" autocomplete="off"> | 450 | <input type="text" name="description" value=(description) maxlength="350" autocomplete="off"> |
| 438 | - </label> | 451 | + </span> |
| 439 | - <p class="muted small">(g::t(lang, K::DescriptionHelp))</p> | 452 | + </label> |
| 440 | - if options.is_empty() { | 453 | + if options.is_empty() { |
| 441 | - <p class="muted">(g::t(lang, K::NoBranchesYet))</p> | 454 | + <div class="row-line"> |
| 442 | - } else { | 455 | + <div class="row-main"> |
| 443 | - <label> | 456 | + <span class="row-title">(g::t(lang, K::DefaultBranch))</span> |
| 444 | - <span>(g::t(lang, K::DefaultBranch))</span> | 457 | + <span class="row-status">(g::t(lang, K::NoBranchesYet))</span> |
| 458 | + </div> | ||
| 459 | + </div> | ||
| 460 | + } else { | ||
| 461 | + <label class="row-line row-field"> | ||
| 462 | + <span class="row-main"> | ||
| 463 | + <span class="row-title">(g::t(lang, K::DefaultBranch))</span> | ||
| 464 | + </span> | ||
| 465 | + <span class="row-control"> | ||
| 445 | <select name="default_branch"> | 466 | <select name="default_branch"> |
| 446 | for option in options.iter() { | 467 | for option in options.iter() { |
| 447 | <option value=(option.0.as_str()) selected=(option.1)>(option.0.as_str())</option> | 468 | <option value=(option.0.as_str()) selected=(option.1)>(option.0.as_str())</option> |
| 448 | } | 469 | } |
| 449 | </select> | 470 | </select> |
| 450 | - </label> | 471 | + </span> |
| 451 | - } | 472 | + </label> |
| 452 | - <div> | 473 | + } |
| 453 | - <button type="submit" class="primary">(g::t(lang, K::SaveGeneral))</button> | 474 | + <div class="row-foot"> |
| 454 | - </div> | 475 | + <input type="hidden" name="csrf" value=(csrf.clone())> |
| 455 | - </form> | 476 | + <button type="submit" class="primary">(g::t(lang, K::SaveGeneral))</button> |
| 477 | + </div> | ||
| 478 | + </form> | ||
| 456 | 479 | ||
| 457 | - <ul class="action-list"> | 480 | + <section class="card rows-pane"> |
| 458 | - <li class="action-row"> | 481 | + <div class="row-line"> |
| 459 | - <div class="action-text"> | 482 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg> |
| 460 | - <h3>(g::t(lang, K::VisibilityHeading))</h3> | 483 | + <div class="row-main"> |
| 461 | - <p class="muted small">(current_visibility)</p> | 484 | + <h2 class="row-title">(g::t(lang, K::VisibilityHeading))</h2> |
| 462 | - </div> | 485 | + <p class="row-status">(current_visibility)</p> |
| 463 | - <div class="action-control"> | 486 | + </div> |
| 464 | - <details class="confirm-inline"> | 487 | + <details class="row-action"> |
| 465 | - <summary class="button">(flip_label)</summary> | 488 | + <summary>(flip_label)</summary> |
| 466 | - <div class="confirm-pop"> | 489 | + <div class="row-panel"> |
| 467 | - <p>(flip_confirm)</p> | 490 | + <p>(flip_confirm)</p> |
| 468 | - <form method="post" action=(visibility_action)> | 491 | + <form method="post" action=(visibility_action) class="row-actions"> |
| 469 | - <input type="hidden" name="csrf" value=(csrf.clone())> | 492 | + <input type="hidden" name="csrf" value=(csrf.clone())> |
| 470 | - <input type="hidden" name="visibility" value=(flip_to)> | 493 | + <input type="hidden" name="visibility" value=(flip_to)> |
| 471 | - <input type="hidden" name="understand" value="on"> | 494 | + <input type="hidden" name="understand" value="on"> |
| 472 | - <button type="submit" class="danger">(flip_label)</button> | 495 | + <button type="submit" class="danger">(flip_label)</button> |
| 473 | - <button type="button" data-close-details="">(g::t(lang, K::Cancel))</button> | 496 | + <button type="button" data-close-details="">(g::t(lang, K::Cancel))</button> |
| 474 | - </form> | 497 | + </form> |
| 475 | - </div> | ||
| 476 | - </details> | ||
| 477 | - </div> | ||
| 478 | - </li> | ||
| 479 | - <li class="action-row"> | ||
| 480 | - <div class="action-text"> | ||
| 481 | - <h3>(g::t(lang, K::ArchiveHeading))</h3> | ||
| 482 | - if archived { | ||
| 483 | - <p class="muted small">(g::t(lang, K::ArchivedHelp))</p> | ||
| 484 | - } else { | ||
| 485 | - <p class="muted small">(g::t(lang, K::ArchiveHelp))</p> | ||
| 486 | - } | ||
| 487 | </div> | 498 | </div> |
| 488 | - <div class="action-control"> | 499 | + </details> |
| 489 | - if archived { | 500 | + </div> |
| 490 | - <form method="post" action=(archive_action.as_str())> | 501 | + <div class="row-line"> |
| 502 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="4" width="18" height="5" rx="1"/><path d="M5 9v10h14V9M10 13h4"/></svg> | ||
| 503 | + <div class="row-main"> | ||
| 504 | + <h2 class="row-title">(g::t(lang, K::ArchiveHeading))</h2> | ||
| 505 | + if archived { | ||
| 506 | + <p class="row-status">(g::t(lang, K::ArchivedHelp))</p> | ||
| 507 | + } else { | ||
| 508 | + <p class="row-status">(g::t(lang, K::ArchiveHelp))</p> | ||
| 509 | + } | ||
| 510 | + </div> | ||
| 511 | + if archived { | ||
| 512 | + <form method="post" action=(archive_action.as_str()) class="row-form"> | ||
| 513 | + <input type="hidden" name="csrf" value=(csrf.clone())> | ||
| 514 | + <input type="hidden" name="archived" value="0"> | ||
| 515 | + <button type="submit">(g::t(lang, K::UnarchiveRepo))</button> | ||
| 516 | + </form> | ||
| 517 | + } else { | ||
| 518 | + <details class="row-action"> | ||
| 519 | + <summary>(g::t(lang, K::ArchiveRepo))</summary> | ||
| 520 | + <div class="row-panel"> | ||
| 521 | + <p>(g::t(lang, K::ArchiveConfirm))</p> | ||
| 522 | + <form method="post" action=(archive_action.as_str()) class="row-actions"> | ||
| 491 | <input type="hidden" name="csrf" value=(csrf.clone())> | 523 | <input type="hidden" name="csrf" value=(csrf.clone())> |
| 492 | - <input type="hidden" name="archived" value="0"> | 524 | + <input type="hidden" name="archived" value="1"> |
| 493 | - <button type="submit">(g::t(lang, K::UnarchiveRepo))</button> | 525 | + <button type="submit" class="danger">(g::t(lang, K::ArchiveRepo))</button> |
| 526 | + <button type="button" data-close-details="">(g::t(lang, K::Cancel))</button> | ||
| 494 | </form> | 527 | </form> |
| 495 | - } else { | 528 | + </div> |
| 496 | - <details class="confirm-inline"> | 529 | + </details> |
| 497 | - <summary class="button">(g::t(lang, K::ArchiveRepo))</summary> | 530 | + } |
| 498 | - <div class="confirm-pop"> | 531 | + </div> |
| 499 | - <p>(g::t(lang, K::ArchiveConfirm))</p> | ||
| 500 | - <form method="post" action=(archive_action.as_str())> | ||
| 501 | - <input type="hidden" name="csrf" value=(csrf.clone())> | ||
| 502 | - <input type="hidden" name="archived" value="1"> | ||
| 503 | - <button type="submit" class="danger">(g::t(lang, K::ArchiveRepo))</button> | ||
| 504 | - <button type="button" data-close-details="">(g::t(lang, K::Cancel))</button> | ||
| 505 | - </form> | ||
| 506 | - </div> | ||
| 507 | - </details> | ||
| 508 | - } | ||
| 509 | - </div> | ||
| 510 | - </li> | ||
| 511 | - </ul> | ||
| 512 | </section> | 532 | </section> |
| 513 | }) | 533 | }) |
| 514 | } | 534 | } |
| @@ -601,7 +621,7 @@ struct RuleCard { | |||
| 601 | draft: RuleDraft, | 621 | draft: RuleDraft, |
| 602 | } | 622 | } |
| 603 | 623 | ||
| 604 | -/// One switch row: a title with an optional muted line under it, and a toggle on the right. | 624 | +/// One rule option as a row: a title with an optional muted line under it, and a toggle on the right. |
| 605 | #[component] | 625 | #[component] |
| 606 | async fn switch_row( | 626 | async fn switch_row( |
| 607 | name: String, | 627 | name: String, |
| @@ -610,14 +630,16 @@ async fn switch_row( | |||
| 610 | description: Option<String>, | 630 | description: Option<String>, |
| 611 | ) -> Result<impl View> { | 631 | ) -> Result<impl View> { |
| 612 | Ok(view! { | 632 | Ok(view! { |
| 613 | - <label class="switch-row"> | 633 | + <label class="row-line row-field"> |
| 614 | - <span class="switch-text"> | 634 | + <span class="row-main"> |
| 615 | - <span class="switch-title">(title.as_str())</span> | 635 | + <span class="row-title">(title.as_str())</span> |
| 616 | if let Some(text) = description { | 636 | if let Some(text) = description { |
| 617 | - <span class="switch-desc">(text.as_str())</span> | 637 | + <span class="row-status">(text.as_str())</span> |
| 618 | } | 638 | } |
| 619 | </span> | 639 | </span> |
| 620 | - <input type="checkbox" name=(name.as_str()) value="on" checked=(checked)> | 640 | + <span class="row-control"> |
| 641 | + <input type="checkbox" name=(name.as_str()) value="on" checked=(checked)> | ||
| 642 | + </span> | ||
| 621 | </label> | 643 | </label> |
| 622 | }) | 644 | }) |
| 623 | } | 645 | } |
| @@ -740,15 +762,17 @@ async fn branch_rule_form( | |||
| 740 | <fieldset class="rule-section"> | 762 | <fieldset class="rule-section"> |
| 741 | <legend>(g::t(lang, K::SectionMerging))</legend> | 763 | <legend>(g::t(lang, K::SectionMerging))</legend> |
| 742 | <div class="switch-list"> | 764 | <div class="switch-list"> |
| 743 | - <div class="switch-row stepper-row"> | 765 | + <div class="row-line row-field stepper-row"> |
| 744 | - <span class="switch-text"> | 766 | + <span class="row-main"> |
| 745 | - <span class="switch-title" id="required-approvals-label">(g::t(lang, K::RequiredApprovals))</span> | 767 | + <span class="row-title" id="required-approvals-label">(g::t(lang, K::RequiredApprovals))</span> |
| 746 | - <span class="switch-desc">(g::t(lang, K::ApprovalsHelp))</span> | 768 | + <span class="row-status">(g::t(lang, K::ApprovalsHelp))</span> |
| 747 | </span> | 769 | </span> |
| 748 | - <div class="runner-pill"> | 770 | + <div class="row-control"> |
| 749 | - <button type="button" class="runner-step" data-step="-1" aria-label=(passkeys::s(lang, "Fewer", "Azalt"))>"−"</button> | 771 | + <div class="runner-pill"> |
| 750 | - <input type="number" name="required_approvals" min="0" max="20" step="1" inputmode="numeric" value=(required_approvals.as_str()) aria-labelledby="required-approvals-label"> | 772 | + <button type="button" class="runner-step" data-step="-1" aria-label=(passkeys::s(lang, "Fewer", "Azalt"))>"−"</button> |
| 751 | - <button type="button" class="runner-step" data-step="1" aria-label=(passkeys::s(lang, "More", "Artır"))>"+"</button> | 773 | + <input type="number" name="required_approvals" min="0" max="20" step="1" inputmode="numeric" value=(required_approvals.as_str()) aria-labelledby="required-approvals-label"> |
| 774 | + <button type="button" class="runner-step" data-step="1" aria-label=(passkeys::s(lang, "More", "Artır"))>"+"</button> | ||
| 775 | + </div> | ||
| 752 | </div> | 776 | </div> |
| 753 | </div> | 777 | </div> |
| 754 | switch_row(name: "block_on_changes_requested".to_owned(), checked: block_on_changes_requested, | 778 | switch_row(name: "block_on_changes_requested".to_owned(), checked: block_on_changes_requested, |
crates/forge-web/src/pages/repo_webhooks.rsmodified+127 -95
| @@ -31,7 +31,7 @@ use crate::pages::repo_ctx::{RepoCtx, RepoHead, load_repo}; | |||
| 31 | use crate::pages::repo_settings::settings_frame; | 31 | use crate::pages::repo_settings::settings_frame; |
| 32 | use crate::pages::repo_settings_live::settings_head; | 32 | use crate::pages::repo_settings_live::settings_head; |
| 33 | use crate::state::AppState; | 33 | use crate::state::AppState; |
| 34 | -use crate::views::{alert, empty_state, enc, now_unix, relative_time, shell}; | 34 | +use crate::views::{alert, enc, now_unix, relative_time, shell}; |
| 35 | use crate::webhooks::client::{WebhookPolicy, validate_url}; | 35 | use crate::webhooks::client::{WebhookPolicy, validate_url}; |
| 36 | use crate::webhooks::emit::emit_ping; | 36 | use crate::webhooks::emit::emit_ping; |
| 37 | 37 | ||
| @@ -528,35 +528,51 @@ async fn hook_form( | |||
| 528 | lang: Lang, | 528 | lang: Lang, |
| 529 | ) -> Result<impl View> { | 529 | ) -> Result<impl View> { |
| 530 | Ok(view! { | 530 | Ok(view! { |
| 531 | - <form method="post" action=(action.as_str()) class="stack webhook-form"> | 531 | + <form method="post" action=(action.as_str()) class="card rows-pane webhook-form"> |
| 532 | if let Some(message) = error { | 532 | if let Some(message) = error { |
| 533 | alert(message: message.as_str()) | 533 | alert(message: message.as_str()) |
| 534 | } | 534 | } |
| 535 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 535 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 536 | - <label> | 536 | + <label class="row-line row-field"> |
| 537 | - <span>(g::t(lang, K::PayloadUrl))</span> | 537 | + <span class="row-main"> |
| 538 | - <input type="url" name="url" value=(url.as_str()) autocomplete="off" spellcheck="false" required=(true)> | 538 | + <span class="row-title">(g::t(lang, K::PayloadUrl))</span> |
| 539 | + <span class="row-status">(g::t(lang, K::UrlHintNew))</span> | ||
| 540 | + </span> | ||
| 541 | + <span class="row-control"> | ||
| 542 | + <input type="url" name="url" value=(url.as_str()) autocomplete="off" spellcheck="false" required=(true)> | ||
| 543 | + </span> | ||
| 539 | </label> | 544 | </label> |
| 540 | - <p class="muted small">(g::t(lang, K::UrlHintNew))</p> | 545 | + <label class="row-line row-field"> |
| 541 | - <label> | 546 | + <span class="row-main"> |
| 542 | - <span>(g::t(lang, K::Secret))</span> | 547 | + <span class="row-title">(g::t(lang, K::Secret))</span> |
| 543 | - <input type="password" name="secret" autocomplete="new-password" maxlength="256"> | 548 | + <span class="row-status">(secret_hint.as_str()) (g::t(lang, K::SignedWith))</span> |
| 549 | + </span> | ||
| 550 | + <span class="row-control"> | ||
| 551 | + <input type="password" name="secret" autocomplete="new-password" maxlength="256"> | ||
| 552 | + </span> | ||
| 544 | </label> | 553 | </label> |
| 545 | - <p class="muted small">(secret_hint.as_str()) (g::t(lang, K::SignedWith))</p> | 554 | + <div class="row-line row-field event-choices" role="group" aria-label=(g::t(lang, K::Events))> |
| 546 | - <fieldset class="event-choices"> | 555 | + <span class="row-main"> |
| 547 | - <legend>(g::t(lang, K::Events))</legend> | 556 | + <span class="row-title">(g::t(lang, K::Events))</span> |
| 548 | - for event in events.iter() { | 557 | + </span> |
| 549 | - <label class="inline"> | 558 | + <span class="row-control"> |
| 550 | - <input type="checkbox" name=(event.name.as_str()) value="on" checked=(event.checked)> | 559 | + for event in events.iter() { |
| 551 | - <span>(event.label)</span> | 560 | + <label class="inline"> |
| 552 | - </label> | 561 | + <input type="checkbox" name=(event.name.as_str()) value="on" checked=(event.checked)> |
| 553 | - } | 562 | + <span>(event.label)</span> |
| 554 | - </fieldset> | 563 | + </label> |
| 555 | - <label class="inline"> | 564 | + } |
| 556 | - <input type="checkbox" name="active" value="on" checked=(active)> | 565 | + </span> |
| 557 | - <span>(g::t(lang, K::ActiveField))</span> | 566 | + </div> |
| 567 | + <label class="row-line row-field"> | ||
| 568 | + <span class="row-main"> | ||
| 569 | + <span class="row-title">(g::t(lang, K::ActiveField))</span> | ||
| 570 | + </span> | ||
| 571 | + <span class="row-control"> | ||
| 572 | + <input type="checkbox" name="active" value="on" checked=(active)> | ||
| 573 | + </span> | ||
| 558 | </label> | 574 | </label> |
| 559 | - <div> | 575 | + <div class="row-foot"> |
| 560 | <button type="submit" class="primary">(submit)</button> | 576 | <button type="submit" class="primary">(submit)</button> |
| 561 | </div> | 577 | </div> |
| 562 | </form> | 578 | </form> |
| @@ -575,43 +591,44 @@ async fn hooks_list_body( | |||
| 575 | let new_href = format!("{}/new", hooks_href(&title)); | 591 | let new_href = format!("{}/new", hooks_href(&title)); |
| 576 | Ok(view! { | 592 | Ok(view! { |
| 577 | frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang, | 593 | frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang, |
| 578 | - <section class="card"> | 594 | + <section class="card rows-pane"> |
| 579 | - <h2>(g::t(lang, K::Webhooks))</h2> | 595 | + <div class="row-line"> |
| 580 | - <p class="muted small">(g::t(lang, K::WebhooksIntro))</p> | 596 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 581 | - if !archived { | 597 | + <div class="row-main"> |
| 582 | - <p><a href=(new_href.as_str()) class="button">(g::t(lang, K::AddWebhook))</a></p> | 598 | + <h2 class="row-title">(g::t(lang, K::Webhooks))</h2> |
| 583 | - } | 599 | + if rows.is_empty() { |
| 584 | - if rows.is_empty() { | 600 | + <p class="row-status">(g::t(lang, K::NoWebhooks))</p> |
| 585 | - empty_state(title: g::t(lang, K::NoWebhooks)) | 601 | + } else { |
| 586 | - } else { | 602 | + <p class="row-status">(g::t(lang, K::WebhooksIntro))</p> |
| 587 | - <ul class="runner-list hook-list"> | ||
| 588 | - for row in rows.iter() { | ||
| 589 | - <li class="runner-row"> | ||
| 590 | - <div class="runner-id"> | ||
| 591 | - <div class="runner-title"> | ||
| 592 | - <span class=(row.dot_class) role="img" aria-label=(row.dot_text) title=(row.dot_text)></span> | ||
| 593 | - <a class="runner-name hook-url" href=(row.href.as_str())>(row.url.as_str())</a> | ||
| 594 | - </div> | ||
| 595 | - <p class="runner-meta muted"> | ||
| 596 | - if !row.events.is_empty() { | ||
| 597 | - (row.events.as_str())" · " | ||
| 598 | - } | ||
| 599 | - if row.last_at.is_empty() { | ||
| 600 | - (row.last_text) | ||
| 601 | - } else { | ||
| 602 | - (row.last_text)<time data-rel="true" datetime=(row.last_at.as_str()) title=(row.last_full.as_str())>(row.last_rel.as_str())</time> | ||
| 603 | - } | ||
| 604 | - if !row.problem.is_empty() { | ||
| 605 | - " · "<span class="hook-problem">(row.problem)</span> | ||
| 606 | - } | ||
| 607 | - if !row.active { | ||
| 608 | - " · "(row.inactive_text) | ||
| 609 | - } | ||
| 610 | - </p> | ||
| 611 | - </div> | ||
| 612 | - </li> | ||
| 613 | } | 603 | } |
| 614 | - </ul> | 604 | + </div> |
| 605 | + if !archived { | ||
| 606 | + <a href=(new_href.as_str()) class="button primary">(g::t(lang, K::AddWebhook))</a> | ||
| 607 | + } | ||
| 608 | + </div> | ||
| 609 | + for row in rows.iter() { | ||
| 610 | + <div class="row-line"> | ||
| 611 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/></svg> | ||
| 612 | + <div class="row-main"> | ||
| 613 | + <strong class="row-name"><span class=(row.dot_class) role="img" aria-label=(row.dot_text) title=(row.dot_text)></span> <a href=(row.href.as_str())>(row.url.as_str())</a></strong> | ||
| 614 | + <p class="row-status"> | ||
| 615 | + if !row.events.is_empty() { | ||
| 616 | + (row.events.as_str())" · " | ||
| 617 | + } | ||
| 618 | + if row.last_at.is_empty() { | ||
| 619 | + (row.last_text) | ||
| 620 | + } else { | ||
| 621 | + (row.last_text)<time data-rel="true" datetime=(row.last_at.as_str()) title=(row.last_full.as_str())>(row.last_rel.as_str())</time> | ||
| 622 | + } | ||
| 623 | + if !row.problem.is_empty() { | ||
| 624 | + " · "<span class="hook-problem">(row.problem)</span> | ||
| 625 | + } | ||
| 626 | + if !row.active { | ||
| 627 | + " · "(row.inactive_text) | ||
| 628 | + } | ||
| 629 | + </p> | ||
| 630 | + </div> | ||
| 631 | + </div> | ||
| 615 | } | 632 | } |
| 616 | </section> | 633 | </section> |
| 617 | ) | 634 | ) |
| @@ -688,25 +705,34 @@ async fn hook_body( | |||
| 688 | let events = event_boxes(lang, &draft.events); | 705 | let events = event_boxes(lang, &draft.events); |
| 689 | Ok(view! { | 706 | Ok(view! { |
| 690 | frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang, | 707 | frame_top(head: head, title: title.clone(), notice: notice, archived: archived, lang: lang, |
| 691 | - <section class="card"> | 708 | + if archived { |
| 692 | - <h2>(g::t(lang, K::EditWebhook))</h2> | 709 | + <section class="card rows-pane"> |
| 693 | - if archived { | 710 | + <div class="row-line"> |
| 694 | - <p class="muted small">(g::t(lang, K::ArchivedHookNote))</p> | 711 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1"/><path d="M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1"/></svg> |
| 695 | - <p><code>(draft.url.as_str())</code></p> | 712 | + <div class="row-main"> |
| 696 | - } else { | 713 | + <strong class="row-name">(draft.url.as_str())</strong> |
| 697 | - hook_form(action: edit_action.clone(), csrf: csrf.clone(), url: draft.url, | 714 | + <p class="row-status">(g::t(lang, K::ArchivedHookNote))</p> |
| 698 | - events: events, active: draft.active, secret_hint: secret_hint, | 715 | + </div> |
| 699 | - error: draft.error, submit: g::t(lang, K::SaveWebhook), lang: lang) | 716 | + </div> |
| 700 | - } | 717 | + </section> |
| 701 | - </section> | 718 | + } else { |
| 719 | + hook_form(action: edit_action.clone(), csrf: csrf.clone(), url: draft.url, | ||
| 720 | + events: events, active: draft.active, secret_hint: secret_hint, | ||
| 721 | + error: draft.error, submit: g::t(lang, K::SaveWebhook), lang: lang) | ||
| 722 | + } | ||
| 702 | if !archived { | 723 | if !archived { |
| 703 | - <section class="card"> | 724 | + <section class="card rows-pane"> |
| 704 | - <h2>(g::t(lang, K::Test))</h2> | 725 | + <div class="row-line"> |
| 705 | - <p class="muted small">(g::t(lang, K::TestIntro))</p> | 726 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M22 2 11 13"/><path d="M22 2 15 22l-4-9-9-4z"/></svg> |
| 706 | - <form method="post" action=(test_action.as_str()) class="inline-form"> | 727 | + <div class="row-main"> |
| 707 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | 728 | + <h2 class="row-title">(g::t(lang, K::Test))</h2> |
| 708 | - <button type="submit">(g::t(lang, K::SendTestPing))</button> | 729 | + <p class="row-status">(g::t(lang, K::TestIntro))</p> |
| 709 | - </form> | 730 | + </div> |
| 731 | + <form method="post" action=(test_action.as_str()) class="row-form"> | ||
| 732 | + <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 733 | + <button type="submit">(g::t(lang, K::SendTestPing))</button> | ||
| 734 | + </form> | ||
| 735 | + </div> | ||
| 710 | </section> | 736 | </section> |
| 711 | } | 737 | } |
| 712 | <section class="card"> | 738 | <section class="card"> |
| @@ -715,15 +741,18 @@ async fn hook_body( | |||
| 715 | delivery_list(deliveries: deliveries, csrf: csrf.clone(), archived: archived, lang: lang) | 741 | delivery_list(deliveries: deliveries, csrf: csrf.clone(), archived: archived, lang: lang) |
| 716 | </section> | 742 | </section> |
| 717 | if !archived { | 743 | if !archived { |
| 718 | - <section class="card"> | 744 | + <section class="card rows-pane security-danger"> |
| 719 | - <h2>(g::t(lang, K::DeleteWebhook))</h2> | 745 | + <div class="row-line"> |
| 720 | - <p class="muted small">(g::t(lang, K::DeleteIntro))</p> | 746 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4l9 16H3z"/><path d="M12 10v4M12 17v.5"/></svg> |
| 721 | - <div> | 747 | + <div class="row-main"> |
| 722 | - <details class="confirm-inline"> | 748 | + <h2 class="row-title">(g::t(lang, K::DeleteWebhook))</h2> |
| 723 | - <summary class="button danger">(g::t(lang, K::DeleteWebhook))</summary> | 749 | + <p class="row-status">(g::t(lang, K::DeleteIntro))</p> |
| 724 | - <div class="confirm-pop"> | 750 | + </div> |
| 751 | + <details class="row-action danger"> | ||
| 752 | + <summary>(g::t(lang, K::DeleteWebhook))</summary> | ||
| 753 | + <div class="row-panel"> | ||
| 725 | <p>(g::t(lang, K::DeleteConfirm))</p> | 754 | <p>(g::t(lang, K::DeleteConfirm))</p> |
| 726 | - <form method="post" action=(delete_action.as_str())> | 755 | + <form method="post" action=(delete_action.as_str()) class="row-actions"> |
| 727 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 756 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 728 | <input type="hidden" name="confirm" value="on"> | 757 | <input type="hidden" name="confirm" value="on"> |
| 729 | <button type="submit" class="danger">(g::t(lang, K::DeleteWebhook))</button> | 758 | <button type="submit" class="danger">(g::t(lang, K::DeleteWebhook))</button> |
| @@ -815,16 +844,19 @@ async fn hook_new_body( | |||
| 815 | let back = hooks_href(&title); | 844 | let back = hooks_href(&title); |
| 816 | Ok(view! { | 845 | Ok(view! { |
| 817 | frame_top(head: head, title: title.clone(), notice: None, archived: archived, lang: lang, | 846 | frame_top(head: head, title: title.clone(), notice: None, archived: archived, lang: lang, |
| 818 | - <div class="fit-pane settings-split"> | 847 | + <section class="card rows-pane"> |
| 819 | - <section class="card"> | 848 | + <div class="row-line"> |
| 820 | - <h2>(g::t(lang, K::AddWebhook))</h2> | 849 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 821 | - <p class="muted small">(g::t(lang, K::AddWebhookIntro))</p> | 850 | + <div class="row-main"> |
| 822 | - hook_form(action: action, csrf: csrf, url: draft.url, events: events, | 851 | + <h2 class="row-title">(g::t(lang, K::AddWebhook))</h2> |
| 823 | - active: draft.active, secret_hint: g::t(lang, K::SecretHintNew).to_owned(), | 852 | + <p class="row-status">(g::t(lang, K::AddWebhookIntro))</p> |
| 824 | - error: draft.error, submit: g::t(lang, K::CreateWebhook), lang: lang) | 853 | + </div> |
| 825 | - <p><a href=(back.as_str())>(g::t(lang, K::BackToWebhooks))</a></p> | 854 | + <a href=(back.as_str()) class="button">(g::t(lang, K::BackToWebhooks))</a> |
| 826 | - </section> | 855 | + </div> |
| 827 | - </div> | 856 | + </section> |
| 857 | + hook_form(action: action, csrf: csrf, url: draft.url, events: events, | ||
| 858 | + active: draft.active, secret_hint: g::t(lang, K::SecretHintNew).to_owned(), | ||
| 859 | + error: draft.error, submit: g::t(lang, K::CreateWebhook), lang: lang) | ||
| 828 | ) | 860 | ) |
| 829 | }) | 861 | }) |
| 830 | } | 862 | } |
crates/forge-web/src/pages/settings_appearance.rsmodified+65 -45
| @@ -329,6 +329,7 @@ async fn colour_row(row: ColourRow) -> Result<impl View> { | |||
| 329 | "accent-swatch hue-swatch" | 329 | "accent-swatch hue-swatch" |
| 330 | }; | 330 | }; |
| 331 | Ok(view! { | 331 | Ok(view! { |
| 332 | + <div class="row-line row-field colour-line"> | ||
| 332 | <fieldset class="colour-picker" data-colour-row="true" data-kind=(kind) data-lightness=(lightness.as_str())> | 333 | <fieldset class="colour-picker" data-colour-row="true" data-kind=(kind) data-lightness=(lightness.as_str())> |
| 333 | <legend>(legend)</legend> | 334 | <legend>(legend)</legend> |
| 334 | <div class="colour-choices"> | 335 | <div class="colour-choices"> |
| @@ -368,6 +369,7 @@ async fn colour_row(row: ColourRow) -> Result<impl View> { | |||
| 368 | </div> | 369 | </div> |
| 369 | </div> | 370 | </div> |
| 370 | </fieldset> | 371 | </fieldset> |
| 372 | + </div> | ||
| 371 | }) | 373 | }) |
| 372 | } | 374 | } |
| 373 | 375 | ||
| @@ -445,53 +447,83 @@ async fn appearance_body(page: AppearancePage) -> Result<impl View> { | |||
| 445 | <section class="page-head"> | 447 | <section class="page-head"> |
| 446 | <h1>(g::t(lang, K::Appearance))</h1> | 448 | <h1>(g::t(lang, K::Appearance))</h1> |
| 447 | </section> | 449 | </section> |
| 448 | - <div class="appearance-page"> | 450 | + <form id="appearance-form" method="post" action="/settings/appearance" class="card rows-pane appearance" data-appearance="true"> |
| 449 | - <form id="appearance-form" method="post" action="/settings/appearance" class="appearance" data-appearance="true"> | ||
| 450 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 451 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 451 | - <div class="appearance-top"> | 452 | + <label class="row-line row-field"> |
| 452 | - <label> | 453 | + <span class="row-main"> |
| 453 | - <span>(g::t(lang, K::ThemeLabel))</span> | 454 | + <span class="row-title">(g::t(lang, K::ThemeLabel))</span> |
| 455 | + <span class="row-status">(g::t(lang, K::MatchSystemHelp))</span> | ||
| 456 | + </span> | ||
| 457 | + <span class="row-control"> | ||
| 454 | <select name="theme" data-autosubmit="true"> | 458 | <select name="theme" data-autosubmit="true"> |
| 455 | for choice in theme.into_iter() { | 459 | for choice in theme.into_iter() { |
| 456 | <option value=(choice.value) selected=(choice.selected)>(choice.label)</option> | 460 | <option value=(choice.value) selected=(choice.selected)>(choice.label)</option> |
| 457 | } | 461 | } |
| 458 | </select> | 462 | </select> |
| 459 | - <small class="muted">(g::t(lang, K::MatchSystemHelp))</small> | 463 | + </span> |
| 460 | - </label> | 464 | + </label> |
| 461 | - <label> | 465 | + <label class="row-line row-field"> |
| 462 | - <span>(g::t(lang, K::LanguageLabel))</span> | 466 | + <span class="row-main"> |
| 467 | + <span class="row-title">(g::t(lang, K::LanguageLabel))</span> | ||
| 468 | + </span> | ||
| 469 | + <span class="row-control"> | ||
| 463 | <select name="language" data-autosubmit="true"> | 470 | <select name="language" data-autosubmit="true"> |
| 464 | for choice in language.into_iter() { | 471 | for choice in language.into_iter() { |
| 465 | <option value=(choice.value) selected=(choice.selected)>(choice.label)</option> | 472 | <option value=(choice.value) selected=(choice.selected)>(choice.label)</option> |
| 466 | } | 473 | } |
| 467 | </select> | 474 | </select> |
| 468 | - </label> | 475 | + </span> |
| 469 | - <fieldset class="side-picker"> | 476 | + </label> |
| 470 | - <legend>(g::t(lang, K::SidebarLabel))</legend> | 477 | + <div class="row-line row-field side-picker" role="group" aria-labelledby="sidebar-side-title"> |
| 471 | - <div class="segmented snippet-segmented" role="group"> | 478 | + <span class="row-main"> |
| 472 | - for choice in sidebar.into_iter() { | 479 | + <span class="row-title" id="sidebar-side-title">(g::t(lang, K::SidebarLabel))</span> |
| 473 | - <label class="segment"> | 480 | + <span class="row-status">(crate::pages::passkeys::s(lang, "Moves the menu on settings and admin pages.", "Ayarlar ve yönetim sayfalarındaki menüyü taşır."))</span> |
| 474 | - <input type="radio" name="sidebar_side" value=(choice.value) checked=(choice.selected) data-autosubmit="true"> | 481 | + </span> |
| 475 | - <span>(choice.label)</span> | 482 | + <span class="row-control"> |
| 476 | - </label> | 483 | + <div class="segmented snippet-segmented" role="group"> |
| 477 | - } | 484 | + for choice in sidebar.into_iter() { |
| 478 | - </div> | 485 | + <label class="segment"> |
| 479 | - <small class="muted">(crate::pages::passkeys::s(lang, "Moves the menu on settings and admin pages.", "Ayarlar ve yönetim sayfalarındaki menüyü taşır."))</small> | 486 | + <input type="radio" name="sidebar_side" value=(choice.value) checked=(choice.selected) data-autosubmit="true"> |
| 480 | - </fieldset> | 487 | + <span>(choice.label)</span> |
| 481 | - <fieldset class="side-picker sound-toggle"> | 488 | + </label> |
| 482 | - <legend>(g::t(lang, K::SoundLabel))</legend> | 489 | + } |
| 483 | - <input type="hidden" name="sound_shown" value="1"> | 490 | + </div> |
| 484 | - <div class="sound-row"> | 491 | + </span> |
| 485 | - <span>(g::t(lang, K::SoundSwitch))</span> | 492 | + </div> |
| 486 | - <label class="sound-switch"> | 493 | + <label class="row-line row-field sound-toggle"> |
| 494 | + <span class="row-main"> | ||
| 495 | + <span class="row-title">(g::t(lang, K::SoundLabel))</span> | ||
| 496 | + <span class="row-status">(g::t(lang, K::SoundSwitch))</span> | ||
| 497 | + </span> | ||
| 498 | + <span class="row-control"> | ||
| 499 | + <input type="hidden" name="sound_shown" value="1"> | ||
| 500 | + <span class="sound-switch"> | ||
| 487 | <input type="checkbox" name="sound" value="on" checked=(sound_on) data-autosubmit="true" aria-label=(g::t(lang, K::SoundSwitch))> | 501 | <input type="checkbox" name="sound" value="on" checked=(sound_on) data-autosubmit="true" aria-label=(g::t(lang, K::SoundSwitch))> |
| 488 | <span class="sound-track"><span class="sound-knob"></span></span> | 502 | <span class="sound-track"><span class="sound-knob"></span></span> |
| 489 | - </label> | 503 | + </span> |
| 490 | - </div> | 504 | + </span> |
| 491 | - </fieldset> | 505 | + </label> |
| 506 | + <div class="row-line row-field"> | ||
| 507 | + <span class="row-main"> | ||
| 508 | + <span class="row-title">(g::t(lang, K::SoundPassed))</span> | ||
| 509 | + <span class="row-status">(g::t(lang, K::SoundPassedNote))</span> | ||
| 510 | + </span> | ||
| 511 | + <span class="row-control"> | ||
| 512 | + <button type="button" class="btn" data-sound-play="passed">(g::t(lang, K::SoundPlay))</button> | ||
| 513 | + </span> | ||
| 492 | </div> | 514 | </div> |
| 493 | - <fieldset class="card colour-group" data-colour-group="true" data-tab=(tab)> | 515 | + <div class="row-line row-field"> |
| 494 | - <legend>(colours)</legend> | 516 | + <span class="row-main"> |
| 517 | + <span class="row-title">(g::t(lang, K::SoundFailed))</span> | ||
| 518 | + <span class="row-status">(g::t(lang, K::SoundFailedNote))</span> | ||
| 519 | + </span> | ||
| 520 | + <span class="row-control"> | ||
| 521 | + <button type="button" class="btn" data-sound-play="failed">(g::t(lang, K::SoundPlay))</button> | ||
| 522 | + </span> | ||
| 523 | + </div> | ||
| 524 | + <p class="row-foot muted small">(g::t(lang, K::SoundOwnRuns)) " · " (g::t(lang, K::SoundFootOwn))</p> | ||
| 525 | + <fieldset class="row-field colour-group" data-colour-group="true" data-tab=(tab)> | ||
| 526 | + <legend class="row-title">(colours)</legend> | ||
| 495 | <div class="segmented snippet-segmented colour-tabs" role="group"> | 527 | <div class="segmented snippet-segmented colour-tabs" role="group"> |
| 496 | for choice in tabs.into_iter() { | 528 | for choice in tabs.into_iter() { |
| 497 | <label class="segment"> | 529 | <label class="segment"> |
| @@ -504,18 +536,6 @@ async fn appearance_body(page: AppearancePage) -> Result<impl View> { | |||
| 504 | colour_panel(group: dark) | 536 | colour_panel(group: dark) |
| 505 | </fieldset> | 537 | </fieldset> |
| 506 | </form> | 538 | </form> |
| 507 | - <section class="card sound-card" aria-label=(g::t(lang, K::SoundLabel))> | ||
| 508 | - <p class="muted small">(g::t(lang, K::SoundOwnRuns)) " · " (g::t(lang, K::SoundFootOwn))</p> | ||
| 509 | - <div class="sound-row"> | ||
| 510 | - <span class="sound-name">(g::t(lang, K::SoundPassed)) <span class="muted">(g::t(lang, K::SoundPassedNote))</span></span> | ||
| 511 | - <button type="button" class="btn" data-sound-play="passed">(g::t(lang, K::SoundPlay))</button> | ||
| 512 | - </div> | ||
| 513 | - <div class="sound-row"> | ||
| 514 | - <span class="sound-name">(g::t(lang, K::SoundFailed)) <span class="muted">(g::t(lang, K::SoundFailedNote))</span></span> | ||
| 515 | - <button type="button" class="btn" data-sound-play="failed">(g::t(lang, K::SoundPlay))</button> | ||
| 516 | - </div> | ||
| 517 | - </section> | ||
| 518 | - </div> | ||
| 519 | </div> | 539 | </div> |
| 520 | }) | 540 | }) |
| 521 | } | 541 | } |
crates/forge-web/src/pages/settings_export.rsmodified+46 -38
| @@ -66,48 +66,56 @@ async fn export_view(lang: Lang, csrf: &str, exports: Vec<DataExport>) -> Result | |||
| 66 | <h1>(g::t(lang, K::ExportTitle))</h1> | 66 | <h1>(g::t(lang, K::ExportTitle))</h1> |
| 67 | </section> | 67 | </section> |
| 68 | <div class="export-page" data-live=(live.as_deref()) data-live-state=(if building { "building" } else { "idle" })> | 68 | <div class="export-page" data-live=(live.as_deref()) data-live-state=(if building { "building" } else { "idle" })> |
| 69 | - <section class="card export-intro"> | 69 | + <section class="card rows-pane"> |
| 70 | - <p>(g::t(lang, K::ExportIntro))</p> | 70 | + <div class="row-line"> |
| 71 | - <p class="muted small">(g::t(lang, K::ExportContents))</p> | 71 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4v11M7 10l5 5 5-5"/><path d="M5 19h14"/></svg> |
| 72 | - <p class="muted small">(g::t(lang, K::ExportEmailNote)) " " (ttl_note.as_str())</p> | 72 | + <div class="row-main"> |
| 73 | - <form method="post" action="/settings/export" class="inline-form"> | 73 | + <h2 class="row-title">(crate::pages::passkeys::s(lang, "Archive", "Arşiv"))</h2> |
| 74 | - csrf_field(token: csrf) | 74 | + <p class="row-status">(g::t(lang, K::ExportIntro))</p> |
| 75 | - <button type="submit" class="primary" disabled=(building)>(g::t(lang, K::ExportRequest))</button> | 75 | + <p class="row-status">(g::t(lang, K::ExportContents))</p> |
| 76 | - </form> | 76 | + <p class="row-status">(g::t(lang, K::ExportEmailNote)) " " (ttl_note.as_str())</p> |
| 77 | - </section> | 77 | + </div> |
| 78 | - <section class="card"> | 78 | + <form method="post" action="/settings/export" class="row-form"> |
| 79 | + csrf_field(token: csrf) | ||
| 80 | + <button type="submit" class="primary" disabled=(building)>(g::t(lang, K::ExportRequest))</button> | ||
| 81 | + </form> | ||
| 82 | + </div> | ||
| 79 | if empty { | 83 | if empty { |
| 80 | - <p class="muted">(g::t(lang, K::ExportNone))</p> | 84 | + <div class="row-line"> |
| 81 | - } else { | 85 | + <div class="row-main"> |
| 82 | - <ul class="item-list export-list"> | 86 | + <p class="row-status">(g::t(lang, K::ExportNone))</p> |
| 83 | - for export in exports.iter() { | 87 | + </div> |
| 84 | - <li class="item export-row"> | 88 | + </div> |
| 85 | - <div class="item-main"> | 89 | + } |
| 86 | - <strong>(g::t(lang, K::ExportRequested)) " " rel_time(lang: lang, stamp: export.created_at.as_str())</strong> | 90 | + for export in exports.iter() { |
| 87 | - if export.state == ExportState::Ready { | 91 | + <div class="row-line export-row"> |
| 88 | - <span class="muted small"> | 92 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16v4H4zM6 11v8h12v-8"/><path d="M10 15h4"/></svg> |
| 89 | - (g::t(lang, K::ExportSize)) ": " (human_size(lang, u64::try_from(export.size).unwrap_or(0))) | 93 | + <div class="row-main"> |
| 90 | - " · " (g::expires_label(lang)) " " rel_time(lang: lang, stamp: export.expires_at.as_str()) | 94 | + <strong class="row-name">(g::t(lang, K::ExportRequested)) " " rel_time(lang: lang, stamp: export.created_at.as_str())</strong> |
| 91 | - </span> | 95 | + if export.state == ExportState::Ready { |
| 92 | - } | 96 | + <p class="row-status"> |
| 93 | - </div> | 97 | + (g::t(lang, K::ExportSize)) ": " (human_size(lang, u64::try_from(export.size).unwrap_or(0))) |
| 94 | - if export.state == ExportState::Ready { | 98 | + " · " (g::expires_label(lang)) " " rel_time(lang: lang, stamp: export.expires_at.as_str()) |
| 95 | - <span class="badge public">(g::t(lang, K::ExportReady))</span> | 99 | + </p> |
| 96 | - <a class="button primary" href=(format!("/settings/export/{}/download", export.id))>(g::t(lang, K::ExportDownload))</a> | 100 | + } |
| 97 | - } | 101 | + if export.state == ExportState::Building { |
| 98 | - if export.state == ExportState::Building { | 102 | + <progress class="import-progress export-progress"></progress> |
| 99 | - <span class="badge import-running">(g::t(lang, K::ExportBuilding))</span> | 103 | + } |
| 100 | - <progress class="import-progress export-progress"></progress> | ||
| 101 | - } | ||
| 102 | - if export.state == ExportState::Failed { | ||
| 103 | - <span class="badge import-failed">(g::t(lang, K::ExportFailed))</span> | ||
| 104 | - } | ||
| 105 | - </li> | ||
| 106 | if let Some(message) = export.error.as_ref() { | 104 | if let Some(message) = export.error.as_ref() { |
| 107 | - <li class="export-error">alert(message: message.as_str())</li> | 105 | + alert(message: message.as_str()) |
| 108 | } | 106 | } |
| 107 | + </div> | ||
| 108 | + if export.state == ExportState::Ready { | ||
| 109 | + <span class="badge public">(g::t(lang, K::ExportReady))</span> | ||
| 110 | + <a class="button primary" href=(format!("/settings/export/{}/download", export.id))>(g::t(lang, K::ExportDownload))</a> | ||
| 111 | + } | ||
| 112 | + if export.state == ExportState::Building { | ||
| 113 | + <span class="badge import-running">(g::t(lang, K::ExportBuilding))</span> | ||
| 114 | + } | ||
| 115 | + if export.state == ExportState::Failed { | ||
| 116 | + <span class="badge import-failed">(g::t(lang, K::ExportFailed))</span> | ||
| 109 | } | 117 | } |
| 110 | - </ul> | 118 | + </div> |
| 111 | } | 119 | } |
| 112 | </section> | 120 | </section> |
| 113 | </div> | 121 | </div> |
crates/forge-web/src/pages/settings_gpg.rsmodified+40 -36
| @@ -16,7 +16,7 @@ use crate::auth::{require_csrf, require_user}; | |||
| 16 | use crate::i18n::{self, Key, Lang, t}; | 16 | use crate::i18n::{self, Key, Lang, t}; |
| 17 | use crate::signatures; | 17 | use crate::signatures; |
| 18 | use crate::state::AppState; | 18 | use crate::state::AppState; |
| 19 | -use crate::views::{added_status, alert, empty_state, shell, user_facing_message}; | 19 | +use crate::views::{added_status, alert, shell, user_facing_message}; |
| 20 | 20 | ||
| 21 | #[derive(Deserialize)] | 21 | #[derive(Deserialize)] |
| 22 | struct AddKeyForm { | 22 | struct AddKeyForm { |
| @@ -50,44 +50,48 @@ async fn gpg_view( | |||
| 50 | if !available { | 50 | if !available { |
| 51 | <p class="notice">(t(lang, Key::GpgUnavailable))</p> | 51 | <p class="notice">(t(lang, Key::GpgUnavailable))</p> |
| 52 | } | 52 | } |
| 53 | - <section class="card fit-pane"> | 53 | + <section class="card rows-pane"> |
| 54 | - if keys.is_empty() { | 54 | + <div class="row-line"> |
| 55 | - empty_state(title: t(lang, Key::NoGpgKeys), | 55 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 56 | - <a class="button" href="#add-gpg-key">(t(lang, Key::AddGpgKeyTitle))</a>) | 56 | + <div class="row-main"> |
| 57 | - } else { | 57 | + <h2 class="row-title">(t(lang, Key::AddGpgKeyTitle))</h2> |
| 58 | - <ul class="item-list"> | 58 | + if keys.is_empty() { |
| 59 | - for key in keys.into_iter() { | 59 | + <p class="row-status">(t(lang, Key::NoGpgKeys))</p> |
| 60 | - <li class="item"> | ||
| 61 | - <div class="item-main"> | ||
| 62 | - <code class="small">(key.fingerprint.clone())</code> | ||
| 63 | - <span class="muted small">(key.emails.join(", "))</span> | ||
| 64 | - <span class="muted small">added_status(lang: lang, added: Some(key.created_at.as_str()), used: None)</span> | ||
| 65 | - </div> | ||
| 66 | - <form method="post" action="/settings/gpg/delete"> | ||
| 67 | - <input type="hidden" name="csrf" value=(csrf)> | ||
| 68 | - <input type="hidden" name="id" value=(key.id.clone())> | ||
| 69 | - <button type="submit" class="danger">(t(lang, Key::Delete))</button> | ||
| 70 | - </form> | ||
| 71 | - </li> | ||
| 72 | } | 60 | } |
| 73 | - </ul> | 61 | + </div> |
| 62 | + <details class="row-action" id="add-gpg-key" open=(error.is_some())> | ||
| 63 | + <summary>(t(lang, Key::AddKeyButton))</summary> | ||
| 64 | + <div class="row-panel"> | ||
| 65 | + if let Some(message) = error { | ||
| 66 | + alert(message: message.as_str()) | ||
| 67 | + } | ||
| 68 | + <form method="post" action="/settings/gpg" class="stack"> | ||
| 69 | + <input type="hidden" name="csrf" value=(csrf)> | ||
| 70 | + <label> | ||
| 71 | + <span>(t(lang, Key::ArmoredPublicKeyLabel))</span> | ||
| 72 | + <textarea name="armored" rows="10" spellcheck="false" required=(true)>(armored)</textarea> | ||
| 73 | + <small class="muted">(t(lang, Key::ArmoredHint))</small> | ||
| 74 | + </label> | ||
| 75 | + <button type="submit" class="primary">(t(lang, Key::AddKeyButton))</button> | ||
| 76 | + </form> | ||
| 77 | + </div> | ||
| 78 | + </details> | ||
| 79 | + </div> | ||
| 80 | + for key in keys.into_iter() { | ||
| 81 | + <div class="row-line"> | ||
| 82 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 20l4-1 10-10-3-3L5 16z"/><path d="M14 6l3 3"/></svg> | ||
| 83 | + <div class="row-main"> | ||
| 84 | + <strong class="row-name"><code>(key.fingerprint.clone())</code></strong> | ||
| 85 | + <p class="row-status">(key.emails.join(", ")) " · " added_status(lang: lang, added: Some(key.created_at.as_str()), used: None)</p> | ||
| 86 | + </div> | ||
| 87 | + <form method="post" action="/settings/gpg/delete" class="row-form"> | ||
| 88 | + <input type="hidden" name="csrf" value=(csrf)> | ||
| 89 | + <input type="hidden" name="id" value=(key.id.clone())> | ||
| 90 | + <button type="submit" class="danger">(t(lang, Key::Delete))</button> | ||
| 91 | + </form> | ||
| 92 | + </div> | ||
| 74 | } | 93 | } |
| 75 | </section> | 94 | </section> |
| 76 | - <section class="card" id="add-gpg-key"> | ||
| 77 | - <h2>(t(lang, Key::AddGpgKeyTitle))</h2> | ||
| 78 | - if let Some(message) = error { | ||
| 79 | - alert(message: message.as_str()) | ||
| 80 | - } | ||
| 81 | - <form method="post" action="/settings/gpg" class="stack"> | ||
| 82 | - <input type="hidden" name="csrf" value=(csrf)> | ||
| 83 | - <label> | ||
| 84 | - <span>(t(lang, Key::ArmoredPublicKeyLabel))</span> | ||
| 85 | - <textarea name="armored" rows="10" spellcheck="false" required=(true)>(armored)</textarea> | ||
| 86 | - <small class="muted">(t(lang, Key::ArmoredHint))</small> | ||
| 87 | - </label> | ||
| 88 | - <button type="submit" class="primary">(t(lang, Key::AddKeyButton))</button> | ||
| 89 | - </form> | ||
| 90 | - </section> | ||
| 91 | }) | 95 | }) |
| 92 | } | 96 | } |
| 93 | 97 | ||
crates/forge-web/src/pages/settings_keys.rsmodified+46 -41
| @@ -15,7 +15,7 @@ use crate::audit::{self, Actor, Target}; | |||
| 15 | use crate::auth::{require_csrf, require_user}; | 15 | use crate::auth::{require_csrf, require_user}; |
| 16 | use crate::i18n::{self, Key, Lang, t, unsupported_key_type}; | 16 | use crate::i18n::{self, Key, Lang, t, unsupported_key_type}; |
| 17 | use crate::state::AppState; | 17 | use crate::state::AppState; |
| 18 | -use crate::views::{added_status, alert, empty_state, shell, user_facing_message}; | 18 | +use crate::views::{added_status, alert, shell, user_facing_message}; |
| 19 | 19 | ||
| 20 | /// Algorithms accepted for web-registered keys. `ssh-rsa` is rejected with its own message. | 20 | /// Algorithms accepted for web-registered keys. `ssh-rsa` is rejected with its own message. |
| 21 | const ACCEPTED: &[&str] = &[ | 21 | const ACCEPTED: &[&str] = &[ |
| @@ -147,49 +147,54 @@ async fn keys_view( | |||
| 147 | <section class="page-head"> | 147 | <section class="page-head"> |
| 148 | <h1>(t(lang, Key::SshKeys))</h1> | 148 | <h1>(t(lang, Key::SshKeys))</h1> |
| 149 | </section> | 149 | </section> |
| 150 | - <section class="card fit-pane"> | 150 | + <section class="card rows-pane"> |
| 151 | - if keys.is_empty() { | 151 | + <div class="row-line"> |
| 152 | - empty_state(title: t(lang, Key::NoSshKeys), | 152 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 153 | - <a class="button" href="#add-key">(t(lang, Key::AddSshKeyTitle))</a>) | 153 | + <div class="row-main"> |
| 154 | - } else { | 154 | + <h2 class="row-title">(t(lang, Key::AddSshKeyTitle))</h2> |
| 155 | - <ul class="item-list"> | 155 | + if keys.is_empty() { |
| 156 | - for key in keys.into_iter() { | 156 | + <p class="row-status">(t(lang, Key::NoSshKeys))</p> |
| 157 | - <li class="item"> | 157 | + } else { |
| 158 | - <div class="item-main"> | 158 | + <p class="row-status">(t(lang, Key::PublicKeyHint))</p> |
| 159 | - <strong>(key.title.clone())</strong> | ||
| 160 | - <span class="muted small">(key.algorithm.clone())</span> | ||
| 161 | - <code class="small">(key.fingerprint.clone())</code> | ||
| 162 | - <span class="muted small">added_status(lang: lang, added: Some(key.created_at.as_str()), used: key.last_used_at.as_deref())</span> | ||
| 163 | - </div> | ||
| 164 | - <form method="post" action="/settings/keys/delete"> | ||
| 165 | - <input type="hidden" name="csrf" value=(csrf)> | ||
| 166 | - <input type="hidden" name="id" value=(key.id.clone())> | ||
| 167 | - <button type="submit" class="danger">(t(lang, Key::Delete))</button> | ||
| 168 | - </form> | ||
| 169 | - </li> | ||
| 170 | } | 159 | } |
| 171 | - </ul> | 160 | + </div> |
| 161 | + <details class="row-action" id="add-key" open=(error.is_some())> | ||
| 162 | + <summary>(t(lang, Key::AddKeyButton))</summary> | ||
| 163 | + <div class="row-panel"> | ||
| 164 | + if let Some(message) = error { | ||
| 165 | + alert(message: message.as_str()) | ||
| 166 | + } | ||
| 167 | + <form data-hard="true" method="post" action="/settings/keys" class="stack"> | ||
| 168 | + <input type="hidden" name="csrf" value=(csrf)> | ||
| 169 | + <label> | ||
| 170 | + <span>(t(lang, Key::TitleOptional))</span> | ||
| 171 | + <input type="text" name="title" maxlength="100" autocomplete="off"> | ||
| 172 | + </label> | ||
| 173 | + <label> | ||
| 174 | + <span>(t(lang, Key::PublicKeyLabel))</span> | ||
| 175 | + <textarea name="public_key" rows="4" spellcheck="false" required=(true)>(public_key)</textarea> | ||
| 176 | + <small class="muted">(t(lang, Key::PublicKeyHint))</small> | ||
| 177 | + </label> | ||
| 178 | + <button type="submit" class="primary">(t(lang, Key::AddKeyButton))</button> | ||
| 179 | + </form> | ||
| 180 | + </div> | ||
| 181 | + </details> | ||
| 182 | + </div> | ||
| 183 | + for key in keys.into_iter() { | ||
| 184 | + <div class="row-line"> | ||
| 185 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="8" cy="15" r="4"/><path d="m11 12 9-9M16 7l3 3"/></svg> | ||
| 186 | + <div class="row-main"> | ||
| 187 | + <strong class="row-name">(key.title.clone())</strong> | ||
| 188 | + <p class="row-status"><code>(key.fingerprint.clone())</code> " · " (key.algorithm.clone()) " · " added_status(lang: lang, added: Some(key.created_at.as_str()), used: key.last_used_at.as_deref())</p> | ||
| 189 | + </div> | ||
| 190 | + <form method="post" action="/settings/keys/delete" class="row-form"> | ||
| 191 | + <input type="hidden" name="csrf" value=(csrf)> | ||
| 192 | + <input type="hidden" name="id" value=(key.id.clone())> | ||
| 193 | + <button type="submit" class="danger">(t(lang, Key::Delete))</button> | ||
| 194 | + </form> | ||
| 195 | + </div> | ||
| 172 | } | 196 | } |
| 173 | </section> | 197 | </section> |
| 174 | - <section class="card" id="add-key"> | ||
| 175 | - <h2>(t(lang, Key::AddSshKeyTitle))</h2> | ||
| 176 | - if let Some(message) = error { | ||
| 177 | - alert(message: message.as_str()) | ||
| 178 | - } | ||
| 179 | - <form method="post" action="/settings/keys" class="stack"> | ||
| 180 | - <input type="hidden" name="csrf" value=(csrf)> | ||
| 181 | - <label> | ||
| 182 | - <span>(t(lang, Key::TitleOptional))</span> | ||
| 183 | - <input type="text" name="title" maxlength="100" autocomplete="off"> | ||
| 184 | - </label> | ||
| 185 | - <label> | ||
| 186 | - <span>(t(lang, Key::PublicKeyLabel))</span> | ||
| 187 | - <textarea name="public_key" rows="4" spellcheck="false" required=(true)>(public_key)</textarea> | ||
| 188 | - <small class="muted">(t(lang, Key::PublicKeyHint))</small> | ||
| 189 | - </label> | ||
| 190 | - <button type="submit" class="primary">(t(lang, Key::AddKeyButton))</button> | ||
| 191 | - </form> | ||
| 192 | - </section> | ||
| 193 | }) | 198 | }) |
| 194 | } | 199 | } |
| 195 | 200 | ||
crates/forge-web/src/pages/settings_notifications.rsmodified+79 -61
| @@ -18,7 +18,7 @@ use crate::auth::{require_csrf, require_user}; | |||
| 18 | use crate::i18n::push as push_text; | 18 | use crate::i18n::push as push_text; |
| 19 | use crate::i18n::{self, Key, Lang, t}; | 19 | use crate::i18n::{self, Key, Lang, t}; |
| 20 | use crate::state::AppState; | 20 | use crate::state::AppState; |
| 21 | -use crate::views::{csrf_field, empty_state, rel_time, shell}; | 21 | +use crate::views::{csrf_field, rel_time, shell}; |
| 22 | 22 | ||
| 23 | #[query_params(error = bad_request)] | 23 | #[query_params(error = bad_request)] |
| 24 | struct NotificationsQuery { | 24 | struct NotificationsQuery { |
| @@ -78,78 +78,96 @@ async fn notifications_body(page: NotificationsPage) -> Result<impl View> { | |||
| 78 | <p>(message.as_str())</p> | 78 | <p>(message.as_str())</p> |
| 79 | </section> | 79 | </section> |
| 80 | } | 80 | } |
| 81 | - <section class="card"> | 81 | + <section class="card rows-pane"> |
| 82 | - <form method="post" action="/settings/notifications" class="notify-form"> | 82 | + <form id="notify-form" method="post" action="/settings/notifications" class="notify-form"> |
| 83 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 83 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 84 | - <div class="check-field"> | ||
| 85 | - <label> | ||
| 86 | - <input type="checkbox" name="email_notifications" value="1" checked=(on) disabled=(blocked) data-autosubmit="true"> | ||
| 87 | - <span>(t(lang, Key::EmailNotifyLabel))</span> | ||
| 88 | - </label> | ||
| 89 | - <small class="muted">(t(lang, Key::EmailNotifyHelp))</small> | ||
| 90 | - </div> | ||
| 91 | - if let Some(message) = server_note { | ||
| 92 | - <p class="notice" role="note">(message)</p> | ||
| 93 | - } | ||
| 94 | - if let Some(message) = unverified_note { | ||
| 95 | - <p class="notice" role="note">(message)</p> | ||
| 96 | - } | ||
| 97 | - <noscript> | ||
| 98 | - <div class="actions"> | ||
| 99 | - <button type="submit" class="primary" disabled=(blocked)>(t(lang, Key::Save))</button> | ||
| 100 | - </div> | ||
| 101 | - </noscript> | ||
| 102 | </form> | 84 | </form> |
| 85 | + <label class="row-line row-field"> | ||
| 86 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/></svg> | ||
| 87 | + <span class="row-main"> | ||
| 88 | + <span class="row-title">(t(lang, Key::EmailNotifyLabel))</span> | ||
| 89 | + <span class="row-status">(t(lang, Key::EmailNotifyHelp))</span> | ||
| 90 | + </span> | ||
| 91 | + <span class="row-control"> | ||
| 92 | + <input type="checkbox" form="notify-form" name="email_notifications" value="1" checked=(on) disabled=(blocked) data-autosubmit="true"> | ||
| 93 | + </span> | ||
| 94 | + </label> | ||
| 95 | + if let Some(message) = server_note { | ||
| 96 | + <p class="notice" role="note">(message)</p> | ||
| 97 | + } | ||
| 98 | + if let Some(message) = unverified_note { | ||
| 99 | + <p class="notice" role="note">(message)</p> | ||
| 100 | + } | ||
| 101 | + <noscript> | ||
| 102 | + <div class="row-foot"> | ||
| 103 | + <button type="submit" form="notify-form" class="primary" disabled=(blocked)>(t(lang, Key::Save))</button> | ||
| 104 | + </div> | ||
| 105 | + </noscript> | ||
| 103 | </section> | 106 | </section> |
| 104 | - <section class="card push-card" data-push="true" data-live="/settings/notifications/push/events"> | 107 | + <section class="card rows-pane push-card" data-push="true" data-live="/settings/notifications/push/events"> |
| 105 | - <h2>(push_text::t(lang, push_text::K::DeviceHeading))</h2> | 108 | + <div class="row-line"> |
| 106 | - <small class="muted">(push_text::t(lang, push_text::K::DeviceHelp))</small> | 109 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 8 3 8H3s3-1 3-8"/><path d="M10 20a2 2 0 0 0 4 0"/></svg> |
| 110 | + <div class="row-main"> | ||
| 111 | + <h2 class="row-title">(push_text::t(lang, push_text::K::DeviceHeading))</h2> | ||
| 112 | + <p class="row-status">(push_text::t(lang, push_text::K::DeviceHelp))</p> | ||
| 113 | + <p class="row-status" data-push-state="on" hidden=(true)>(push_text::t(lang, push_text::K::DeviceOn))</p> | ||
| 114 | + <p class="row-status" data-push-state="off" hidden=(true)>(push_text::t(lang, push_text::K::DeviceOff))</p> | ||
| 115 | + </div> | ||
| 116 | + <div class="row-actions"> | ||
| 117 | + <button type="button" class="primary" data-push-action="enable" hidden=(true)>(push_text::t(lang, push_text::K::TurnOn))</button> | ||
| 118 | + <button type="button" data-push-action="disable" hidden=(true)>(push_text::t(lang, push_text::K::TurnOff))</button> | ||
| 119 | + </div> | ||
| 120 | + </div> | ||
| 107 | <p class="notice" role="note" data-push-state="unsupported" hidden=(true)>(push_text::t(lang, push_text::K::DeviceUnsupported))</p> | 121 | <p class="notice" role="note" data-push-state="unsupported" hidden=(true)>(push_text::t(lang, push_text::K::DeviceUnsupported))</p> |
| 108 | <p class="notice" role="note" data-push-state="https" hidden=(true)>(push_text::t(lang, push_text::K::DeviceNeedsHttps))</p> | 122 | <p class="notice" role="note" data-push-state="https" hidden=(true)>(push_text::t(lang, push_text::K::DeviceNeedsHttps))</p> |
| 109 | <p class="notice" role="note" data-push-state="ios" hidden=(true)>(push_text::t(lang, push_text::K::DeviceIosHint))</p> | 123 | <p class="notice" role="note" data-push-state="ios" hidden=(true)>(push_text::t(lang, push_text::K::DeviceIosHint))</p> |
| 110 | <p class="notice" role="note" data-push-state="denied" hidden=(true)>(push_text::t(lang, push_text::K::DeviceDenied))</p> | 124 | <p class="notice" role="note" data-push-state="denied" hidden=(true)>(push_text::t(lang, push_text::K::DeviceDenied))</p> |
| 111 | <p class="notice" role="alert" data-push-state="error" hidden=(true)>(push_text::t(lang, push_text::K::DeviceError))</p> | 125 | <p class="notice" role="alert" data-push-state="error" hidden=(true)>(push_text::t(lang, push_text::K::DeviceError))</p> |
| 112 | - <p class="muted" data-push-state="on" hidden=(true)>(push_text::t(lang, push_text::K::DeviceOn))</p> | 126 | + <form method="post" action="/settings/notifications/push/test" class="row-line"> |
| 113 | - <p class="muted" data-push-state="off" hidden=(true)>(push_text::t(lang, push_text::K::DeviceOff))</p> | ||
| 114 | - <div class="actions"> | ||
| 115 | - <button type="button" class="primary" data-push-action="enable" hidden=(true)>(push_text::t(lang, push_text::K::TurnOn))</button> | ||
| 116 | - <button type="button" data-push-action="disable" hidden=(true)>(push_text::t(lang, push_text::K::TurnOff))</button> | ||
| 117 | - </div> | ||
| 118 | - <form method="post" action="/settings/notifications/push/test" class="actions"> | ||
| 119 | csrf_field(token: csrf.as_str()) | 127 | csrf_field(token: csrf.as_str()) |
| 120 | - <button type="submit" data-push-test="true" disabled=(!can_test)>(push_text::t(lang, push_text::K::SendTest))</button> | 128 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M22 2L11 13"/><path d="M22 2l-7 20-4-9-9-4z"/></svg> |
| 121 | - if !can_test { | 129 | + <div class="row-main"> |
| 122 | - <small class="muted">(push_text::t(lang, push_text::K::TestNoDevices))</small> | 130 | + <h2 class="row-title">(push_text::t(lang, push_text::K::SendTest))</h2> |
| 123 | - } | 131 | + if !can_test { |
| 132 | + <p class="row-status">(push_text::t(lang, push_text::K::TestNoDevices))</p> | ||
| 133 | + } | ||
| 134 | + </div> | ||
| 135 | + <div class="row-actions"> | ||
| 136 | + <button type="submit" data-push-test="true" disabled=(!can_test)>(push_text::t(lang, push_text::K::SendTest))</button> | ||
| 137 | + </div> | ||
| 124 | </form> | 138 | </form> |
| 125 | </section> | 139 | </section> |
| 126 | - <section class="card"> | 140 | + <section class="card rows-pane"> |
| 127 | - <h2>(push_text::t(lang, push_text::K::DevicesHeading))</h2> | 141 | + <div class="row-line"> |
| 128 | - if devices.is_empty() { | 142 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="7" y="3" width="10" height="18" rx="2"/><path d="M11 18h2"/></svg> |
| 129 | - empty_state(title: push_text::t(lang, push_text::K::DevicesEmpty)) | 143 | + <div class="row-main"> |
| 144 | + <h2 class="row-title">(push_text::t(lang, push_text::K::DevicesHeading))</h2> | ||
| 145 | + if devices.is_empty() { | ||
| 146 | + <p class="row-status">(push_text::t(lang, push_text::K::DevicesEmpty))</p> | ||
| 147 | + } | ||
| 148 | + </div> | ||
| 149 | + </div> | ||
| 150 | + for device in devices.into_iter() { | ||
| 151 | + <div class="row-line"> | ||
| 152 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="7" y="3" width="10" height="18" rx="2"/><path d="M11 18h2"/></svg> | ||
| 153 | + <div class="row-main"> | ||
| 154 | + <strong class="row-name">(device.agent_label.as_str())</strong> | ||
| 155 | + <p class="row-status">(push_text::added_label(lang)) " " rel_time(lang: lang, stamp: device.created_at.as_str())</p> | ||
| 156 | + <p class="row-status"> | ||
| 157 | + if let Some(stamp) = device.last_success_at.as_deref() { | ||
| 158 | + (push_text::last_delivered_label(lang)) " " rel_time(lang: lang, stamp: stamp) | ||
| 159 | + } else { | ||
| 160 | + (push_text::t(lang, push_text::K::NeverDelivered)) | ||
| 161 | + } | ||
| 162 | + </p> | ||
| 163 | + </div> | ||
| 164 | + <form method="post" action="/settings/notifications/push/remove" class="row-form"> | ||
| 165 | + csrf_field(token: csrf.as_str()) | ||
| 166 | + <input type="hidden" name="id" value=(device.id.as_str())> | ||
| 167 | + <button type="submit" class="danger">(push_text::t(lang, push_text::K::RemoveDevice))</button> | ||
| 168 | + </form> | ||
| 169 | + </div> | ||
| 130 | } | 170 | } |
| 131 | - <ul class="push-devices"> | ||
| 132 | - for device in devices.into_iter() { | ||
| 133 | - <li class="push-device"> | ||
| 134 | - <div> | ||
| 135 | - <strong>(device.agent_label.as_str())</strong> | ||
| 136 | - <small class="muted">(push_text::added_label(lang)) " " rel_time(lang: lang, stamp: device.created_at.as_str())</small> | ||
| 137 | - <small class="muted"> | ||
| 138 | - if let Some(stamp) = device.last_success_at.as_deref() { | ||
| 139 | - (push_text::last_delivered_label(lang)) " " rel_time(lang: lang, stamp: stamp) | ||
| 140 | - } else { | ||
| 141 | - (push_text::t(lang, push_text::K::NeverDelivered)) | ||
| 142 | - } | ||
| 143 | - </small> | ||
| 144 | - </div> | ||
| 145 | - <form method="post" action="/settings/notifications/push/remove" class="push-remove"> | ||
| 146 | - csrf_field(token: csrf.as_str()) | ||
| 147 | - <input type="hidden" name="id" value=(device.id.as_str())> | ||
| 148 | - <button type="submit" class="link-button">(push_text::t(lang, push_text::K::RemoveDevice))</button> | ||
| 149 | - </form> | ||
| 150 | - </li> | ||
| 151 | - } | ||
| 152 | - </ul> | ||
| 153 | </section> | 171 | </section> |
| 154 | </div> | 172 | </div> |
| 155 | }) | 173 | }) |
crates/forge-web/src/pages/settings_profile.rsmodified+74 -60
| @@ -147,75 +147,89 @@ async fn profile_body(page: ProfilePage) -> Result<impl View> { | |||
| 147 | <p>(message)</p> | 147 | <p>(message)</p> |
| 148 | </section> | 148 | </section> |
| 149 | } | 149 | } |
| 150 | - <div class="profile-settings"> | 150 | + <section class="card rows-pane"> |
| 151 | - <form method="post" action="/settings/profile" class="profile-form"> | 151 | + <div class="row-line profile-settings-avatar"> |
| 152 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | 152 | + <img class="avatar profile-settings-avatar-img" src=(avatar_src.as_str()) alt=(t(lang, Key::AvatarAlt)) width="40" height="40"> |
| 153 | - <div class="profile-field"> | 153 | + <div class="row-main"> |
| 154 | - <label for="profile-display-name">(t(lang, Key::DisplayName))</label> | 154 | + <h2 class="row-title">(t(lang, Key::Avatar))</h2> |
| 155 | - <input id="profile-display-name" type="text" name="display_name" maxlength="80" autocomplete="name" value=(draft.display_name.as_str()) aria-describedby="profile-display-name-hint"> | 155 | + <p class="row-status">(t(lang, Key::AvatarHint))</p> |
| 156 | - <small class="muted" id="profile-display-name-hint">(t(lang, Key::DisplayNameHint))</small> | 156 | + if let Some(message) = errors.avatar { |
| 157 | - if let Some(message) = errors.display_name { | ||
| 158 | alert(message: message.as_str()) | 157 | alert(message: message.as_str()) |
| 159 | } | 158 | } |
| 160 | </div> | 159 | </div> |
| 161 | - <div class="profile-field"> | 160 | + <div class="row-actions"> |
| 162 | - <label for="profile-username">(t(lang, Key::Username))</label> | 161 | + <form method="post" action="/settings/profile/avatar" enctype="multipart/form-data" class="row-form profile-settings-avatar-upload"> |
| 163 | - <input id="profile-username" type="text" name="username" maxlength="64" required=(true) autocomplete="username" value=(draft.username.as_str()) aria-describedby="profile-username-hint"> | 162 | + <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 164 | - <small class="muted" id="profile-username-hint">(t(lang, Key::UsernameHint))</small> | 163 | + <input class="profile-settings-avatar-file" type="file" id="profile-settings-avatar-file" name="avatar" aria-label=(t(lang, Key::Image)) accept="image/png,image/jpeg,image/webp,image/gif" required=(true)> |
| 165 | - if let Some(message) = errors.username { | 164 | + <label class="profile-settings-avatar-item" for="profile-settings-avatar-file">(t(lang, Key::UploadPhoto))</label> |
| 166 | - alert(message: message.as_str()) | 165 | + <button type="submit" class="primary">(t(lang, Key::Upload))</button> |
| 167 | - } | 166 | + </form> |
| 168 | - </div> | 167 | + if has_avatar { |
| 169 | - <div class="profile-field"> | 168 | + <form method="post" action="/settings/profile/avatar/delete" class="row-form profile-settings-avatar-remove"> |
| 170 | - <label for="profile-about">(t(lang, Key::About))</label> | 169 | + <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 171 | - <textarea id="profile-about" name="about" rows="6" maxlength="2000" aria-describedby="profile-about-hint">(draft.about.as_str())</textarea> | 170 | + <button type="submit" class="link-button">(t(lang, Key::RemovePhoto))</button> |
| 172 | - <small class="muted" id="profile-about-hint">(t(lang, Key::AboutHint))</small> | 171 | + </form> |
| 173 | - if let Some(message) = errors.about { | ||
| 174 | - alert(message: message.as_str()) | ||
| 175 | } | 172 | } |
| 176 | </div> | 173 | </div> |
| 177 | - <div class="profile-field"> | 174 | + </div> |
| 178 | - <label for="profile-timezone">(t(lang, Key::Timezone))</label> | 175 | + <form id="profile-form" method="post" action="/settings/profile" class="profile-form"> |
| 179 | - <select id="profile-timezone" name="timezone"> | 176 | + <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 177 | + </form> | ||
| 178 | + <label class="row-line row-field"> | ||
| 179 | + <span class="row-main"> | ||
| 180 | + <span class="row-title">(t(lang, Key::DisplayName))</span> | ||
| 181 | + <span class="row-status" id="profile-display-name-hint">(t(lang, Key::DisplayNameHint))</span> | ||
| 182 | + </span> | ||
| 183 | + <span class="row-control"> | ||
| 184 | + <input id="profile-display-name" form="profile-form" type="text" name="display_name" maxlength="80" autocomplete="name" value=(draft.display_name.as_str()) aria-describedby="profile-display-name-hint"> | ||
| 185 | + </span> | ||
| 186 | + </label> | ||
| 187 | + if let Some(message) = errors.display_name { | ||
| 188 | + alert(message: message.as_str()) | ||
| 189 | + } | ||
| 190 | + <label class="row-line row-field"> | ||
| 191 | + <span class="row-main"> | ||
| 192 | + <span class="row-title">(t(lang, Key::Username))</span> | ||
| 193 | + <span class="row-status" id="profile-username-hint">(t(lang, Key::UsernameHint))</span> | ||
| 194 | + </span> | ||
| 195 | + <span class="row-control"> | ||
| 196 | + <input id="profile-username" form="profile-form" type="text" name="username" maxlength="64" required=(true) autocomplete="username" value=(draft.username.as_str()) aria-describedby="profile-username-hint"> | ||
| 197 | + </span> | ||
| 198 | + </label> | ||
| 199 | + if let Some(message) = errors.username { | ||
| 200 | + alert(message: message.as_str()) | ||
| 201 | + } | ||
| 202 | + <label class="row-line row-field"> | ||
| 203 | + <span class="row-main"> | ||
| 204 | + <span class="row-title">(t(lang, Key::About))</span> | ||
| 205 | + <span class="row-status" id="profile-about-hint">(t(lang, Key::AboutHint))</span> | ||
| 206 | + </span> | ||
| 207 | + <span class="row-control"> | ||
| 208 | + <textarea id="profile-about" form="profile-form" name="about" rows="6" maxlength="2000" aria-describedby="profile-about-hint">(draft.about.as_str())</textarea> | ||
| 209 | + </span> | ||
| 210 | + </label> | ||
| 211 | + if let Some(message) = errors.about { | ||
| 212 | + alert(message: message.as_str()) | ||
| 213 | + } | ||
| 214 | + <label class="row-line row-field"> | ||
| 215 | + <span class="row-main"> | ||
| 216 | + <span class="row-title">(t(lang, Key::Timezone))</span> | ||
| 217 | + </span> | ||
| 218 | + <span class="row-control"> | ||
| 219 | + <select id="profile-timezone" form="profile-form" name="timezone"> | ||
| 180 | for zone in zones.into_iter() { | 220 | for zone in zones.into_iter() { |
| 181 | <option value=(zone.name.clone()) selected=(zone.selected)>(zone.name)</option> | 221 | <option value=(zone.name.clone()) selected=(zone.selected)>(zone.name)</option> |
| 182 | } | 222 | } |
| 183 | </select> | 223 | </select> |
| 184 | - if let Some(message) = errors.timezone { | 224 | + </span> |
| 185 | - alert(message: message.as_str()) | 225 | + </label> |
| 186 | - } | 226 | + if let Some(message) = errors.timezone { |
| 187 | - </div> | 227 | + alert(message: message.as_str()) |
| 188 | - <div class="profile-actions"> | 228 | + } |
| 189 | - <button type="submit" class="primary">(t(lang, Key::Save))</button> | 229 | + <div class="row-foot"> |
| 190 | - </div> | 230 | + <button type="submit" class="primary" form="profile-form">(t(lang, Key::Save))</button> |
| 191 | - </form> | 231 | + </div> |
| 192 | - <aside class="profile-settings-avatar" aria-label=(t(lang, Key::Avatar))> | 232 | + </section> |
| 193 | - <div class="profile-settings-avatar-frame"> | ||
| 194 | - <img class="avatar profile-settings-avatar-img" src=(avatar_src.as_str()) alt=(t(lang, Key::AvatarAlt)) width="180" height="180"> | ||
| 195 | - <details class="menu profile-settings-avatar-menu"> | ||
| 196 | - <summary>(t(lang, Key::Edit))</summary> | ||
| 197 | - <div class="menu-list profile-settings-avatar-list"> | ||
| 198 | - <form method="post" action="/settings/profile/avatar" enctype="multipart/form-data" class="profile-settings-avatar-upload"> | ||
| 199 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 200 | - <input class="profile-settings-avatar-file" type="file" id="profile-settings-avatar-file" name="avatar" aria-label=(t(lang, Key::Image)) accept="image/png,image/jpeg,image/webp,image/gif" required=(true)> | ||
| 201 | - <label class="profile-settings-avatar-item" for="profile-settings-avatar-file">(t(lang, Key::UploadPhoto))</label> | ||
| 202 | - <button type="submit" class="primary">(t(lang, Key::Upload))</button> | ||
| 203 | - </form> | ||
| 204 | - if has_avatar { | ||
| 205 | - <form method="post" action="/settings/profile/avatar/delete" class="profile-settings-avatar-remove"> | ||
| 206 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | ||
| 207 | - <button type="submit" class="link-button">(t(lang, Key::RemovePhoto))</button> | ||
| 208 | - </form> | ||
| 209 | - } | ||
| 210 | - </div> | ||
| 211 | - </details> | ||
| 212 | - </div> | ||
| 213 | - if let Some(message) = errors.avatar { | ||
| 214 | - alert(message: message.as_str()) | ||
| 215 | - } | ||
| 216 | - <small class="muted">(t(lang, Key::AvatarHint))</small> | ||
| 217 | - </aside> | ||
| 218 | - </div> | ||
| 219 | </div> | 233 | </div> |
| 220 | }) | 234 | }) |
| 221 | } | 235 | } |
crates/forge-web/src/pages/settings_security.rsmodified+53 -53
| @@ -209,8 +209,8 @@ async fn security_body(page: SecurityPage) -> Result<impl View> { | |||
| 209 | } = page; | 209 | } = page; |
| 210 | let two_factor_on = two_factor.is_some(); | 210 | let two_factor_on = two_factor.is_some(); |
| 211 | let codes_class = match &two_factor { | 211 | let codes_class = match &two_factor { |
| 212 | - Some(device) if device.codes_low => "security-row-status warn", | 212 | + Some(device) if device.codes_low => "row-status warn", |
| 213 | - _ => "security-row-status", | 213 | + _ => "row-status", |
| 214 | }; | 214 | }; |
| 215 | let password_open = password_error.is_some(); | 215 | let password_open = password_error.is_some(); |
| 216 | let email_open = email_error.is_some(); | 216 | let email_open = email_error.is_some(); |
| @@ -260,18 +260,18 @@ async fn security_body(page: SecurityPage) -> Result<impl View> { | |||
| 260 | <p><button type="button" data-copy="recovery-codes" data-lines="" data-copied=(rc::t(lang, RC::CopyDone)) data-failed=(rc::t(lang, RC::CopyFailed))>(pk::t(lang, PK::CopyCommand))</button></p> | 260 | <p><button type="button" data-copy="recovery-codes" data-lines="" data-copied=(rc::t(lang, RC::CopyDone)) data-failed=(rc::t(lang, RC::CopyFailed))>(pk::t(lang, PK::CopyCommand))</button></p> |
| 261 | </section> | 261 | </section> |
| 262 | } | 262 | } |
| 263 | - <section class="card security-card"> | 263 | + <section class="card rows-pane"> |
| 264 | - <div class="security-row"> | 264 | + <div class="row-line"> |
| 265 | - <svg class="security-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></svg> | 265 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/></svg> |
| 266 | - <div class="security-row-main"> | 266 | + <div class="row-main"> |
| 267 | - <h2 class="security-row-title">(t(lang, Key::Password))</h2> | 267 | + <h2 class="row-title">(t(lang, Key::Password))</h2> |
| 268 | if let Some(stamp) = password_changed { | 268 | if let Some(stamp) = password_changed { |
| 269 | - <p class="security-row-status">(i18n::last_changed_label(lang)) " " rel_time(lang: lang, stamp: stamp.as_str())</p> | 269 | + <p class="row-status">(i18n::last_changed_label(lang)) " " rel_time(lang: lang, stamp: stamp.as_str())</p> |
| 270 | } | 270 | } |
| 271 | </div> | 271 | </div> |
| 272 | - <details class="security-action" open=(password_open)> | 272 | + <details class="row-action" open=(password_open)> |
| 273 | <summary>(t(lang, Key::ChangeAction))</summary> | 273 | <summary>(t(lang, Key::ChangeAction))</summary> |
| 274 | - <div class="security-panel"> | 274 | + <div class="row-panel"> |
| 275 | if let Some(message) = password_error { | 275 | if let Some(message) = password_error { |
| 276 | alert(message: message.as_str()) | 276 | alert(message: message.as_str()) |
| 277 | } | 277 | } |
| @@ -295,25 +295,25 @@ async fn security_body(page: SecurityPage) -> Result<impl View> { | |||
| 295 | </div> | 295 | </div> |
| 296 | </details> | 296 | </details> |
| 297 | </div> | 297 | </div> |
| 298 | - <div class="security-row"> | 298 | + <div class="row-line"> |
| 299 | - <svg class="security-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/></svg> | 299 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/></svg> |
| 300 | - <div class="security-row-main"> | 300 | + <div class="row-main"> |
| 301 | - <h2 class="security-row-title">(t(lang, Key::Email))</h2> | 301 | + <h2 class="row-title">(t(lang, Key::Email))</h2> |
| 302 | if stored_email.is_empty() { | 302 | if stored_email.is_empty() { |
| 303 | - <p class="security-row-status">(t(lang, Key::EmailNoAddress))</p> | 303 | + <p class="row-status">(t(lang, Key::EmailNoAddress))</p> |
| 304 | } else { | 304 | } else { |
| 305 | - <p class="security-row-status"><span class="security-email">(stored_email.as_str())</span> (" · ")(email_status.as_str()) if let Some(stamp) = email_sent { " " rel_time(lang: lang, stamp: stamp.as_str()) }</p> | 305 | + <p class="row-status"><span class="security-email">(stored_email.as_str())</span> (" · ")(email_status.as_str()) if let Some(stamp) = email_sent { " " rel_time(lang: lang, stamp: stamp.as_str()) }</p> |
| 306 | } | 306 | } |
| 307 | </div> | 307 | </div> |
| 308 | if show_resend { | 308 | if show_resend { |
| 309 | - <form method="post" action="/settings/security/email/resend" class="security-inline-form"> | 309 | + <form method="post" action="/settings/security/email/resend" class="row-form"> |
| 310 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 310 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 311 | <button type="submit">(t(lang, Key::VerifyResend))</button> | 311 | <button type="submit">(t(lang, Key::VerifyResend))</button> |
| 312 | </form> | 312 | </form> |
| 313 | } | 313 | } |
| 314 | - <details class="security-action" open=(email_open)> | 314 | + <details class="row-action" open=(email_open)> |
| 315 | <summary>(t(lang, Key::ChangeAction))</summary> | 315 | <summary>(t(lang, Key::ChangeAction))</summary> |
| 316 | - <div class="security-panel"> | 316 | + <div class="row-panel"> |
| 317 | if let Some(message) = email_error { | 317 | if let Some(message) = email_error { |
| 318 | alert(message: message.as_str()) | 318 | alert(message: message.as_str()) |
| 319 | } | 319 | } |
| @@ -332,25 +332,25 @@ async fn security_body(page: SecurityPage) -> Result<impl View> { | |||
| 332 | </div> | 332 | </div> |
| 333 | </details> | 333 | </details> |
| 334 | </div> | 334 | </div> |
| 335 | - <div class="security-block"> | 335 | + <div class="rows-block"> |
| 336 | - <div class="security-row"> | 336 | + <div class="row-line"> |
| 337 | - <svg class="security-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l8 3v6c0 4.5-3.4 8.3-8 9-4.6-.7-8-4.5-8-9V6z"/><path d="M9 12l2 2 4-4"/></svg> | 337 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l8 3v6c0 4.5-3.4 8.3-8 9-4.6-.7-8-4.5-8-9V6z"/><path d="M9 12l2 2 4-4"/></svg> |
| 338 | - <div class="security-row-main"> | 338 | + <div class="row-main"> |
| 339 | - <h2 class="security-row-title"> | 339 | + <h2 class="row-title"> |
| 340 | <span>(t(lang, Key::TwoFactorAuth))</span> | 340 | <span>(t(lang, Key::TwoFactorAuth))</span> |
| 341 | <span class=(two_factor_pill_class)>(two_factor_pill_text)</span> | 341 | <span class=(two_factor_pill_class)>(two_factor_pill_text)</span> |
| 342 | </h2> | 342 | </h2> |
| 343 | if !two_factor_on && pending.is_none() { | 343 | if !two_factor_on && pending.is_none() { |
| 344 | - <p class="security-row-status">(t(lang, Key::TwoFactorOffIntro))</p> | 344 | + <p class="row-status">(t(lang, Key::TwoFactorOffIntro))</p> |
| 345 | } | 345 | } |
| 346 | if pending.is_some() { | 346 | if pending.is_some() { |
| 347 | - <p class="security-row-status">(t(lang, Key::SetupInProgress))</p> | 347 | + <p class="row-status">(t(lang, Key::SetupInProgress))</p> |
| 348 | } | 348 | } |
| 349 | </div> | 349 | </div> |
| 350 | if two_factor_on { | 350 | if two_factor_on { |
| 351 | - <details class="security-action danger" open=(disable_open)> | 351 | + <details class="row-action danger" open=(disable_open)> |
| 352 | <summary>(t(lang, Key::TurnOffTwoFactorButton))</summary> | 352 | <summary>(t(lang, Key::TurnOffTwoFactorButton))</summary> |
| 353 | - <div class="security-panel"> | 353 | + <div class="row-panel"> |
| 354 | if let Some(message) = disable_error { | 354 | if let Some(message) = disable_error { |
| 355 | alert(message: message.as_str()) | 355 | alert(message: message.as_str()) |
| 356 | } | 356 | } |
| @@ -369,7 +369,7 @@ async fn security_body(page: SecurityPage) -> Result<impl View> { | |||
| 369 | </div> | 369 | </div> |
| 370 | </details> | 370 | </details> |
| 371 | } else if pending.is_none() { | 371 | } else if pending.is_none() { |
| 372 | - <form data-hard="true" method="post" action="/settings/security/2fa/enable" class="security-inline-form"> | 372 | + <form data-hard="true" method="post" action="/settings/security/2fa/enable" class="row-form"> |
| 373 | <input type="hidden" name="csrf" value=(csrf.as_str())> | 373 | <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 374 | <button type="submit" class="primary">(t(lang, Key::SetUpAction))</button> | 374 | <button type="submit" class="primary">(t(lang, Key::SetUpAction))</button> |
| 375 | </form> | 375 | </form> |
| @@ -377,25 +377,25 @@ async fn security_body(page: SecurityPage) -> Result<impl View> { | |||
| 377 | </div> | 377 | </div> |
| 378 | if let Some(device) = two_factor { | 378 | if let Some(device) = two_factor { |
| 379 | <ul class="security-devices"> | 379 | <ul class="security-devices"> |
| 380 | - <li class="security-row security-device"> | 380 | + <li class="row-line security-device"> |
| 381 | - <svg class="security-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="7" y="3" width="10" height="18" rx="2"/><path d="M11 18h2"/></svg> | 381 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="7" y="3" width="10" height="18" rx="2"/><path d="M11 18h2"/></svg> |
| 382 | - <div class="security-row-main"> | 382 | + <div class="row-main"> |
| 383 | - <p class="security-row-title">(device.name.as_str())</p> | 383 | + <p class="row-title">(device.name.as_str())</p> |
| 384 | - <p class="security-row-status">added_status(lang: lang, added: device.added.as_deref(), used: device.used.as_deref())</p> | 384 | + <p class="row-status">added_status(lang: lang, added: device.added.as_deref(), used: device.used.as_deref())</p> |
| 385 | </div> | 385 | </div> |
| 386 | </li> | 386 | </li> |
| 387 | - <li class="security-row security-device"> | 387 | + <li class="row-line security-device"> |
| 388 | - <svg class="security-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="8" cy="15" r="4"/><path d="M11 12l9-9M17 6l3 3M14 9l3 3"/></svg> | 388 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="8" cy="15" r="4"/><path d="M11 12l9-9M17 6l3 3M14 9l3 3"/></svg> |
| 389 | - <div class="security-row-main"> | 389 | + <div class="row-main"> |
| 390 | - <p class="security-row-title">(t(lang, Key::RecoveryCodes))</p> | 390 | + <p class="row-title">(t(lang, Key::RecoveryCodes))</p> |
| 391 | <p class=(codes_class)>(device.codes_line.as_str())</p> | 391 | <p class=(codes_class)>(device.codes_line.as_str())</p> |
| 392 | if device.codes_low { | 392 | if device.codes_low { |
| 393 | - <p class="security-row-status warn">(t(lang, Key::CodesRunningLow))</p> | 393 | + <p class="row-status warn">(t(lang, Key::CodesRunningLow))</p> |
| 394 | } | 394 | } |
| 395 | </div> | 395 | </div> |
| 396 | - <details class="security-action" open=(regenerate_open)> | 396 | + <details class="row-action" open=(regenerate_open)> |
| 397 | <summary>(t(lang, Key::RegenerateCodes))</summary> | 397 | <summary>(t(lang, Key::RegenerateCodes))</summary> |
| 398 | - <div class="security-panel"> | 398 | + <div class="row-panel"> |
| 399 | if let Some(message) = regenerate_error { | 399 | if let Some(message) = regenerate_error { |
| 400 | alert(message: message.as_str()) | 400 | alert(message: message.as_str()) |
| 401 | } | 401 | } |
| @@ -414,7 +414,7 @@ async fn security_body(page: SecurityPage) -> Result<impl View> { | |||
| 414 | </ul> | 414 | </ul> |
| 415 | } | 415 | } |
| 416 | if let Some((secret, uri)) = pending { | 416 | if let Some((secret, uri)) = pending { |
| 417 | - <div class="security-panel security-setup"> | 417 | + <div class="row-panel security-setup"> |
| 418 | <p>(t(lang, Key::TwoFactorPendingIntro))</p> | 418 | <p>(t(lang, Key::TwoFactorPendingIntro))</p> |
| 419 | <p>(t(lang, Key::SecretPrefix)) <code>(secret)</code></p> | 419 | <p>(t(lang, Key::SecretPrefix)) <code>(secret)</code></p> |
| 420 | <p>(t(lang, Key::LinkPrefix)) <code>(uri)</code></p> | 420 | <p>(t(lang, Key::LinkPrefix)) <code>(uri)</code></p> |
| @@ -439,22 +439,22 @@ async fn security_body(page: SecurityPage) -> Result<impl View> { | |||
| 439 | </div> | 439 | </div> |
| 440 | passkeys_panel(lang: lang, csrf: csrf.as_str(), panel: passkeys) | 440 | passkeys_panel(lang: lang, csrf: csrf.as_str(), panel: passkeys) |
| 441 | </section> | 441 | </section> |
| 442 | - <section class="card security-card security-danger"> | 442 | + <section class="card rows-pane security-danger"> |
| 443 | <p class="security-danger-label">(t(lang, Key::DangerZone))</p> | 443 | <p class="security-danger-label">(t(lang, Key::DangerZone))</p> |
| 444 | - <div class="security-row"> | 444 | + <div class="row-line"> |
| 445 | - <svg class="security-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4l9 16H3z"/><path d="M12 10v4M12 17v.5"/></svg> | 445 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4l9 16H3z"/><path d="M12 10v4M12 17v.5"/></svg> |
| 446 | - <div class="security-row-main"> | 446 | + <div class="row-main"> |
| 447 | - <h2 class="security-row-title">(t(lang, Key::DeleteAccount))</h2> | 447 | + <h2 class="row-title">(t(lang, Key::DeleteAccount))</h2> |
| 448 | if delete_blocked { | 448 | if delete_blocked { |
| 449 | - <p class="security-row-status">(t(lang, Key::TransferOrDeleteRepos))</p> | 449 | + <p class="row-status">(t(lang, Key::TransferOrDeleteRepos))</p> |
| 450 | } else { | 450 | } else { |
| 451 | - <p class="security-row-status">(t(lang, Key::DeleteAccountIntro))</p> | 451 | + <p class="row-status">(t(lang, Key::DeleteAccountIntro))</p> |
| 452 | } | 452 | } |
| 453 | </div> | 453 | </div> |
| 454 | if !delete_blocked { | 454 | if !delete_blocked { |
| 455 | - <details class="security-action danger" open=(delete_open)> | 455 | + <details class="row-action danger" open=(delete_open)> |
| 456 | <summary>(t(lang, Key::DeleteAccount))</summary> | 456 | <summary>(t(lang, Key::DeleteAccount))</summary> |
| 457 | - <div class="security-panel"> | 457 | + <div class="row-panel"> |
| 458 | if let Some(message) = delete_error { | 458 | if let Some(message) = delete_error { |
| 459 | alert(message: message.as_str()) | 459 | alert(message: message.as_str()) |
| 460 | } | 460 | } |
| @@ -1689,12 +1689,12 @@ mod tests { | |||
| 1689 | .await; | 1689 | .await; |
| 1690 | assert!(reply.body.contains("Current password is incorrect.")); | 1690 | assert!(reply.body.contains("Current password is incorrect.")); |
| 1691 | assert!( | 1691 | assert!( |
| 1692 | - reply.body.contains("security-action danger\" open"), | 1692 | + reply.body.contains("row-action danger\" open"), |
| 1693 | "turn-off panel should stay open: {}", | 1693 | "turn-off panel should stay open: {}", |
| 1694 | reply.body | 1694 | reply.body |
| 1695 | ); | 1695 | ); |
| 1696 | assert!( | 1696 | assert!( |
| 1697 | - !reply.body.contains("security-action\" open"), | 1697 | + !reply.body.contains("row-action\" open"), |
| 1698 | "only the turn-off panel should be open" | 1698 | "only the turn-off panel should be open" |
| 1699 | ); | 1699 | ); |
| 1700 | 1700 | ||
crates/forge-web/src/pages/settings_sessions.rsmodified+19 -20
| @@ -66,24 +66,16 @@ async fn sessions_view( | |||
| 66 | </form> | 66 | </form> |
| 67 | } | 67 | } |
| 68 | </section> | 68 | </section> |
| 69 | - <section class="card fit-pane session-pane"> | 69 | + <section class="card rows-pane session-pane"> |
| 70 | - <ul class="item-list"> | 70 | + for session in sessions.into_iter() { |
| 71 | - for session in sessions.into_iter() { | 71 | + <div class="row-line"> |
| 72 | - <li class="item"> | 72 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/></svg> |
| 73 | - <div class="item-main"> | 73 | + <div class="row-main"> |
| 74 | - <a href=(format!("/settings/sessions/{}", session.id)) data-dialog=(format!("session-{}", session.id))><strong>(session_label(lang, &session))</strong></a> | 74 | + <strong class="row-name"><a href=(format!("/settings/sessions/{}", session.id)) data-dialog=(format!("session-{}", session.id))>(session_label(lang, &session))</a></strong> |
| 75 | - <span class="muted small">(i18n::dated_label(lang, Key::SignedIn)) " " rel_time(lang: lang, stamp: session.created_at.as_str()) " · " (i18n::dated_label(lang, Key::LastSeen)) " " rel_time(lang: lang, stamp: session.last_seen.as_str()) " · " (i18n::dated_label(lang, Key::ExpiresLabel)) " " rel_time(lang: lang, stamp: session.expires_at.as_str()) (address_text(&session))</span> | 75 | + if session.id == current_id { |
| 76 | - if session.id == current_id { | 76 | + <span class="badge public">(t(lang, Key::ThisSession))</span> |
| 77 | - <span class="badge public">(t(lang, Key::ThisSession))</span> | ||
| 78 | - } | ||
| 79 | - </div> | ||
| 80 | - if session.id != current_id { | ||
| 81 | - <form method="post" action="/settings/sessions/revoke"> | ||
| 82 | - <input type="hidden" name="csrf" value=(csrf)> | ||
| 83 | - <input type="hidden" name="id" value=(session.id.clone())> | ||
| 84 | - <button type="submit" class="danger">(t(lang, Key::Revoke))</button> | ||
| 85 | - </form> | ||
| 86 | } | 77 | } |
| 78 | + <p class="row-status"><span class="muted small">(i18n::dated_label(lang, Key::SignedIn)) " " rel_time(lang: lang, stamp: session.created_at.as_str()) " · " (i18n::dated_label(lang, Key::LastSeen)) " " rel_time(lang: lang, stamp: session.last_seen.as_str()) " · " (i18n::dated_label(lang, Key::ExpiresLabel)) " " rel_time(lang: lang, stamp: session.expires_at.as_str()) (address_text(&session))</span></p> | ||
| 87 | <dialog class="session-dialog" id=(format!("session-{}", session.id)) aria-labelledby=(format!("session-{}-title", session.id))> | 79 | <dialog class="session-dialog" id=(format!("session-{}", session.id)) aria-labelledby=(format!("session-{}-title", session.id))> |
| 88 | <div class="session-dialog-head"> | 80 | <div class="session-dialog-head"> |
| 89 | <h2 id=(format!("session-{}-title", session.id))>(session_label(lang, &session))</h2> | 81 | <h2 id=(format!("session-{}-title", session.id))>(session_label(lang, &session))</h2> |
| @@ -93,9 +85,16 @@ async fn sessions_view( | |||
| 93 | </div> | 85 | </div> |
| 94 | session_details(lang: lang, csrf: csrf, session: session.clone(), current: session.id == current_id) | 86 | session_details(lang: lang, csrf: csrf, session: session.clone(), current: session.id == current_id) |
| 95 | </dialog> | 87 | </dialog> |
| 96 | - </li> | 88 | + </div> |
| 97 | - } | 89 | + if session.id != current_id { |
| 98 | - </ul> | 90 | + <form method="post" action="/settings/sessions/revoke" class="row-form"> |
| 91 | + <input type="hidden" name="csrf" value=(csrf)> | ||
| 92 | + <input type="hidden" name="id" value=(session.id.clone())> | ||
| 93 | + <button type="submit" class="danger">(t(lang, Key::Revoke))</button> | ||
| 94 | + </form> | ||
| 95 | + } | ||
| 96 | + </div> | ||
| 97 | + } | ||
| 99 | </section> | 98 | </section> |
| 100 | }) | 99 | }) |
| 101 | } | 100 | } |
crates/forge-web/src/pages/settings_tokens.rsmodified+50 -45
| @@ -24,7 +24,7 @@ use crate::i18n::releases_ci::{self as rc, K as RC}; | |||
| 24 | use crate::i18n::{self, Key, Lang, t, token_name_length}; | 24 | use crate::i18n::{self, Key, Lang, t, token_name_length}; |
| 25 | use crate::pages::admin_runners::confirm_post; | 25 | use crate::pages::admin_runners::confirm_post; |
| 26 | use crate::state::AppState; | 26 | use crate::state::AppState; |
| 27 | -use crate::views::{alert, empty_state, rel_time, rel_time_or_never, shell}; | 27 | +use crate::views::{alert, rel_time, rel_time_or_never, shell}; |
| 28 | 28 | ||
| 29 | /// Scopes are fixed to `repo` for M1. | 29 | /// Scopes are fixed to `repo` for M1. |
| 30 | const SCOPES: &[&str] = &["repo"]; | 30 | const SCOPES: &[&str] = &["repo"]; |
| @@ -100,52 +100,57 @@ async fn tokens_view( | |||
| 100 | <p class="muted small">(t(lang, Key::UseAsPassword))</p> | 100 | <p class="muted small">(t(lang, Key::UseAsPassword))</p> |
| 101 | </section> | 101 | </section> |
| 102 | } | 102 | } |
| 103 | - <section class="card fit-pane"> | 103 | + <section class="card rows-pane"> |
| 104 | - if tokens.is_empty() { | 104 | + <div class="row-line"> |
| 105 | - empty_state(title: t(lang, Key::NoAccessTokens), | 105 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> |
| 106 | - <a class="button" href="#add-token">(t(lang, Key::NewToken))</a>) | 106 | + <div class="row-main"> |
| 107 | - } else { | 107 | + <h2 class="row-title">(t(lang, Key::NewToken))</h2> |
| 108 | - <ul class="item-list"> | 108 | + if tokens.is_empty() { |
| 109 | - for token in tokens.into_iter() { | 109 | + <p class="row-status">(t(lang, Key::NoAccessTokens))</p> |
| 110 | - <li class="item"> | ||
| 111 | - <div class="item-main"> | ||
| 112 | - <strong>(token.name.clone())</strong> | ||
| 113 | - <span class="muted small">(i18n::dated_label(lang, Key::Created)) " " rel_time(lang: lang, stamp: token.created_at.as_str()) " · " (i18n::dated_label(lang, Key::LastUsed)) " " rel_time_or_never(lang: lang, stamp: token.last_used_at.as_deref()) " · " (i18n::dated_label(lang, Key::ExpiresLabel)) " " rel_time_or_never(lang: lang, stamp: token.expires_at.as_deref())</span> | ||
| 114 | - </div> | ||
| 115 | - confirm_post(lang: lang, csrf: csrf, action: "/settings/tokens/delete", label: t(lang, Key::Delete), message: delete_message(lang, token.name.as_str()), confirm: delete_confirm(lang), danger: true, fields: vec![("id", token.id.clone())]) | ||
| 116 | - </li> | ||
| 117 | } | 110 | } |
| 118 | - </ul> | 111 | + </div> |
| 119 | - } | 112 | + <details class="row-action" id="add-token" open=(error.is_some())> |
| 120 | - </section> | 113 | + <summary>(t(lang, Key::CreateToken))</summary> |
| 121 | - <section class="card" id="add-token"> | 114 | + <div class="row-panel"> |
| 122 | - <h2>(t(lang, Key::NewToken))</h2> | 115 | + if let Some(message) = error { |
| 123 | - if let Some(message) = error { | 116 | + alert(message: message.as_str()) |
| 124 | - alert(message: message.as_str()) | 117 | + } |
| 118 | + <form method="post" action="/settings/tokens" class="stack"> | ||
| 119 | + <input type="hidden" name="csrf" value=(csrf)> | ||
| 120 | + <label> | ||
| 121 | + <span>(t(lang, Key::Name))</span> | ||
| 122 | + <input type="text" name="name" maxlength="64" required=(true) autocomplete="off"> | ||
| 123 | + </label> | ||
| 124 | + <label> | ||
| 125 | + <span>(t(lang, Key::Expires))</span> | ||
| 126 | + <select name="expires"> | ||
| 127 | + <option value="30">(t(lang, Key::ExpiresIn30))</option> | ||
| 128 | + <option value="90" selected=(true)>(t(lang, Key::ExpiresIn90))</option> | ||
| 129 | + <option value="365">(t(lang, Key::ExpiresIn365))</option> | ||
| 130 | + <option value="never">(t(lang, Key::ExpiresNever))</option> | ||
| 131 | + </select> | ||
| 132 | + </label> | ||
| 133 | + <label class="checkbox"> | ||
| 134 | + <input type="checkbox" name="packages" value="on"> | ||
| 135 | + <span>(pk::t(lang, PK::ScopePackages))</span> | ||
| 136 | + </label> | ||
| 137 | + <p class="muted small">(pk::t(lang, PK::ScopePackagesHelp))</p> | ||
| 138 | + <p class="muted small">(t(lang, Key::ScopeNote))</p> | ||
| 139 | + <button type="submit" class="primary">(t(lang, Key::CreateToken))</button> | ||
| 140 | + </form> | ||
| 141 | + </div> | ||
| 142 | + </details> | ||
| 143 | + </div> | ||
| 144 | + for token in tokens.into_iter() { | ||
| 145 | + <div class="row-line"> | ||
| 146 | + <svg class="row-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="7" width="18" height="10" rx="2"/><path d="M8 12h.01M12 12h.01M16 12h.01"/></svg> | ||
| 147 | + <div class="row-main"> | ||
| 148 | + <strong class="row-name">(token.name.clone())</strong> | ||
| 149 | + <p class="row-status">(i18n::dated_label(lang, Key::Created)) " " rel_time(lang: lang, stamp: token.created_at.as_str()) " · " (i18n::dated_label(lang, Key::LastUsed)) " " rel_time_or_never(lang: lang, stamp: token.last_used_at.as_deref()) " · " (i18n::dated_label(lang, Key::ExpiresLabel)) " " rel_time_or_never(lang: lang, stamp: token.expires_at.as_deref())</p> | ||
| 150 | + </div> | ||
| 151 | + confirm_post(lang: lang, csrf: csrf, action: "/settings/tokens/delete", label: t(lang, Key::Delete), message: delete_message(lang, token.name.as_str()), confirm: delete_confirm(lang), danger: true, fields: vec![("id", token.id.clone())]) | ||
| 152 | + </div> | ||
| 125 | } | 153 | } |
| 126 | - <form method="post" action="/settings/tokens" class="stack"> | ||
| 127 | - <input type="hidden" name="csrf" value=(csrf)> | ||
| 128 | - <label> | ||
| 129 | - <span>(t(lang, Key::Name))</span> | ||
| 130 | - <input type="text" name="name" maxlength="64" required=(true) autocomplete="off"> | ||
| 131 | - </label> | ||
| 132 | - <label> | ||
| 133 | - <span>(t(lang, Key::Expires))</span> | ||
| 134 | - <select name="expires"> | ||
| 135 | - <option value="30">(t(lang, Key::ExpiresIn30))</option> | ||
| 136 | - <option value="90" selected=(true)>(t(lang, Key::ExpiresIn90))</option> | ||
| 137 | - <option value="365">(t(lang, Key::ExpiresIn365))</option> | ||
| 138 | - <option value="never">(t(lang, Key::ExpiresNever))</option> | ||
| 139 | - </select> | ||
| 140 | - </label> | ||
| 141 | - <label class="checkbox"> | ||
| 142 | - <input type="checkbox" name="packages" value="on"> | ||
| 143 | - <span>(pk::t(lang, PK::ScopePackages))</span> | ||
| 144 | - </label> | ||
| 145 | - <p class="muted small">(pk::t(lang, PK::ScopePackagesHelp))</p> | ||
| 146 | - <p class="muted small">(t(lang, Key::ScopeNote))</p> | ||
| 147 | - <button type="submit" class="primary">(t(lang, Key::CreateToken))</button> | ||
| 148 | - </form> | ||
| 149 | </section> | 154 | </section> |
| 150 | }) | 155 | }) |
| 151 | } | 156 | } |
crates/forge-web/src/pages/wiki.rsmodified+13 -10
| @@ -685,18 +685,21 @@ async fn wiki_settings_body( | |||
| 685 | enabled: bool, | 685 | enabled: bool, |
| 686 | ) -> Result<impl View> { | 686 | ) -> Result<impl View> { |
| 687 | Ok(view! { | 687 | Ok(view! { |
| 688 | - <section class="card"> | 688 | + <form method="post" action=(action.as_str()) class="card rows-pane wiki-form"> |
| 689 | - <h2>(g::t(lang, K::WikiSettings))</h2> | 689 | + <input type="hidden" name="csrf" value=(csrf.as_str())> |
| 690 | - <form method="post" action=(action.as_str()) class="stack wiki-form"> | 690 | + <label class="row-line row-field"> |
| 691 | - <input type="hidden" name="csrf" value=(csrf.as_str())> | 691 | + <span class="row-main"> |
| 692 | - <label class="checkbox"> | 692 | + <span class="row-title">(g::t(lang, K::EnableWiki))</span> |
| 693 | + <span class="row-status">(g::t(lang, K::WikiDisabledHint))</span> | ||
| 694 | + </span> | ||
| 695 | + <span class="row-control"> | ||
| 693 | <input type="checkbox" name="enabled" value="1" checked=(enabled)> | 696 | <input type="checkbox" name="enabled" value="1" checked=(enabled)> |
| 694 | - <span>(g::t(lang, K::EnableWiki))</span> | 697 | + </span> |
| 695 | - </label> | 698 | + </label> |
| 696 | - <small class="muted">(g::t(lang, K::WikiDisabledHint))</small> | 699 | + <div class="row-foot"> |
| 697 | <button type="submit" class="primary">(g::t(lang, K::Save))</button> | 700 | <button type="submit" class="primary">(g::t(lang, K::Save))</button> |
| 698 | - </form> | 701 | + </div> |
| 699 | - </section> | 702 | + </form> |
| 700 | }) | 703 | }) |
| 701 | } | 704 | } |
| 702 | 705 | ||
style/_account_admin.scssmodified+0 -125
| @@ -214,28 +214,6 @@ dialog.session-dialog { | |||
| 214 | } | 214 | } |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | -.user-actions, | ||
| 218 | -.user-danger { | ||
| 219 | - h2 { | ||
| 220 | - margin: 0 0 4px; | ||
| 221 | - font-size: 0.9375rem; | ||
| 222 | - } | ||
| 223 | -} | ||
| 224 | - | ||
| 225 | -.user-danger { | ||
| 226 | - border-color: var(--danger); | ||
| 227 | - | ||
| 228 | - h2 { | ||
| 229 | - color: var(--danger); | ||
| 230 | - } | ||
| 231 | -} | ||
| 232 | - | ||
| 233 | -.action-list { | ||
| 234 | - list-style: none; | ||
| 235 | - margin: 0; | ||
| 236 | - padding: 0; | ||
| 237 | -} | ||
| 238 | - | ||
| 239 | .action-row { | 217 | .action-row { |
| 240 | display: grid; | 218 | display: grid; |
| 241 | grid-template-columns: minmax(0, 1fr) auto; | 219 | grid-template-columns: minmax(0, 1fr) auto; |
| @@ -254,10 +232,6 @@ dialog.session-dialog { | |||
| 254 | } | 232 | } |
| 255 | } | 233 | } |
| 256 | 234 | ||
| 257 | -.action-list > .action-row + .action-row { | ||
| 258 | - border-top: 1px solid var(--border); | ||
| 259 | -} | ||
| 260 | - | ||
| 261 | .action-text { | 235 | .action-text { |
| 262 | min-width: 0; | 236 | min-width: 0; |
| 263 | } | 237 | } |
| @@ -407,16 +381,6 @@ dialog.session-dialog { | |||
| 407 | } | 381 | } |
| 408 | } | 382 | } |
| 409 | 383 | ||
| 410 | -.health-storage, | ||
| 411 | -.health-status { | ||
| 412 | - margin-bottom: 16px; | ||
| 413 | - | ||
| 414 | - h2 { | ||
| 415 | - margin: 0 0 12px; | ||
| 416 | - font-size: 0.9375rem; | ||
| 417 | - } | ||
| 418 | -} | ||
| 419 | - | ||
| 420 | .health-usage-head { | 384 | .health-usage-head { |
| 421 | display: flex; | 385 | display: flex; |
| 422 | flex-wrap: wrap; | 386 | flex-wrap: wrap; |
| @@ -427,100 +391,11 @@ dialog.session-dialog { | |||
| 427 | } | 391 | } |
| 428 | 392 | ||
| 429 | // The data directory's usage bar: 8px tall, the fill turns red at 90%. | 393 | // The data directory's usage bar: 8px tall, the fill turns red at 90%. |
| 430 | -.health-storage .meter { | ||
| 431 | - display: block; | ||
| 432 | - width: 100%; | ||
| 433 | - height: 8px; | ||
| 434 | - appearance: none; | ||
| 435 | - border: 0; | ||
| 436 | - border-radius: 4px; | ||
| 437 | - background: var(--surface-2); | ||
| 438 | - overflow: hidden; | ||
| 439 | - | ||
| 440 | - &::-webkit-progress-bar { | ||
| 441 | - background: var(--surface-2); | ||
| 442 | - } | ||
| 443 | - | ||
| 444 | - &::-webkit-progress-value { | ||
| 445 | - background: var(--text-2); | ||
| 446 | - } | ||
| 447 | - | ||
| 448 | - &::-moz-progress-bar { | ||
| 449 | - background: var(--text-2); | ||
| 450 | - } | ||
| 451 | - | ||
| 452 | - &.bad::-webkit-progress-value { | ||
| 453 | - background: var(--bad); | ||
| 454 | - } | ||
| 455 | - | ||
| 456 | - &.bad::-moz-progress-bar { | ||
| 457 | - background: var(--bad); | ||
| 458 | - } | ||
| 459 | -} | ||
| 460 | - | ||
| 461 | .health-path { | 394 | .health-path { |
| 462 | margin-top: 4px; | 395 | margin-top: 4px; |
| 463 | overflow-wrap: anywhere; | 396 | overflow-wrap: anywhere; |
| 464 | } | 397 | } |
| 465 | 398 | ||
| 466 | -.health-facts { | ||
| 467 | - display: grid; | ||
| 468 | - grid-template-columns: repeat(3, minmax(0, 1fr)); | ||
| 469 | - gap: 16px; | ||
| 470 | - margin-top: 16px; | ||
| 471 | - | ||
| 472 | - @media (max-width: 640px) { | ||
| 473 | - grid-template-columns: minmax(0, 1fr); | ||
| 474 | - } | ||
| 475 | -} | ||
| 476 | - | ||
| 477 | -.health-fact-value { | ||
| 478 | - margin-top: 2px; | ||
| 479 | - font-size: 0.9375rem; | ||
| 480 | - font-weight: 600; | ||
| 481 | - overflow-wrap: anywhere; | ||
| 482 | - | ||
| 483 | - &.bad { | ||
| 484 | - color: var(--bad); | ||
| 485 | - } | ||
| 486 | - | ||
| 487 | - &.muted { | ||
| 488 | - font-weight: 400; | ||
| 489 | - } | ||
| 490 | -} | ||
| 491 | - | ||
| 492 | -.health-rows { | ||
| 493 | - list-style: none; | ||
| 494 | - margin: 0; | ||
| 495 | - padding: 0; | ||
| 496 | -} | ||
| 497 | - | ||
| 498 | -.health-row { | ||
| 499 | - display: grid; | ||
| 500 | - grid-template-columns: 16px minmax(0, 1fr) auto; | ||
| 501 | - align-items: center; | ||
| 502 | - gap: 8px; | ||
| 503 | - padding: 10px 0; | ||
| 504 | - | ||
| 505 | - & + .health-row { | ||
| 506 | - border-top: 1px solid var(--border); | ||
| 507 | - } | ||
| 508 | - | ||
| 509 | - .health-dot { | ||
| 510 | - justify-self: center; | ||
| 511 | - } | ||
| 512 | -} | ||
| 513 | - | ||
| 514 | -.health-row-value { | ||
| 515 | - text-align: right; | ||
| 516 | - font-variant-numeric: tabular-nums; | ||
| 517 | - overflow-wrap: anywhere; | ||
| 518 | - | ||
| 519 | - &.muted { | ||
| 520 | - color: var(--muted); | ||
| 521 | - } | ||
| 522 | -} | ||
| 523 | - | ||
| 524 | .health-meta { | 399 | .health-meta { |
| 525 | margin: 0 0 16px; | 400 | margin: 0 0 16px; |
| 526 | } | 401 | } |
style/_alive_settings.scssmodified+0 -6
| @@ -237,9 +237,3 @@ | |||
| 237 | white-space: nowrap; | 237 | white-space: nowrap; |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | -// The profile avatar's Edit pill sits inside the circle's bottom right, clear of the edge. | ||
| 241 | -.profile-settings-avatar-menu { | ||
| 242 | - left: auto; | ||
| 243 | - right: 30px; | ||
| 244 | - bottom: 30px; | ||
| 245 | -} | ||
style/_appearance.scssmodified+0 -32
| @@ -2,29 +2,6 @@ | |||
| 2 | // the colours. From 1100px: general controls and the sound card on the left, colours on the right, | 2 | // the colours. From 1100px: general controls and the sound card on the left, colours on the right, |
| 3 | // so the page fits one screen. The form is `display: contents` so its two blocks join this grid. | 3 | // so the page fits one screen. The form is `display: contents` so its two blocks join this grid. |
| 4 | // The sound card sits outside the form: its Play buttons must not be inside it. | 4 | // The sound card sits outside the form: its Play buttons must not be inside it. |
| 5 | -.appearance-page { | ||
| 6 | - display: flex; | ||
| 7 | - flex-direction: column; | ||
| 8 | - gap: 16px; | ||
| 9 | - min-width: 0; | ||
| 10 | - | ||
| 11 | - > form.appearance { | ||
| 12 | - display: contents; | ||
| 13 | - } | ||
| 14 | - | ||
| 15 | - .appearance-top { | ||
| 16 | - order: 1; | ||
| 17 | - } | ||
| 18 | - | ||
| 19 | - .sound-card { | ||
| 20 | - order: 2; | ||
| 21 | - } | ||
| 22 | - | ||
| 23 | - .colour-group { | ||
| 24 | - order: 3; | ||
| 25 | - } | ||
| 26 | -} | ||
| 27 | - | ||
| 28 | @media (min-width: 1100px) { | 5 | @media (min-width: 1100px) { |
| 29 | .appearance-page { | 6 | .appearance-page { |
| 30 | display: grid; | 7 | display: grid; |
| @@ -51,15 +28,6 @@ | |||
| 51 | } | 28 | } |
| 52 | 29 | ||
| 53 | // Settings: the sound card. The density radios use the sidebar side's segmented pill. | 30 | // Settings: the sound card. The density radios use the sidebar side's segmented pill. |
| 54 | -.sound-card { | ||
| 55 | - display: grid; | ||
| 56 | - gap: 8px; | ||
| 57 | - | ||
| 58 | - > p { | ||
| 59 | - margin: 0; | ||
| 60 | - } | ||
| 61 | -} | ||
| 62 | - | ||
| 63 | // A sound-row's name and its quiet note sit on one line, with a gap rather than a typed space. | 31 | // A sound-row's name and its quiet note sit on one line, with a gap rather than a typed space. |
| 64 | .sound-name { | 32 | .sound-name { |
| 65 | display: flex; | 33 | display: flex; |
style/_canvas_account.scssmodified+1 -1
| @@ -120,7 +120,7 @@ | |||
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | // Security danger zone: the repo names line up with the body text beside the icon. | 122 | // Security danger zone: the repo names line up with the body text beside the icon. |
| 123 | -.card.security-danger .security-row > .security-repos { | 123 | +.card.security-danger .row-line > .security-repos { |
| 124 | padding-left: 36px; | 124 | padding-left: 36px; |
| 125 | } | 125 | } |
| 126 | 126 | ||
style/_canvas_detail.scssmodified+0 -90
| @@ -81,89 +81,6 @@ | |||
| 81 | 81 | ||
| 82 | // Labels: one line each, columns line up down the pane. Edit opens under its row and holds Delete, | 82 | // Labels: one line each, columns line up down the pane. Edit opens under its row and holds Delete, |
| 83 | // so a pane of labels is not a pane of red buttons. | 83 | // so a pane of labels is not a pane of red buttons. |
| 84 | -.label-list .label-row { | ||
| 85 | - position: relative; | ||
| 86 | - display: grid; | ||
| 87 | - grid-template-columns: 220px minmax(0, 1fr) 80px 56px; | ||
| 88 | - grid-template-rows: 36px auto; | ||
| 89 | - column-gap: 16px; | ||
| 90 | - align-items: center; | ||
| 91 | - padding: 0; | ||
| 92 | - | ||
| 93 | - > .label-chip { | ||
| 94 | - justify-self: start; | ||
| 95 | - max-width: 100%; | ||
| 96 | - overflow: hidden; | ||
| 97 | - text-overflow: ellipsis; | ||
| 98 | - white-space: nowrap; | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - > .label-desc { | ||
| 102 | - margin: 0; | ||
| 103 | - min-width: 0; | ||
| 104 | - overflow: hidden; | ||
| 105 | - text-overflow: ellipsis; | ||
| 106 | - white-space: nowrap; | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - > .label-open { | ||
| 110 | - text-align: right; | ||
| 111 | - color: var(--text-2); | ||
| 112 | - white-space: nowrap; | ||
| 113 | - } | ||
| 114 | - | ||
| 115 | - > .label-chip, | ||
| 116 | - > .label-desc, | ||
| 117 | - > .label-open { | ||
| 118 | - grid-row: 1; | ||
| 119 | - position: relative; | ||
| 120 | - z-index: 1; | ||
| 121 | - } | ||
| 122 | - | ||
| 123 | - > .label-chip { | ||
| 124 | - grid-column: 1; | ||
| 125 | - } | ||
| 126 | - | ||
| 127 | - > .label-desc { | ||
| 128 | - grid-column: 2; | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - > .label-open { | ||
| 132 | - grid-column: 3; | ||
| 133 | - } | ||
| 134 | - | ||
| 135 | - > .label-edit { | ||
| 136 | - grid-column: 1 / -1; | ||
| 137 | - grid-row: 1 / span 2; | ||
| 138 | - align-self: start; | ||
| 139 | - min-width: 0; | ||
| 140 | - | ||
| 141 | - > summary { | ||
| 142 | - width: fit-content; | ||
| 143 | - margin-left: auto; | ||
| 144 | - line-height: 36px; | ||
| 145 | - font-size: 13px; | ||
| 146 | - color: var(--text-2); | ||
| 147 | - cursor: pointer; | ||
| 148 | - list-style: none; | ||
| 149 | - position: relative; | ||
| 150 | - z-index: 1; | ||
| 151 | - | ||
| 152 | - &::-webkit-details-marker { | ||
| 153 | - display: none; | ||
| 154 | - } | ||
| 155 | - | ||
| 156 | - &:hover { | ||
| 157 | - color: var(--text); | ||
| 158 | - } | ||
| 159 | - } | ||
| 160 | - | ||
| 161 | - &[open] > summary { | ||
| 162 | - color: var(--text); | ||
| 163 | - } | ||
| 164 | - } | ||
| 165 | -} | ||
| 166 | - | ||
| 167 | .label-edit-body { | 84 | .label-edit-body { |
| 168 | display: flex; | 85 | display: flex; |
| 169 | align-items: flex-end; | 86 | align-items: flex-end; |
| @@ -230,13 +147,6 @@ | |||
| 230 | padding-bottom: 20px; | 147 | padding-bottom: 20px; |
| 231 | } | 148 | } |
| 232 | 149 | ||
| 233 | -@media (min-width: 900px) { | ||
| 234 | - .srv-page form.srv-form .srv-grid { | ||
| 235 | - grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); | ||
| 236 | - max-width: none; | ||
| 237 | - } | ||
| 238 | -} | ||
| 239 | - | ||
| 240 | // File pages: the path row has no rules of its own, the tab row's rule is the only one above it. | 150 | // File pages: the path row has no rules of its own, the tab row's rule is the only one above it. |
| 241 | .browse-bar { | 151 | .browse-bar { |
| 242 | border-top: 0; | 152 | border-top: 0; |
style/_fit_admin.scssmodified+0 -59
| @@ -51,65 +51,6 @@ | |||
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | -// Org teams (/org/{org}/teams): the team list and the new-team form side by side. | ||
| 55 | -@media (min-width: 900px) { | ||
| 56 | - .teams-page { | ||
| 57 | - display: grid; | ||
| 58 | - grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); | ||
| 59 | - column-gap: 16px; | ||
| 60 | - align-items: start; | ||
| 61 | - | ||
| 62 | - > :not(.card) { | ||
| 63 | - grid-column: 1 / -1; | ||
| 64 | - } | ||
| 65 | - } | ||
| 66 | -} | ||
| 67 | - | ||
| 68 | -// Server settings (/admin/server): the settings card takes the left column and fills the window, | ||
| 69 | -// and the restart card sits beside it. The settings card runs three across, and four from 1200px. | ||
| 70 | -@media (min-width: 900px) { | ||
| 71 | - .srv-page { | ||
| 72 | - display: grid; | ||
| 73 | - grid-template-columns: minmax(0, 1fr) 260px; | ||
| 74 | - column-gap: 16px; | ||
| 75 | - align-items: start; | ||
| 76 | - | ||
| 77 | - > .page-head, | ||
| 78 | - > .subnav, | ||
| 79 | - > .notice { | ||
| 80 | - grid-column: 1 / -1; | ||
| 81 | - } | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - // Tighter cells: the field rows sit closer, and the help text lines are shorter. | ||
| 85 | - .srv-form .srv-grid { | ||
| 86 | - grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); | ||
| 87 | - gap: 8px 16px; | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - .srv-form .srv-field { | ||
| 91 | - gap: 4px; | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - .srv-form .srv-field > p.small { | ||
| 95 | - line-height: 1.3; | ||
| 96 | - } | ||
| 97 | -} | ||
| 98 | - | ||
| 99 | -// From 1200px the settings take three across, wide enough for a label and its two badges; from | ||
| 100 | -// 1680px four. | ||
| 101 | -@media (min-width: 1200px) { | ||
| 102 | - .srv-form .srv-grid { | ||
| 103 | - grid-template-columns: repeat(3, minmax(0, 1fr)); | ||
| 104 | - } | ||
| 105 | -} | ||
| 106 | - | ||
| 107 | -@media (min-width: 1680px) { | ||
| 108 | - .srv-form .srv-grid { | ||
| 109 | - grid-template-columns: repeat(4, minmax(0, 1fr)); | ||
| 110 | - } | ||
| 111 | -} | ||
| 112 | - | ||
| 113 | // Mail settings (/admin/mail): the SMTP form runs three fields across, the actions span the row. | 54 | // Mail settings (/admin/mail): the SMTP form runs three fields across, the actions span the row. |
| 114 | @media (min-width: 900px) { | 55 | @media (min-width: 900px) { |
| 115 | form.stack[action="/admin/mail"] { | 56 | form.stack[action="/admin/mail"] { |
style/_lang_admin.scssmodified+4 -18
| @@ -25,8 +25,8 @@ $page-column: ".shell-site > .shell-body > main, .shell-site > .shell-body > mai | |||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | // Two panes: the list takes the window, and the form beside it stays a form's width. | 27 | // Two panes: the list takes the window, and the form beside it stays a form's width. |
| 28 | - .shell-site > .shell-body > main:has(> .card ~ .card), | 28 | + .shell-site > .shell-body > main:not(:has(> .rows-pane)):has(> .card ~ .card), |
| 29 | - .shell-site > .shell-body > main > [data-live]:not(.srv-page):not(.health-page):not(.user-page):not(.teams-page):not(.runner-detail):has(> .card ~ .card) { | 29 | + .shell-site > .shell-body > main > [data-live]:not(.srv-page):not(.health-page):not(.user-page):not(.teams-page):not(.runner-detail):not(:has(> .rows-pane)):has(> .card ~ .card) { |
| 30 | grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem); | 30 | grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem); |
| 31 | } | 31 | } |
| 32 | } | 32 | } |
| @@ -41,8 +41,8 @@ $page-column: ".shell-site > .shell-body > main, .shell-site > .shell-body > mai | |||
| 41 | 41 | ||
| 42 | // A form in a pane is a column of its own: 720px at most, left aligned. The mail form keeps its | 42 | // A form in a pane is a column of its own: 720px at most, left aligned. The mail form keeps its |
| 43 | // three-field row. | 43 | // three-field row. |
| 44 | -.shell-site main .card > form:not(.inline-form):not(.srv-form):not([action="/admin/mail"]), | 44 | +.shell-site main .card > form:not(.inline-form):not(.srv-form):not([action="/admin/mail"]):not(:has(> .row-line)), |
| 45 | -.shell-site main .card > form.stack:not(.srv-form):not([action="/admin/mail"]) { | 45 | +.shell-site main .card > form.stack:not(.srv-form):not([action="/admin/mail"]):not(:has(> .row-line)) { |
| 46 | max-width: 720px; | 46 | max-width: 720px; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| @@ -84,10 +84,6 @@ $page-column: ".shell-site > .shell-body > main, .shell-site > .shell-body > mai | |||
| 84 | @extend %mono-label; | 84 | @extend %mono-label; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | -.shell-site main .user-danger > h2 { | ||
| 88 | - color: var(--danger); | ||
| 89 | -} | ||
| 90 | - | ||
| 91 | // Panes side by side end at the same height. A card's bottom margin would shorten a stretched pane | 87 | // Panes side by side end at the same height. A card's bottom margin would shorten a stretched pane |
| 92 | // by 16px, so the split's and the grids' cards drop it; the grid gap already spaces them. | 88 | // by 16px, so the split's and the grids' cards drop it; the grid gap already spaces them. |
| 93 | .fit-split > .card, | 89 | .fit-split > .card, |
| @@ -135,13 +131,3 @@ $page-column: ".shell-site > .shell-body > main, .shell-site > .shell-body > mai | |||
| 135 | scrollbar-width: thin; | 131 | scrollbar-width: thin; |
| 136 | } | 132 | } |
| 137 | 133 | ||
| 138 | -// The settings card and the restart card start on one line. | ||
| 139 | -@media (min-width: 900px) { | ||
| 140 | - .srv-page > .card { | ||
| 141 | - margin-top: 0; | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - .srv-page > .card.fit-pane { | ||
| 145 | - align-self: start; | ||
| 146 | - } | ||
| 147 | -} | ||
style/_lang_ci.scssmodified+35 -2
| @@ -11,7 +11,7 @@ | |||
| 11 | // The runs list (480px, as the canvas) and the selected run fill the window down to the footer. | 11 | // The runs list (480px, as the canvas) and the selected run fill the window down to the footer. |
| 12 | @media (min-width: 900px) { | 12 | @media (min-width: 900px) { |
| 13 | .ci-split.fit-pane { | 13 | .ci-split.fit-pane { |
| 14 | - grid-template-columns: minmax(0, 480px) minmax(0, 1fr); | 14 | + grid-template-columns: clamp(340px, 25vw, 480px) minmax(0, 1fr); |
| 15 | align-items: stretch; | 15 | align-items: stretch; |
| 16 | gap: 12px; | 16 | gap: 12px; |
| 17 | padding: 0; | 17 | padding: 0; |
| @@ -51,11 +51,44 @@ | |||
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | -// Between phone and desktop the panes stack, as the rest of the site does. | 54 | +// A run's page keeps the runs list at the left, in the same place, so a click only changes the right. |
| 55 | +.ci-split > .ci-run { | ||
| 56 | + display: flex; | ||
| 57 | + flex-direction: column; | ||
| 58 | + gap: 12px; | ||
| 59 | + min-width: 0; | ||
| 60 | + min-height: 0; | ||
| 61 | + | ||
| 62 | + > .ci-tl-main { | ||
| 63 | + flex: 1 1 0; | ||
| 64 | + min-height: 0; | ||
| 65 | + } | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +@media (min-width: 900px) { | ||
| 69 | + .ci-split.fit-pane:has(> .ci-run) { | ||
| 70 | + height: calc(100dvh - var(--pane-top, 107px) - 20px); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + .ci-split > .ci-run { | ||
| 74 | + overflow: hidden; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + .ci-all-runs { | ||
| 78 | + display: none; | ||
| 79 | + } | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +// Between phone and desktop the panes stack, as the rest of the site does. On a run's page the run | ||
| 83 | +// comes first and All runs leads back, or it would sit under a whole list. | ||
| 55 | @media (max-width: 899px) { | 84 | @media (max-width: 899px) { |
| 56 | .ci-split { | 85 | .ci-split { |
| 57 | grid-template-columns: minmax(0, 1fr); | 86 | grid-template-columns: minmax(0, 1fr); |
| 58 | } | 87 | } |
| 88 | + | ||
| 89 | + .ci-split:has(> .ci-run) > .ci-side { | ||
| 90 | + display: none; | ||
| 91 | + } | ||
| 59 | } | 92 | } |
| 60 | 93 | ||
| 61 | // The detail's empty state reads from the left, inside its pane. | 94 | // The detail's empty state reads from the left, inside its pane. |
style/_look.scssmodified+1 -2
| @@ -48,7 +48,7 @@ th, | |||
| 48 | .ci-art-title, | 48 | .ci-art-title, |
| 49 | .ci-warnings-title, | 49 | .ci-warnings-title, |
| 50 | .import-log-title, | 50 | .import-log-title, |
| 51 | -.security-row-title, | 51 | +.row-title, |
| 52 | .notif-group-head, | 52 | .notif-group-head, |
| 53 | .profile-section-head, | 53 | .profile-section-head, |
| 54 | .mx-caption, | 54 | .mx-caption, |
| @@ -67,7 +67,6 @@ th, | |||
| 67 | .release-card, | 67 | .release-card, |
| 68 | .newrepo-card, | 68 | .newrepo-card, |
| 69 | .newrepo-mirror, | 69 | .newrepo-mirror, |
| 70 | -.security-panel, | ||
| 71 | .ci-side, | 70 | .ci-side, |
| 72 | .ci-main, | 71 | .ci-main, |
| 73 | .import-sources, | 72 | .import-sources, |
style/_palette.scssmodified+19 -2
| @@ -120,11 +120,28 @@ dialog.palette { | |||
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | +.palette-list li[role="option"]:has(.palette-why) { | ||
| 124 | + display: flex; | ||
| 125 | + align-items: baseline; | ||
| 126 | + justify-content: space-between; | ||
| 127 | + gap: 16px; | ||
| 128 | +} | ||
| 129 | + | ||
| 123 | .palette-why { | 130 | .palette-why { |
| 124 | - float: right; | 131 | + flex: 0 1 55%; |
| 125 | - margin-left: 12px; | 132 | + overflow: hidden; |
| 126 | color: var(--muted); | 133 | color: var(--muted); |
| 127 | font-size: 0.75rem; | 134 | font-size: 0.75rem; |
| 135 | + text-align: right; | ||
| 136 | + text-overflow: ellipsis; | ||
| 137 | + white-space: nowrap; | ||
| 138 | +} | ||
| 139 | + | ||
| 140 | +// Where a search led: the setting it found, until the next key or click. | ||
| 141 | +.palette-hit { | ||
| 142 | + outline: 2px solid var(--accent); | ||
| 143 | + outline-offset: -2px; | ||
| 144 | + border-radius: var(--radius-sm); | ||
| 128 | } | 145 | } |
| 129 | 146 | ||
| 130 | .palette-note { | 147 | .palette-note { |
style/_system.scssmodified+0 -26
| @@ -661,27 +661,6 @@ main .side-picker > legend { | |||
| 661 | margin-bottom: 16px; | 661 | margin-bottom: 16px; |
| 662 | } | 662 | } |
| 663 | 663 | ||
| 664 | -.org-split { | ||
| 665 | - display: grid; | ||
| 666 | - grid-template-columns: minmax(0, 1fr); | ||
| 667 | - align-items: start; | ||
| 668 | - gap: 16px; | ||
| 669 | - | ||
| 670 | - > .card { | ||
| 671 | - margin: 0; | ||
| 672 | - } | ||
| 673 | - | ||
| 674 | - > .card > h3 { | ||
| 675 | - margin: 0 0 12px; | ||
| 676 | - color: var(--muted); | ||
| 677 | - font-family: var(--mono); | ||
| 678 | - font-size: 12px; | ||
| 679 | - font-weight: 500; | ||
| 680 | - letter-spacing: 0.08em; | ||
| 681 | - text-transform: uppercase; | ||
| 682 | - } | ||
| 683 | -} | ||
| 684 | - | ||
| 685 | @media (min-width: 900px) { | 664 | @media (min-width: 900px) { |
| 686 | .org-split:has(> .card ~ .card) { | 665 | .org-split:has(> .card ~ .card) { |
| 687 | grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem); | 666 | grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem); |
| @@ -834,8 +813,3 @@ form.stack[action="/admin/mail"], | |||
| 834 | } | 813 | } |
| 835 | } | 814 | } |
| 836 | } | 815 | } |
| 837 | - | ||
| 838 | -.org-split > .card > h2 { | ||
| 839 | - margin: 0 0 4px; | ||
| 840 | - font-size: 16px; | ||
| 841 | -} | ||
style/main.scssmodified+207 -192
| @@ -2243,13 +2243,6 @@ code { | |||
| 2243 | margin-top: 8px; | 2243 | margin-top: 8px; |
| 2244 | } | 2244 | } |
| 2245 | 2245 | ||
| 2246 | -.org-settings-grid { | ||
| 2247 | - display: grid; | ||
| 2248 | - grid-template-columns: minmax(0, 1fr); | ||
| 2249 | - gap: 16px; | ||
| 2250 | - align-items: start; | ||
| 2251 | -} | ||
| 2252 | - | ||
| 2253 | @media (min-width: 900px) { | 2246 | @media (min-width: 900px) { |
| 2254 | .org-settings-grid { | 2247 | .org-settings-grid { |
| 2255 | grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); | 2248 | grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); |
| @@ -2478,48 +2471,6 @@ code { | |||
| 2478 | min-width: 0; | 2471 | min-width: 0; |
| 2479 | } | 2472 | } |
| 2480 | 2473 | ||
| 2481 | -.appearance-top { | ||
| 2482 | - // Theme and Language share the width; the sidebar toggle takes its own width. Rows size to their | ||
| 2483 | - // content, so the helper text under a select is never clipped. | ||
| 2484 | - display: grid; | ||
| 2485 | - grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; | ||
| 2486 | - grid-auto-rows: auto; | ||
| 2487 | - align-items: start; | ||
| 2488 | - gap: 16px 24px; | ||
| 2489 | - min-width: 0; | ||
| 2490 | - height: auto; | ||
| 2491 | - overflow: visible; | ||
| 2492 | - | ||
| 2493 | - @media (max-width: 720px) { | ||
| 2494 | - grid-template-columns: minmax(0, 1fr); | ||
| 2495 | - } | ||
| 2496 | - | ||
| 2497 | - // Each field: label row, control row, then optional helper text. The label rows are all the | ||
| 2498 | - // same height, so the three labels share a baseline and the three controls sit on one line. | ||
| 2499 | - > label, | ||
| 2500 | - > fieldset { | ||
| 2501 | - display: grid; | ||
| 2502 | - grid-template-rows: auto var(--control-h) auto; | ||
| 2503 | - gap: 4px; | ||
| 2504 | - min-width: 0; | ||
| 2505 | - height: auto; | ||
| 2506 | - overflow: visible; | ||
| 2507 | - align-content: start; | ||
| 2508 | - } | ||
| 2509 | - | ||
| 2510 | - > label > span, | ||
| 2511 | - > fieldset > legend { | ||
| 2512 | - line-height: 1.25rem; | ||
| 2513 | - } | ||
| 2514 | - | ||
| 2515 | - > label > small { | ||
| 2516 | - display: block; | ||
| 2517 | - font-size: 0.8125rem; | ||
| 2518 | - line-height: 1.45; | ||
| 2519 | - overflow-wrap: anywhere; | ||
| 2520 | - } | ||
| 2521 | -} | ||
| 2522 | - | ||
| 2523 | // The sidebar side (appearance settings): the same segmented pill as the New repository | 2474 | // The sidebar side (appearance settings): the same segmented pill as the New repository |
| 2524 | // visibility toggle (.segmented.snippet-segmented), sized to --control-h like the selects. | 2475 | // visibility toggle (.segmented.snippet-segmented), sized to --control-h like the selects. |
| 2525 | .side-picker { | 2476 | .side-picker { |
| @@ -3141,36 +3092,6 @@ code { | |||
| 3141 | 3092 | ||
| 3142 | // labels & milestones | 3093 | // labels & milestones |
| 3143 | // Label list and create/edit forms on the labels page. Chips get their colors from labels.css. | 3094 | // Label list and create/edit forms on the labels page. Chips get their colors from labels.css. |
| 3144 | -.label-list, | ||
| 3145 | -.milestone-list { | ||
| 3146 | - list-style: none; | ||
| 3147 | - margin: 0; | ||
| 3148 | - padding: 0; | ||
| 3149 | -} | ||
| 3150 | - | ||
| 3151 | -.label-row, | ||
| 3152 | -.milestone-row { | ||
| 3153 | - padding: 12px 0; | ||
| 3154 | - border-bottom: 1px solid var(--border); | ||
| 3155 | - | ||
| 3156 | - &:last-child { | ||
| 3157 | - border-bottom: none; | ||
| 3158 | - } | ||
| 3159 | - | ||
| 3160 | - h3 { | ||
| 3161 | - margin: 0 0 4px; | ||
| 3162 | - font-size: 1rem; | ||
| 3163 | - | ||
| 3164 | - a { | ||
| 3165 | - color: var(--text); | ||
| 3166 | - } | ||
| 3167 | - } | ||
| 3168 | - | ||
| 3169 | - p { | ||
| 3170 | - margin: 4px 0; | ||
| 3171 | - } | ||
| 3172 | -} | ||
| 3173 | - | ||
| 3174 | .label-head { | 3095 | .label-head { |
| 3175 | display: flex; | 3096 | display: flex; |
| 3176 | flex-wrap: wrap; | 3097 | flex-wrap: wrap; |
| @@ -3252,17 +3173,6 @@ code { | |||
| 3252 | margin-left: 0; | 3173 | margin-left: 0; |
| 3253 | } | 3174 | } |
| 3254 | 3175 | ||
| 3255 | -.label-row, | ||
| 3256 | -.milestone-row { | ||
| 3257 | - .remove-form { | ||
| 3258 | - margin: 0; | ||
| 3259 | - } | ||
| 3260 | -} | ||
| 3261 | - | ||
| 3262 | -.milestone-row .markdown-body { | ||
| 3263 | - margin: 4px 0; | ||
| 3264 | -} | ||
| 3265 | - | ||
| 3266 | @media (max-width: 600px) { | 3176 | @media (max-width: 600px) { |
| 3267 | .milestone-progress progress { | 3177 | .milestone-progress progress { |
| 3268 | width: 100%; | 3178 | width: 100%; |
| @@ -7173,82 +7083,24 @@ button.ci-job-last { | |||
| 7173 | margin-top: 4px; | 7083 | margin-top: 4px; |
| 7174 | } | 7084 | } |
| 7175 | 7085 | ||
| 7176 | -.profile-settings-avatar { | ||
| 7177 | - display: flex; | ||
| 7178 | - flex-direction: column; | ||
| 7179 | - gap: 10px; | ||
| 7180 | - min-width: 0; | ||
| 7181 | - | ||
| 7182 | - small { | ||
| 7183 | - font-size: 0.8125rem; | ||
| 7184 | - line-height: 1.45; | ||
| 7185 | - } | ||
| 7186 | -} | ||
| 7187 | - | ||
| 7188 | -.profile-settings-avatar-frame { | ||
| 7189 | - position: relative; | ||
| 7190 | - width: 180px; | ||
| 7191 | - height: 180px; | ||
| 7192 | -} | ||
| 7193 | - | ||
| 7194 | .profile-settings-avatar-img { | 7086 | .profile-settings-avatar-img { |
| 7195 | - display: block; | 7087 | + flex: none; |
| 7196 | - width: 180px; | 7088 | + width: 40px; |
| 7197 | - height: 180px; | 7089 | + height: 40px; |
| 7198 | box-sizing: border-box; | 7090 | box-sizing: border-box; |
| 7199 | border: 1px solid var(--border); | 7091 | border: 1px solid var(--border); |
| 7200 | } | 7092 | } |
| 7201 | 7093 | ||
| 7202 | -// The Edit pill sits over the bottom-left edge of the circle. | ||
| 7203 | -.profile-settings-avatar-menu { | ||
| 7204 | - position: absolute; | ||
| 7205 | - left: 6px; | ||
| 7206 | - bottom: 10px; | ||
| 7207 | - | ||
| 7208 | - > summary { | ||
| 7209 | - display: inline-flex; | ||
| 7210 | - align-items: center; | ||
| 7211 | - height: 32px; | ||
| 7212 | - padding: 0 14px; | ||
| 7213 | - border: 1px solid var(--border-strong); | ||
| 7214 | - border-radius: var(--radius-full); | ||
| 7215 | - background: var(--surface); | ||
| 7216 | - box-shadow: var(--shadow); | ||
| 7217 | - color: var(--text); | ||
| 7218 | - font-size: 0.8125rem; | ||
| 7219 | - font-weight: 500; | ||
| 7220 | - cursor: pointer; | ||
| 7221 | - | ||
| 7222 | - &:hover { | ||
| 7223 | - background: var(--surface-2); | ||
| 7224 | - } | ||
| 7225 | - } | ||
| 7226 | - | ||
| 7227 | - &[open] > summary { | ||
| 7228 | - border-color: var(--border-strong); | ||
| 7229 | - } | ||
| 7230 | -} | ||
| 7231 | - | ||
| 7232 | -.profile-settings-avatar-list { | ||
| 7233 | - left: 0; | ||
| 7234 | - right: auto; | ||
| 7235 | - top: calc(100% + 8px); | ||
| 7236 | - min-width: 220px; | ||
| 7237 | -} | ||
| 7238 | - | ||
| 7239 | .profile-settings-avatar-upload { | 7094 | .profile-settings-avatar-upload { |
| 7240 | - display: flex; | 7095 | + position: relative; |
| 7241 | - flex-direction: column; | 7096 | + flex-direction: row; |
| 7242 | - align-items: stretch; | 7097 | + align-items: center; |
| 7098 | + gap: 8px; | ||
| 7243 | margin: 0; | 7099 | margin: 0; |
| 7244 | - | ||
| 7245 | - > button { | ||
| 7246 | - margin: 4px 14px 10px; | ||
| 7247 | - } | ||
| 7248 | } | 7100 | } |
| 7249 | 7101 | ||
| 7250 | -// The file input stays in the tab order but is visually hidden. Its label is the visible item. | 7102 | +// The file input stays in the tab order but is visually hidden. Its label is the visible button. |
| 7251 | -.profile-settings-avatar-upload .profile-settings-avatar-file { | 7103 | +.profile-settings-avatar-file { |
| 7252 | position: absolute; | 7104 | position: absolute; |
| 7253 | width: 1px; | 7105 | width: 1px; |
| 7254 | height: 1px; | 7106 | height: 1px; |
| @@ -7262,10 +7114,15 @@ button.ci-job-last { | |||
| 7262 | } | 7114 | } |
| 7263 | 7115 | ||
| 7264 | .profile-settings-avatar-item { | 7116 | .profile-settings-avatar-item { |
| 7265 | - display: block; | 7117 | + display: inline-flex; |
| 7266 | - padding: 8px 14px; | 7118 | + flex-direction: row; |
| 7119 | + align-items: center; | ||
| 7120 | + height: var(--control-h); | ||
| 7121 | + padding: 0 12px; | ||
| 7122 | + border: 1px solid var(--border-strong); | ||
| 7123 | + border-radius: var(--radius-md); | ||
| 7267 | color: var(--text); | 7124 | color: var(--text); |
| 7268 | - font-size: 0.875rem; | 7125 | + font-size: 0.8125rem; |
| 7269 | white-space: nowrap; | 7126 | white-space: nowrap; |
| 7270 | cursor: pointer; | 7127 | cursor: pointer; |
| 7271 | 7128 | ||
| @@ -7274,15 +7131,9 @@ button.ci-job-last { | |||
| 7274 | } | 7131 | } |
| 7275 | } | 7132 | } |
| 7276 | 7133 | ||
| 7277 | -.profile-settings-avatar-upload .profile-settings-avatar-file:focus-visible + .profile-settings-avatar-item { | 7134 | +.profile-settings-avatar-file:focus-visible + .profile-settings-avatar-item { |
| 7278 | - outline: 2px solid var(--accent); | 7135 | + outline: 2px solid var(--focus); |
| 7279 | - outline-offset: -2px; | 7136 | + outline-offset: 2px; |
| 7280 | -} | ||
| 7281 | - | ||
| 7282 | -.profile-settings-avatar-remove { | ||
| 7283 | - margin: 0; | ||
| 7284 | - padding-top: 6px; | ||
| 7285 | - border-top: 1px solid var(--border); | ||
| 7286 | } | 7137 | } |
| 7287 | 7138 | ||
| 7288 | @media (max-width: 48rem) { | 7139 | @media (max-width: 48rem) { |
| @@ -7291,9 +7142,6 @@ button.ci-job-last { | |||
| 7291 | gap: 24px; | 7142 | gap: 24px; |
| 7292 | } | 7143 | } |
| 7293 | 7144 | ||
| 7294 | - .profile-settings-avatar { | ||
| 7295 | - order: -1; | ||
| 7296 | - } | ||
| 7297 | } | 7145 | } |
| 7298 | 7146 | ||
| 7299 | // --------------------------------------------------------------------------- | 7147 | // --------------------------------------------------------------------------- |
| @@ -7302,7 +7150,7 @@ button.ci-job-last { | |||
| 7302 | // zone is its own card with a red border. | 7150 | // zone is its own card with a red border. |
| 7303 | // --------------------------------------------------------------------------- | 7151 | // --------------------------------------------------------------------------- |
| 7304 | 7152 | ||
| 7305 | -.security-card { | 7153 | +.rows-pane { |
| 7306 | padding: 0; | 7154 | padding: 0; |
| 7307 | overflow: hidden; | 7155 | overflow: hidden; |
| 7308 | 7156 | ||
| @@ -7311,9 +7159,10 @@ button.ci-job-last { | |||
| 7311 | } | 7159 | } |
| 7312 | } | 7160 | } |
| 7313 | 7161 | ||
| 7314 | -.security-row { | 7162 | +.row-line { |
| 7315 | position: relative; | 7163 | position: relative; |
| 7316 | display: flex; | 7164 | display: flex; |
| 7165 | + flex-direction: row; | ||
| 7317 | flex-wrap: wrap; | 7166 | flex-wrap: wrap; |
| 7318 | align-items: center; | 7167 | align-items: center; |
| 7319 | gap: 10px 16px; | 7168 | gap: 10px 16px; |
| @@ -7321,18 +7170,18 @@ button.ci-job-last { | |||
| 7321 | min-width: 0; | 7170 | min-width: 0; |
| 7322 | 7171 | ||
| 7323 | // While an action is open its summary stays on this heading row, so keep the title clear of it. | 7172 | // While an action is open its summary stays on this heading row, so keep the title clear of it. |
| 7324 | - &:has(> .security-action[open]) > .security-row-main { | 7173 | + &:has(> .row-action[open]) > .row-main { |
| 7325 | padding-right: 150px; | 7174 | padding-right: 150px; |
| 7326 | } | 7175 | } |
| 7327 | } | 7176 | } |
| 7328 | 7177 | ||
| 7329 | -.security-block { | 7178 | +.rows-block { |
| 7330 | display: flex; | 7179 | display: flex; |
| 7331 | flex-direction: column; | 7180 | flex-direction: column; |
| 7332 | min-width: 0; | 7181 | min-width: 0; |
| 7333 | } | 7182 | } |
| 7334 | 7183 | ||
| 7335 | -.security-icon { | 7184 | +.row-icon { |
| 7336 | flex: none; | 7185 | flex: none; |
| 7337 | width: 20px; | 7186 | width: 20px; |
| 7338 | height: 20px; | 7187 | height: 20px; |
| @@ -7343,7 +7192,7 @@ button.ci-job-last { | |||
| 7343 | stroke-linejoin: round; | 7192 | stroke-linejoin: round; |
| 7344 | } | 7193 | } |
| 7345 | 7194 | ||
| 7346 | -.security-row-main { | 7195 | +.row-main { |
| 7347 | flex: 1 1 200px; | 7196 | flex: 1 1 200px; |
| 7348 | min-width: 0; | 7197 | min-width: 0; |
| 7349 | display: flex; | 7198 | display: flex; |
| @@ -7351,8 +7200,9 @@ button.ci-job-last { | |||
| 7351 | gap: 2px; | 7200 | gap: 2px; |
| 7352 | } | 7201 | } |
| 7353 | 7202 | ||
| 7354 | -.security-row-title { | 7203 | +.row-title { |
| 7355 | display: flex; | 7204 | display: flex; |
| 7205 | + flex-direction: row; | ||
| 7356 | flex-wrap: wrap; | 7206 | flex-wrap: wrap; |
| 7357 | align-items: center; | 7207 | align-items: center; |
| 7358 | gap: 8px; | 7208 | gap: 8px; |
| @@ -7365,7 +7215,7 @@ button.ci-job-last { | |||
| 7365 | padding: 0; | 7215 | padding: 0; |
| 7366 | } | 7216 | } |
| 7367 | 7217 | ||
| 7368 | -.security-row-status { | 7218 | +.row-status { |
| 7369 | margin: 0; | 7219 | margin: 0; |
| 7370 | font-size: 0.8125rem; | 7220 | font-size: 0.8125rem; |
| 7371 | line-height: 1.45; | 7221 | line-height: 1.45; |
| @@ -7410,11 +7260,174 @@ button.ci-job-last { | |||
| 7410 | } | 7260 | } |
| 7411 | } | 7261 | } |
| 7412 | 7262 | ||
| 7413 | -.security-inline-form { | 7263 | +.row-form { |
| 7264 | + margin: 0; | ||
| 7265 | +} | ||
| 7266 | + | ||
| 7267 | +// The rows pattern, shared by every settings, admin and list page: one pane that hugs its content, | ||
| 7268 | +// rows of icon, label or name, one line of status, and the actions at the right end. A form opens | ||
| 7269 | +// in place under its row from a `.row-action`, so no page keeps an empty pane beside a form. | ||
| 7270 | +.rows-pane { | ||
| 7271 | + display: block; | ||
| 7272 | + align-self: start; | ||
| 7273 | + justify-self: stretch; | ||
| 7274 | + width: 100%; | ||
| 7275 | + min-width: 0; | ||
| 7276 | +} | ||
| 7277 | + | ||
| 7278 | +.row-name { | ||
| 7279 | + display: block; | ||
| 7280 | + overflow: hidden; | ||
| 7281 | + color: var(--text); | ||
| 7282 | + font-size: 0.875rem; | ||
| 7283 | + font-weight: 600; | ||
| 7284 | + line-height: 1.4; | ||
| 7285 | + text-overflow: ellipsis; | ||
| 7286 | + white-space: nowrap; | ||
| 7287 | + | ||
| 7288 | + a { | ||
| 7289 | + color: inherit; | ||
| 7290 | + } | ||
| 7291 | +} | ||
| 7292 | + | ||
| 7293 | +.row-actions { | ||
| 7294 | + display: flex; | ||
| 7295 | + flex: none; | ||
| 7296 | + align-items: center; | ||
| 7297 | + gap: 8px; | ||
| 7298 | + margin-left: auto; | ||
| 7299 | +} | ||
| 7300 | + | ||
| 7301 | +.row-count { | ||
| 7302 | + padding: 0 7px; | ||
| 7303 | + border: 1px solid var(--border); | ||
| 7304 | + border-radius: var(--radius-full); | ||
| 7305 | + color: var(--muted); | ||
| 7306 | + font-family: var(--mono); | ||
| 7307 | + font-size: 11px; | ||
| 7308 | + letter-spacing: 0; | ||
| 7309 | +} | ||
| 7310 | + | ||
| 7311 | +// A setting on one row: its label and hint at the left, its control at the right. | ||
| 7312 | +.row-field { | ||
| 7313 | + align-items: center; | ||
| 7314 | + | ||
| 7315 | + > .row-control { | ||
| 7316 | + display: flex; | ||
| 7317 | + flex: 0 1 22rem; | ||
| 7318 | + align-items: center; | ||
| 7319 | + justify-content: flex-end; | ||
| 7320 | + gap: 8px; | ||
| 7321 | + min-width: 0; | ||
| 7322 | + | ||
| 7323 | + > input:not([type="checkbox"], [type="radio"]), | ||
| 7324 | + > select, | ||
| 7325 | + > textarea { | ||
| 7326 | + width: 100%; | ||
| 7327 | + } | ||
| 7328 | + } | ||
| 7329 | +} | ||
| 7330 | + | ||
| 7331 | +.row-foot { | ||
| 7332 | + display: flex; | ||
| 7333 | + align-items: center; | ||
| 7334 | + gap: 8px; | ||
| 7335 | + padding: 12px 20px; | ||
| 7336 | +} | ||
| 7337 | + | ||
| 7338 | +.row-main > .badge { | ||
| 7339 | + width: fit-content; | ||
| 7340 | +} | ||
| 7341 | + | ||
| 7342 | +// Rows inside a form in a pane: the form is only a wrapper, and its rows keep their hairlines. | ||
| 7343 | +.rows-pane form:not(.row-form, .profile-settings-avatar-upload) { | ||
| 7344 | + display: block; | ||
| 7345 | + max-width: none; | ||
| 7346 | + margin: 0; | ||
| 7347 | + | ||
| 7348 | + > .row-line + .row-line, | ||
| 7349 | + > .row-foot { | ||
| 7350 | + border-top: 1px solid var(--border); | ||
| 7351 | + } | ||
| 7352 | +} | ||
| 7353 | + | ||
| 7354 | +form.rows-pane { | ||
| 7355 | + max-width: none; | ||
| 7356 | +} | ||
| 7357 | + | ||
| 7358 | +.row-line.event-choices { | ||
| 7359 | + display: flex; | ||
| 7360 | + padding: 16px 20px; | ||
| 7361 | + | ||
| 7362 | + > .row-main, | ||
| 7363 | + > .row-control { | ||
| 7364 | + flex: 1 1 100%; | ||
| 7365 | + } | ||
| 7366 | + | ||
| 7367 | + > .row-control { | ||
| 7368 | + flex-wrap: wrap; | ||
| 7369 | + justify-content: flex-start; | ||
| 7370 | + gap: 8px 24px; | ||
| 7371 | + } | ||
| 7372 | +} | ||
| 7373 | + | ||
| 7374 | +.row-line > .row-form, | ||
| 7375 | +.row-actions > .row-form { | ||
| 7376 | + display: flex; | ||
| 7377 | + align-items: center; | ||
| 7378 | + gap: 8px; | ||
| 7379 | +} | ||
| 7380 | + | ||
| 7381 | +.row-title .srv-label { | ||
| 7382 | + margin: 0; | ||
| 7383 | + color: inherit; | ||
| 7384 | + font: inherit; | ||
| 7385 | +} | ||
| 7386 | + | ||
| 7387 | +// A setting is a row like any other, not the stacked label and control of the stat cells above it. | ||
| 7388 | +.srv-form .srv-field.row-line { | ||
| 7389 | + flex-direction: row; | ||
| 7390 | + gap: 10px 16px; | ||
| 7391 | +} | ||
| 7392 | + | ||
| 7393 | +// A colour picker holds a whole row of swatches, so it takes the row. | ||
| 7394 | +.colour-line > .colour-picker { | ||
| 7395 | + flex: 1 1 100%; | ||
| 7396 | + min-width: 0; | ||
| 7397 | +} | ||
| 7398 | + | ||
| 7399 | +.rows-pane > .colour-group { | ||
| 7400 | + padding: 16px 20px; | ||
| 7401 | + border-width: 1px 0 0; | ||
| 7402 | + border-radius: 0; | ||
| 7403 | +} | ||
| 7404 | + | ||
| 7405 | +// The rule editor's switches are rows inside its own panes. | ||
| 7406 | +.switch-list > .row-line { | ||
| 7407 | + padding: 10px 0; | ||
| 7408 | + | ||
| 7409 | + & + .row-line { | ||
| 7410 | + border-top: 1px solid var(--border); | ||
| 7411 | + } | ||
| 7412 | +} | ||
| 7413 | + | ||
| 7414 | +.rows-section { | ||
| 7414 | margin: 0; | 7415 | margin: 0; |
| 7416 | + padding: 12px 20px 8px; | ||
| 7417 | +} | ||
| 7418 | + | ||
| 7419 | +@media (max-width: 600px) { | ||
| 7420 | + .row-field > .row-control { | ||
| 7421 | + flex-basis: 100%; | ||
| 7422 | + justify-content: flex-start; | ||
| 7423 | + } | ||
| 7424 | + | ||
| 7425 | + .row-foot { | ||
| 7426 | + padding: 12px 16px; | ||
| 7427 | + } | ||
| 7415 | } | 7428 | } |
| 7416 | 7429 | ||
| 7417 | -.security-action { | 7430 | +.row-action { |
| 7418 | margin-left: auto; | 7431 | margin-left: auto; |
| 7419 | 7432 | ||
| 7420 | > summary { | 7433 | > summary { |
| @@ -7458,19 +7471,19 @@ button.ci-job-last { | |||
| 7458 | } | 7471 | } |
| 7459 | 7472 | ||
| 7460 | // Lines up with the title, past the row icon (20px) and its gap (16px). | 7473 | // Lines up with the title, past the row icon (20px) and its gap (16px). |
| 7461 | - > .security-panel { | 7474 | + > .row-panel { |
| 7462 | width: auto; | 7475 | width: auto; |
| 7463 | margin-left: 36px; | 7476 | margin-left: 36px; |
| 7464 | } | 7477 | } |
| 7465 | } | 7478 | } |
| 7466 | } | 7479 | } |
| 7467 | 7480 | ||
| 7468 | -.security-panel { | 7481 | +.row-panel { |
| 7469 | display: flex; | 7482 | display: flex; |
| 7470 | flex-direction: column; | 7483 | flex-direction: column; |
| 7471 | gap: 12px; | 7484 | gap: 12px; |
| 7472 | width: 100%; | 7485 | width: 100%; |
| 7473 | - max-width: 420px; | 7486 | + max-width: 720px; |
| 7474 | margin-top: 12px; | 7487 | margin-top: 12px; |
| 7475 | padding-top: 14px; | 7488 | padding-top: 14px; |
| 7476 | border-top: 1px solid var(--border); | 7489 | border-top: 1px solid var(--border); |
| @@ -7504,7 +7517,7 @@ button.ci-job-last { | |||
| 7504 | // Passkeys: the add form sits under the list, aligned with the row text. Both the add form and the | 7517 | // Passkeys: the add form sits under the list, aligned with the row text. Both the add form and the |
| 7505 | // login button stay hidden until nav.js sees that the browser supports passkeys. | 7518 | // login button stay hidden until nav.js sees that the browser supports passkeys. |
| 7506 | .passkey-add { | 7519 | .passkey-add { |
| 7507 | - max-width: none; | 7520 | + max-width: 776px; |
| 7508 | margin: 0; | 7521 | margin: 0; |
| 7509 | padding: 4px 20px 18px 56px; | 7522 | padding: 4px 20px 18px 56px; |
| 7510 | 7523 | ||
| @@ -7573,11 +7586,11 @@ button.ci-job-last { | |||
| 7573 | color: var(--bad); | 7586 | color: var(--bad); |
| 7574 | } | 7587 | } |
| 7575 | 7588 | ||
| 7576 | - .security-row-title { | 7589 | + .row-title { |
| 7577 | color: var(--bad); | 7590 | color: var(--bad); |
| 7578 | } | 7591 | } |
| 7579 | 7592 | ||
| 7580 | - .security-icon { | 7593 | + .row-icon { |
| 7581 | stroke: var(--bad); | 7594 | stroke: var(--bad); |
| 7582 | } | 7595 | } |
| 7583 | 7596 | ||
| @@ -7589,13 +7602,13 @@ button.ci-job-last { | |||
| 7589 | } | 7602 | } |
| 7590 | 7603 | ||
| 7591 | @media (max-width: 600px) { | 7604 | @media (max-width: 600px) { |
| 7592 | - .security-row { | 7605 | + .row-line { |
| 7593 | align-items: flex-start; | 7606 | align-items: flex-start; |
| 7594 | padding: 14px 16px; | 7607 | padding: 14px 16px; |
| 7595 | } | 7608 | } |
| 7596 | 7609 | ||
| 7597 | // The icon sits on the title's first line (20px box, 1.4 line of 15px) instead of mid-row. | 7610 | // The icon sits on the title's first line (20px box, 1.4 line of 15px) instead of mid-row. |
| 7598 | - .security-row > .security-icon { | 7611 | + .row-line > .row-icon { |
| 7599 | margin-top: 0.5px; | 7612 | margin-top: 0.5px; |
| 7600 | } | 7613 | } |
| 7601 | 7614 | ||
| @@ -7716,8 +7729,10 @@ button.ci-job-last { | |||
| 7716 | gap: 8px; | 7729 | gap: 8px; |
| 7717 | } | 7730 | } |
| 7718 | 7731 | ||
| 7719 | -.srv-form .actions { | 7732 | +.srv-page { |
| 7720 | - margin-top: 16px; | 7733 | + display: flex; |
| 7734 | + flex-direction: column; | ||
| 7735 | + gap: 16px; | ||
| 7721 | } | 7736 | } |
| 7722 | 7737 | ||
| 7723 | // Runner page: the name with its state pill on the left, the actions (back link, restart) on the | 7738 | // Runner page: the name with its state pill on the left, the actions (back link, restart) on the |