Skip to content

Commit 9aeb205

Browse files
committed
services: Improve layout to PF6
1 parent b882a7b commit 9aeb205

File tree

5 files changed

+42
-43
lines changed

5 files changed

+42
-43
lines changed

pkg/systemd/service-details.jsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import { ModalError } from 'cockpit-components-inline-notification.jsx';
5151

5252
import './service-details.scss';
5353
import { KebabDropdown } from "cockpit-components-dropdown";
54+
import { Icon } from "@patternfly/react-core";
5455

5556
const _ = cockpit.gettext;
5657
const METRICS_POLL_DELAY = 30000; // 30s
@@ -456,15 +457,19 @@ export class ServiceDetails extends React.Component {
456457
if (active) {
457458
status.push(
458459
<div key="running" className="status-running">
459-
<OnRunningIcon className="status-icon" />
460+
<Icon status="success">
461+
<OnRunningIcon className="status-icon" />
462+
</Icon>
460463
<span className="status">{ _("Running") }</span>
461464
<span className="side-note font-xs">{ _("Active since ") + timeformat.dateTime(this.props.unit.ActiveEnterTimestamp / 1000) }</span>
462465
</div>
463466
);
464467
} else {
465468
status.push(
466469
<div key="stopped" className="status-stopped">
467-
<OffIcon className="status-icon" />
470+
<Icon>
471+
<OffIcon className="status-icon" />
472+
</Icon>
468473
<span className="status">{ _("Not running") }</span>
469474
</div>
470475
);

pkg/systemd/service-details.scss

+6-5
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
padding-inline-start: 0;
2727
}
2828

29-
.service-thumbtack-icon {
30-
color: var(--pf-v5-global--icon--Color--light);
31-
}
29+
// .service-thumbtack-icon {
30+
// color: var(--pf-v5-global--icon--Color--light);
31+
// }
3232

3333
.action-button {
3434
margin-inline-start: 2rem;
@@ -43,10 +43,11 @@
4343
color: var(--pf-v5-global--icon--Color--light);
4444
}
4545

46+
// REVIEW @Venefilyn: Green = good/success; Running or enabled is a status so
47+
// we should use something that is better suited for informational stuff -- like purple
4648
.status-running > .status-icon,
4749
.status-enabled > .status-icon {
48-
/* mid-way between PF4 success-100 & 200; then rounded to AA contrast */
49-
color: #6da000;
50+
color: var(--pf-t--global--border--color--status--success--default);
5051
}
5152

5253
.status-failed > .status-icon,

pkg/systemd/services.jsx

+13-10
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import React, { useState, useEffect, useCallback } from "react";
2525
import { createRoot } from 'react-dom/client';
2626
import { Flex, FlexItem } from "@patternfly/react-core/dist/esm/layouts/Flex/index.js";
2727
import { Page, PageSection, } from "@patternfly/react-core/dist/esm/components/Page/index.js";
28-
import { Card } from "@patternfly/react-core/dist/esm/components/Card/index.js";
28+
import { Card, CardHeader } from "@patternfly/react-core/dist/esm/components/Card/index.js";
2929
import { SearchInput } from "@patternfly/react-core/dist/esm/components/SearchInput/index.js";
3030
import { ToggleGroup, ToggleGroupItem } from "@patternfly/react-core/dist/esm/components/ToggleGroup/index.js";
3131
import { Toolbar, ToolbarContent, ToolbarFilter, ToolbarItem, ToolbarToggleGroup } from "@patternfly/react-core/dist/esm/components/Toolbar/index.js";
@@ -706,13 +706,15 @@ class ServicesPageBody extends React.Component {
706706
return (
707707
<PageSection hasBodyWrapper={false}>
708708
<Card isCompact>
709-
<ServicesPageFilters activeStateDropdownOptions={activeStateDropdownOptions}
710-
fileStateDropdownOptions={fileStateDropdownOptions}
711-
filtersRef={this.filtersRef}
712-
loadingUnits={this.props.isLoading}
713-
options={cockpit.location.options}
714-
onOptionsChanged={this.onOptionsChanged}
715-
/>
709+
<CardHeader id='services-card-header'>
710+
<ServicesPageFilters activeStateDropdownOptions={activeStateDropdownOptions}
711+
fileStateDropdownOptions={fileStateDropdownOptions}
712+
filtersRef={this.filtersRef}
713+
loadingUnits={this.props.isLoading}
714+
options={cockpit.location.options}
715+
onOptionsChanged={this.onOptionsChanged}
716+
/>
717+
</CardHeader>
716718
<ServicesList key={cockpit.format("$0-list", activeTab)}
717719
isTimer={activeTab == 'timer'}
718720
filtersRef={this.filtersRef}
@@ -865,7 +867,8 @@ const ServicesPageFilters = ({
865867
</ToolbarToggleGroup>;
866868

867869
return (
868-
<Toolbar data-loading={loadingUnits}
870+
<Toolbar
871+
data-loading={loadingUnits}
869872
clearAllFilters={onClearAllFilters}
870873
className="pf-m-sticky-top ct-compact services-toolbar"
871874
id="services-toolbar"
@@ -904,7 +907,7 @@ const ServicesPage = () => {
904907

905908
return (
906909
<WithDialogs>
907-
<Page>
910+
<Page className='no-masthead-sidebar'>
908911
{cockpit.location.path.length == 0 &&
909912
<PageSection hasBodyWrapper={false} className="services-header">
910913
<Flex>

pkg/systemd/services.scss

+10-20
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// The service list lacks a top border.
55
// However, the toolbar also lacks a border and is sticky, so add a bottom
66
// border to the toolbar to separate the toolbar and list.
7-
.services-toolbar {
8-
border-block-end: 1px solid var(--pf-v5-global--BorderColor--100);
7+
.pf-m-grid-lg.pf-v6-c-table tbody:where(.pf-v6-c-table__tbody):first-of-type {
8+
border-block-start: var(--pf-v6-c-table__tbody--responsive--border-width--base) solid var(--pf-v6-c-table--responsive--BorderColor);
99
}
1010

1111
// Magic pixie dust to make the list a bit faster and more furious
@@ -32,7 +32,7 @@
3232

3333
.service-unit-file-state {
3434
display: inline-block;
35-
font-size: var(--pf-v5-global--FontSize--sm);
35+
// font-size: var(--pf-t--global--font--size--sm);
3636
min-inline-size: 5rem;
3737
text-align: center;
3838
}
@@ -46,19 +46,6 @@
4646
.pf-v6-c-nav__link > .ct-exclamation-circle {
4747
margin-inline-start: 0.5rem;
4848
}
49-
50-
.services-header.pf-v6-c-page__main-nav {
51-
padding-block-end: 1rem;
52-
padding-inline-end: 0;
53-
54-
> .pf-v6-l-flex {
55-
// Add spacing between the tabs and the 'Create timer' button in mobile
56-
row-gap: var(--pf-v5-global--spacer--sm);
57-
// Align 'Create timer' button with the right side of the services list card
58-
margin-inline-end: var(--pf-v5-c-page__main-section--PaddingRight);
59-
}
60-
}
61-
6249
// Add some spacing between the icon and the status string in the list
6350
.service-unit-status-failed > .ct-exclamation-circle {
6451
margin-inline-end: 0.5rem;
@@ -68,23 +55,26 @@
6855
min-inline-size: 20rem;
6956
display: grid;
7057
grid-template-columns: repeat(auto-fill, minmax(5rem, 25rem));
71-
grid-gap: var(--pf-v5-global--spacer--sm);
58+
grid-gap: var(--pf-t--global--spacer--sm);
7259

7360
.service-unit-description {
7461
font-weight: bold;
7562
}
7663
}
7764

78-
.service-thumbtack-icon-color {
79-
color: var(--pf-v5-global--icon--Color--light);
65+
// FIXME @Venefilyn: Long-named services causes the cell to exceed its length
66+
// as it won't wrap correctly. It does seem like (inline-)flex itself cause the
67+
// issues. For now we go to how it was in PF5 and set it to display: block.
68+
#services .service-unit-id {
69+
--pf-v6-c-button--Display: block;
8070
}
8171

8272
.service-unit-triggers {
8373
min-inline-size: 20ch;
8474
}
8575

8676
.pf-v6-c-table .service-unit-second-column {
87-
--pf-v5-c-table--cell--Width: 20%;
77+
--pf-v6-c-table--cell--Width: 20%;
8878
}
8979

9080
// Don't show labels from mobile mode

test/verify/check-system-services

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class TestServices(testlib.MachineCase):
6161

6262
def do_action(self, action):
6363
self.browser.click(".service-top-panel button.pf-v6-c-menu-toggle")
64-
self.browser.click(f".service-top-panel .pf-v6-c-menu__list-item:contains('{action}') button")
64+
self.browser.click(f"#services-page .pf-v6-c-menu__list-item:contains('{action}') button")
6565

6666
def check_service_details(self, statuses, actions, enabled, onoff=True, kebab=True):
6767
with self.browser.wait_timeout(60):
@@ -73,11 +73,11 @@ class TestServices(testlib.MachineCase):
7373

7474
if kebab:
7575
self.browser.click(".service-top-panel button.pf-v6-c-menu-toggle")
76-
self.browser.wait_text(".service-top-panel .pf-v6-c-menu__list", "".join(actions))
76+
self.browser.wait_text("#services-page .pf-v6-c-menu__list", "".join(actions))
7777
# Click away to close the pf-v6-c-menu__list
7878
self.browser.click(".service-top-panel button.pf-v6-c-menu-toggle")
7979
else:
80-
self.browser.wait_not_present(".service-top-panel .pf-v6-c-menu__list")
80+
self.browser.wait_not_present("#services-page .pf-v6-c-menu__list")
8181

8282
def check_service_on(self, expect_reload=True):
8383
self.check_service_details(
@@ -630,17 +630,17 @@ WantedBy=default.target
630630
# wait for layout to settle
631631
time.sleep(1)
632632
b.click(".service-top-panel button.pf-v6-c-menu-toggle")
633-
b.wait_in_text(".service-top-panel .pf-v6-c-menu__list", "Disallow running")
633+
b.wait_in_text("#services-page .pf-v6-c-menu__list", "Disallow running")
634634
b.assert_pixels_in_current_layout("#service-details-unit", "services-kebabdropdown-rtl")
635635
# Close menu
636636
b.click(".service-top-panel button.pf-v6-c-menu-toggle")
637637
b.wait_not_present(".pf-v6-c-menu__list")
638638
b.set_layout("desktop")
639639
b.click(".service-top-panel button.pf-v6-c-menu-toggle")
640-
b.wait_in_text(".service-top-panel .pf-v6-c-menu__list", "Disallow running")
640+
b.wait_in_text("#services-page .pf-v6-c-menu__list", "Disallow running")
641641
# check if our custom kebab menu renders properly
642642
b.assert_pixels("#service-details-unit", "services-kebabdropdown", skip_layouts=['rtl'])
643-
b.wait_not_in_text(".service-top-panel .pf-v6-c-menu__list", "Delete")
643+
b.wait_not_in_text("#services-page .pf-v6-c-menu__list", "Delete")
644644
b.click(".pf-v6-c-breadcrumb a:contains('Services')")
645645

646646
@testlib.nondestructive

0 commit comments

Comments
 (0)