forge
Explore
Log in

Don't you dare go Hollow

The contribution calendar returns to the top of the profile overview and the Contributions tab goes

Browse files at this commit

aa3031d53528a28b214810940844dfa290bdc77fAhmet Kaan GümüşParent: 8e56ffc
All checks have passed
Show checks
  • style
    • the contribution calendar returns to the top of the profile overview and the Contributions tab goes
    • the search and sort of a repository list share one aligned toolbar, styles lost with the dashboard are restored, and organization rows line up
    • a runner's page drops its Metrics tab and shows the numbers and charts in a card on top
    • the floating profile panel shows the full name and its menus open on hover
  • feat
    • deleting an organization from the admin pages explains that it goes through its own settings and links there
  • fix
    • page loads no longer stall on open streams: a page closes its streams when it is left, and a tab hidden for three seconds gives them up and catches up when shown
    • a job page's log tail keeps its byte offset, so its stream resumes where it stopped even when the catch-up render is held back or fails
Show full message
💄 style: the contribution calendar returns to the top of the profile overview and the Contributions tab goes; the search and sort of a repository list share one aligned toolbar, styles lost with the dashboard are restored, and organization rows line up; a runner's page drops its Metrics tab and shows the numbers and charts in a card on top; the floating profile panel shows the full name and its menus open on hover; ✨ feat: deleting an organization from the admin pages explains that it goes through its own settings and links there; 🐛 fix: page loads no longer stall on open streams: a page closes its streams when it is left, and a tab hidden for three seconds gives them up and catches up when shown; a job page's log tail keeps its byte offset, so its stream resumes where it stopped even when the catch-up render is held back or fails
.gitignoremodified+1 -0
@@ -14,3 +14,4 @@ ssh_host_ed25519_key
14 14
15 # smoke check deps15 # smoke check deps
16 /scripts/smoke/node_modules16 /scripts/smoke/node_modules
17+__pycache__/
crates/forge-core/src/store/user_delete.rsmodified+1 -1
@@ -247,7 +247,7 @@ async fn plan(conn: &Connection, user_id: &str, ghost_id: Option<&str>) -> Resul
247 .ok_or(Error::NotFound)?;247 .ok_or(Error::NotFound)?;
248 if kind == "org" {248 if kind == "org" {
249 return Err(Error::Conflict(249 return Err(Error::Conflict(
250- "an organization is removed with its own delete, not as a user".into(),250+ "this is an organization: an owner deletes it from its settings page".into(),
251 ));251 ));
252 }252 }
253 if count(conn, LAST_OWNER_OF_ORG, user_id).await? > 0 {253 if count(conn, LAST_OWNER_OF_ORG, user_id).await? > 0 {
crates/forge-web/assets/nav.jsmodified+185 -12
@@ -540,7 +540,7 @@
540 540
541 // One EventSource that stays open. The browser reconnects by itself, except when a proxy answers541 // One EventSource that stays open. The browser reconnects by itself, except when a proxy answers
542 // with an error: EventSource then closes for good, so it is opened again here after 1, 2, then 3 s.542 // with an error: EventSource then closes for good, so it is opened again here after 1, 2, then 3 s.
543- // `restart()` reconnects at once.543+ // `restart()` reconnects at once and `stop()` closes it until the next restart.
544 function keepOpen(url, onOpen, onError, handlers) {544 function keepOpen(url, onOpen, onError, handlers) {
545 var es = null, delay = 1000, timer = null;545 var es = null, delay = 1000, timer = null;
546 function connect() {546 function connect() {
@@ -558,14 +558,18 @@
558 delay = Math.min(delay + 1000, 3000);558 delay = Math.min(delay + 1000, 3000);
559 };559 };
560 }560 }
561+ function stop() {
562+ if (timer) { clearTimeout(timer); timer = null; }
563+ if (es) { es.close(); }
564+ }
561 connect();565 connect();
562 return {566 return {
563 restart: function () {567 restart: function () {
564- if (timer) { clearTimeout(timer); timer = null; }568+ stop();
565- if (es) { es.close(); }
566 delay = 1000;569 delay = 1000;
567 connect();570 connect();
568- }571+ },
572+ stop: stop
569 };573 };
570 }574 }
571 575
@@ -609,6 +613,39 @@
609 if (fresh || !streamUp) { alive.restart(); }613 if (fresh || !streamUp) { alive.restart(); }
610 if (link.down) { armBanner(); }614 if (link.down) { armBanner(); }
611 }615 }
616+ // Over HTTP/1.1 a browser allows six connections to a host, and a stream holds one for as long as it
617+ // is open, so a few tabs would leave none for the next page load. A tab hidden for a while gives up
618+ // its streams and takes them back when shown, then re-renders to catch up on what it missed.
619+ var HIDDEN_CLOSE = 3000; // a quick look at another tab keeps the streams
620+ var hiddenTimer = null;
621+ var streamsAsleep = false; // a hidden tab has closed its streams
622+
623+ function sleepSoon() {
624+ if (hiddenTimer) { return; }
625+ hiddenTimer = setTimeout(function () {
626+ hiddenTimer = null;
627+ if (!document.hidden) { return; }
628+ streamsAsleep = true;
629+ alive.stop();
630+ closeLive();
631+ }, HIDDEN_CLOSE);
632+ }
633+
634+ // The streams reopen first, as the render may be held back or fail. A job page's tail knows the
635+ // offset it reached, so its stream resumes there and the render's own offset replaces it.
636+ function catchUp() {
637+ syncLive();
638+ refreshLive(true);
639+ }
640+
641+ function wakeStreams() {
642+ if (hiddenTimer) { clearTimeout(hiddenTimer); hiddenTimer = null; }
643+ if (!streamsAsleep) { return; }
644+ streamsAsleep = false;
645+ alive.restart();
646+ catchUp();
647+ }
648+
612 if (window.EventSource) {649 if (window.EventSource) {
613 alive = keepOpen('/-/shell/events', aliveOpen, aliveDown, {650 alive = keepOpen('/-/shell/events', aliveOpen, aliveDown, {
614 theme: applyAppearance,651 theme: applyAppearance,
@@ -622,10 +659,24 @@
622 // The viewer's activity changed: the strip, ring and chips are fetched again.659 // The viewer's activity changed: the strip, ring and chips are fetched again.
623 activity: function () { refreshActivity(); }660 activity: function () { refreshActivity(); }
624 });661 });
625- document.addEventListener('visibilitychange', function () { wake(false); });662+ document.addEventListener('visibilitychange', function () {
663+ if (document.hidden) { sleepSoon(); return; }
664+ wakeStreams();
665+ wake(false);
666+ });
667+ if (document.hidden) { sleepSoon(); }
626 document.addEventListener('resume', function () { wake(true); });668 document.addEventListener('resume', function () { wake(true); });
627- window.addEventListener('pageshow', function (e) { leaving = false; if (e.persisted) { wake(true); } });669+ // A page kept in the back-forward cache holds its streams open, so they close on leaving and open
628- window.addEventListener('pagehide', function () { leaving = true; });670+ // again if the page is restored.
671+ window.addEventListener('pageshow', function (e) {
672+ leaving = false;
673+ if (e.persisted) { streamsAsleep = false; wake(true); catchUp(); }
674+ });
675+ window.addEventListener('pagehide', function () {
676+ leaving = true;
677+ alive.stop();
678+ closeLive();
679+ });
629 }680 }
630 if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js').catch(function () {}); }681 if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js').catch(function () {}); }
631 682
@@ -801,6 +852,10 @@
801 if (!p.dragging) {852 if (!p.dragging) {
802 if (Math.hypot(e.clientX - p.x, e.clientY - p.y) < CORNER_SLOP) { return; }853 if (Math.hypot(e.clientX - p.x, e.clientY - p.y) < CORNER_SLOP) { return; }
803 p.dragging = true;854 p.dragging = true;
855+ // A drag ends any hover the mouse started: the menu or the bell closes, and a pending open is dropped.
856+ clearTimeout(hoverTimer);
857+ hoverTimer = 0;
858+ hoverHide();
804 try { p.el.setPointerCapture(p.id); } catch (err) { }859 try { p.el.setPointerCapture(p.id); } catch (err) { }
805 p.el.classList.add('dragging');860 p.el.classList.add('dragging');
806 }861 }
@@ -903,11 +958,113 @@
903 });958 });
904 document.addEventListener('scroll', cornerScrolled, { capture: true, passive: true });959 document.addEventListener('scroll', cornerScrolled, { capture: true, passive: true });
905 960
961+ // A mouse that rests on the profile corner opens its account menu, or the bell popover on the bell,
962+ // after a short rest; when it leaves, the menu or popover it opened closes. Touch and keyboard
963+ // keep the click. hoverOn names what the mouse opened; hoverWait says whether the pending timer
964+ // shows it or hides it.
965+ var HOVER_OPEN = 120; // a mouse rests this long before a menu opens
966+ var HOVER_CLOSE = 250; // and may leave this long, enough to cross the gap to the menu
967+ var hoverOn = null; // 'menu' or 'bell': what the mouse opened
968+ var hoverTimer = 0;
969+ var hoverWait = ''; // 'show' or 'hide': what the pending timer does
970+ var hoverMute = false; // a click on the bell: it stays shut until the mouse leaves the bell
971+
972+ // The part of the corner a node belongs to: 'bell' for the bell and its popover (tested first, as
973+ // the popover sits inside the panel), 'menu' for the rest of the panel, null elsewhere.
974+ function hoverKind(node) {
975+ if (!node || !node.closest) { return null; }
976+ if (node.closest('.corner-bell, .bell-pop')) { return 'bell'; }
977+ if (node.closest('.corner-float')) { return 'menu'; }
978+ return null;
979+ }
980+
981+ // Whether the account menu or the bell popover is open right now.
982+ function hoverIsOpen(kind) {
983+ if (kind === 'menu') {
984+ var details = document.querySelector('details.corner');
985+ return !!(details && details.open);
986+ }
987+ var pop = document.querySelector('.bell-pop');
988+ return !!(pop && isPeekOpen(pop));
989+ }
990+
991+ // Opens the menu or the bell popover for a resting mouse. One the reader opened by click or keyboard
992+ // is left alone.
993+ function hoverShow(kind) {
994+ if (hoverOn && hoverOn !== kind) { hoverHide(); }
995+ if (hoverIsOpen(kind) && hoverOn !== kind) { return; }
996+ if (kind === 'menu') {
997+ var details = document.querySelector('details.corner');
998+ if (details) { details.open = true; }
999+ } else {
1000+ var pop = document.querySelector('.bell-pop');
1001+ try { if (pop) { pop.showPopover(); } } catch (err) { }
1002+ }
1003+ hoverOn = kind;
1004+ }
1005+
1006+ // Closes what the mouse opened, and forgets it.
1007+ function hoverHide() {
1008+ if (hoverOn === 'menu') {
1009+ var details = document.querySelector('details.corner');
1010+ if (details) { details.open = false; }
1011+ } else if (hoverOn === 'bell') {
1012+ var pop = document.querySelector('.bell-pop');
1013+ try { if (pop) { pop.hidePopover(); } } catch (err) { }
1014+ }
1015+ hoverOn = null;
1016+ }
1017+
1018+ // A mouse entering the corner starts a show (a fresh rest each time it moves within it). Leaving the
1019+ // corner cancels a pending show, and starts a hide only when nothing is pending, so moving across the
1020+ // page does not keep pushing the hide back.
1021+ document.addEventListener('pointerover', function (e) {
1022+ if (e.pointerType !== 'mouse' || cornerPress) { return; }
1023+ var kind = hoverKind(e.target);
1024+ if (hoverMute) {
1025+ if (kind === 'bell') { return; }
1026+ hoverMute = false;
1027+ }
1028+ if (kind) {
1029+ clearTimeout(hoverTimer);
1030+ hoverTimer = 0;
1031+ if (kind === hoverOn && hoverIsOpen(kind)) { return; }
1032+ hoverWait = 'show';
1033+ hoverTimer = setTimeout(function () {
1034+ hoverTimer = 0;
1035+ hoverShow(kind);
1036+ }, HOVER_OPEN);
1037+ return;
1038+ }
1039+ if (hoverWait === 'show' && hoverTimer) {
1040+ clearTimeout(hoverTimer);
1041+ hoverTimer = 0;
1042+ }
1043+ if (hoverOn && !hoverTimer) {
1044+ hoverWait = 'hide';
1045+ hoverTimer = setTimeout(function () {
1046+ hoverTimer = 0;
1047+ hoverHide();
1048+ }, HOVER_CLOSE);
1049+ }
1050+ });
1051+
1052+ // A click on the menu's summary, while the mouse holds it open, does nothing: the menu stays open.
1053+ // A chip link inside the summary still goes where it leads. Registered after the drag's swallow
1054+ // listener, so that one runs first.
1055+ window.addEventListener('click', function (e) {
1056+ if (hoverOn !== 'menu' || !e.target || !e.target.closest) { return; }
1057+ if (!e.target.closest('summary.corner-btn') || e.target.closest('a')) { return; }
1058+ e.preventDefault();
1059+ }, true);
1060+
906 // The bell beside the profile corner opens a popover of the newest notifications instead of going1061 // The bell beside the profile corner opens a popover of the newest notifications instead of going
907- // to the inbox. A plain click toggles it; with a modifier or a middle click the link's own1062+ // to the inbox. A touch or keyboard click toggles it; a mouse has already opened it by hovering, so
908- // behaviour stays. The Popover API light-dismisses it and Escape closes it. Its list is fetched1063+ // its click goes to the inbox. With a modifier or a middle click the link's own behaviour stays.
909- // each time it opens (see the toggle handler). The bell and the popover are siblings.1064+ // The Popover API light-dismisses it and Escape closes it. Its list is fetched each time it opens
1065+ // (see the toggle handler). The bell and the popover are siblings.
910 var peekPress = null; // at a press: whether the popover was open (null before any press)1066 var peekPress = null; // at a press: whether the popover was open (null before any press)
1067+ var peekHover = false; // at a press: whether the mouse held the popover open
911 1068
912 function isPeekOpen(pop) {1069 function isPeekOpen(pop) {
913 try { return pop.matches(':popover-open'); } catch (err) { return false; }1070 try { return pop.matches(':popover-open'); } catch (err) { return false; }
@@ -966,6 +1123,7 @@
966 if (!bell) { return; }1123 if (!bell) { return; }
967 var pop = bell.nextElementSibling;1124 var pop = bell.nextElementSibling;
968 peekPress = !!(pop && pop.classList.contains('bell-pop') && isPeekOpen(pop));1125 peekPress = !!(pop && pop.classList.contains('bell-pop') && isPeekOpen(pop));
1126+ peekHover = hoverOn === 'bell';
969 }, true);1127 }, true);
970 1128
971 // Capture on window, so it runs before the soft navigation (capture on document) follows the1129 // Capture on window, so it runs before the soft navigation (capture on document) follows the
@@ -976,6 +1134,11 @@
976 if (!bell) { return; }1134 if (!bell) { return; }
977 var pop = bell.nextElementSibling;1135 var pop = bell.nextElementSibling;
978 if (!pop || !pop.classList.contains('bell-pop')) { return; }1136 if (!pop || !pop.classList.contains('bell-pop')) { return; }
1137+ // The mouse opened the popover by resting on the bell: this click goes to the inbox instead. The
1138+ // press decides, as light dismiss has closed the popover by now.
1139+ clearTimeout(hoverTimer);
1140+ hoverTimer = 0;
1141+ if (peekHover) { peekHover = false; hoverOn = null; peekPress = null; hoverMute = true; return; }
979 e.preventDefault();1142 e.preventDefault();
980 // A keyboard click has no press: the popover's own state decides.1143 // A keyboard click has no press: the popover's own state decides.
981 var was = peekPress === null ? isPeekOpen(pop) : peekPress;1144 var was = peekPress === null ? isPeekOpen(pop) : peekPress;
@@ -995,6 +1158,9 @@
995 if (open) {1158 if (open) {
996 placePeek(bell, pop);1159 placePeek(bell, pop);
997 loadPeek(pop);1160 loadPeek(pop);
1161+ } else if (hoverOn === 'bell') {
1162+ // Closed by Escape or a light dismiss: the mouse no longer holds it open.
1163+ hoverOn = null;
998 }1164 }
999 }, true);1165 }, true);
1000 1166
@@ -1004,6 +1170,10 @@
1004 try { pop.hidePopover(); } catch (err) { }1170 try { pop.hidePopover(); } catch (err) { }
1005 });1171 });
1006 });1172 });
1173+ // A swap that took the mouse's popover or menu away leaves nothing for hover to close.
1174+ document.addEventListener('forge:swapped', function () {
1175+ if (hoverOn && !hoverIsOpen(hoverOn)) { hoverOn = null; }
1176+ });
1007 1177
1008 // Repo home resize: a drag on the separator between the file tree and the README sets the tree's1178 // Repo home resize: a drag on the separator between the file tree and the README sets the tree's
1009 // width, the --tree-w property of the .repo-home grid. The width is kept in localStorage and applied1179 // width, the --tree-w property of the .repo-home grid. The width is kept in localStorage and applied
@@ -2788,12 +2958,13 @@
2788 if (liveTimer) { return; }2958 if (liveTimer) { return; }
2789 liveTimer = setTimeout(function () { liveTimer = null; refreshLive(); }, 1000);2959 liveTimer = setTimeout(function () { liveTimer = null; refreshLive(); }, 1000);
2790 });2960 });
2791- es.addEventListener('log', function (e) { appendLog(e.data); });2961+ es.addEventListener('log', function (e) { appendLog(e.data, e.lastEventId); });
2792 return es;2962 return es;
2793 }2963 }
2794 2964
2795 // Closes the streams the page no longer names and opens the ones it newly names.2965 // Closes the streams the page no longer names and opens the ones it newly names.
2796 function syncLive() {2966 function syncLive() {
2967+ if (streamsAsleep) { return; }
2797 var want = liveWanted();2968 var want = liveWanted();
2798 Object.keys(liveStreams).forEach(function (url) {2969 Object.keys(liveStreams).forEach(function (url) {
2799 if (!want[url]) { liveStreams[url].close(); delete liveStreams[url]; }2970 if (!want[url]) { liveStreams[url].close(); delete liveStreams[url]; }
@@ -2813,9 +2984,11 @@
2813 2984
2814 // Appends streamed log text to the tail as a text node, never as HTML. The tail follows the end2985 // Appends streamed log text to the tail as a text node, never as HTML. The tail follows the end
2815 // only while the reader is already at the end (within 24px). Scrolling back down resumes following.2986 // only while the reader is already at the end (within 24px). Scrolling back down resumes following.
2816- function appendLog(text) {2987+ // The event's id is the log's byte offset after this text: the tail keeps it for the next stream.
2988+ function appendLog(text, offset) {
2817 var pre = document.querySelector('[data-live-log]');2989 var pre = document.querySelector('[data-live-log]');
2818 if (!pre || !text) { return; }2990 if (!pre || !text) { return; }
2991+ if (offset) { pre.setAttribute('data-offset', offset); }
2819 var atEnd = pre.scrollTop + pre.clientHeight >= pre.scrollHeight - 24;2992 var atEnd = pre.scrollTop + pre.clientHeight >= pre.scrollHeight - 24;
2820 if (pre._ci) { logFeed(pre, text); logRefind(pre); }2993 if (pre._ci) { logFeed(pre, text); logRefind(pre); }
2821 else { pre.appendChild(document.createTextNode(text)); }2994 else { pre.appendChild(document.createTextNode(text)); }
crates/forge-web/src/ci/metrics_chart.rsmodified+2 -2
@@ -6,12 +6,12 @@
6 use forge_ci::proto::RunnerSample;6 use forge_ci::proto::RunnerSample;
7 7
8 /// The width of the chart's viewBox. The SVG scales to its container with the aspect kept.8 /// The width of the chart's viewBox. The SVG scales to its container with the aspect kept.
9-pub const VIEW_W: f64 = 700.0;9+pub const VIEW_W: f64 = 360.0;
10 /// The height of the chart's viewBox.10 /// The height of the chart's viewBox.
11 pub const VIEW_H: f64 = 110.0;11 pub const VIEW_H: f64 = 110.0;
12 /// Where the plot starts and ends on the x axis, and its top and bottom on the y axis.12 /// Where the plot starts and ends on the x axis, and its top and bottom on the y axis.
13 pub const X0: f64 = 40.0;13 pub const X0: f64 = 40.0;
14-pub const X1: f64 = 696.0;14+pub const X1: f64 = 356.0;
15 pub const Y0: f64 = 6.0;15 pub const Y0: f64 = 6.0;
16 pub const Y1: f64 = 94.0;16 pub const Y1: f64 = 94.0;
17 /// The time one bucket covers, in milliseconds.17 /// The time one bucket covers, in milliseconds.
crates/forge-web/src/i18n/admin.rsmodified+24 -0
@@ -33,6 +33,7 @@ pub enum K {
33 DatabaseErrorPrefix,33 DatabaseErrorPrefix,
34 DeleteAccountRest,34 DeleteAccountRest,
35 DeletesAccount,35 DeletesAccount,
36+ DeleteOrgTitle,
36 DeleteUser,37 DeleteUser,
37 Directory,38 Directory,
38 Disable,39 Disable,
@@ -180,6 +181,10 @@ pub enum K {
180 TransferOrDeleteFirst,181 TransferOrDeleteFirst,
181 UnknownHost,182 UnknownHost,
182 Users,183 Users,
184+ OpenOrgSettings,
185+ OrgNotAUser,
186+ OrgReposFirst,
187+ ViewOrg,
183 WhatHappens,188 WhatHappens,
184 }189 }
185 190
@@ -253,6 +258,8 @@ pub fn t(lang: Lang, key: K) -> &'static str {
253 }258 }
254 (DeletesAccount, En) => "This deletes the account ",259 (DeletesAccount, En) => "This deletes the account ",
255 (DeletesAccount, Tr) => "Bu işlem ",260 (DeletesAccount, Tr) => "Bu işlem ",
261+ (DeleteOrgTitle, En) => "Delete organization",
262+ (DeleteOrgTitle, Tr) => "Kuruluşu sil",
256 (DeleteUser, En) => "Delete user",263 (DeleteUser, En) => "Delete user",
257 (DeleteUser, Tr) => "Kullanıcıyı sil",264 (DeleteUser, Tr) => "Kullanıcıyı sil",
258 (Directory, En) => "Directory",265 (Directory, En) => "Directory",
@@ -263,6 +270,16 @@ pub fn t(lang: Lang, key: K) -> &'static str {
263 (Disabled, Tr) => "devre dışı",270 (Disabled, Tr) => "devre dışı",
264 (Enable, En) => "Enable",271 (Enable, En) => "Enable",
265 (Enable, Tr) => "Etkinleştir",272 (Enable, Tr) => "Etkinleştir",
273+ (OpenOrgSettings, En) => "Open organization settings",
274+ (OpenOrgSettings, Tr) => "Kuruluş ayarlarını aç",
275+ (OrgNotAUser, En) => {
276+ " is an organization, not a user account, so it cannot be deleted from here. One of its owners deletes it from the organization's settings."
277+ }
278+ (OrgNotAUser, Tr) => {
279+ " bir kuruluştur, kullanıcı hesabı değildir, bu yüzden buradan silinemez. Kuruluşu sahiplerinden biri, kuruluşun ayarlarından siler."
280+ }
281+ (OrgReposFirst, En) => "It can be deleted once it owns no repositories. It still owns:",
282+ (OrgReposFirst, Tr) => "Hiç deposu kalmadığında silinebilir. Hâlâ sahip olduğu depolar:",
266 (ErrAccountCannotBeDeleted, En) => "this account cannot be deleted",283 (ErrAccountCannotBeDeleted, En) => "this account cannot be deleted",
267 (ErrAccountCannotBeDeleted, Tr) => "bu hesap silinemez",284 (ErrAccountCannotBeDeleted, Tr) => "bu hesap silinemez",
268 (ErrBackupsNotConfigured, En) => {285 (ErrBackupsNotConfigured, En) => {
@@ -605,6 +622,8 @@ pub fn t(lang: Lang, key: K) -> &'static str {
605 (UnknownHost, Tr) => "bilinmiyor",622 (UnknownHost, Tr) => "bilinmiyor",
606 (Users, En) => "Users",623 (Users, En) => "Users",
607 (Users, Tr) => "Kullanıcılar",624 (Users, Tr) => "Kullanıcılar",
625+ (ViewOrg, En) => "View organization",
626+ (ViewOrg, Tr) => "Kuruluşu görüntüle",
608 (WhatHappens, En) => "What happens",627 (WhatHappens, En) => "What happens",
609 (WhatHappens, Tr) => "Ne olacak",628 (WhatHappens, Tr) => "Ne olacak",
610 }629 }
@@ -833,11 +852,15 @@ mod tests {
833 K::DatabaseErrorPrefix,852 K::DatabaseErrorPrefix,
834 K::DeleteAccountRest,853 K::DeleteAccountRest,
835 K::DeletesAccount,854 K::DeletesAccount,
855+ K::DeleteOrgTitle,
836 K::DeleteUser,856 K::DeleteUser,
837 K::Directory,857 K::Directory,
838 K::Disable,858 K::Disable,
839 K::Disabled,859 K::Disabled,
840 K::Enable,860 K::Enable,
861+ K::OpenOrgSettings,
862+ K::OrgNotAUser,
863+ K::OrgReposFirst,
841 K::ErrAccountCannotBeDeleted,864 K::ErrAccountCannotBeDeleted,
842 K::ErrBackupsNotConfigured,865 K::ErrBackupsNotConfigured,
843 K::ErrChooseSecurity,866 K::ErrChooseSecurity,
@@ -980,6 +1003,7 @@ mod tests {
980 K::TransferOrDeleteFirst,1003 K::TransferOrDeleteFirst,
981 K::UnknownHost,1004 K::UnknownHost,
982 K::Users,1005 K::Users,
1006+ K::ViewOrg,
983 K::WhatHappens,1007 K::WhatHappens,
984 ];1008 ];
985 1009
crates/forge-web/src/i18n/orgs.rsmodified+0 -4
@@ -121,7 +121,6 @@ pub enum K {
121 PinsTooMany,121 PinsTooMany,
122 NoPinnableRepos,122 NoPinnableRepos,
123 TabOverview,123 TabOverview,
124- TabContributions,
125 Overview,124 Overview,
126 TabStars,125 TabStars,
127 FilterRepos,126 FilterRepos,
@@ -376,8 +375,6 @@ pub fn t(lang: Lang, key: K) -> &'static str {
376 (NoPinnableRepos, Tr) => "Henüz sabitlenecek depo yok.",375 (NoPinnableRepos, Tr) => "Henüz sabitlenecek depo yok.",
377 (TabOverview, En) => "Overview",376 (TabOverview, En) => "Overview",
378 (TabOverview, Tr) => "Genel bakış",377 (TabOverview, Tr) => "Genel bakış",
379- (TabContributions, En) => "Contributions",
380- (TabContributions, Tr) => "Katkılar",
381 (Overview, En) => "Overview",378 (Overview, En) => "Overview",
382 (Overview, Tr) => "Genel bakış",379 (Overview, Tr) => "Genel bakış",
383 (TabStars, En) => "Stars",380 (TabStars, En) => "Stars",
@@ -621,7 +618,6 @@ mod tests {
621 K::PinsTooMany,618 K::PinsTooMany,
622 K::NoPinnableRepos,619 K::NoPinnableRepos,
623 K::TabOverview,620 K::TabOverview,
624- K::TabContributions,
625 K::Overview,621 K::Overview,
626 K::TabStars,622 K::TabStars,
627 K::FilterRepos,623 K::FilterRepos,
crates/forge-web/src/pages/admin_runners.rsmodified+104 -94
@@ -795,15 +795,13 @@ fn sel(on: bool) -> Option<&'static str> {
795 on.then_some("selected")795 on.then_some("selected")
796 }796 }
797 797
798-/// The detail page tabs: slug and the config keys on it. `jobs`, `metrics`, `identity` and `logs` are798+/// The detail page tabs: slug and the config keys on it. `jobs`, `identity` and `logs` are read-only.
799-/// read-only.799+const TABS: [(&str, &[&str]); 7] = [
800-const TABS: [(&str, &[&str]); 8] = [
801 (800 (
802 "general",801 "general",
803 &["concurrency", "labels", "executor", "auto_update"],802 &["concurrency", "labels", "executor", "auto_update"],
804 ),803 ),
805 ("jobs", &[]),804 ("jobs", &[]),
806- ("metrics", &[]),
807 (805 (
808 "limits",806 "limits",
809 &[807 &[
@@ -837,7 +835,6 @@ fn tab_label(lang: Lang, slug: &str) -> &'static str {
837 "sandbox" => s(lang, "Sandbox", "Kum havuzu"),835 "sandbox" => s(lang, "Sandbox", "Kum havuzu"),
838 "logs" => s(lang, "Logs", "Günlük"),836 "logs" => s(lang, "Logs", "Günlük"),
839 "jobs" => s(lang, "Jobs", "İşler"),837 "jobs" => s(lang, "Jobs", "İşler"),
840- "metrics" => s(lang, "Metrics", "Ölçümler"),
841 _ => s(lang, "Identity", "Kimlik"),838 _ => s(lang, "Identity", "Kimlik"),
842 }839 }
843 }840 }
@@ -1243,9 +1240,8 @@ async fn runner_job_rows(
1243 ))1240 ))
1244 }1241 }
1245 1242
1246-/// The metrics tab: three graphs over the last hour and the table of their buckets.1243+/// The metrics on the runner page: three graphs over the last hour and the table of their buckets.
1247-#[derive(Default)]1244+struct MetricsView {
1248-struct MetricsTab {
1249 /// True when no sample falls in the last hour.1245 /// True when no sample falls in the last hour.
1250 empty: bool,1246 empty: bool,
1251 charts: Vec<MxChart>,1247 charts: Vec<MxChart>,
@@ -1451,7 +1447,7 @@ fn mx_chart(
1451 }1447 }
1452 1448
1453 /// The three graphs of a runner's samples as of `now_ms`, with the table of their buckets.1449 /// The three graphs of a runner's samples as of `now_ms`, with the table of their buckets.
1454-fn metrics_tab(lang: Lang, samples: &[RunnerSample], now_ms: i64) -> MetricsTab {1450+fn metrics_view(lang: Lang, samples: &[RunnerSample], now_ms: i64) -> MetricsView {
1455 let points = metrics_chart::chart_points(samples, now_ms);1451 let points = metrics_chart::chart_points(samples, now_ms);
1456 let latest = points.iter().rev().flatten().next().copied();1452 let latest = points.iter().rev().flatten().next().copied();
1457 let empty = latest.is_none();1453 let empty = latest.is_none();
@@ -1526,7 +1522,7 @@ fn metrics_tab(lang: Lang, samples: &[RunnerSample], now_ms: i64) -> MetricsTab
1526 tx: rate_text(b.tx),1522 tx: rate_text(b.tx),
1527 })1523 })
1528 .collect();1524 .collect();
1529- MetricsTab {1525+ MetricsView {
1530 empty,1526 empty,
1531 charts: vec![cpu, mem, net],1527 charts: vec![cpu, mem, net],
1532 rows,1528 rows,
@@ -1553,7 +1549,7 @@ async fn runner_detail_view(
1553 log: Vec<LogRow>,1549 log: Vec<LogRow>,
1554 running_jobs: Vec<RunnerJobRow>,1550 running_jobs: Vec<RunnerJobRow>,
1555 recent_jobs: Vec<RunnerJobRow>,1551 recent_jobs: Vec<RunnerJobRow>,
1556- metrics: MetricsTab,1552+ metrics: MetricsView,
1557 ) -> Result<impl View> {1553 ) -> Result<impl View> {
1558 let version = or_dash(runner.reported.version.clone().unwrap_or_default());1554 let version = or_dash(runner.reported.version.clone().unwrap_or_default());
1559 let cpus = or_dash(1555 let cpus = or_dash(
@@ -1586,10 +1582,27 @@ async fn runner_detail_view(
1586 };1582 };
1587 let shown = detail_fields(lang, tab, &fields);1583 let shown = detail_fields(lang, tab, &fields);
1588 let identity = identity_rows(lang, &fields);1584 let identity = identity_rows(lang, &fields);
1589- let editing = !matches!(tab, "identity" | "logs" | "jobs" | "metrics");1585+ let editing = !matches!(tab, "identity" | "logs" | "jobs");
1590 let jobs_href = format!("{}?tab=jobs", row.detail_href);1586 let jobs_href = format!("{}?tab=jobs", row.detail_href);
1591 let save_action = format!("{}/settings", row.detail_href);1587 let save_action = format!("{}/settings", row.detail_href);
1592 let reset_action = row.config_action.clone();1588 let reset_action = row.config_action.clone();
1589+ // The facts under each graph's caption. Memory's total is in its caption once a sample exists,
1590+ // so the memory facts name the total only when there is none.
1591+ let cpu_facts = format!("{cpus} {}", s(lang, "CPUs", "CPU"));
1592+ let budget_facts = format!(
1593+ "{} {budget_text} · {} {reserved_text} · {} {free_text}",
1594+ s(lang, "Budget", "Bütçe"),
1595+ s(lang, "Reserved", "Ayrılan"),
1596+ s(lang, "Free to admit", "Alınabilir"),
1597+ );
1598+ let mem_facts = if metrics.empty {
1599+ format!("{memory} · {budget_facts}")
1600+ } else {
1601+ budget_facts
1602+ };
1603+ let facts = [cpu_facts, mem_facts, String::new()];
1604+ // A runner that has reported nothing has no figures to show, only the note below.
1605+ let has_host = !metrics.empty || runner.reported.cpus.is_some();
1593 Ok(view! {1606 Ok(view! {
1594 <div data-live="/admin/runners/events">1607 <div data-live="/admin/runners/events">
1595 <section class="page-head">1608 <section class="page-head">
@@ -1612,18 +1625,89 @@ async fn runner_detail_view(
1612 <section class="card notice" role="status">(text)</section>1625 <section class="card notice" role="status">(text)</section>
1613 }1626 }
1614 }1627 }
1615- <section class="card">1628+ <section class="card runner-overview">
1616 <div class="srv-grid srv-stats">1629 <div class="srv-grid srv-stats">
1617 <div class="srv-field"><span class="srv-label">(s(lang, "Running jobs", "Çalışan işler"))</span><strong><a href=(jobs_href.as_str())>(in_use.as_str())</a></strong></div>1630 <div class="srv-field"><span class="srv-label">(s(lang, "Running jobs", "Çalışan işler"))</span><strong><a href=(jobs_href.as_str())>(in_use.as_str())</a></strong></div>
1618 <div class="srv-field"><span class="srv-label">(g::t(lang, K::LastSeen))</span><strong title=(row.last_seen_full.as_str())><time data-rel="true" datetime=(row.last_seen_at.as_str())>(row.last_seen.as_str())</time></strong></div>1631 <div class="srv-field"><span class="srv-label">(g::t(lang, K::LastSeen))</span><strong title=(row.last_seen_full.as_str())><time data-rel="true" datetime=(row.last_seen_at.as_str())>(row.last_seen.as_str())</time></strong></div>
1619 <div class="srv-field"><span class="srv-label">(s(lang, "Build", "Derleme"))</span><strong class="runner-build-stat" title=(row.build.as_str())>(if row.build_short.is_empty() { "-" } else { row.build_short.as_str() })<span class=(format!("ci-state {}", row.build_class))>(row.build_label)</span></strong></div>1632 <div class="srv-field"><span class="srv-label">(s(lang, "Build", "Derleme"))</span><strong class="runner-build-stat" title=(row.build.as_str())>(if row.build_short.is_empty() { "-" } else { row.build_short.as_str() })<span class=(format!("ci-state {}", row.build_class))>(row.build_label)</span></strong></div>
1620 <div class="srv-field"><span class="srv-label">(s(lang, "Runner version", "Çalıştırıcı sürümü"))</span><strong>(version.as_str())</strong></div>1633 <div class="srv-field"><span class="srv-label">(s(lang, "Runner version", "Çalıştırıcı sürümü"))</span><strong>(version.as_str())</strong></div>
1621- <div class="srv-field"><span class="srv-label">(s(lang, "CPUs", "CPU sayısı"))</span><strong>(cpus.as_str())</strong></div>
1622- <div class="srv-field"><span class="srv-label">(s(lang, "Memory", "Bellek"))</span><strong>(memory.as_str())</strong></div>
1623- <div class="srv-field"><span class="srv-label">(s(lang, "Memory budget", "Bellek bütçesi"))</span><strong>(budget_text.as_str())</strong></div>
1624- <div class="srv-field"><span class="srv-label">(s(lang, "Reserved", "Ayrılan"))</span><strong>(reserved_text.as_str())</strong></div>
1625- <div class="srv-field"><span class="srv-label">(s(lang, "Free to admit", "Alınabilir"))</span><strong>(free_text.as_str())</strong></div>
1626 </div>1634 </div>
1635+ if has_host {
1636+ <div class="mx-panels">
1637+ for (c, fact) in metrics.charts.iter().zip(facts.iter()) {
1638+ <div class="mx-panel">
1639+ <div class="mx-head">
1640+ <p class="mx-caption">(c.caption.as_str())</p>
1641+ if !fact.is_empty() {
1642+ <p class="muted small mx-facts">(fact.as_str())</p>
1643+ }
1644+ if !c.legend.is_empty() {
1645+ <ul class="mx-legend">
1646+ for (key, text) in c.legend.iter() {
1647+ <li><span class=(*key) aria-hidden="true"></span>(*text)</li>
1648+ }
1649+ </ul>
1650+ }
1651+ </div>
1652+ if !metrics.empty {
1653+ <svg class="mx-svg" viewBox=(c.view_box.as_str()) role="img" aria-label=(c.aria)>
1654+ for y in c.grids.iter() {
1655+ <line class="mx-grid" x1=(c.x0.as_str()) x2=(c.x1.as_str()) y1=(y.as_str()) y2=(y.as_str())/>
1656+ }
1657+ for (x, w) in c.bands.iter() {
1658+ <rect class="mx-band" x=(x.as_str()) y=(c.y0.as_str()) width=(w.as_str()) height=(c.band_h.as_str())/>
1659+ }
1660+ for (y, text) in c.ticks.iter() {
1661+ <text class="mx-axis" x=(c.tick_x.as_str()) y=(y.as_str()) text-anchor="end" dominant-baseline="middle">(text.as_str())</text>
1662+ }
1663+ for p in c.paths.iter() {
1664+ <path class=(p.class) d=(p.d.as_str())/>
1665+ }
1666+ <text class="mx-axis" x=(c.x0.as_str()) y="106">(s(lang, "-60 min", "-60 dk"))</text>
1667+ <text class="mx-axis" x=(c.mid.as_str()) y="106" text-anchor="middle">(s(lang, "-30 min", "-30 dk"))</text>
1668+ <text class="mx-axis" x=(c.x1.as_str()) y="106" text-anchor="end">(s(lang, "now", "şimdi"))</text>
1669+ for hit in c.hits.iter() {
1670+ <g class="mx-hit">
1671+ <title>(hit.title.as_str())</title>
1672+ <rect class="mx-hit-area" x=(hit.x.as_str()) y=(c.y0.as_str()) width=(hit.w.as_str()) height=(c.band_h.as_str())/>
1673+ <line class="mx-cross" x1=(hit.cx.as_str()) x2=(hit.cx.as_str()) y1=(c.y0.as_str()) y2=(c.y1.as_str())/>
1674+ <g class="mx-tip">
1675+ <rect x=(hit.tip_x.as_str()) y=(hit.tip_y.as_str()) width=(hit.tip_w.as_str()) height=(hit.tip_h.as_str()) rx="4"/>
1676+ for line in hit.lines.iter() {
1677+ <text x=(line.x.as_str()) y=(line.y.as_str())>(line.text.as_str())</text>
1678+ }
1679+ </g>
1680+ </g>
1681+ }
1682+ </svg>
1683+ }
1684+ </div>
1685+ }
1686+ </div>
1687+ }
1688+ if metrics.empty {
1689+ <p class="muted small">(s(lang, "No metrics yet. A runner sends them from this version on; an older one sends nothing.", "Henüz ölçüm yok. Ölçümleri bu sürümden itibaren çalıştırıcı gönderir; eski sürüm hiçbir şey göndermez."))</p>
1690+ } else {
1691+ <details class="mx-table">
1692+ <summary>(s(lang, "Show as table", "Tablo olarak göster"))</summary>
1693+ <div class="table-wrap mx-table-scroll">
1694+ <table class="table">
1695+ <thead><tr><th>(s(lang, "Time (UTC)", "Saat (UTC)"))</th><th>(s(lang, "CPU", "CPU"))</th><th>(s(lang, "Memory", "Bellek"))</th><th>(s(lang, "Received", "Alınan"))</th><th>(s(lang, "Sent", "Gönderilen"))</th></tr></thead>
1696+ <tbody>
1697+ for row in metrics.rows.iter() {
1698+ <tr>
1699+ <td class="nowrap">(row.time.as_str())</td>
1700+ <td class="nowrap">(row.cpu.as_str())</td>
1701+ <td class="nowrap">(row.mem.as_str())</td>
1702+ <td class="nowrap">(row.rx.as_str())</td>
1703+ <td class="nowrap">(row.tx.as_str())</td>
1704+ </tr>
1705+ }
1706+ </tbody>
1707+ </table>
1708+ </div>
1709+ </details>
1710+ }
1627 </section>1711 </section>
1628 <nav class="subnav" aria-label=(s(lang, "Configuration", "Yapılandırma"))>1712 <nav class="subnav" aria-label=(s(lang, "Configuration", "Yapılandırma"))>
1629 for (slug, _) in TABS.iter() {1713 for (slug, _) in TABS.iter() {
@@ -1689,76 +1773,6 @@ async fn runner_detail_view(
1689 }1773 }
1690 </pre>1774 </pre>
1691 }1775 }
1692- } else if tab == "metrics" {
1693- if metrics.empty {
1694- <p class="muted small">(s(lang, "No metrics yet. A runner sends them from this version on; an older one sends nothing.", "Henüz ölçüm yok. Ölçümleri bu sürümden itibaren çalıştırıcı gönderir; eski sürüm hiçbir şey göndermez."))</p>
1695- } else {
1696- <div class="mx-stack">
1697- for c in metrics.charts.iter() {
1698- <div class="mx-row">
1699- <div class="mx-head">
1700- <p class="mx-caption">(c.caption.as_str())</p>
1701- if !c.legend.is_empty() {
1702- <ul class="mx-legend">
1703- for (key, text) in c.legend.iter() {
1704- <li><span class=(*key) aria-hidden="true"></span>(*text)</li>
1705- }
1706- </ul>
1707- }
1708- </div>
1709- <svg class="mx-svg" viewBox=(c.view_box.as_str()) role="img" aria-label=(c.aria)>
1710- for y in c.grids.iter() {
1711- <line class="mx-grid" x1=(c.x0.as_str()) x2=(c.x1.as_str()) y1=(y.as_str()) y2=(y.as_str())/>
1712- }
1713- for (x, w) in c.bands.iter() {
1714- <rect class="mx-band" x=(x.as_str()) y=(c.y0.as_str()) width=(w.as_str()) height=(c.band_h.as_str())/>
1715- }
1716- for (y, text) in c.ticks.iter() {
1717- <text class="mx-axis" x=(c.tick_x.as_str()) y=(y.as_str()) text-anchor="end" dominant-baseline="middle">(text.as_str())</text>
1718- }
1719- for p in c.paths.iter() {
1720- <path class=(p.class) d=(p.d.as_str())/>
1721- }
1722- <text class="mx-axis" x=(c.x0.as_str()) y="106">(s(lang, "-60 min", "-60 dk"))</text>
1723- <text class="mx-axis" x=(c.mid.as_str()) y="106" text-anchor="middle">(s(lang, "-30 min", "-30 dk"))</text>
1724- <text class="mx-axis" x=(c.x1.as_str()) y="106" text-anchor="end">(s(lang, "now", "şimdi"))</text>
1725- for hit in c.hits.iter() {
1726- <g class="mx-hit">
1727- <title>(hit.title.as_str())</title>
1728- <rect class="mx-hit-area" x=(hit.x.as_str()) y=(c.y0.as_str()) width=(hit.w.as_str()) height=(c.band_h.as_str())/>
1729- <line class="mx-cross" x1=(hit.cx.as_str()) x2=(hit.cx.as_str()) y1=(c.y0.as_str()) y2=(c.y1.as_str())/>
1730- <g class="mx-tip">
1731- <rect x=(hit.tip_x.as_str()) y=(hit.tip_y.as_str()) width=(hit.tip_w.as_str()) height=(hit.tip_h.as_str()) rx="4"/>
1732- for line in hit.lines.iter() {
1733- <text x=(line.x.as_str()) y=(line.y.as_str())>(line.text.as_str())</text>
1734- }
1735- </g>
1736- </g>
1737- }
1738- </svg>
1739- </div>
1740- }
1741- </div>
1742- <details class="mx-table">
1743- <summary>(s(lang, "Show as table", "Tablo olarak göster"))</summary>
1744- <div class="table-wrap mx-table-scroll">
1745- <table class="table">
1746- <thead><tr><th>(s(lang, "Time (UTC)", "Saat (UTC)"))</th><th>(s(lang, "CPU", "CPU"))</th><th>(s(lang, "Memory", "Bellek"))</th><th>(s(lang, "Received", "Alınan"))</th><th>(s(lang, "Sent", "Gönderilen"))</th></tr></thead>
1747- <tbody>
1748- for row in metrics.rows.iter() {
1749- <tr>
1750- <td class="nowrap">(row.time.as_str())</td>
1751- <td class="nowrap">(row.cpu.as_str())</td>
1752- <td class="nowrap">(row.mem.as_str())</td>
1753- <td class="nowrap">(row.rx.as_str())</td>
1754- <td class="nowrap">(row.tx.as_str())</td>
1755- </tr>
1756- }
1757- </tbody>
1758- </table>
1759- </div>
1760- </details>
1761- }
1762 } else if tab == "jobs" {1776 } else if tab == "jobs" {
1763 <h2>(s(lang, "Running now", "Şu an çalışan"))</h2>1777 <h2>(s(lang, "Running now", "Şu an çalışan"))</h2>
1764 if running_jobs.is_empty() {1778 if running_jobs.is_empty() {
@@ -1848,12 +1862,8 @@ async fn runner_detail_page(cx: &Cx) -> Result<impl View> {
1848 } else {1862 } else {
1849 (Vec::new(), Vec::new())1863 (Vec::new(), Vec::new())
1850 };1864 };
1851- let metrics = if tab == "metrics" {1865+ let samples = state.runner_metrics.samples(&runner.id);
1852- let samples = state.runner_metrics.samples(&runner.id);1866+ let metrics = metrics_view(lang, &samples, now_unix().saturating_mul(1000));
1853- metrics_tab(lang, &samples, now_unix().saturating_mul(1000))
1854- } else {
1855- MetricsTab::default()
1856- };
1857 let title = runner.name.clone();1867 let title = runner.name.clone();
1858 Ok(view! {1868 Ok(view! {
1859 shell(title: title.as_str(), viewer: Some(&viewer), runner_detail_view(lang: lang, csrf: csrf, runner: runner.clone(), row: row, fields: fields, notice: notice, tab: tab, log: log, running_jobs: running_jobs, recent_jobs: recent_jobs, metrics: metrics))1869 shell(title: title.as_str(), viewer: Some(&viewer), runner_detail_view(lang: lang, csrf: csrf, runner: runner.clone(), row: row, fields: fields, notice: notice, tab: tab, log: log, running_jobs: running_jobs, recent_jobs: recent_jobs, metrics: metrics))
crates/forge-web/src/pages/admin_users.rsmodified+65 -8
@@ -1,6 +1,7 @@
1 //! Page: admin user management (`/admin/users`). Non-admins get 404.1 //! Page: admin user management (`/admin/users`). Non-admins get 404.
2 2
3 use forge_core::names::{normalize_name, validate_username};3 use forge_core::names::{normalize_name, validate_username};
4+use forge_core::store::orgs::OrgMemberRole;
4 use forge_core::store::user_delete::{DeletionReport, GHOST_USERNAME};5 use forge_core::store::user_delete::{DeletionReport, GHOST_USERNAME};
5 use forge_core::{AuditAction, Session, Store, User};6 use forge_core::{AuditAction, Session, Store, User};
6 use serde::Deserialize;7 use serde::Deserialize;
@@ -264,6 +265,16 @@ struct Impact {
264 removed: Vec<String>,265 removed: Vec<String>,
265 }266 }
266 267
268+/// The `owner/name` of every repository `owner` owns.
269+async fn owned_repo_names(store: &Store, owner: &User) -> Result<Vec<String>> {
270+ Ok(store
271+ .list_repos_by_owner(&owner.id)
272+ .await?
273+ .into_iter()
274+ .map(|repo| format!("{}/{}", repo.owner_name, repo.name))
275+ .collect())
276+}
277+
267 /// The owned repositories of `target` (listed when non-empty) and either its impact or the278 /// The owned repositories of `target` (listed when non-empty) and either its impact or the
268 /// refusal message. Changes nothing and does not create the ghost account.279 /// refusal message. Changes nothing and does not create the ghost account.
269 async fn review_target(280 async fn review_target(
@@ -271,12 +282,7 @@ async fn review_target(
271 target: &User,282 target: &User,
272 lang: Lang,283 lang: Lang,
273 ) -> Result<(Vec<String>, std::result::Result<Impact, String>)> {284 ) -> Result<(Vec<String>, std::result::Result<Impact, String>)> {
274- let repos = store285+ let repos = owned_repo_names(store, target).await?;
275- .list_repos_by_owner(&target.id)
276- .await?
277- .into_iter()
278- .map(|repo| format!("{}/{}", repo.owner_name, repo.name))
279- .collect();
280 let ghost_id = store.user_by_username(GHOST_USERNAME).await?.map(|g| g.id);286 let ghost_id = store.user_by_username(GHOST_USERNAME).await?.map(|g| g.id);
281 let outcome = match store287 let outcome = match store
282 .deletion_preview(&target.id, ghost_id.as_deref())288 .deletion_preview(&target.id, ghost_id.as_deref())
@@ -356,6 +362,44 @@ async fn delete_body(
356 })362 })
357 }363 }
358 364
365+/// An organization is not a person: this points at its own settings instead of offering a delete.
366+#[component]
367+async fn org_delete_note(
368+ lang: Lang,
369+ target: User,
370+ repos: Vec<String>,
371+ is_owner: bool,
372+) -> Result<impl View> {
373+ let has_repos = !repos.is_empty();
374+ let settings = format!("/org/{}/settings", enc(&target.username));
375+ let profile = format!("/{}", enc(&target.username));
376+ Ok(view! {
377+ <section class="page-head">
378+ <h1>(g::t(lang, K::DeleteOrgTitle))</h1>
379+ </section>
380+ <section class="card">
381+ <p><strong>(target.username.as_str())</strong>(g::t(lang, K::OrgNotAUser))</p>
382+ if has_repos {
383+ <p>(g::t(lang, K::OrgReposFirst))</p>
384+ <ul class="item-list">
385+ for name in repos.into_iter() {
386+ <li>(name)</li>
387+ }
388+ </ul>
389+ }
390+ <p>
391+ if is_owner {
392+ <a href=(settings.as_str())>(g::t(lang, K::OpenOrgSettings))</a>
393+ } else {
394+ <a href=(profile.as_str())>(g::t(lang, K::ViewOrg))</a>
395+ }
396+ " · "
397+ <a href="/admin/users">(g::t(lang, K::BackToUsers))</a>
398+ </p>
399+ </section>
400+ })
401+}
402+
359 #[page("/admin/users/{user_id}/delete")]403 #[page("/admin/users/{user_id}/delete")]
360 async fn user_delete_page(cx: &Cx) -> Result<impl View> {404 async fn user_delete_page(cx: &Cx) -> Result<impl View> {
361 let viewer = admin_only(cx).await?;405 let viewer = admin_only(cx).await?;
@@ -376,10 +420,19 @@ async fn user_delete_page(cx: &Cx) -> Result<impl View> {
376 Ok(impact) => (Some(impact), None),420 Ok(impact) => (Some(impact), None),
377 Err(message) => (None, Some(message)),421 Err(message) => (None, Some(message)),
378 };422 };
423+ let is_org = target.is_org();
424+ let is_owner = is_org
425+ && store.org_member_role(&target.id, &viewer.0.id).await? == Some(OrgMemberRole::Owner);
379 let csrf = viewer.1.csrf_token.clone();426 let csrf = viewer.1.csrf_token.clone();
380- let title = g::t(lang, K::DeleteUser);427+ let title = if is_org {
428+ g::t(lang, K::DeleteOrgTitle)
429+ } else {
430+ g::t(lang, K::DeleteUser)
431+ };
381 Ok(view! {432 Ok(view! {
382- shell(title: title, viewer: Some(&viewer), delete_body(lang: lang, csrf: csrf.as_str(), target: target, repos: repos, impact: impact, refusal: refusal, error: None))433+ shell(title: title, viewer: Some(&viewer),
434+ if is_org { org_delete_note(lang: lang, target: target.clone(), repos: repos.clone(), is_owner: is_owner) }
435+ else { delete_body(lang: lang, csrf: csrf.as_str(), target: target, repos: repos, impact: impact, refusal: refusal, error: None) })
383 })436 })
384 }437 }
385 438
@@ -401,6 +454,10 @@ async fn user_delete(cx: &Cx, Form(form): Form<DeleteForm>) -> Result<impl View>
401 if is_ghost(&target) {454 if is_ghost(&target) {
402 return Err(not_found().into());455 return Err(not_found().into());
403 }456 }
457+ if target.is_org() {
458+ // The note with its links is on the GET page: send the browser there.
459+ return Err(see_other(&format!("/admin/users/{}/delete", enc(&target.id))).into());
460+ }
404 let error = if form.confirm_username != target.username {461 let error = if form.confirm_username != target.username {
405 Some(g::t(lang, K::ErrTypeUsernameExactly).to_owned())462 Some(g::t(lang, K::ErrTypeUsernameExactly).to_owned())
406 } else {463 } else {
crates/forge-web/src/pages/explore.rsmodified+4 -2
@@ -218,8 +218,10 @@ async fn explore_body(
218 <input type="hidden" name="sort" value=(sort)>218 <input type="hidden" name="sort" value=(sort)>
219 <button type="submit">(g::t(lang, K::Search))</button>219 <button type="submit">(g::t(lang, K::Search))</button>
220 </form>220 </form>
221- sort_chips(links: sort_links, lang: lang)221+ <div class="repo-subbar">
222- <p class="muted small">(g::repo_count(lang, total))</p>222+ sort_chips(links: sort_links, lang: lang)
223+ <p class="muted small repo-count">(g::repo_count(lang, total))</p>
224+ </div>
223 if empty {225 if empty {
224 empty_state(title: g::t(lang, K::NoPublicReposMatch),226 empty_state(title: g::t(lang, K::NoPublicReposMatch),
225 if has_search {227 if has_search {
crates/forge-web/src/pages/profile.rsmodified+41 -52
@@ -1,8 +1,7 @@
1 //! Page: public profile at `/{username}`. Avatar, about (rendered markdown) and local time, then1 //! Page: public profile at `/{username}`. Avatar, about (rendered markdown) and local time, then
2 //! the tabs: `overview` (pinned repos, or the most recently active ones when nothing is pinned,2 //! the tabs: `overview` (pinned repos, or the most recently active ones when nothing is pinned,
3-//! plus an organization's members and teams), `contributions` (people only: the contribution3+//! plus a person's contribution calendar, or an organization's members and teams), `repositories`,
4-//! calendar and the selected day's list), `repositories`, `snippets` (people only), `stars`,4+//! `snippets` (people only), `stars`, `packages` and `organizations` (the viewer's own only). The
5-//! `packages` and `organizations` (the viewer's own only). The
6 //! repo tabs list what the viewer is allowed to read, 30 per page, with a name filter and three5 //! repo tabs list what the viewer is allowed to read, 30 per page, with a name filter and three
7 //! sort orders; the filtering, sorting and paging run in the database. Fixed single-segment routes6 //! sort orders; the filtering, sorting and paging run in the database. Fixed single-segment routes
8 //! are registered statically, so they win over this parameter route.7 //! are registered statically, so they win over this parameter route.
@@ -56,7 +55,7 @@ struct ProfileQuery {
56 q: Option<String>,55 q: Option<String>,
57 sort: Option<String>,56 sort: Option<String>,
58 page: Option<String>,57 page: Option<String>,
59- /// A calendar day whose contributions to list under the calendar on the contributions tab.58+ /// A calendar day whose contributions to list under the calendar on the overview.
60 day: Option<String>,59 day: Option<String>,
61 }60 }
62 61
@@ -100,14 +99,10 @@ async fn profile_page(cx: &Cx) -> Result<impl View> {
100 let lang = i18n::lang(cx, actor);99 let lang = i18n::lang(cx, actor);
101 // Whether the viewer is this person. Only the person sees their Organizations tab and edit links.100 // Whether the viewer is this person. Only the person sees their Organizations tab and edit links.
102 let own =!user.is_org() && actor.is_some_and(|u| u.id == user.id);101 let own =!user.is_org() && actor.is_some_and(|u| u.id == user.id);
103- // A `?day=` link with no tab predates the Contributions tab, so it opens that tab.102+ let tab = tab_key(query.tab.as_deref());
104- let tab = match query.tab.as_deref() {103+ // An organization cannot be starred or keep snippets, so those tabs show the overview instead.
105- None if query.day.is_some() => "contributions",104+ // The Organizations tab is the viewer's own, so anyone else gets the overview.
106- raw => tab_key(raw),105+ let tab = if (user.is_org() && matches!(tab, "stars" | "snippets"))
107- };
108- // An organization cannot be starred, keep snippets or have a calendar, so those tabs show the
109- // overview instead. The Organizations tab is the viewer's own, so anyone else gets the overview.
110- let tab = if (user.is_org() && matches!(tab, "stars" | "snippets" | "contributions"))
111 || (tab == "organizations" && !own)106 || (tab == "organizations" && !own)
112 {107 {
113 "overview"108 "overview"
@@ -187,9 +182,9 @@ async fn profile_page(cx: &Cx) -> Result<impl View> {
187 }182 }
188 });183 });
189 184
190- // The contribution calendar on its tab, for a person only. Its counts and day links use public185+ // The contribution calendar on the overview, for a person only. Its counts and day links use
191- // repos alone, so anyone may see it.186+ // public repos alone, so anyone may see it.
192- let heat = if tab == "contributions" && !user.is_org() {187+ let heat = if tab == "overview" && !user.is_org() {
193 Some(load_calendar(state, &user, query.day.as_deref()).await?)188 Some(load_calendar(state, &user, query.day.as_deref()).await?)
194 } else {189 } else {
195 None190 None
@@ -383,7 +378,7 @@ async fn profile_fingerprint(
383 let teams = state.store.teams_for_org(&user.id).await?.len();378 let teams = state.store.teams_for_org(&user.id).await?.len();
384 lines.push(format!("org {members} {teams}"));379 lines.push(format!("org {members} {teams}"));
385 } else {380 } else {
386- // The Contributions tab shows a person's calendar, so its total moves with each one.381+ // The overview shows a person's calendar, so its total moves with each one.
387 let total: u64 = state382 let total: u64 = state
388 .store383 .store
389 .contribution_counts(&user.id, &calendar_since(), &user.timezone)384 .contribution_counts(&user.id, &calendar_since(), &user.timezone)
@@ -456,7 +451,6 @@ struct Listing {
456 fn tab_key(raw: Option<&str>) -> &'static str {451 fn tab_key(raw: Option<&str>) -> &'static str {
457 match raw {452 match raw {
458 Some("repositories") => "repositories",453 Some("repositories") => "repositories",
459- Some("contributions") => "contributions",
460 Some("snippets") => "snippets",454 Some("snippets") => "snippets",
461 Some("stars") => "stars",455 Some("stars") => "stars",
462 Some("packages") => "packages",456 Some("packages") => "packages",
@@ -575,8 +569,6 @@ async fn profile_card(
575 let is_org = user.is_org();569 let is_org = user.is_org();
576 let base = format!("/{}", enc(&user.username));570 let base = format!("/{}", enc(&user.username));
577 let overview_on = tab == "overview";571 let overview_on = tab == "overview";
578- let contributions_on = tab == "contributions";
579- let contributions_href = profile_href(&user.username, "contributions", "", SORTS[0].0, 1);
580 let repos_on = tab == "repositories";572 let repos_on = tab == "repositories";
581 let stars_on = tab == "stars";573 let stars_on = tab == "stars";
582 let list_on = repos_on || stars_on;574 let list_on = repos_on || stars_on;
@@ -643,9 +635,6 @@ async fn profile_card(
643 }635 }
644 <nav class="profile-tabs" aria-label=(user.username.as_str())>636 <nav class="profile-tabs" aria-label=(user.username.as_str())>
645 <a class=(tab_class(overview_on)) href=(overview_href.as_str())>(g::t(lang, K::TabOverview))</a>637 <a class=(tab_class(overview_on)) href=(overview_href.as_str())>(g::t(lang, K::TabOverview))</a>
646- if !is_org {
647- <a class=(tab_class(contributions_on)) href=(contributions_href.as_str())>(g::t(lang, K::TabContributions))</a>
648- }
649 <a class=(tab_class(repos_on)) href=(repositories_href.as_str())>638 <a class=(tab_class(repos_on)) href=(repositories_href.as_str())>
650 (g::t(lang, K::Repositories)) " " <span class="tab-count">(repo_count_text.as_str())</span>639 (g::t(lang, K::Repositories)) " " <span class="tab-count">(repo_count_text.as_str())</span>
651 </a>640 </a>
@@ -674,6 +663,9 @@ async fn profile_card(
674 }663 }
675 </nav>664 </nav>
676 if overview_on {665 if overview_on {
666+ if let Some((calendar, selected)) = heat {
667+ contribution_calendar(calendar: calendar, selected: selected, lang: lang, base: base.clone())
668+ }
677 <section class="profile-pinned">669 <section class="profile-pinned">
678 <div class="profile-section-head">670 <div class="profile-section-head">
679 <h2>(pinned_heading)</h2>671 <h2>(pinned_heading)</h2>
@@ -718,27 +710,24 @@ async fn profile_card(
718 </section>710 </section>
719 }711 }
720 }712 }
721- if contributions_on {
722- if let Some((calendar, selected)) = heat {
723- contribution_calendar(calendar: calendar, selected: selected, lang: lang, base: base.clone())
724- }
725- }
726 if list_on {713 if list_on {
727 <section class="repo-listing">714 <section class="repo-listing">
728- if own_profile && repos_on {715+ <div class="repo-tools">
729- <div class="profile-section-head">716+ <form method="get" action=(base.as_str()) class="explore-search" role="search">
717+ <input type="hidden" name="tab" value=(tab.as_str())>
718+ <input type="hidden" name="sort" value=(sort)>
719+ <input type="search" name="q" value=(q.as_str()) data-live-search=""
720+ placeholder=(filter_label) aria-label=(filter_label)>
721+ <button type="submit">(g::t(lang, K::Search))</button>
722+ </form>
723+ if own_profile && repos_on {
730 <a class="button primary" href="/new">(g::t(lang, K::NewRepository))</a>724 <a class="button primary" href="/new">(g::t(lang, K::NewRepository))</a>
731- </div>725+ }
732- }726+ </div>
733- <form method="get" action=(base.as_str()) class="explore-search" role="search">727+ <div class="repo-subbar">
734- <input type="hidden" name="tab" value=(tab.as_str())>728+ sort_chips(links: sort_links, lang: lang)
735- <input type="hidden" name="sort" value=(sort)>729+ <p class="muted small repo-count">(count_text.as_str())</p>
736- <input type="search" name="q" value=(q.as_str()) data-live-search=""730+ </div>
737- placeholder=(filter_label) aria-label=(filter_label)>
738- <button type="submit">(g::t(lang, K::Search))</button>
739- </form>
740- sort_chips(links: sort_links, lang: lang)
741- <p class="muted small repo-count">(count_text.as_str())</p>
742 if has_rows {731 if has_rows {
743 repo_rows(rows: rows, lang: lang)732 repo_rows(rows: rows, lang: lang)
744 } else {733 } else {
@@ -805,15 +794,15 @@ async fn profile_card(
805 }794 }
806 </div>795 </div>
807 if has_orgs {796 if has_orgs {
808- <ul class="item-list">797+ <ul class="item-list org-rows">
809 for org in orgs.into_iter() {798 for org in orgs.into_iter() {
810 <li>799 <li>
811 <img class="avatar avatar-sm" src=(org.avatar.as_str()) alt="" width="24" height="24">800 <img class="avatar avatar-sm" src=(org.avatar.as_str()) alt="" width="24" height="24">
812- <a href=(org.href.as_str())>(org.name.as_str())</a>801+ <a class="repo-name" href=(org.href.as_str())>(org.name.as_str())</a>
813 if !org.display_name.is_empty() {802 if !org.display_name.is_empty() {
814- " " <span class="muted small">(org.display_name.as_str())</span>803+ <span class="muted small">(org.display_name.as_str())</span>
815 }804 }
816- " " <span class="muted small">(org.role)</span>805+ <span class="badge">(org.role)</span>
817 </li>806 </li>
818 }807 }
819 </ul>808 </ul>
@@ -1218,17 +1207,17 @@ mod tests {
1218 );1207 );
1219 }1208 }
1220 1209
1221- /// The calendar sits on the Contributions tab, not the overview, and an old `?day=` link with no1210+ /// The calendar sits on the overview. An old `?tab=contributions` link falls through to it.
1222- /// tab opens that tab.
1223 #[tokio::test]1211 #[tokio::test]
1224- async fn contributions_tab_holds_the_calendar() {1212+ async fn overview_holds_the_calendar() {
1225 let site = seeded().await;1213 let site = seeded().await;
1226 let (_, overview) = get(&site.router, "/tahinli", None).await;1214 let (_, overview) = get(&site.router, "/tahinli", None).await;
1227- assert!(!overview.contains("class=\"heat\""), "overview: no calendar");1215+ assert!(overview.contains("class=\"heat\""), "overview: calendar");
1228- let (_, tab) = get(&site.router, "/tahinli?tab=contributions", None).await;1216+ let (_, old) = get(&site.router, "/tahinli?tab=contributions", None).await;
1229- assert!(tab.contains("class=\"heat\""), "contributions: calendar");1217+ assert!(old.contains("class=\"heat\""), "old tab link: calendar");
1230- let (_, old) = get(&site.router, "/tahinli?day=2020-01-01", None).await;1218+ assert!(!overview.contains("tab=contributions"), "nav: no contributions tab");
1231- assert!(old.contains("class=\"heat\""), "old day link: calendar");1219+ let (_, day) = get(&site.router, "/tahinli?day=2020-01-01", None).await;
1220+ assert!(day.contains("class=\"heat\""), "day link: calendar");
1232 }1221 }
1233 1222
1234 fn count(body: &str, needle: &str) -> usize {1223 fn count(body: &str, needle: &str) -> usize {
crates/forge-web/src/views/heatmap.rsmodified+5 -5
@@ -4,7 +4,7 @@
4 //! `build` is pure date and streak maths over the counts from the store. `contribution_calendar`4 //! `build` is pure date and streak maths over the counts from the store. `contribution_calendar`
5 //! draws it with classes only (CSP): the grid placement comes from CSS (`grid-auto-flow: column`5 //! draws it with classes only (CSP): the grid placement comes from CSS (`grid-auto-flow: column`
6 //! with seven rows), so every cell is an element and the blank slots keep the columns aligned.6 //! with seven rows), so every cell is an element and the blank slots keep the columns aligned.
7-//! Each day is a link to `?tab=contributions&day=` (a plain link, no script): the page then lists7+//! Each day is a link to `?day=` (a plain link, no script): the page then lists
8 //! that day's contributions under the calendar, and clicking the selected day again clears it.8 //! that day's contributions under the calendar, and clicking the selected day again clears it.
9 9
10 use std::collections::HashMap;10 use std::collections::HashMap;
@@ -210,14 +210,14 @@ struct DayView {
210 210
211 /// The link for a calendar day: the day's contributions below the calendar, or back to the211 /// The link for a calendar day: the day's contributions below the calendar, or back to the
212 /// plain calendar when the day is the selected one. `base` is the profile's path, without a query.212 /// plain calendar when the day is the selected one. `base` is the profile's path, without a query.
213-/// Both links stay on the Contributions tab. The anchor brings a full page load back to the213+/// The anchor brings a full page load back to the calendar; nav.js swaps in place and keeps the
214-/// calendar; nav.js swaps in place and keeps the scroll (`data-keep-scroll`), so it is not used there.214+/// scroll (`data-keep-scroll`), so it is not used there.
215 fn day_href(base: &str, date: (i64, i64, i64), selected: bool) -> String {215 fn day_href(base: &str, date: (i64, i64, i64), selected: bool) -> String {
216 if selected {216 if selected {
217- format!("{base}?tab=contributions#contributions-h")217+ format!("{base}#contributions-h")
218 } else {218 } else {
219 format!(219 format!(
220- "{base}?tab=contributions&day={:04}-{:02}-{:02}#contributions-h",220+ "{base}?day={:04}-{:02}-{:02}#contributions-h",
221 date.0, date.1, date.2221 date.0, date.1, date.2
222 )222 )
223 }223 }
crates/forge-web/src/views/mod.rsmodified+1 -1
@@ -294,7 +294,7 @@ struct ProfileCorner {
294 }294 }
295 295
296 /// The floating account panel fixed at the bottom left of the window (signed in only). It opens296 /// The floating account panel fixed at the bottom left of the window (signed in only). It opens
297-/// upward: the avatar, the chips, the notifications bell with its unread count and popover, then297+/// upward: the avatar, the viewer's full name, the chips, the notifications bell with its unread count and popover, then
298 /// the Explore, profile, settings, admin and log out links and the theme choice.298 /// the Explore, profile, settings, admin and log out links and the theme choice.
299 #[component]299 #[component]
300 async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View> {300 async fn profile_corner(lang: Lang, corner: ProfileCorner) -> Result<impl View> {
style/_admin_rows.scssmodified+35 -16
@@ -134,30 +134,50 @@
134 margin-bottom: 6px;134 margin-bottom: 6px;
135 }135 }
136 136
137-// The metrics tab: three small graphs, one under another, each with its caption on the left. Every137+// The runner's metrics sit under its stats: three graphs side by side on a wide page (one column
138-// graph is its own SVG with one y axis; colours come from tokens only. A line follows the accent, a138+// below 900px), each in a panel with its caption and facts above it. Every graph is its own SVG with
139-// sent line is dashed in the secondary text colour so it is told apart without colour.139+// one y axis; colours come from tokens only. A line follows the accent, a sent line is dashed in the
140-.mx-stack {140+// secondary text colour so it is told apart without colour.
141+// The wrapper is `.mx-panels`, not `.mx-grid`: that name is the SVG gridline class below.
142+.mx-panels {
141 display: grid;143 display: grid;
142- gap: 10px;144+ grid-template-columns: minmax(0, 1fr);
145+ gap: 16px 24px;
146+ margin-top: 16px;
147+ padding-top: 16px;
148+ border-top: 1px solid var(--border);
143 }149 }
144 150
145-.mx-row {151+@media (min-width: 900px) {
152+ .mx-panels {
153+ grid-template-columns: repeat(3, minmax(0, 1fr));
154+ }
155+}
156+
157+.mx-panel {
146 display: grid;158 display: grid;
147- grid-template-columns: 200px minmax(0, 1fr);159+ gap: 6px;
148- align-items: center;160+ align-content: start;
149- gap: 4px 16px;161+ min-width: 0;
162+}
163+
164+.mx-head {
165+ min-height: 2.75rem;
150 }166 }
151 167
152 .mx-caption {168 .mx-caption {
153 margin: 0;169 margin: 0;
154 color: var(--text);170 color: var(--text);
155- font-size: 0.875rem;171+ font-size: 1.0625rem;
156 font-weight: 600;172 font-weight: 600;
157 font-variant-numeric: tabular-nums;173 font-variant-numeric: tabular-nums;
158 white-space: nowrap;174 white-space: nowrap;
159 }175 }
160 176
177+.mx-facts {
178+ margin: 0;
179+}
180+
161 .mx-legend {181 .mx-legend {
162 display: flex;182 display: flex;
163 flex-wrap: wrap;183 flex-wrap: wrap;
@@ -169,6 +189,10 @@
169 font-size: 0.75rem;189 font-size: 0.75rem;
170 }190 }
171 191
192+.mx-panel .mx-legend {
193+ margin-top: 0;
194+}
195+
172 // A legend swatch: a short line in the series' style. It carries the identity, the text does not.196 // A legend swatch: a short line in the series' style. It carries the identity, the text does not.
173 .mx-key {197 .mx-key {
174 display: inline-block;198 display: inline-block;
@@ -186,6 +210,7 @@
186 .mx-svg {210 .mx-svg {
187 display: block;211 display: block;
188 width: 100%;212 width: 100%;
213+ max-width: 560px;
189 height: auto;214 height: auto;
190 overflow: visible;215 overflow: visible;
191 }216 }
@@ -267,9 +292,3 @@
267 max-height: 240px;292 max-height: 240px;
268 overflow: auto;293 overflow: auto;
269 }294 }
270-
271-@media (max-width: 600px) {
272- .mx-row {
273- grid-template-columns: minmax(0, 1fr);
274- }
275-}
style/_dashboard.scssadded+179 -0
@@ -0,0 +1,179 @@
1+// Shared list and page styles that were in the dashboard file until c812504: the explore search and
2+// sort chips, the repo listing on profile tabs, repo rows, the numbered pager and the org page head.
3+
4+// Explore: one-row search (input, then its button) and a sort control of pill links.
5+.explore-search {
6+ display: flex;
7+ flex-wrap: wrap;
8+ gap: 8px;
9+ align-items: center;
10+ margin: 18px 0 0;
11+
12+ input[type="search"] {
13+ flex: 1 1 240px;
14+ width: auto;
15+ min-width: 0;
16+ }
17+
18+ button {
19+ flex: 0 0 auto;
20+ }
21+
22+ @media (max-width: 479px) {
23+ input[type="search"] {
24+ flex: 1 1 100%;
25+ }
26+ }
27+}
28+
29+.explore-sort {
30+ display: flex;
31+ flex-wrap: wrap;
32+ gap: 6px 8px;
33+ align-items: center;
34+ margin: 14px 0 0;
35+ font-size: 13px;
36+
37+ a,
38+ .current {
39+ display: inline-flex;
40+ align-items: center;
41+ height: 28px;
42+ padding: 0 12px;
43+ border: 1px solid var(--border);
44+ border-radius: var(--radius-full);
45+ color: var(--text-2);
46+ text-decoration: none;
47+ }
48+
49+ a:hover {
50+ background: var(--surface-2);
51+ text-decoration: none;
52+ }
53+
54+ .current {
55+ border-color: transparent;
56+ background: var(--accent-soft);
57+ color: var(--accent-ink);
58+ font-weight: 600;
59+ }
60+}
61+
62+// Repo listing toolbar: the search takes the free width, and the New repository button sits beside it.
63+.repo-tools {
64+ display: flex;
65+ flex-wrap: wrap;
66+ gap: 8px;
67+ align-items: center;
68+
69+ .explore-search {
70+ flex: 1 1 320px;
71+ margin: 0;
72+ }
73+
74+ .button {
75+ flex: none;
76+ }
77+}
78+
79+// Sort chips and the count on one line under the toolbar; the chips' own gap spaces "Sort by".
80+.repo-subbar {
81+ display: flex;
82+ flex-wrap: wrap;
83+ align-items: center;
84+ justify-content: space-between;
85+ gap: 8px 16px;
86+
87+ .explore-sort,
88+ p {
89+ margin: 0;
90+ }
91+}
92+
93+// A repo listing (profile tabs): search, sort chips, count, rows and pager as one tight block, so
94+// the profile's section gap does not open between the count line and the list.
95+.repo-listing {
96+ display: flex;
97+ flex-direction: column;
98+ gap: 10px;
99+
100+ > .explore-search,
101+ > .explore-sort,
102+ > p {
103+ margin: 0;
104+ }
105+}
106+
107+.repo-item-head {
108+ display: flex;
109+ align-items: center;
110+ gap: 8px;
111+ min-width: 0;
112+
113+ .repo-name {
114+ min-width: 0;
115+ overflow: hidden;
116+ text-overflow: ellipsis;
117+ white-space: nowrap;
118+ }
119+
120+ .badge {
121+ flex: 0 0 auto;
122+ }
123+}
124+
125+.repo-item .repo-desc {
126+ overflow: hidden;
127+ text-overflow: ellipsis;
128+ white-space: nowrap;
129+}
130+
131+.pager-numbered {
132+ flex-wrap: wrap;
133+ gap: 4px;
134+ font-size: 13px;
135+
136+ .pager-page,
137+ .pager-step,
138+ .pager-gap {
139+ display: inline-flex;
140+ align-items: center;
141+ justify-content: center;
142+ min-width: 30px;
143+ height: 30px;
144+ padding: 0 8px;
145+ border-radius: var(--radius-full);
146+ color: var(--text-2);
147+ text-decoration: none;
148+ }
149+
150+ a:hover {
151+ background: var(--surface-2);
152+ text-decoration: none;
153+ }
154+
155+ .current {
156+ background: var(--accent-soft);
157+ color: var(--accent-ink);
158+ font-weight: 600;
159+ }
160+
161+ .pager-gap {
162+ min-width: 20px;
163+ padding: 0;
164+ }
165+}
166+
167+// Organization pages: the name and description stack; the section links are in the shell sidebar.
168+.org-head {
169+ .org-head-text {
170+ display: grid;
171+ gap: 4px;
172+ min-width: 0;
173+ }
174+
175+ h1,
176+ p {
177+ margin: 0;
178+ }
179+}
style/_shell.scssmodified+14 -4
@@ -898,14 +898,14 @@ a.chip {
898 box-shadow: var(--shadow);898 box-shadow: var(--shadow);
899 }899 }
900 900
901-// The profile corner: a small panel fixed at the bottom left of the window, the avatar, the chips and901+// The profile corner: a small panel fixed at the bottom left of the window, the avatar, the name, the
902-// the bell. The name is left out of the panel; its aria-label still names the viewer.902+// chips and the bell. The name is always shown in full (see `.corner-name` below).
903 .corner-float {903 .corner-float {
904 position: fixed;904 position: fixed;
905 left: 16px;905 left: 16px;
906 bottom: 16px;906 bottom: 16px;
907 z-index: 40;907 z-index: 40;
908- max-width: min(280px, calc(100vw - 32px));908+ max-width: calc(100vw - 32px);
909 background: var(--surface);909 background: var(--surface);
910 border: 1px solid var(--border);910 border: 1px solid var(--border);
911 border-radius: 999px;911 border-radius: 999px;
@@ -953,8 +953,18 @@ a.chip {
953 right: 8px;953 right: 8px;
954 }954 }
955 955
956+// The viewer's full name, never truncated. On a phone it wraps instead of running off the screen.
956 .corner-float .corner-name {957 .corner-float .corner-name {
957- display: none;958+ display: block;
959+ padding-right: 4px;
960+ white-space: nowrap;
961+ overflow: visible;
962+}
963+
964+@media (max-width: 479px) {
965+ .corner-float .corner-name {
966+ white-space: normal;
967+ }
958 }968 }
959 969
960 .corner-float .corner-btn {970 .corner-float .corner-btn {
style/main.scssmodified+20 -1
@@ -2328,7 +2328,21 @@ code {
2328 }2328 }
2329 }2329 }
2330 2330
2331-// Pinned repos: two cards per row on wide screens, one on phones.2331+// The viewer's organization rows: avatar, name, display name and role on one centred line, with the
2332+// same row rule as `.repo-item`.
2333+.org-rows li {
2334+ display: flex;
2335+ align-items: center;
2336+ gap: 10px;
2337+ padding: 10px 0;
2338+ border-bottom: 1px solid var(--border);
2339+
2340+ &:last-child {
2341+ border-bottom: 0;
2342+ }
2343+}
2344+
2345+// Pinned repos: three cards per row on wide screens, two on tablets, one on phones.
2332 .pin-grid {2346 .pin-grid {
2333 display: grid;2347 display: grid;
2334 grid-template-columns: minmax(0, 1fr);2348 grid-template-columns: minmax(0, 1fr);
@@ -2340,6 +2354,10 @@ code {
2340 @media (min-width: 720px) {2354 @media (min-width: 720px) {
2341 grid-template-columns: repeat(2, minmax(0, 1fr));2355 grid-template-columns: repeat(2, minmax(0, 1fr));
2342 }2356 }
2357+
2358+ @media (min-width: 1100px) {
2359+ grid-template-columns: repeat(3, minmax(0, 1fr));
2360+ }
2343 }2361 }
2344 2362
2345 .pin-card {2363 .pin-card {
@@ -7043,6 +7061,7 @@ button.ci-job-last {
7043 @import "heatmap";7061 @import "heatmap";
7044 @import "repo";7062 @import "repo";
7045 @import "pull";7063 @import "pull";
7064+@import "dashboard";
7046 @import "wiki";7065 @import "wiki";
7047 @import "browse";7066 @import "browse";
7048 @import "import";7067 @import "import";