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

Adapt network to the new UI #1302

Merged
merged 2 commits into from
Jun 11, 2024
Merged
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
51 changes: 39 additions & 12 deletions web/src/components/network/NetworkPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

import React, { useEffect, useState } from "react";
import { useLoaderData } from "react-router-dom";
import { Button, Skeleton } from "@patternfly/react-core";
import { Button, CardBody, Flex, FlexItem, Grid, GridItem, Skeleton } from "@patternfly/react-core";
import { Icon } from "~/components/layout";
import { useInstallerClient } from "~/context/installer";
import { If, Section } from "~/components/core";
import { ConnectionsTable, NetworkPageMenu, WifiSelector } from "~/components/network";
import { If, CardField, Page } from "~/components/core";
import { ConnectionsTable, WifiSelector } from "~/components/network";
import { NetworkEventTypes } from "~/client/network";
import { _ } from "~/i18n";

Expand Down Expand Up @@ -177,15 +177,42 @@ export default function NetworkPage() {

return (
<>
<Section title={_("Wired connections")} icon="lan">
{ready ? <WiredConnections /> : <Skeleton />}
</Section>

<Section title={_("WiFi connections")} icon="wifi">
{ready ? <WifiConnections /> : <Skeleton />}
</Section>

<NetworkPageMenu wifiScanSupported={wifiScanSupported} openWifiSelector={openWifiSelector} />
<Page.Header>
<Flex>
<FlexItem>
<h2>{_("Network")}</h2>
</FlexItem>
<If
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, I'm killing the <If> component too. There were no few complains about it in the past :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, another note: for the shake of reducing nodes, I'm using Flex with props when possible instead of Flex with FlexItems. But this is just a comment, please keep the change as it is.

condition={wifiScanSupported}
then={
<FlexItem align={{ default: "alignRight" }}>
<Button variant="secondary" onClick={openWifiSelector}>
{_("Connect to a Wi-Fi network")}
</Button>
</FlexItem>
}
/>
</Flex>
</Page.Header>

<Page.MainContent>
<Grid hasGutter>
<GridItem sm={12}>
<CardField label={_("Wired connections")}>
<CardBody>
{ready ? <WiredConnections /> : <Skeleton />}
</CardBody>
</CardField>
</GridItem>
<GridItem sm={12}>
<CardField label={_("WiFi connections")}>
<CardBody>
{ready ? <WifiConnections /> : <Skeleton />}
</CardBody>
</CardField>
</GridItem>
</Grid>
</Page.MainContent>

<If
condition={wifiScanSupported}
Expand Down
51 changes: 0 additions & 51 deletions web/src/components/network/NetworkPageMenu.jsx

This file was deleted.

1 change: 0 additions & 1 deletion web/src/components/network/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/

export { default as NetworkPage } from "./NetworkPage";
export { default as NetworkPageMenu } from "./NetworkPageMenu";
export { default as AddressesDataList } from "./AddressesDataList";
export { default as ConnectionsTable } from "./ConnectionsTable";
export { default as DnsDataList } from "./DnsDataList";
Expand Down
Loading