Skip to content

Commit

Permalink
pkg: fix fragments should contain more then one child
Browse files Browse the repository at this point in the history
`oxlint` a Rust implementation of `eslint` finds more issues for the
`jsx-no-useless-fragment` eslint react rule. The Rust implementation is
not feature complete yet so we can't yet switch over.
  • Loading branch information
jelly committed Apr 3, 2024
1 parent f2cc9e1 commit e75bd6f
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 105 deletions.
14 changes: 6 additions & 8 deletions pkg/networkmanager/dialogs-common.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,12 @@ export const NetworkAction = ({ buttonText, iface, connectionSettings, type }) =
}

return (
<>
<Button id={"networking-" + (!iface ? "add-" : "edit-") + type}
isInline={!!iface}
onClick={syn_click(model, show)}
variant={!iface ? "secondary" : "link"}>
{buttonText || _("edit")}
</Button>
</>
<Button id={"networking-" + (!iface ? "add-" : "edit-") + type}
isInline={!!iface}
onClick={syn_click(model, show)}
variant={!iface ? "secondary" : "link"}>
{buttonText || _("edit")}
</Button>
);
};

Expand Down
42 changes: 20 additions & 22 deletions pkg/packagekit/updates.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,13 @@ function updateItem(remarkable, info, pkgNames, key) {
if (secSeverityURL)
secSeverityURL = <a rel="noopener noreferrer" target="_blank" href={secSeverityURL}>{secSeverity}</a>;
type = (
<>
<Tooltip id="tip-severity" content={ secSeverity || _("security") }>
<span>
{icon}
{ (info.cve_urls && info.cve_urls.length > 0) ? info.cve_urls.length : "" }
</span>
</Tooltip>
</>);
<Tooltip id="tip-severity" content={ secSeverity || _("security") }>
<span>
{icon}
{ (info.cve_urls && info.cve_urls.length > 0) ? info.cve_urls.length : "" }
</span>
</Tooltip>
);
} else {
const tip = (info.severity >= PK.Enum.INFO_NORMAL) ? _("bug fix") : _("enhancement");
type = (
Expand Down Expand Up @@ -1462,7 +1461,8 @@ class OsUpdates extends React.Component {
</Gallery>
</PageSection>
{ this.state.showRestartServicesDialog &&
<RestartServices tracerPackages={this.state.tracerPackages}
<RestartServices
tracerPackages={this.state.tracerPackages}
close={() => this.setState({ showRestartServicesDialog: false })}
state={this.state.state}
callTracer={(state) => this.callTracer(state)}
Expand Down Expand Up @@ -1587,24 +1587,22 @@ class OsUpdates extends React.Component {
});

return (
<>
<PageSection>
<Gallery className='ct-cards-grid' hasGutter>
<CardsPage onValueChanged={this.onValueChanged} handleRefresh={this.handleRefresh} {...this.state} />
</Gallery>
{ this.state.showRestartServicesDialog &&
<RestartServices tracerPackages={this.state.tracerPackages}
<PageSection>
<Gallery className='ct-cards-grid' hasGutter>
<CardsPage onValueChanged={this.onValueChanged} handleRefresh={this.handleRefresh} {...this.state} />
</Gallery>
{ this.state.showRestartServicesDialog &&
<RestartServices tracerPackages={this.state.tracerPackages}
close={() => this.setState({ showRestartServicesDialog: false })}
state={this.state.state}
callTracer={(state) => this.callTracer(state)}
onValueChanged={delta => this.setState(delta)}
loadUpdates={this.loadUpdates} />
}
{ this.state.showRebootSystemDialog &&
<ShutdownModal onClose={() => this.setState({ showRebootSystemDialog: false })} />
}
</PageSection>
</>
}
{ this.state.showRebootSystemDialog &&
<ShutdownModal onClose={() => this.setState({ showRebootSystemDialog: false })} />
}
</PageSection>
);
}

Expand Down
20 changes: 9 additions & 11 deletions pkg/shell/failures.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ export const EarlyFailure = ({ ca_cert_url }) => {
<EmptyStatePanel icon={ExclamationCircleIcon}
title={ _("Connection failed") }
paragraph={
<>
<Stack hasGutter>
<div>{_("There was an unexpected error while connecting to the machine.")}</div>
<div>{_("Messages related to the failure might be found in the journal:")}</div>
<ClipboardCopy isReadOnly hoverTip={_("Copy")} clickTip={_("Copied")}>journalctl -u cockpit</ClipboardCopy>
{ca_cert_url && <div id="safari-cert-help">
<div>{_("Safari users need to import and trust the certificate of the self-signing CA:")}</div>
<Button variant="link" component="a" id="safari-cert" href={ca_cert_url} download>ca.cer</Button>
</div>}
</Stack>
</>
<Stack hasGutter>
<div>{_("There was an unexpected error while connecting to the machine.")}</div>
<div>{_("Messages related to the failure might be found in the journal:")}</div>
<ClipboardCopy isReadOnly hoverTip={_("Copy")} clickTip={_("Copied")}>journalctl -u cockpit</ClipboardCopy>
{ca_cert_url && <div id="safari-cert-help">
<div>{_("Safari users need to import and trust the certificate of the self-signing CA:")}</div>
<Button variant="link" component="a" id="safari-cert" href={ca_cert_url} download>ca.cer</Button>
</div>}
</Stack>
} />
</PageSection>
</Page>
Expand Down
4 changes: 2 additions & 2 deletions pkg/shell/hosts_dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ class NotSupported extends React.Component {
position="top" variant="medium"
onClose={this.props.onClose}
title={_("Cockpit is not installed")}
footer={<>
footer={
<Button variant="link" className="btn-cancel" onClick={this.props.onClose}>
{ _("Close") }
</Button>
</>}
}
>
<Stack hasGutter>
{ this.props.dialogError && <ModalError dialogError={this.props.dialogError} />}
Expand Down
16 changes: 7 additions & 9 deletions pkg/storaged/lvm2/block-logical-volume.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,13 @@ export const StructureDescription = ({ client, lvol }) => {
</FlexItem>);

return (
<>
<StorageDescription title={_("Stripes")}>
<Flex alignItems={{ default: "alignItemsStretch" }}>{stripes}</Flex>
{status}
{lvol.SyncRatio != 1.0
? <div>{cockpit.format(_("$0 synchronized"), lvol.SyncRatio * 100 + "%")}</div>
: null}
</StorageDescription>
</>);
<StorageDescription title={_("Stripes")}>
<Flex alignItems={{ default: "alignItemsStretch" }}>{stripes}</Flex>
{status}
{lvol.SyncRatio != 1.0
? <div>{cockpit.format(_("$0 synchronized"), lvol.SyncRatio * 100 + "%")}</div>
: null}
</StorageDescription>);
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion pkg/systemd/abrtLog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export class AbrtLogDetails extends React.Component {
</GalleryItem>
<GalleryItem id="abrt-details">
<Card>
<CardHeader actions={{ actions: <><Button variant="danger" onClick={this.onDelete}>{_("Delete")}</Button></> }}>
<CardHeader actions={{ actions: <Button variant="danger" onClick={this.onDelete}>{_("Delete")}</Button> }}>

<CardTitle component="h2">{_("Extended information")}</CardTitle>
</CardHeader>
Expand Down
90 changes: 43 additions & 47 deletions pkg/systemd/overview-cards/configurationCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,51 +57,49 @@ export const ConfigurationCard = ({ hostname }) => {
: null;

return (
<>
<Card className="system-configuration">
<CardTitle>{_("Configuration")}</CardTitle>
<CardBody>
<table className="pf-v5-c-table pf-m-grid-md pf-m-compact">
<tbody className="pf-v5-c-table__tbody">
<tr className="pf-v5-c-table__tr">
<th className="pf-v5-c-table__th" scope="row">{_("Hostname")}</th>
<td className="pf-v5-c-table__td">
{hostname && <span id="system_information_hostname_text">{hostname}</span>}
<span>{hostname_button}</span>
</td>
</tr>

<tr className="pf-v5-c-table__tr">
<th className="pf-v5-c-table__th" scope="row">{_("System time")}</th>
<td className="pf-v5-c-table__td"><ServerTimeConfig /></td>
</tr>

<tr className="pf-v5-c-table__tr">
<th className="pf-v5-c-table__th" scope="row">{_("Domain")}</th>
<td className="pf-v5-c-table__td"><RealmButton realmd_client={realmd_client} /></td>
</tr>

<tr className="pf-v5-c-table__tr">
<th className="pf-v5-c-table__th" scope="row">{_("Performance profile")}</th>
<td className="pf-v5-c-table__td"><TunedPerformanceProfile /></td>
</tr>

<CryptoPolicyRow />

<tr className="pf-v5-c-table__tr">
<th className="pf-v5-c-table__th" scope="row">{_("Secure shell keys")}</th>
<td className="pf-v5-c-table__td">
<Button variant="link" isInline id="system-ssh-keys-link"
<Card className="system-configuration">
<CardTitle>{_("Configuration")}</CardTitle>
<CardBody>
<table className="pf-v5-c-table pf-m-grid-md pf-m-compact">
<tbody className="pf-v5-c-table__tbody">
<tr className="pf-v5-c-table__tr">
<th className="pf-v5-c-table__th" scope="row">{_("Hostname")}</th>
<td className="pf-v5-c-table__td">
{hostname && <span id="system_information_hostname_text">{hostname}</span>}
<span>{hostname_button}</span>
</td>
</tr>

<tr className="pf-v5-c-table__tr">
<th className="pf-v5-c-table__th" scope="row">{_("System time")}</th>
<td className="pf-v5-c-table__td"><ServerTimeConfig /></td>
</tr>

<tr className="pf-v5-c-table__tr">
<th className="pf-v5-c-table__th" scope="row">{_("Domain")}</th>
<td className="pf-v5-c-table__td"><RealmButton realmd_client={realmd_client} /></td>
</tr>

<tr className="pf-v5-c-table__tr">
<th className="pf-v5-c-table__th" scope="row">{_("Performance profile")}</th>
<td className="pf-v5-c-table__td"><TunedPerformanceProfile /></td>
</tr>

<CryptoPolicyRow />

<tr className="pf-v5-c-table__tr">
<th className="pf-v5-c-table__th" scope="row">{_("Secure shell keys")}</th>
<td className="pf-v5-c-table__td">
<Button variant="link" isInline id="system-ssh-keys-link"
onClick={() => Dialogs.show(<SystemInformationSshKeys />)}>
{_("Show fingerprints")}
</Button>
</td>
</tr>
</tbody>
</table>
</CardBody>
</Card>
</>
{_("Show fingerprints")}
</Button>
</td>
</tr>
</tbody>
</table>
</CardBody>
</Card>
);
};

Expand Down Expand Up @@ -194,9 +192,7 @@ const SystemInformationSshKeys = () => {
onClose={Dialogs.close}
id="system_information_ssh_keys"
title={_("Machine SSH key fingerprints")}
footer={<>
<Button variant='secondary' onClick={Dialogs.close}>{_("Close")}</Button>
</>}
footer={<Button variant='secondary' onClick={Dialogs.close}>{_("Close")}</Button>}
>
{body}
</Modal>
Expand Down
5 changes: 2 additions & 3 deletions pkg/systemd/services.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ const ServicesPageFilters = ({
filtersRef.current = onClearAllFilters;
}, [filtersRef, onClearAllFilters]);

const toolbarItems = <>
const toolbarItems =
<ToolbarToggleGroup toggleIcon={<><span className="pf-v5-c-button__icon pf-m-start"><FilterIcon /></span>{_("Toggle filters")}</>} breakpoint="sm"
variant="filter-group" alignment={{ default: 'alignLeft' }}>
<ToolbarItem variant="search-filter">
Expand Down Expand Up @@ -854,8 +854,7 @@ const ServicesPageFilters = ({
value={option.label} />)}
</Select>
</ToolbarFilter>
</ToolbarToggleGroup>
</>;
</ToolbarToggleGroup>;

return (
<Toolbar data-loading={loadingUnits}
Expand Down
4 changes: 2 additions & 2 deletions pkg/systemd/timer-dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ const CreateTimerDialogBody = ({ owner }) => {
}}
validated={submitted && validationFailedSecond ? "error" : "default"} />
}
{repeat == "hourly" && <>
{repeat == "hourly" &&
<TextInput className='delay-number'
value={repeatPatterns[idx].minute}
onChange={(_event, minute) => {
Expand All @@ -303,7 +303,7 @@ const CreateTimerDialogBody = ({ owner }) => {
setRepeatPatterns(arr);
}}
validated={submitted && validationFailedMinute ? "error" : "default"} />
</>}
}
{repeat == "daily" && timePicker(idx)}
{repeat == "weekly" && <>
<FormSelect value={repeatPatterns[idx].day}
Expand Down

0 comments on commit e75bd6f

Please sign in to comment.