Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
13b2eb0
[web] Add a model.js for network factories and types
imobachgs Oct 27, 2022
a18bf8e
[web] Fix createConnection factory function
imobachgs Oct 28, 2022
2afdf92
[web] DBusClient#proxies waits for the proxies
imobachgs Oct 28, 2022
5d4d63b
[web] Extract the logic to convert the Connection to Cockpit
imobachgs Oct 28, 2022
b107871
[web] Add an AccessPoint model
imobachgs Oct 28, 2022
271a730
[web] Allow using destructuring to remove properties
imobachgs Oct 28, 2022
149df3e
[web] Extend the NetworkClient with an addConnection method
imobachgs Oct 28, 2022
8c1a42d
[web] Avoid setting up twice a NetworkClient
imobachgs Oct 28, 2022
a772d07
[web] Fix a typo in setUp
imobachgs Oct 28, 2022
18a007e
[web] Added a wireless network selector
imobachgs Oct 28, 2022
12ceb13
Added AP supported security protocols function
teclator Oct 28, 2022
791df4e
Use a security attribute for the supported protocols
teclator Oct 28, 2022
000b50c
[web] Move SecurityProtocols to model.js
teclator Oct 28, 2022
d9da36d
Added wireless security settings
teclator Oct 28, 2022
6b7eb73
Fix wireless config activation
teclator Oct 28, 2022
5fab6a4
[web] Fix NetworkManagerAdapter tests
imobachgs Oct 30, 2022
118b438
[web] WirelessSelector returns null when no APs are available
imobachgs Oct 30, 2022
83bffe8
[web] When on APs are available, do not display the link to connect
imobachgs Oct 30, 2022
70dbb4f
Fix filtering of ssids
teclator Nov 2, 2022
f663da1
[web] Use proxies to handle active connections
imobachgs Oct 30, 2022
7087ed2
[web] Simplify network events handling
imobachgs Oct 31, 2022
e349042
[web] Methods to get the network config are not async anymore
imobachgs Nov 2, 2022
3ff6234
[web] Fix the function to remove a handler
imobachgs Nov 2, 2022
6418032
[web] Remove some unused @typedef
imobachgs Nov 2, 2022
54fd477
[web] Rename AP_* constants for consistency
imobachgs Nov 3, 2022
95e655e
Added security form selector
teclator Nov 7, 2022
d8aafd6
[web] Add method for connect to a wireless network
dgdavid Nov 7, 2022
f9b8544
[web] Do not force the auth alghoritm by now
dgdavid Nov 7, 2022
e947b79
[web] Use a unified form for connecting to a WiFi network
dgdavid Nov 7, 2022
25a5843
[web] Use icons for newtork security and strength
dgdavid Nov 7, 2022
a90ce22
[web] Change title of popup for selecting WiFi network
dgdavid Nov 7, 2022
27cf11b
[web] Allow filling the Wi-Fi form for hidden network
dgdavid Nov 7, 2022
af426b5
For wifi connections the name should be shown too
teclator Nov 7, 2022
a6e2323
[web] Change link text
dgdavid Nov 7, 2022
25f8ad2
Obtain connections for showing information in the Wireless config dialog
teclator Nov 10, 2022
d1b00b1
[web] Add contextual menu for WiFi networks actions
dgdavid Nov 10, 2022
f253ed6
[web] Remove leftover imports
dgdavid Nov 10, 2022
5a2fc85
[web] Change UI for adding network manually
dgdavid Nov 10, 2022
45d71cd
[web] Use large popup always for displaying WiFi networks
dgdavid Nov 10, 2022
ae650d4
[web] Minor spacing update
dgdavid Nov 10, 2022
3163303
Added listeners to connection events.
teclator Nov 10, 2022
dc3aa5a
[web] Extract the WiFi connection form
dgdavid Nov 10, 2022
2587f54
[web] Fix WifiConnectionForm by calling proper connection method
dgdavid Nov 10, 2022
3d00fb4
[web] Update the WifiSelector dialog
dgdavid Nov 10, 2022
e4d2b2c
Initial support for initializing security from AP capabilities
teclator Nov 10, 2022
48ce44d
[web] Add some internal state to WirelessSelector component
dgdavid Nov 11, 2022
ea5c87a
[web] Remove dead console.log
dgdavid Nov 11, 2022
8b1ddc8
[web] More WirelessSelector UI improvements
dgdavid Nov 11, 2022
4ef449f
[web] Fix React complain for uncontrolled input radio
dgdavid Nov 11, 2022
6928c1b
[web] Avoid duplicate connections
dgdavid Nov 11, 2022
f986d14
[web] Change WiFi selector name and title
dgdavid Nov 11, 2022
f13c695
Use a function to show the Wi-Fi connection state
teclator Nov 11, 2022
176c8fb
Rename Wireless to Wifi
teclator Nov 11, 2022
d0b60a0
[web] Set manual network as selected when connecting
dgdavid Nov 11, 2022
8e027fb
[web] Allows setting manual network as hidden
dgdavid Nov 11, 2022
c7e517e
Typescript doc fixes
teclator Nov 13, 2022
dd81c93
Fix broken test
teclator Nov 13, 2022
6104045
Remove hidden network checkbox
teclator Nov 14, 2022
81e46c7
Remove not supported authentication
teclator Nov 14, 2022
5a4299a
Use a type password for WPA2 password.
teclator Nov 14, 2022
c0d013e
[web] Improve usability
dgdavid Nov 14, 2022
d0f0250
Allow to configure WiFi IPv4
teclator Nov 14, 2022
54e2eae
Update patternfly packages
teclator Nov 14, 2022
ab952d4
Improved Wireless config usability
teclator Nov 14, 2022
67b83c5
[web] Adjust the kebab menu toggler a little bit
dgdavid Nov 14, 2022
f7e9a81
[web] Change text for WifiSelector link
dgdavid Nov 14, 2022
7aeb6b6
Merge branch 'master' into feature/wireless-support
dgdavid Nov 14, 2022
b1f1dff
[web] Fix CSS
dgdavid Nov 14, 2022
181adbc
Added unit tests to the network client (model and network_manager)
teclator Nov 16, 2022
a502fb1
Fixed typo
teclator Nov 16, 2022
b89c9a7
Moved formatIp function to the network client utils file
teclator Nov 16, 2022
0f465ef
Added unit test for ConnectionsDataList component
teclator Nov 16, 2022
beb0e4a
[web] Split WifiSelector in small components
dgdavid Nov 16, 2022
71f5d59
[web] Improvements from code review
dgdavid Nov 17, 2022
768d6e9
[web] Rename some Wi-Fi related components
dgdavid Nov 17, 2022
4491ee2
[web] Add classNames utility
dgdavid Nov 17, 2022
65d5b6e
[web] Improve the ConnectionsDataList
imobachgs Nov 17, 2022
fbd1ec4
Merge pull request #313 from yast/improve-test
imobachgs Nov 17, 2022
bc38096
Do not use async when not needed (CR suggestion)
teclator Nov 17, 2022
146bdfd
Added unit test for Network component
teclator Nov 17, 2022
9c7715f
Added a Fixme for moving the security options
teclator Nov 17, 2022
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
1 change: 1 addition & 0 deletions web/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 2 }],
"no-var": "error",
"no-use-before-define": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "ignoreRestSiblings": true }],
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/ban-ts-comment": "off",
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
Expand Down
158 changes: 79 additions & 79 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
"webpack-cli": "^4.9.1"
},
"dependencies": {
"@patternfly/patternfly": "4.192.1",
"@patternfly/react-core": "4.207.0",
"@patternfly/react-table": "^4.61.15",
"@patternfly/patternfly": "^4.219.2",
"@patternfly/react-core": "^4.261.0",
"@patternfly/react-table": "^4.111.33",
"core-js": "^3.21.1",
"eos-ds": "^5.0.0",
"eos-icons-react": "^2.3.0",
Expand Down
5 changes: 3 additions & 2 deletions web/src/ConnectionsDataList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import {
EOS_WIFI as WifiIcon
} from "eos-icons-react";

import { ConnectionTypes, formatIp } from "./client/network";
import { ConnectionTypes } from "./client/network";
import { formatIp } from "./client/network/utils";

export default function ConnectionsDataList({ conns, onSelect }) {
if (conns.length === 0) return null;
Expand All @@ -58,7 +59,7 @@ export default function ConnectionsDataList({ conns, onSelect }) {
};

const renderConnectionId = (connection, onClick) => {
if (typeof onClick !== "function") return connection.id;
if (typeof onClick !== "function") return connection.name || connection.id;

return (
<Button variant="link" isInline onClick={() => onClick(connection)}>
Expand Down
73 changes: 73 additions & 0 deletions web/src/ConnectionsDataList.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (c) [2022] SUSE LLC
*
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, contact SUSE LLC.
*
* To contact SUSE LLC about this file by physical or electronic mail, you may
* find current contact information at www.suse.com.
*/

import React from "react";
import { screen } from "@testing-library/react";
import { plainRender } from "./test-utils";
import ConnectionsDataList from "./ConnectionsDataList";
import { ConnectionTypes } from "./client/network";

jest.mock("./client");

const wiredConnection = {
id: "wired-1",
name: "Wired 1",
type: ConnectionTypes.ETHERNET,
addresses: [{ address: "192.168.122.20", prefix: 24 }]
};
const wiFiConnection = {
id: "wifi-1",
name: "WiFi 1",
type: ConnectionTypes.WIFI,
addresses: [{ address: "192.168.69.200", prefix: 24 }]
};

const conns = [wiredConnection, wiFiConnection];

describe("ConnectionsDataList", () => {
describe("when no connections are given", () => {
it("renders nothing", () => {
const { container } = plainRender(<ConnectionsDataList conns={[]} />, { usingLayout: false });
expect(container).toBeEmptyDOMElement();
});
});

describe("when a list of connections are given", () => {
it("renders a list with the name and the IPv4 addresses of each connection", () => {
plainRender(<ConnectionsDataList conns={conns} />, { usingLayout: false });

screen.getByText("Wired 1");
screen.getByText("WiFi 1");
screen.getByText("192.168.122.20/24");
screen.getByText("192.168.69.200/24");
});
});

describe("when the user clicks on a connection", () => {
it("calls the onSelect function", async () => {
const onSelect = jest.fn();
const { user } = plainRender(<ConnectionsDataList conns={conns} onSelect={onSelect} />, { usingLayout: false });
const connection = screen.getByRole("button", { name: "WiFi 1" });
await user.click(connection);
expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "wifi-1" }));
});
});
});
Loading