diff --git a/ui/src/app/machines/components/HeaderStrip/ActionFormWrapper/OverrideTestForm/OverrideTestForm.js b/ui/src/app/machines/components/HeaderStrip/ActionFormWrapper/OverrideTestForm/OverrideTestForm.js
index 01ce7b9c37..bd0a7db84a 100644
--- a/ui/src/app/machines/components/HeaderStrip/ActionFormWrapper/OverrideTestForm/OverrideTestForm.js
+++ b/ui/src/app/machines/components/HeaderStrip/ActionFormWrapper/OverrideTestForm/OverrideTestForm.js
@@ -5,6 +5,7 @@ import React, { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import * as Yup from "yup";
+import { generateLegacyURL } from "app/utils";
import { machine as machineActions } from "app/base/actions";
import {
machine as machineSelectors,
@@ -23,11 +24,19 @@ const generateFailedTestsMessage = (numFailedTests, selectedMachines) => {
numFailedTests
)}.`;
if (singleMachine) {
- const url = `${process.env.REACT_APP_BASENAME}${process.env.REACT_APP_ANGULAR_BASENAME}/machine/${singleMachine.system_id}`;
+ const url = generateLegacyURL(`/machine/${singleMachine.system_id}`);
return (
Machine {singleMachine.hostname} has{" "}
- {numFailedTestsString}
+ {
+ evt.preventDefault();
+ window.history.pushState(null, null, url);
+ }}
+ >
+ {numFailedTestsString}
+
);
}
@@ -160,7 +169,19 @@ export const OverrideTestForm = ({
{selectedMachines.length === 1 ? (
{
+ evt.preventDefault();
+ window.history.pushState(
+ null,
+ null,
+ generateLegacyURL(
+ `/machine/${selectedMachines[0].system_id}`
+ )
+ );
+ }}
>
Machine > Hardware tests
diff --git a/ui/src/app/machines/views/MachineList/MachineListTable/FabricColumn/FabricColumn.js b/ui/src/app/machines/views/MachineList/MachineListTable/FabricColumn/FabricColumn.js
index 10f2377c90..233c05206d 100644
--- a/ui/src/app/machines/views/MachineList/MachineListTable/FabricColumn/FabricColumn.js
+++ b/ui/src/app/machines/views/MachineList/MachineListTable/FabricColumn/FabricColumn.js
@@ -14,6 +14,7 @@ export const FabricColumn = ({ systemId }) => {
const fabricID = machine.vlan && machine.vlan.fabric_id;
const fabricName = machine.vlan && machine.vlan.fabric_name;
+ const fabricURL = generateLegacyURL(`/fabric/${fabricID}`);
const vlan = machine.vlan && machine.vlan.name ? machine.vlan.name : "";
return (
@@ -30,6 +31,10 @@ export const FabricColumn = ({ systemId }) => {
{
+ evt.preventDefault();
+ window.history.pushState(null, null, fabricURL);
+ }}
>
{fabricName}
diff --git a/ui/src/app/machines/views/MachineList/MachineListTable/FabricColumn/__snapshots__/FabricColumn.test.js.snap b/ui/src/app/machines/views/MachineList/MachineListTable/FabricColumn/__snapshots__/FabricColumn.test.js.snap
index d96b51ff93..c4ae5bc544 100644
--- a/ui/src/app/machines/views/MachineList/MachineListTable/FabricColumn/__snapshots__/FabricColumn.test.js.snap
+++ b/ui/src/app/machines/views/MachineList/MachineListTable/FabricColumn/__snapshots__/FabricColumn.test.js.snap
@@ -20,6 +20,7 @@ exports[`FabricColumn renders 1`] = `
fabric-0
@@ -68,6 +69,7 @@ exports[`FabricColumn renders 1`] = `
fabric-0
diff --git a/ui/src/app/machines/views/MachineList/MachineListTable/NameColumn/NameColumn.js b/ui/src/app/machines/views/MachineList/MachineListTable/NameColumn/NameColumn.js
index d83efdf25c..cbee59d5e3 100644
--- a/ui/src/app/machines/views/MachineList/MachineListTable/NameColumn/NameColumn.js
+++ b/ui/src/app/machines/views/MachineList/MachineListTable/NameColumn/NameColumn.js
@@ -3,6 +3,7 @@ import { useSelector } from "react-redux";
import React from "react";
import PropTypes from "prop-types";
+import { generateLegacyURL } from "app/utils";
import { machine as machineSelectors } from "app/base/selectors";
import DoubleRow from "app/base/components/DoubleRow";
import Tooltip from "app/base/components/Tooltip";
@@ -13,11 +14,7 @@ const generateFQDN = (machine, machineURL) => {
href={machineURL}
onClick={(evt) => {
evt.preventDefault();
- window.history.pushState(
- null,
- null,
- `${process.env.REACT_APP_BASENAME}${machineURL}`
- );
+ window.history.pushState(null, null, machineURL);
}}
title={machine.fqdn}
>
@@ -87,11 +84,27 @@ const generateIPAddresses = (machine) => {
const generateMAC = (machine, machineURL) => {
return (
<>
-
+ {
+ evt.preventDefault();
+ window.history.pushState(null, null, machineURL);
+ }}
+ title={machine.pxe_mac_vendor}
+ >
{machine.pxe_mac}
{machine.extra_macs && machine.extra_macs.length > 0 ? (
- (+{machine.extra_macs.length})
+ {
+ evt.preventDefault();
+ window.history.pushState(null, null, machineURL);
+ }}
+ >
+ {" "}
+ (+{machine.extra_macs.length})
+
) : null}
>
);
@@ -101,7 +114,9 @@ export const NameColumn = ({ handleCheckbox, selected, showMAC, systemId }) => {
const machine = useSelector((state) =>
machineSelectors.getBySystemId(state, systemId)
);
- const machineURL = `${process.env.REACT_APP_ANGULAR_BASENAME}/${machine.link_type}/${machine.system_id}`;
+ const machineURL = generateLegacyURL(
+ `/${machine.link_type}/${machine.system_id}`
+ );
const primaryRow = showMAC
? generateMAC(machine, machineURL)
: generateFQDN(machine, machineURL);
diff --git a/ui/src/app/machines/views/MachineList/MachineListTable/NameColumn/__snapshots__/NameColumn.test.js.snap b/ui/src/app/machines/views/MachineList/MachineListTable/NameColumn/__snapshots__/NameColumn.test.js.snap
index 46cb4e8c2d..f7629a7066 100644
--- a/ui/src/app/machines/views/MachineList/MachineListTable/NameColumn/__snapshots__/NameColumn.test.js.snap
+++ b/ui/src/app/machines/views/MachineList/MachineListTable/NameColumn/__snapshots__/NameColumn.test.js.snap
@@ -12,7 +12,7 @@ exports[`NameColumn renders 1`] = `
id="abc123"
label={
@@ -50,7 +50,7 @@ exports[`NameColumn renders 1`] = `
id="abc123"
label={
@@ -71,7 +71,7 @@ exports[`NameColumn renders 1`] = `
forId="abc123"
label={
@@ -105,7 +105,7 @@ exports[`NameColumn renders 1`] = `
htmlFor="abc123"
>
diff --git a/ui/src/app/machines/views/MachineList/MachineListTable/ZoneColumn/ZoneColumn.js b/ui/src/app/machines/views/MachineList/MachineListTable/ZoneColumn/ZoneColumn.js
index 8075459327..493e1a3ef2 100644
--- a/ui/src/app/machines/views/MachineList/MachineListTable/ZoneColumn/ZoneColumn.js
+++ b/ui/src/app/machines/views/MachineList/MachineListTable/ZoneColumn/ZoneColumn.js
@@ -62,6 +62,8 @@ export const ZoneColumn = ({ onToggleMenu, systemId }) => {
}
}, [updating, machine.zone.id]);
+ const zoneURL = generateLegacyURL(`/zone/${machine.zone.id}`);
+
return (
{
) : null}
{
+ evt.preventDefault();
+ window.history.pushState(null, null, zoneURL);
+ }}
>
{machine.zone.name}
diff --git a/ui/src/app/machines/views/MachineList/MachineListTable/ZoneColumn/__snapshots__/ZoneColumn.test.js.snap b/ui/src/app/machines/views/MachineList/MachineListTable/ZoneColumn/__snapshots__/ZoneColumn.test.js.snap
index 3902abb014..d49c9b4d0d 100644
--- a/ui/src/app/machines/views/MachineList/MachineListTable/ZoneColumn/__snapshots__/ZoneColumn.test.js.snap
+++ b/ui/src/app/machines/views/MachineList/MachineListTable/ZoneColumn/__snapshots__/ZoneColumn.test.js.snap
@@ -23,6 +23,7 @@ exports[`ZoneColumn renders 1`] = `
zone-north
@@ -57,6 +58,7 @@ exports[`ZoneColumn renders 1`] = `
zone-north
diff --git a/ui/src/app/settings/views/Dhcp/DhcpTarget/DhcpTarget.js b/ui/src/app/settings/views/Dhcp/DhcpTarget/DhcpTarget.js
index 41c9a0d60b..567fcc73c7 100644
--- a/ui/src/app/settings/views/Dhcp/DhcpTarget/DhcpTarget.js
+++ b/ui/src/app/settings/views/Dhcp/DhcpTarget/DhcpTarget.js
@@ -2,11 +2,9 @@ import { Link, Spinner } from "@canonical/react-components";
import PropTypes from "prop-types";
import React from "react";
+import { generateLegacyURL } from "app/utils";
import { useDhcpTarget } from "app/settings/hooks";
-const generateURL = (url) =>
- `${process.env.REACT_APP_BASENAME}${process.env.REACT_APP_ANGULAR_BASENAME}${url}`;
-
const DhcpTarget = ({ nodeId, subnetId }) => {
const { loading, loaded, target, type } = useDhcpTarget(nodeId, subnetId);
@@ -22,8 +20,18 @@ const DhcpTarget = ({ nodeId, subnetId }) => {
.{target.domain.name}
>
);
- const url = generateURL(`/${type}/${nodeId || subnetId}`);
- return {name};
+ const url = generateLegacyURL(`/${type}/${nodeId || subnetId}`);
+ return (
+ {
+ evt.preventDefault();
+ window.history.pushState(null, null, url);
+ }}
+ >
+ {name}
+
+ );
};
DhcpTarget.propTypes = {
diff --git a/ui/src/app/settings/views/Dhcp/DhcpTarget/__snapshots__/DhcpTarget.test.js.snap b/ui/src/app/settings/views/Dhcp/DhcpTarget/__snapshots__/DhcpTarget.test.js.snap
index 2f590e6bf4..169a8b0678 100644
--- a/ui/src/app/settings/views/Dhcp/DhcpTarget/__snapshots__/DhcpTarget.test.js.snap
+++ b/ui/src/app/settings/views/Dhcp/DhcpTarget/__snapshots__/DhcpTarget.test.js.snap
@@ -3,10 +3,12 @@
exports[`DhcpTarget can display a node link 1`] = `
machine1