Debian Codegraph @

pkg/metrics/metrics.scss

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 @use "page";
3 @use "ct-card";
4 @use "global-variables" as *;
5 @use "@patternfly/patternfly/utilities/Text/text.scss";
6
7 // utilities for `pf-u...` classes
8 @use "@patternfly/patternfly/utilities/Spacing/spacing.css";
9
10 // colors for PF charts
11 @use "@patternfly/patternfly/patternfly-charts.css";
12
13 #app {
14 section.pf-v6-c-page__main-breadcrumb {
15 padding-block-end: var(--pf-v6-c-page__main-breadcrumb--PaddingBlockStart);
16 }
17 }
18
19 html {
20 --resource-icon-color-empty: var(--pf-t--global--border--color--nonstatus--gray--default);
21 --resource-icon-color-middle: var(--pf-t--global--background--color--highlight--default);
22 --resource-icon-color-full: var(--pf-t--global--icon--color--status--warning--default);
23 }
24
25 // Remove doubled-up padding on "main" sections, when two+ sections are used.
26 .pf-v6-c-page__main-section + .pf-v6-c-page__main-section {
27 padding-block-start: 0;
28 }
29
30 // FIXME: More styles from ct-system-overview
31 .current-metrics {
32 --card-width: 200px;
33 --pf-v6-l-gallery--GridTemplateColumns: repeat(auto-fit, minmax(var(--card-width), 1fr));
34
35 // the cards already have padding, align the "top 5" tables with the other content
36 .pf-v6-c-table {
37 --pf-v6-c-table--cell--first-last-child--PaddingInline: 0;
38
39 tr > * {
40 --pf-v6-c-table--cell--PaddingBlockStart: var(--pf-t--global--spacer--xs);
41 --pf-v6-c-table--cell--PaddingBlockEnd: var(--pf-t--global--spacer--xs);
42 }
43 }
44
45 .pf-v6-c-card {
46 &__title-text {
47 font-size: var(--pf-t--global--font--size--xl);
48 font-weight: var(--pf-t--global--font--weight--body);
49 }
50
51 // Let the children get flexy
52 &__body {
53 display: flex;
54 flex-direction: column;
55
56 // Make sure the cards do not get taller than 50% of the screen
57 // ...and when they do, they should scroll
58 @media screen and (orientation: landscape) {
59 max-block-size: 50vh;
60 overflow: auto;
61 }
62
63 // Strip the padding from the first item,
64 // including table headings
65 > :first-child,
66 > :first-child > thead > tr > th {
67 padding-block-start: 0;
68 }
69
70 .pf-v6-c-table thead th:not(:first-child),
71 .pf-v6-c-table tbody td:not(:first-child) {
72 text-align: end;
73 }
74 }
75
76 .align-baseline {
77 align-items: baseline;
78 }
79
80 .text-color-warning {
81 color: var(--pf-t--global--text--color--status--warning--default);
82 }
83
84 .icon-color-warning {
85 color: var(--pf-t--global--icon--color--status--warning--default);
86 }
87
88 .text-color-critical {
89 color: var(--pf-t--global--text--color--status--danger--default);
90 }
91
92 .icon-color-critical {
93 color: var(--pf-t--global--icon--color--status--danger--default);
94 }
95
96 .progress-stack {
97 display: grid;
98 padding-block-end: var(--pf-t--global--spacer--sm);
99 gap: var(--pf-t--global--spacer--sm) var(--pf-t--global--spacer--md);
100
101 &:not(:first-child) {
102 padding-block-start: var(--pf-t--global--spacer--sm);
103 }
104 }
105
106 .progress-stack-no-space {
107 display: grid;
108 padding-block-end: var(--pf-t--global--spacer--sm);
109 gap: 0;
110
111 &:not(:first-child) {
112 padding-block-start: var(--pf-t--global--spacer--sm);
113 }
114
115 // avoid the "x" icon on high CPU usage
116 .pf-v6-c-progress__status-icon {
117 display: none;
118 }
119
120 // don't center the "View all CPUs" button
121 button {
122 padding-inline-start: 0;
123 inline-size: fit-content;
124 }
125 }
126
127 // Stretch the progress stack and description list so they fill up remaining space.
128 // This pushes the (unflexing) tables to the bottom.
129 .progress-stack,
130 .pf-v6-c-description-list {
131 flex: 1 1 0;
132 align-content: start;
133 }
134
135 // When progress stack and description list are used sequentially,
136 // give the most space to the latter of the two elements.
137 .progress-stack + .pf-v6-c-description-list,
138 .pf-v6-c-description-list + .progress-stack {
139 flex-basis: 100%;
140 }
141
142 // WebKit is a little wonky with flex sizing; it needs specific instructions here
143 .pf-v6-c-description-list:first-child {
144 flex-grow: 0;
145 }
146
147 .pf-v6-c-description-list__description {
148 font-size: var(--pf-t--global--font--size--sm);
149 }
150 }
151
152 // Shrink progress bars and their gap a little
153 .pf-v6-c-progress {
154 gap: 0;
155 --pf-v6-c-progress__bar--Height: var(--pf-t--global--spacer--xs);
156 // PF4 uses end; it probably should arguably use last baseline.
157 // (perhaps end may work better for non-text content?)
158 align-items: last baseline;
159
160 + .pf-v6-c-progress {
161 // Add a tiny gap for sandwiched usage bars (as in CPU)
162 padding-block-start: 1px;
163 }
164 }
165
166 // Only underline the description
167 .pf-v6-c-button.pf-m-link.pf-m-inline {
168 --pf-v6-c-button--TextDecorationLine: var(--pf-t--global--text-decoration--line--100);
169 --pf-v6-c-button--hover--TextDecorationLine: var(--pf-t--global--text-decoration--line--100);
170
171 &:hover .pf-v6-c-progress__description {
172 text-decoration: var(--pf-t--global--text-decoration--line--200);
173 }
174 }
175
176 .pf-v6-c-button .pf-v6-c-button__text {
177 flex: auto;
178 }
179
180 // Match font weight with description list terms
181 .pf-v6-c-progress__description {
182 font-weight: var(--pf-t--global--font--weight--300);
183 }
184
185 // Recolor text
186 .pf-m-link {
187 &, &:hover {
188 .pf-v6-c-progress__measure {
189 color: var(--pf-t--global--text--color--regular);
190 }
191 }
192 }
193
194 // default is way too wide for the cards
195 .pf-v6-c-description-list {
196 --pf-v6-c-description-list--m-horizontal__term--width: minmax(0, auto);
197 --pf-v6-c-description-list--m-horizontal__description--width: minmax(0, auto);
198 }
199
200 // Don't wrap network in / out data
201 // Shrink network cards and data a little more
202 // (as space is costly and they use a lot)
203 // FIXME: Let's fix the content (split off units) and drop this when we can
204 .network-nowrap-shrink {
205 td {
206 white-space: nowrap;
207 font-size: var(--pf-t--global--size--font--xs);
208 }
209 }
210
211 // Shrink percentage column to allow for more service text
212 th[data-label="%"],
213 td[data-label="%"] {
214 inline-size: 2rem;
215 min-inline-size: 0;
216
217 .pf-v6-c-table__text {
218 --pf-v6-c-table--cell--MinWidth: 0;
219 display: inline;
220 }
221 }
222
223 .pf-m-grid-lg.pf-v6-c-table {
224 tbody:first-of-type {
225 border-block-start: none;
226 }
227
228 tbody tr:not(.pf-v6-c-table__expandable-row) {
229 &:last-child {
230 border-block-end: none;
231 }
232 }
233 }
234
235 .all-disks-no-gap {
236 // don't center the "View all disks" button
237 button {
238 padding-inline-start: 0;
239 inline-size: fit-content;
240 }
241 }
242 }
243
244 .pf-v6-c-popover {
245 thead th:not(:first-child) {
246 text-align: end;
247 }
248
249 .disks-nowrap {
250 td {
251 white-space: nowrap;
252 }
253
254 td:not(:first-child) {
255 text-align: end;
256 }
257 }
258 }
259
260 @media (min-width: 641px) and (max-width: 1200px) {
261 .current-metrics {
262 --card-width: 200px;
263 }
264
265 .current-metrics .pf-v6-c-card__body {
266 overflow-block: auto;
267 max-block-size: 50vw;
268 }
269
270 // Trim down the gutter space between cards
271 .current-metrics.pf-v6-l-gallery.pf-m-gutter {
272 gap: var(--pf-t--global--spacer--sm);
273 }
274
275 // Shave off a few pixels from cards
276 .pf-v6-c-card__header, .pf-v6-c-card__title, .pf-v6-c-card__body, .pf-v6-c-card__footer {
277 --pf-v6-c-card--first-child--PaddingBlockStart: var(--pf-t--global--spacer--sm);
278 --pf-v6-c-card__title--not--last-child--PaddingBlockEnd: var(--pf-t--global--spacer--sm);
279 --pf-v6-c-card--child--PaddingBlockEnd: var(--pf-t--global--spacer--sm);
280 --pf-v6-c-card--child--PaddingInlineStart: var(--pf-t--global--spacer--md);
281 --pf-v6-c-card--child--PaddingInlineEnd: var(--pf-t--global--spacer--md);
282 }
283 }
284
285 // Change progress layout in medium sizes
286 @media (min-width: 460px) and (max-width: 1200px) {
287 // Stack description lists (instead of grid)
288 .pf-v6-c-description-list__group {
289 display: block;
290 }
291 }
292
293 // Stretch network card and reflow items
294 @media (min-width: 660px) and (max-width: 860px) {
295 .current-metrics-network {
296 grid-column: 1 / -1;
297
298 // Reflow interfaces horizontally, with wrapping
299 .pf-v6-c-table > tbody {
300 display: grid;
301 grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
302 gap: 0 var(--pf-t--global--spacer--lg);
303 }
304 }
305 }
306
307 $graphs: cpu, memory, disks, network;
308
309 .metrics {
310 --cpu-color: var(--pf-t--global--border--color--nonstatus--purple--default);
311 --cpu-color-extreme: var(--pf-t--global--border--color--nonstatus--purple--clicked);
312
313 --memory-color: var(--pf-t--global--border--color--nonstatus--green--default);
314 --memory-color-extreme: var(--pf-t--global--icon--color--status--success--default);
315
316 --disks-color: var(--pf-t--global--icon--color--status--warning--default);
317 --disks-color-extreme: var(--pf-t--global--icon--color--status--warning--clicked);
318
319 --network-color: var(--pf-t--global--icon--color--severity--undefined--default);
320 --network-color-extreme: var(--pf-t--global--icon--color--disabled);
321
322 --column-size: 10vw;
323 --half-column-size: 8vw;
324 --data-min-height: 5px;
325
326 --graph-column-size: 60%;
327
328 &-hour-compressed {
329 --data-min-height: 1px;
330 display: flex;
331 }
332
333 &-heading,
334 &-hour:not(.metrics-hour-compressed) .metrics-minute {
335 display: flex;
336 }
337
338 &-heading,
339 &-heading-graphs {
340 align-items: center;
341 }
342
343 &-graphs {
344 flex-basis: var(--graph-column-size);
345 margin-inline-start: auto;
346 display: grid;
347 grid-template-columns: repeat(var(--graph-cnt), minmax(var(--column-size), 1fr));
348
349 .metrics-data {
350 min-block-size: var(--data-min-height);
351 }
352 }
353
354 &-sublabels.pf-v6-c-content {
355 display: flex;
356
357 small {
358 font-size: var(--pf-t--global--font--size--xs);
359 margin-block-end: var(--pf-t--global--spacer--xs) !important;
360 }
361 }
362
363 &-label-graph {
364 text-align: end;
365
366 & .metrics-sublabels {
367 justify-content: flex-end;
368 }
369 }
370
371 &-label-graph.have-saturation {
372 text-align: center;
373
374 & .metrics-sublabels {
375 justify-content: space-evenly;
376 }
377 }
378
379 &-minutes {
380 flex-basis: var(--graph-column-size);
381 align-self: end;
382 }
383
384 &-events-hour-header-expanded {
385 inline-size: calc(100% - var(--graph-column-size));
386 }
387
388 &-selectors,
389 &-events-wrapper {
390 flex-basis: calc(100% - var(--graph-column-size));
391 inline-size: 100%;
392 }
393
394 &-events {
395 display: flex;
396 column-gap: var(--pf-t--global--spacer--sm);
397 flex-basis: calc(100% - var(--graph-column-size));
398 align-items: baseline;
399 font-size: var(--pf-t--global--font--size--sm);
400
401 &-expander {
402 min-inline-size: 3rem;
403 }
404
405 time:first-child {
406 margin-inline-start: calc(3rem + var(--pf-t--global--spacer--sm));
407
408 + .spikes_count {
409 padding-inline-start: calc(var(--pf-t--global--spacer--xl) + var(--pf-t--global--spacer--md));
410 color: var(--pf-t--global--text--color--subtle);
411 }
412 }
413
414 .spikes_count {
415 > div {
416 white-space: nowrap;
417 align-items: baseline;
418 }
419
420 svg {
421 align-self: center;
422 }
423 }
424
425 > * {
426 line-height: var(--pf-t--global--font--line-height--heading);
427 }
428
429 > *:not(.metrics-events-expander):not(:last-child) {
430 flex: 1;
431 white-space: nowrap;
432 }
433
434 > *:last-child {
435 flex-basis: 50%;
436 }
437
438 // Just embolden the top level time events
439 button + time {
440 font-weight: var(--pf-t--global--font--weight--300);
441 }
442
443 // Make messages such as `Loading...` or `No logs found` centered
444 .cockpit-log-panel {
445 display: flex;
446 flex-wrap: wrap;
447 // justify-content: center;
448
449 .cockpit-logline {
450 flex: 0 0 100%;
451 }
452 }
453 }
454
455 &-time,
456 &-heading {
457 padding-inline: var(--pf-v6-c-page__main-section--PaddingBlockStart) var(--pf-v6-c-page__main-section--PaddingBlockEnd);
458 }
459
460 &-time {
461 padding-block: var(--pf-t--global--spacer--md) var(--pf-t--global--spacer--sm);
462
463 // Time has tabular numbers, but it's not what we want for a heading
464 time {
465 font-variant: none !important;
466 }
467 }
468
469 &-history-section {
470 padding: 0;
471 }
472
473 &-history {
474 padding: 0;
475 }
476
477 &-data {
478 --gradient-fragment: var(--color) 80%, var(--color-extreme) 90%;
479 --gradient: linear-gradient(to right, var(--gradient-fragment));
480 --gradient-flip: linear-gradient(to left, var(--gradient-fragment));
481 display: grid;
482 contain: strict;
483 margin-block: 0;
484 margin-inline: var(--pf-t--global--spacer--sm);
485 // Make SVG and generated before/after line position relative to metrics-data
486 position: relative;
487 grid-template-areas: "utilization";
488 // Make sure rows expand (WebKit needs this)
489 grid-template-rows: 1fr;
490
491 // vertical ruler line for areas with data, and horizontal tick mark for utilization half
492 &.valid-data::before {
493 content: "";
494 position: absolute;
495 z-index: 1;
496 inline-size: 100%;
497 inset-block: 0;
498 border-inline-end: 1px solid rgb(0 0 0 / 30%);
499 }
500
501 &.valid-data.have-saturation::before {
502 inline-size: 50%;
503 }
504
505 // horizontal tick mark for saturation half, for resources that have it
506 &.valid-data.have-saturation::after {
507 content: "";
508 position: absolute;
509 z-index: 1;
510 inline-size: 50%;
511 inset-inline-start: 50%;
512 }
513
514 .polygon {
515 // WebKit has an issue with normal positioning (height exceeds bounds), but absolute works fine
516 position: absolute;
517 inset-block-start: 0;
518 inset-inline-start: 0;
519 clip-path: polygon(var(--points));
520 background: var(--gradient);
521 block-size: 100%;
522 inline-size: 100%;
523 }
524
525 @each $graph in $graphs {
526 &-#{$graph} {
527 --color: var(--#{$graph}-color);
528 --color-extreme: var(--#{$graph}-color-extreme);
529 }
530 }
531
532 /* we always need to flip the polygons in Y direction, as the SVG
533 * coordinate system's Y goes downwards, and the computed SVGs are relative
534 * to (0,0), with a non-constant max-Y.
535 * Flip them in X direction for RTL. */
536
537 .polygon.polygon-use {
538 grid-area: utilization;
539 // horizontally the use graphs go to the left on LTR, to the right on RTL
540 transform: scale(-1, -1);
541 [dir="rtl"] & { transform: scale(1, -1); }
542 }
543
544 .polygon.polygon-sat {
545 grid-area: saturation;
546 opacity: 0.7;
547 // horizontally the load graphs go to the right on LTR, to the left on RTL
548 transform: scale(1, -1);
549 [dir="rtl"] & { transform: scale(-1, -1); }
550 }
551
552 .compressed.polygon-use {
553 background: var(--gradient-flip);
554 clip-path: inset(0 0 0 calc(100% - var(--utilization) * 100%));
555 [dir="rtl"] & { transform: scale(-1, 1); }
556 }
557
558 .compressed.polygon-sat {
559 background: var(--gradient);
560 clip-path: inset(0 calc(100% - var(--saturation) * 100%) 0 0);
561 opacity: 0.7;
562 [dir="rtl"] & { transform: scale(-1, 1); }
563 }
564 }
565
566 &-data.have-saturation {
567 grid-template-areas: "utilization saturation";
568 }
569
570 // vertical dotted line through graph center, for areas without data
571 &-data::after {
572 content: "";
573 z-index: -1;
574 inset-block-start: 0;
575 inset-block-end: 0;
576 position: absolute;
577 }
578
579 &-data.empty-data::after {
580 position: initial;
581 border-inline-end: 1px dotted rgb(0 0 0 / 30%);
582 }
583
584 &-data.empty-data.have-saturation::after {
585 position: absolute;
586 border-inline-start: 1px dotted rgb(0 0 0 / 30%);
587 border-inline-end: none;
588 inset-inline-start: 50%;
589 }
590
591 &-hour {
592 padding-block: 0;
593 padding-inline: var(--pf-t--global--spacer--sm);
594 }
595
596 &-hour:not(.metrics-hour-compressed) .metrics-minute,
597 &-hour.metrics-hour-compressed .metrics-minute:last-of-type {
598 .valid-data.have-saturation::after,
599 .valid-data::before {
600 // Fake a border via clip-path, to set it on top, instead of after
601 background: rgb(120 120 120 / 30%);
602 pointer-events: none;
603 clip-path: inset(calc(100% - 1px) 0 0);
604 }
605 }
606
607 .pf-v6-c-card__body:first-child {
608 padding-block-start: 0;
609 }
610 }
611
612 // Graph column labels are the widest part; scale down the labels for narrow widths
613 @media (min-width: 800px) and (max-width: 1200px) {
614 .metrics-label-graph {
615 font-size: var(--pf-t--global--font--size--sm);
616 }
617 }
618
619 @media (min-width: 800px) {
620 .metrics-label-graph-mobile {
621 display: none;
622 }
623 }
624
625 @media (max-width: 800px) {
626 .metrics {
627 --graph-column-size: 40%;
628
629 time:first-child {
630 + .spikes_count {
631 padding-inline-start: 0;
632 }
633 }
634 }
635
636 .metrics-heading > .metrics-graphs,
637 .metrics-minute > .metrics-events > .spikes_count {
638 display: none;
639 }
640
641 .metrics-label-graph-mobile {
642 padding-inline-start: var(--pf-t--global--spacer--sm);
643 padding-block-start: var(--pf-t--global--spacer--sm);
644 font-size: var(--pf-t--global--font--size--sm);
645 }
646
647 .square {
648 inline-size: 1rem;
649 block-size: 1rem;
650 }
651
652 @each $graph in $graphs {
653 .label-#{$graph} {
654 background-color: var(--#{$graph}-color);
655 }
656 }
657
658 .metrics-hour > .metrics-events {
659 .spikes_info,
660 .spikes_count svg {
661 display: none;
662 }
663 }
664 }
665
666 .bottom-panel {
667 display: flex;
668 justify-content: space-around;
669 padding: 1em;
670 }
671
672 .nodata {
673 margin: 1em;
674 }
675
676 .select-min {
677 inline-size: min-content;
678 }
679
680 #pcp-settings-modal {
681 .pcp-settings-modal-text {
682 // "Read more..." link
683 a {
684 padding-inline-start: 1em;
685 white-space: nowrap;
686 }
687 }
688
689 // leave some space for the focus rings
690 .pf-v6-c-switch {
691 margin-block-end: 10px;
692 }
693 }
694
695 .cpu-all {
696 --pf-v6-l-grid--m-gutter--GridGap: var(--pf-t--global--spacer--xs) var(--pf-t--global--spacer--md);
697 // Mixing font families need to be aligned properly (to the baseline)
698 align-items: baseline;
699 // In monospaced text, "100%" is 4 characters
700 grid-template-columns: 1fr minmax(4ch, auto);
701
702 > .pf-v6-l-grid__item {
703 // Don't use PF's hardcoded 12-column grid
704 grid-column: auto;
705 }
706
707 > dd {
708 // TODO: Use tabular numbers instead of monospace,
709 // after new font usage is enabled
710 font-family: var(--pf-t--global--font--family--mono);
711 // Aligning percentages to the right, especially when monospaced,
712 // makes it easier to see high percentages
713 text-align: end;
714 }
715 }
716
717 .current-cpu-usage:not(:last-child) {
718 // Bump CPU average above CPU max
719 z-index: 1;
720 }
721
722 .current-top-cpu-usage {
723 // Nudge max to be at the same place as average
724 margin-block-start: -5px;
725
726 // Lighten up the default bar
727 &:not(.pf-m-danger):not(.pf-m-warning) {
728 .pf-v6-c-progress__indicator {
729 opacity: 0.33;
730 }
731 }
732 }
733
734 // FIXME: We probably want to adapt some of these for the general log message widget
735 .cockpit-logline {
736 padding-block: 0.25rem;
737 padding-inline: 0;
738 }
739
740 .cockpit-log-message {
741 text-align: start;
742 overflow-wrap: anywhere;
743 white-space: break-spaces;
744 // Clamping is supported in all browsers,
745 // but it needs special webkit prefix (yes, in all browsers)
746 -webkit-line-clamp: 3;
747 -webkit-box-orient: vertical;
748 display: webkit-box; /* stylelint-disable-line */
749 color: var(--pf-t--global--text--color--link--default);
750 }
751
752 // Log warning icon is incorrectly aligned (especially when messages wrap);
753 // this fixes it by realigning and offsetting
754 .cockpit-log-warning {
755 transform: translateY(calc((var(--pf-t--global--spacer--md) - 22px) / -2));
756 margin: 0;
757 margin-inline-end: var(--pf-t--global--spacer--xs);
758 align-self: baseline;
759 }
760
761 .metrics-events-popover {
762 .cockpit-log-panel {
763 overflow: auto;
764 // Remove extra whitespace; the modal already has some
765 padding: 0;
766 margin: 0;
767 }
768
769 .pf-v6-c-popover__content {
770 // Remove extra whitespace in the modal
771 --pf-v6-c-popover__close--sibling--PaddingInlineEnd: 0;
772 }
773 }
774
775 @media (min-width: 801px) {
776 .metrics-events-popover {
777 .cockpit-log-panel {
778 // Limit the size of the popover to make it more elegant
779 max-block-size: 65vw;
780 }
781
782 .pf-v6-c-popover__content {
783 // Limit the width of the popover in desktop mode
784 max-inline-size: max(30rem, 40vw);
785 }
786 }
787 }
788
789 @media (max-width: 800px) {
790 .metrics-events-popover {
791 // Make the popover into a sheet from the bottom in mobile mode
792 inset-block: auto 0 !important;
793 inset-inline: 0 !important;
794 transform: none !important;
795 max-block-size: 100%;
796 min-block-size: 25vh;
797
798 .pf-v6-c-popover__content {
799 // Limit the width of the popover in desktop mode
800 max-inline-size: max(100vw);
801 }
802
803 // As a sheet at the bottom, it doesn't point to anything
804 .pf-v6-c-popover__arrow {
805 display: none;
806 }
807 }
808 }