Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PF card: Adapt for PF's pf-m-wrap option #19471

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/lib/cockpit-components-logs-panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class LogsPanel extends React.Component {
const actions = (this.state.logs.length > 0 && this.props.goto_url) && <Button variant="secondary" onClick={e => cockpit.jump(this.props.goto_url)}>{_("View all logs")}</Button>;

return (
<Card className="cockpit-log-panel">
<Card className="pf-m-wrap cockpit-log-panel">
<CardHeader actions={{ actions }}>
<CardTitle>{this.props.title}</CardTitle>
</CardHeader>
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/cockpit-components-modifications.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class Modifications extends React.Component {
return (
<>
<ModificationsExportDialog show={this.state.showDialog} shell={this.props.shell} ansible={this.props.ansible} onClose={ () => this.setState({ showDialog: false }) } />
<Card className="modifications-table">
<Card className="pf-m-wrap modifications-table">
<CardHeader>
<CardTitle component="h2">{this.props.title}</CardTitle>
{ !emptyRow &&
Expand Down
10 changes: 0 additions & 10 deletions pkg/lib/patternfly/patternfly-5-overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,8 @@ select.pf-v5-c-form-control {
// https://github.com/patternfly/patternfly/issues/3959
--pf-v5-c-card__header-toggle--MarginTop: 0;

.pf-v5-c-card__header:not(.ct-card-expandable-header),
.pf-v5-c-card__header:not(.ct-card-expandable-header) .pf-v5-c-card__header-main {
// upstream fix (pending): https://github.com/patternfly/patternfly/pull/3714
display: flex;
flex-wrap: wrap;
row-gap: var(--pf-v5-global--spacer--sm);
justify-content: space-between;
}

.pf-v5-c-card__header:not(.ct-card-expandable-header) {
> .pf-v5-c-card__actions {
flex-wrap: wrap;
row-gap: var(--pf-v5-global--spacer--sm);

// PF4 CardActions act up when using buttons while the title is large of font
Expand Down
8 changes: 4 additions & 4 deletions pkg/metrics/metrics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ class CurrentMetrics extends React.Component {

return (
<Gallery className="current-metrics" hasGutter>
<Card id="current-metrics-card-cpu">
<Card className="pf-m-wrap" id="current-metrics-card-cpu">
<CardHeader className='align-baseline'>
<CardTitle>{ _("CPU") }</CardTitle>
{ this.cpuTemperature !== null &&
Expand Down Expand Up @@ -913,7 +913,7 @@ class CurrentMetrics extends React.Component {
</CardBody>
</Card>

<Card id="current-metrics-card-disks">
<Card className="pf-m-wrap" id="current-metrics-card-disks">
<CardTitle>{ _("Disks") }</CardTitle>
<CardBody>
<DescriptionList isHorizontal columnModifier={{ default: '2Col' }}>
Expand Down Expand Up @@ -974,7 +974,7 @@ class CurrentMetrics extends React.Component {
</CardBody>
</Card>

<Card className="current-metrics-network">
<Card className="pf-m-wrap current-metrics-network">
<CardTitle>{ _("Network") }</CardTitle>
<CardBody>
<Table
Expand Down Expand Up @@ -1955,7 +1955,7 @@ class MetricsHistory extends React.Component {
<PageSection className="metrics-history-section" variant={PageSectionVariants.light}>
<>
{ this.state.hours.length > 0 &&
<Card isPlain>
<Card className="pf-m-wrap" isPlain>
<CardBody className="metrics-history">
{ this.state.hours.map((time, i) => {
const showHeader = i == 0 || timeformat.date(time) != timeformat.date(this.state.hours[i - 1]);
Expand Down
2 changes: 1 addition & 1 deletion pkg/networkmanager/firewall.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function ZoneSection(props) {

const actions = !firewall.readonly && <div className="zone-section-buttons">{addServiceAction}{deleteButton}</div>;

return <Card className="zone-section" data-id={props.zone.id}>
return <Card className="pf-m-wrap zone-section" data-id={props.zone.id}>
<CardHeader actions={{ actions }} className="zone-section-heading">
<Flex alignItems={{ default: 'alignSelfBaseline' }} spaceItems={{ default: 'spaceItemsXl' }}>
<CardTitle component="h2">
Expand Down
2 changes: 1 addition & 1 deletion pkg/networkmanager/network-interface-members.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export const NetworkInterfaceMembers = ({
);

return (
<Card id="network-interface-members" className="network-interface-members">
<Card id="network-interface-members" className="pf-m-wrap network-interface-members">
<CardHeader actions={{ actions: add_btn }}>
<CardTitle component="h2">{_("Interface members")}</CardTitle>
</CardHeader>
Expand Down
2 changes: 1 addition & 1 deletion pkg/networkmanager/network-interface.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ export const NetworkInterfacePage = ({
</PageSection>
<PageSection>
<Gallery hasGutter>
<Card className="network-interface-details">
<Card className="pf-m-wrap network-interface-details">
<CardHeader actions={{
actions: (
<>
Expand Down
6 changes: 3 additions & 3 deletions pkg/networkmanager/network-main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const NetworkPage = ({ privileged, operationInProgress, usage_monitor, pl
</PageSection>
<PageSection>
<Gallery hasGutter>
{firewall.installed && <Card id="networking-firewall-summary">
{firewall.installed && <Card className="pf-m-wrap" id="networking-firewall-summary">
<CardHeader actions={{
actions: <Button variant="secondary" id="networking-firewall-link"
component="a"
Expand All @@ -175,7 +175,7 @@ export const NetworkPage = ({ privileged, operationInProgress, usage_monitor, pl
</Button>
</CardBody>
</Card>}
<Card id="networking-interfaces">
<Card className="pf-m-wrap" id="networking-interfaces">
<CardHeader actions={{ actions }}>
<CardTitle component="h2">{_("Interfaces")}</CardTitle>
</CardHeader>
Expand All @@ -190,7 +190,7 @@ export const NetworkPage = ({ privileged, operationInProgress, usage_monitor, pl
rows={managed} />
</Card>
{unmanaged.length > 0 &&
<Card id="networking-unmanaged-interfaces">
<Card className="pf-m-wrap" id="networking-unmanaged-interfaces">
<CardHeader>
<CardTitle component="h2">{_("Unmanaged interfaces")}</CardTitle>
</CardHeader>
Expand Down
10 changes: 5 additions & 5 deletions pkg/playground/react-demo-cards.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ import { Gallery, GalleryItem } from "@patternfly/react-core/dist/esm/layouts/Ga

const CardsDemo = () => {
const cards = [
<Card isCompact key="card1">
<Card className="pf-m-wrap" isCompact key="card1">
<CardBody>I'm a card in a gallery</CardBody>
</Card>,
<Card isCompact key="card2">
<Card className="pf-m-wrap" isCompact key="card2">
<CardBody>I'm a card in a gallery</CardBody>
<CardFooter>I have a footer</CardFooter>
</Card>,
<Card isCompact key="card3">
<Card className="pf-m-wrap" isCompact key="card3">
<CardBody>I'm a card in a gallery</CardBody>
</Card>,
<Card isCompact key="card4">
<Card className="pf-m-wrap" isCompact key="card4">
<CardTitle>I have a header too</CardTitle>
<CardBody>I'm a card in a gallery</CardBody>
</Card>,
<Card key="card5">
<Card className="pf-m-wrap" key="card5">
<CardHeader actions={{
actions: <><input type="checkbox" />
<Button className="btn">click</Button></>,
Expand Down
2 changes: 1 addition & 1 deletion pkg/sosreport/sosreport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ const SOSBody = () => {

return (
<PageSection>
<Card className="ct-card">
<Card className="pf-m-wrap ct-card">
<CardHeader actions={{
actions: <Button id="create-button" variant="primary" onClick={run_report}>
{_("Run report")}
Expand Down
2 changes: 1 addition & 1 deletion pkg/storaged/crypto-keyslots.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ export class CryptoKeyslots extends React.Component {
const remaining = max_slots - keys.length;

return (
<Card className="key-slot-panel">
<Card className="pf-m-wrap key-slot-panel">
<CardHeader actions={{
actions: <>
<span className="key-slot-panel-remaining">
Expand Down
2 changes: 1 addition & 1 deletion pkg/storaged/jobs-panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class JobsPanel extends React.Component {
jobs = jobs.sort(cmp_job);

return (
<Card className="detail-jobs">
<Card className="pf-m-wrap detail-jobs">
<CardTitle component="h2">{_("Jobs")}</CardTitle>
<CardBody className="contains-list">
<DataList isCompact aria-label={_("Jobs")}>
Expand Down
4 changes: 2 additions & 2 deletions pkg/systemd/hwinfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,15 @@ class HardwareInfo extends React.Component {
: undefined } />
</CardBody>
</Card>
<Card id="pci-listing">
<Card className="pf-m-wrap" id="pci-listing">
<CardHeader>
<CardTitle component="h2">{_("PCI")}</CardTitle>
</CardHeader>
<CardBody className="contains-list">
{ pci }
</CardBody>
</Card>
<Card id="memory-listing">
<Card className="pf-m-wrap" id="memory-listing">
<CardHeader>
<CardTitle component="h2">{_("Memory")}</CardTitle>
</CardHeader>
Expand Down
2 changes: 1 addition & 1 deletion pkg/systemd/overview-cards/configurationCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const ConfigurationCard = ({ hostname }) => {

return (
<>
<Card className="system-configuration">
<Card className="pf-m-wrap system-configuration">
<CardTitle>{_("Configuration")}</CardTitle>
<CardBody>
<table className="pf-v5-c-table pf-m-grid-md pf-m-compact">
Expand Down
2 changes: 1 addition & 1 deletion pkg/systemd/overview-cards/healthCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const _ = cockpit.gettext;
export class HealthCard extends React.Component {
render() {
return (
<Card className="system-health">
<Card className="pf-m-wrap system-health">
<CardTitle>{_("Health")}</CardTitle>
<CardBody>
<ul className="system-health-events">
Expand Down
2 changes: 1 addition & 1 deletion pkg/systemd/overview-cards/systemInformationCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class SystemInformationCard extends React.Component {

render() {
return (
<Card className="system-information">
<Card className="pf-m-wrap system-information">
<CardTitle>{_("System information")}</CardTitle>
<CardBody>
<table className="pf-v5-c-table pf-m-grid-md pf-m-compact">
Expand Down
2 changes: 1 addition & 1 deletion pkg/systemd/overview-cards/usageCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class UsageCard extends React.Component {
const cores_str = cockpit.format(cockpit.ngettext("of $0 CPU", "of $0 CPUs", this.state.numCpu), this.state.numCpu);

return (
<Card className="system-usage">
<Card className="pf-m-wrap system-usage">
<CardTitle>{_("Usage")}</CardTitle>
<CardBody>
<table className="pf-v5-c-table pf-m-grid-md pf-m-compact">
Expand Down
2 changes: 1 addition & 1 deletion pkg/systemd/service-details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ export class ServiceDetails extends React.Component {
});

return (
<Card id="service-details-unit" className="ct-card">
<Card id="service-details-unit" className="pf-m-wrap ct-card">
{ this.state.showDeleteDialog &&
<DeleteModal
name={this.props.unit.Description}
Expand Down
2 changes: 1 addition & 1 deletion pkg/systemd/services.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ class ServicesPageBody extends React.Component {

return (
<PageSection>
<Card isCompact>
<Card className="pf-m-wrap" isCompact>
<ServicesPageFilters activeStateDropdownOptions={activeStateDropdownOptions}
fileStateDropdownOptions={fileStateDropdownOptions}
filtersRef={this.filtersRef}
Expand Down
2 changes: 1 addition & 1 deletion pkg/users/account-logs-panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function AccountLogs({ name }) {
}, [name]);

return (
<Card id="account-logs">
<Card className="pf-m-wrap" id="account-logs">
<CardTitle component="h2">{_("Login history")}</CardTitle>
<CardBody className="contains-list">
<ListingTable variant="compact" aria-label={ _("Login history list") }
Expand Down
Loading