diff --git a/web/src/components/network/NetworkPage.jsx b/web/src/components/network/NetworkPage.jsx
index 02ed8e7aca..589130d71a 100644
--- a/web/src/components/network/NetworkPage.jsx
+++ b/web/src/components/network/NetworkPage.jsx
@@ -48,9 +48,9 @@ const NoWiredConnections = () => {
*/
export default function NetworkPage() {
const { network: client } = useInstallerClient();
- const { connections: initialConnections, settings } = useLoaderData();
+ const { connections: initialConnections, devices: initialDevices, settings } = useLoaderData();
const [connections, setConnections] = useState(initialConnections);
- const [devices, setDevices] = useState(undefined);
+ const [devices, setDevices] = useState(initialDevices);
useEffect(() => {
return client.onNetworkChange(({ type, payload }) => {
@@ -69,6 +69,7 @@ export default function NetworkPage() {
const newDevices = devs.filter((d) => d.name !== name);
return [...newDevices, client.fromApiDevice(data)];
});
+
break;
}
@@ -81,12 +82,6 @@ export default function NetworkPage() {
});
}, [client, devices]);
- useEffect(() => {
- if (devices !== undefined) return;
-
- client.devices().then(setDevices);
- }, [client, devices]);
-
const connectionDevice = ({ id }) => devices?.find(({ connection }) => id === connection);
const connectionAddresses = (connection) => {
const device = connectionDevice(connection);
@@ -106,9 +101,11 @@ export default function NetworkPage() {
if (!wifiAvailable) return;
return (
-
- {activeConnection ? _("Change") : _("Connect")}
-
+
+
+ {_("Change")}
+
+
);
};
@@ -116,7 +113,9 @@ export default function NetworkPage() {
if (!wifiAvailable || !activeConnection) return;
return (
-
+ await client.disconnect(activeConnection)}>
+ {_("Disconnect")}
+
);
};
@@ -126,7 +125,6 @@ export default function NetworkPage() {
actions={
-
}
>
diff --git a/web/src/components/network/WifiNetworksListPage.jsx b/web/src/components/network/WifiNetworksListPage.jsx
index caa1e4ccc9..5beee3d435 100644
--- a/web/src/components/network/WifiNetworksListPage.jsx
+++ b/web/src/components/network/WifiNetworksListPage.jsx
@@ -80,6 +80,9 @@ const WifiDrawerPanelBody = ({ network, onCancel }) => {
await client.network.connectTo(network.settings)}>
{_("Connect")}
+
+ {_("Edit")}
+
@@ -101,6 +104,9 @@ const WifiDrawerPanelBody = ({ network, onCancel }) => {
await client.network.disconnect(network.settings)}>
{_("Disconnect")}
+
+ {_("Edit")}
+
diff --git a/web/src/components/network/routes.js b/web/src/components/network/routes.js
index a851d9526b..b05b01479b 100644
--- a/web/src/components/network/routes.js
+++ b/web/src/components/network/routes.js
@@ -33,10 +33,9 @@ const client = await createDefaultClient();
const loaders = {
all: async () => {
- const connections = await client.network.connections();
const devices = await client.network.devices();
+ const connections = await client.network.connections();
const settings = await client.network.settings();
- console.log("loaders.all", connections, devices, settings);
return { connections, devices, settings };
},
connection: async ({ params }) => {
@@ -45,7 +44,6 @@ const loaders = {
},
wifis: async () => {
const connections = await client.network.connections();
- console.log("Obtaining devices");
const devices = await client.network.devices();
const accessPoints = await client.network.accessPoints();
const networks = await client.network.loadNetworks(devices, connections, accessPoints);