-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Anaconda network page #23341
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
base: main
Are you sure you want to change the base?
Anaconda network page #23341
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #network-interface { | ||
| .pf-v6-c-card.pf-m-plain .pf-v6-c-card__header, .pf-v6-c-card.pf-m-plain > .pf-v6-c-card__title { | ||
| padding-block-start: 0; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
| /* | ||
| * Copyright (C) 2021 Red Hat, Inc. | ||
| * SPDX-License-Identifier: LGPL-2.1-or-later | ||
| */ | ||
|
|
||
| import cockpit from "cockpit"; | ||
| import React, { useState } from 'react'; | ||
|
|
||
| import { Flex, FlexItem } from "@patternfly/react-core/dist/esm/layouts/Flex/index.js"; | ||
| import { Page, } from "@patternfly/react-core/dist/esm/components/Page/index.js"; | ||
|
|
||
| import { ListingTableRowProps } from "cockpit-components-table.jsx"; | ||
|
|
||
| import { | ||
| has_group, | ||
| is_loopback, | ||
| is_managed, | ||
| is_wireless, | ||
| render_active_connection, | ||
| } from './interfaces.js'; | ||
| import { Content, ContentVariants, SimpleList, SimpleListGroup, SimpleListItem, Split, SplitItem } from "@patternfly/react-core"; | ||
| import { NetworkInterfacePage } from "./network-interface.jsx"; | ||
| import "./anaconda-main.css"; | ||
|
|
||
| const _ = cockpit.gettext; | ||
|
|
||
| interface AnacondaNetworkPageProps { | ||
| privileged: boolean; | ||
| operationInProgress: boolean; | ||
| usage_monitor: any; | ||
| interfaces: any[]; | ||
| iface?: any; | ||
| } | ||
|
|
||
| interface AnacondaActiveNetwork { | ||
| isWireless?: boolean; | ||
| iface: any; | ||
| } | ||
|
|
||
| export const AnacondaNetworkPage = ({ privileged, operationInProgress, usage_monitor, interfaces }: AnacondaNetworkPageProps) => { | ||
| const [active, setActive] = useState<AnacondaActiveNetwork>(); | ||
| // useEvent(usage_monitor.grid, "notify"); | ||
|
|
||
| const managedWired: ListingTableRowProps[] = []; | ||
| const managedWireless: ListingTableRowProps[] = []; | ||
| let hasDetails = false; | ||
Check noticeCode scanning / CodeQL Unused variable, import, function or class Note
Unused variable hasDetails.
|
||
|
Comment on lines
+44
to
+46
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 3 added lines are not executed by any test. Details |
||
|
|
||
| interfaces.forEach(iface => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This added line is not executed by any test. Details |
||
| // Skip loopback | ||
| if (is_loopback(iface)) | ||
| return; | ||
|
Comment on lines
+50
to
+51
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 2 added lines are not executed by any test. Details |
||
|
|
||
| // Skip members | ||
| else if (has_group(iface)) | ||
| return; | ||
|
Comment on lines
+54
to
+55
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 2 added lines are not executed by any test. Details |
||
|
|
||
| const dev = iface.Device; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This added line is not executed by any test. Details |
||
| // const show_traffic = (dev && (dev.State == 100 || dev.State == 10) && dev.Carrier === true); | ||
|
|
||
| // usage_monitor.add(iface.Name); | ||
|
|
||
| const activeConnection = render_active_connection(dev, false, true); | ||
| const isWireless = is_wireless(iface); | ||
|
Comment on lines
+62
to
+63
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 2 added lines are not executed by any test. Details |
||
|
|
||
| let connectionStatus; | ||
| if (activeConnection) { | ||
| connectionStatus = _("Connected") | ||
|
Comment on lines
+65
to
+67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 3 added lines are not executed by any test. Details |
||
| } else { | ||
| connectionStatus = _("Disconnected") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This added line is not executed by any test. Details |
||
| } | ||
|
|
||
| const row = ( | ||
| <SimpleListItem key={iface.name} onClick={() => {setActive({isWireless, iface})}}> | ||
| <Flex | ||
| direction={{ default: 'row' }} | ||
| justifyContent={{ default: 'justifyContentSpaceBetween' }} | ||
| flexWrap={{ default: 'nowrap' }} | ||
|
Comment on lines
+72
to
+77
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 6 added lines are not executed by any test. Details |
||
| > | ||
| <FlexItem flex={{ default: 'flex_1' }}>{iface.Name}</FlexItem> | ||
| <FlexItem> | ||
| <Content component={ContentVariants.small}>{connectionStatus}</Content> | ||
| </FlexItem> | ||
| </Flex> | ||
| </SimpleListItem> | ||
| ) | ||
|
|
||
| // Details column: show type-specific information | ||
| // let detailsColumn = null; | ||
| // if (dev?.DeviceType === '802-11-wireless') { | ||
| // const networkCount = dev.visibleSsids.length; | ||
| // if (networkCount > 0 || dev.ActiveAccessPoint?.Ssid) { | ||
| // hasDetails = true; | ||
| // detailsColumn = ( | ||
| // <Flex columnGap={{ default: 'columnGapSm' }}> | ||
| // {networkCount > 0 && ( | ||
| // <FlexItem> | ||
| // <Label status="info"> | ||
| // {cockpit.format(cockpit.ngettext("$0 network", "$0 networks", networkCount), networkCount)} | ||
| // </Label> | ||
| // </FlexItem> | ||
| // )} | ||
| // {dev.ActiveAccessPoint?.Ssid && ( | ||
| // <FlexItem> | ||
| // <Label status="success" icon={<ConnectedIcon />}>{dev.ActiveAccessPoint?.Ssid}</Label> | ||
| // </FlexItem> | ||
| // )} | ||
| // </Flex> | ||
| // ); | ||
| // } | ||
| // } | ||
| // row.columns.push({ title: detailsColumn }); | ||
|
|
||
| if (!dev || is_managed(dev)) { | ||
| isWireless ? managedWireless.push(row) : managedWired.push(row); | ||
| } | ||
| }); | ||
|
|
||
| // TODO: Actions: turn on off action and edit (wired) or join wifi (wireless) | ||
| const actions = privileged && ( | ||
Check noticeCode scanning / CodeQL Unused variable, import, function or class Note
Unused variable actions.
|
||
|
|
||
| <> | ||
| {/* <NetworkAction buttonText={_("Add VPN")} type='wg' /> | ||
| <NetworkAction buttonText={_("Add bond")} type='bond' /> | ||
| <NetworkAction buttonText={_("Add team")} type='team' /> | ||
| <NetworkAction buttonText={_("Add bridge")} type='bridge' /> | ||
| <NetworkAction buttonText={_("Add VLAN")} type='vlan' /> */} | ||
| </> | ||
| ); | ||
|
|
||
| return ( | ||
| <Page data-test-wait={operationInProgress} id="networking" className="pf-m-no-sidebar anaconda"> | ||
| <Content component="h1">{_("Networks")}</Content> | ||
| <Split hasGutter> | ||
| <SplitItem> | ||
| <SimpleList> | ||
| {managedWireless.length !== 0 && ( | ||
| <SimpleListGroup title={_("Wireless")} id="wireless-connections">{...managedWireless}</SimpleListGroup> | ||
| )} | ||
| {managedWired.length !== 0 && ( | ||
| <SimpleListGroup title={_("Wired")} id="wired-connections">{...managedWired}</SimpleListGroup> | ||
| )} | ||
| {(managedWireless.length === 0 && managedWired.length === 0) && ( | ||
| <SimpleListItem key="not-found">{_("No networks found")}</SimpleListItem> | ||
| )} | ||
| </SimpleList> | ||
| </SplitItem> | ||
| <SplitItem isFilled> | ||
| {active?.iface && | ||
| <NetworkInterfacePage | ||
| privileged={privileged} | ||
| operationInProgress={operationInProgress} | ||
| usage_monitor={usage_monitor} | ||
| plot_state={undefined} | ||
| interfaces={interfaces} | ||
| iface={active.iface} /> | ||
| } | ||
| </SplitItem> | ||
| </Split> | ||
|
|
||
| </Page> | ||
| ); | ||
| }; | ||
|
|
||
| export const AnacondaWirelessDetail = ({active}: {active: AnacondaActiveNetwork}) => { | ||
| return <> | ||
| <Content component="h2">{_("Wireless")}</Content> | ||
| Interface | ||
| {active.iface.Name} | ||
| Status | ||
| Network joined | ||
| Security type | ||
| </> | ||
| } | ||
|
|
||
| export const AnacondaWiredDetail = ({active}: {active: AnacondaActiveNetwork}) => { | ||
| return <> | ||
| <Content component="h2">{_("Wired")}</Content> | ||
| Interface | ||
| {active.iface.Name} | ||
| Status | ||
| IP Settings | ||
| </> | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 added lines are not executed by any test. Details