diff --git a/src/app/subnets/urls.ts b/src/app/subnets/urls.ts index 1c267a9f53..c0eb552e8e 100644 --- a/src/app/subnets/urls.ts +++ b/src/app/subnets/urls.ts @@ -23,7 +23,7 @@ const urls = { subnet: { summary: withSubnetId("/subnet/:id/summary"), staticRoutes: withSubnetId("/subnet/:id/static-routes"), - reservedIpAddresses: withSubnetId("/subnet/:id/reserved-ip-addresses"), + addressReservation: withSubnetId("/subnet/:id/address-reservation"), dhcpSnippets: withSubnetId("/subnet/:id/dhcp-snippets"), usedIpAddresses: withSubnetId("/subnet/:id/used-ip-addresses"), index: argPath<{ id: Subnet[SubnetMeta.PK] }>("/subnet/:id"), diff --git a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/DeleteStaticIP/DeleteStaticIP.test.tsx b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/DeleteDHCPLease/DeleteDHCPLease.test.tsx similarity index 87% rename from src/app/subnets/views/SubnetDetails/SubnetStaticIPs/DeleteStaticIP/DeleteStaticIP.test.tsx rename to src/app/subnets/views/SubnetDetails/StaticDHCPLease/DeleteDHCPLease/DeleteDHCPLease.test.tsx index 5661561427..0ec4a1d2a4 100644 --- a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/DeleteStaticIP/DeleteStaticIP.test.tsx +++ b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/DeleteDHCPLease/DeleteDHCPLease.test.tsx @@ -1,10 +1,10 @@ -import DeleteStaticIPs from "./DeleteStaticIP"; +import DeleteDHCPLease from "./DeleteDHCPLease"; import { renderWithBrowserRouter, screen } from "@/testing/utils"; it("renders a delete confirmation form", () => { renderWithBrowserRouter( - diff --git a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/DeleteStaticIP/DeleteStaticIP.tsx b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/DeleteDHCPLease/DeleteDHCPLease.tsx similarity index 85% rename from src/app/subnets/views/SubnetDetails/SubnetStaticIPs/DeleteStaticIP/DeleteStaticIP.tsx rename to src/app/subnets/views/SubnetDetails/StaticDHCPLease/DeleteDHCPLease/DeleteDHCPLease.tsx index ac42e9b002..d39dd9179b 100644 --- a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/DeleteStaticIP/DeleteStaticIP.tsx +++ b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/DeleteDHCPLease/DeleteDHCPLease.tsx @@ -3,7 +3,7 @@ import type { SubnetActionProps } from "../../types"; import ModelActionForm from "@/app/base/components/ModelActionForm"; type Props = Pick; -const DeleteStaticIP = ({ setSidePanelContent, macAddress }: Props) => { +const DeleteDHCPLease = ({ setSidePanelContent, macAddress }: Props) => { if (!macAddress) return null; const handleClose = () => setSidePanelContent(null); // TODO: Implement onSubmit function and passing IDs when API supports it. @@ -19,4 +19,4 @@ const DeleteStaticIP = ({ setSidePanelContent, macAddress }: Props) => { ); }; -export default DeleteStaticIP; +export default DeleteDHCPLease; diff --git a/src/app/subnets/views/SubnetDetails/StaticDHCPLease/DeleteDHCPLease/index.ts b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/DeleteDHCPLease/index.ts new file mode 100644 index 0000000000..da88b5c619 --- /dev/null +++ b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/DeleteDHCPLease/index.ts @@ -0,0 +1 @@ +export { default } from "./DeleteDHCPLease"; diff --git a/src/app/subnets/views/SubnetDetails/StaticDHCPLease/StaticDHCPLease.test.tsx b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/StaticDHCPLease.test.tsx new file mode 100644 index 0000000000..7bf81740cc --- /dev/null +++ b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/StaticDHCPLease.test.tsx @@ -0,0 +1,13 @@ +import StaticDHCPLease from "./StaticDHCPLease"; + +import { renderWithBrowserRouter, screen } from "@/testing/utils"; + +it("renders", () => { + renderWithBrowserRouter(); + expect( + screen.getByRole("heading", { name: "Static DHCP leases" }) + ).toBeInTheDocument(); + expect( + screen.getByRole("button", { name: "Reserve static DHCP lease" }) + ).toBeInTheDocument(); +}); diff --git a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/SubnetStaticIPs.tsx b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/StaticDHCPLease.tsx similarity index 75% rename from src/app/subnets/views/SubnetDetails/SubnetStaticIPs/SubnetStaticIPs.tsx rename to src/app/subnets/views/SubnetDetails/StaticDHCPLease/StaticDHCPLease.tsx index 6248bb4f76..a8893694a5 100644 --- a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/SubnetStaticIPs.tsx +++ b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/StaticDHCPLease.tsx @@ -5,25 +5,25 @@ import { SubnetActionTypes, SubnetDetailsSidePanelViews } from "../constants"; import { useSidePanel } from "@/app/base/side-panel-context"; -const SubnetStaticIPs = () => { +const StaticDHCPLease = () => { const { setSidePanelContent } = useSidePanel(); return ( <> - Static IPs + Static DHCP leases @@ -31,4 +31,4 @@ const SubnetStaticIPs = () => { ); }; -export default SubnetStaticIPs; +export default StaticDHCPLease; diff --git a/src/app/subnets/views/SubnetDetails/StaticDHCPLease/index.ts b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/index.ts new file mode 100644 index 0000000000..3755efd028 --- /dev/null +++ b/src/app/subnets/views/SubnetDetails/StaticDHCPLease/index.ts @@ -0,0 +1 @@ +export { default } from "./StaticDHCPLease"; diff --git a/src/app/subnets/views/SubnetDetails/SubnetActionForms/SubnetActionForms.tsx b/src/app/subnets/views/SubnetDetails/SubnetActionForms/SubnetActionForms.tsx index ff11a145e6..ef583b0a4a 100644 --- a/src/app/subnets/views/SubnetDetails/SubnetActionForms/SubnetActionForms.tsx +++ b/src/app/subnets/views/SubnetDetails/SubnetActionForms/SubnetActionForms.tsx @@ -1,14 +1,13 @@ -import AddStaticRouteForm from "../StaticRoutes/AddStaticRouteForm"; -import DeleteStaticRouteForm from "../StaticRoutes/DeleteStaticRouteform"; -import EditStaticRouteForm from "../StaticRoutes/EditStaticRouteForm"; -import DeleteStaticIP from "../SubnetStaticIPs/DeleteStaticIP"; - import DeleteSubnet from "./components/DeleteSubnet"; import EditBootArchitectures from "./components/EditBootArchitectures"; import MapSubnet from "./components/MapSubnet"; import ReservedRangeDeleteForm from "@/app/subnets/components/ReservedRangeDeleteForm"; import ReservedRangeForm from "@/app/subnets/components/ReservedRangeForm"; +import DeleteDHCPLease from "@/app/subnets/views/SubnetDetails/StaticDHCPLease/DeleteDHCPLease"; +import AddStaticRouteForm from "@/app/subnets/views/SubnetDetails/StaticRoutes/AddStaticRouteForm"; +import DeleteStaticRouteForm from "@/app/subnets/views/SubnetDetails/StaticRoutes/DeleteStaticRouteform"; +import EditStaticRouteForm from "@/app/subnets/views/SubnetDetails/StaticRoutes/EditStaticRouteForm"; import { SubnetActionTypes } from "@/app/subnets/views/SubnetDetails/constants"; import type { SubnetAction, @@ -27,9 +26,9 @@ const FormComponents: Record< [SubnetActionTypes.DeleteStaticRoute]: DeleteStaticRouteForm, [SubnetActionTypes.ReserveRange]: ReservedRangeForm, [SubnetActionTypes.DeleteReservedRange]: ReservedRangeDeleteForm, - [SubnetActionTypes.ReserveStaticIP]: () => null, - [SubnetActionTypes.EditStaticIP]: () => null, - [SubnetActionTypes.DeleteStaticIP]: DeleteStaticIP, + [SubnetActionTypes.ReserveStaticDHCPLease]: () => null, + [SubnetActionTypes.EditStaticDHCPLease]: () => null, + [SubnetActionTypes.DeleteDHCPLease]: DeleteDHCPLease, }; const SubnetActionForms = ({ diff --git a/src/app/subnets/views/SubnetDetails/SubnetDetails.test.tsx b/src/app/subnets/views/SubnetDetails/SubnetDetails.test.tsx index 9cf1f23a86..d5ad6a84a6 100644 --- a/src/app/subnets/views/SubnetDetails/SubnetDetails.test.tsx +++ b/src/app/subnets/views/SubnetDetails/SubnetDetails.test.tsx @@ -34,7 +34,7 @@ beforeEach(() => { }, { component: "ReservedRanges", - path: urls.subnets.subnet.reservedIpAddresses({ id: 1 }), + path: urls.subnets.subnet.addressReservation({ id: 1 }), title: "Reserved ranges", }, { diff --git a/src/app/subnets/views/SubnetDetails/SubnetDetails.tsx b/src/app/subnets/views/SubnetDetails/SubnetDetails.tsx index cb00ee5cff..977127f50c 100644 --- a/src/app/subnets/views/SubnetDetails/SubnetDetails.tsx +++ b/src/app/subnets/views/SubnetDetails/SubnetDetails.tsx @@ -3,9 +3,9 @@ import { useEffect } from "react"; import { useDispatch, useSelector } from "react-redux"; import { Navigate, Route, Routes } from "react-router-dom"; +import StaticDHCPLease from "./StaticDHCPLease"; import StaticRoutes from "./StaticRoutes"; import SubnetDetailsHeader from "./SubnetDetailsHeader"; -import SubnetStaticIPs from "./SubnetStaticIPs"; import SubnetSummary from "./SubnetSummary"; import SubnetUsedIPs from "./SubnetUsedIPs"; import Utilisation from "./Utilisation"; @@ -124,13 +124,13 @@ const SubnetDetails = (): JSX.Element => { element={ <> {import.meta.env.VITE_APP_STATIC_IPS_ENABLED === "true" && ( - + )} } path={getRelativeRoute( - urls.subnets.subnet.reservedIpAddresses(null), + urls.subnets.subnet.addressReservation(null), base )} /> diff --git a/src/app/subnets/views/SubnetDetails/SubnetDetailsHeader/SubnetDetailsHeader.tsx b/src/app/subnets/views/SubnetDetails/SubnetDetailsHeader/SubnetDetailsHeader.tsx index 64d4174aab..ed8aada1ed 100644 --- a/src/app/subnets/views/SubnetDetails/SubnetDetailsHeader/SubnetDetailsHeader.tsx +++ b/src/app/subnets/views/SubnetDetails/SubnetDetailsHeader/SubnetDetailsHeader.tsx @@ -44,7 +44,7 @@ const SubnetDetailsHeader = ({ subnet }: Props): JSX.Element => { { active: pathname.startsWith(`${urlBase}/summary`), component: Link, - label: "Summary", + label: "Subnet summary", to: `${urlBase}/summary`, }, { @@ -54,10 +54,10 @@ const SubnetDetailsHeader = ({ subnet }: Props): JSX.Element => { to: `${urlBase}/static-routes`, }, { - active: pathname.startsWith(`${urlBase}/reserved-ip-addresses`), + active: pathname.startsWith(`${urlBase}/address-reservation`), component: Link, - label: "Reserved IPs", - to: `${urlBase}/reserved-ip-addresses`, + label: "Address reservation", + to: `${urlBase}/address-reservation`, }, { active: pathname.startsWith(`${urlBase}/dhcp-snippets`), diff --git a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/DeleteStaticIP/index.ts b/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/DeleteStaticIP/index.ts deleted file mode 100644 index 1bfd0a24c3..0000000000 --- a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/DeleteStaticIP/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./DeleteStaticIP"; diff --git a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/SubnetStaticIPs.test.tsx b/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/SubnetStaticIPs.test.tsx deleted file mode 100644 index e076993ae3..0000000000 --- a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/SubnetStaticIPs.test.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import SubnetStaticIPs from "./SubnetStaticIPs"; - -import { renderWithBrowserRouter, screen } from "@/testing/utils"; - -it("renders", () => { - renderWithBrowserRouter(); - expect( - screen.getByRole("heading", { name: "Static IPs" }) - ).toBeInTheDocument(); - expect( - screen.getByRole("button", { name: "Reserve static IP" }) - ).toBeInTheDocument(); -}); diff --git a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/index.ts b/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/index.ts deleted file mode 100644 index 29c52f34cb..0000000000 --- a/src/app/subnets/views/SubnetDetails/SubnetStaticIPs/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./SubnetStaticIPs"; diff --git a/src/app/subnets/views/SubnetDetails/constants.ts b/src/app/subnets/views/SubnetDetails/constants.ts index 5b9113da1b..291e16820f 100644 --- a/src/app/subnets/views/SubnetDetails/constants.ts +++ b/src/app/subnets/views/SubnetDetails/constants.ts @@ -12,9 +12,9 @@ export const SubnetActionTypes = { DeleteStaticRoute: "DeleteStaticRoute", ReserveRange: "ReserveRange", DeleteReservedRange: "DeleteReservedRange", - ReserveStaticIP: "ReserveStaticIP", - EditStaticIP: "EditStaticIP", - DeleteStaticIP: "DeleteStaticIP", + ReserveStaticDHCPLease: "ReserveStaticDHCPLease", + EditStaticDHCPLease: "EditStaticDHCPLease", + DeleteDHCPLease: "DeleteDHCPLease", } as const; export type SubnetActionType = ValueOf; @@ -27,9 +27,9 @@ export const subnetActionLabels = { [SubnetActionTypes.DeleteStaticRoute]: "Delete static route", [SubnetActionTypes.ReserveRange]: "Reserve range", [SubnetActionTypes.DeleteReservedRange]: "Delete Reserved Range", - [SubnetActionTypes.ReserveStaticIP]: "Reserve static IP", - [SubnetActionTypes.EditStaticIP]: "Edit static IP", - [SubnetActionTypes.DeleteStaticIP]: "Delete static IP", + [SubnetActionTypes.ReserveStaticDHCPLease]: "Reserve static DHCP lease", + [SubnetActionTypes.EditStaticDHCPLease]: "Edit static DHCP lease", + [SubnetActionTypes.DeleteDHCPLease]: "Delete static DHCP lease", } as const; export const SubnetDetailsSidePanelViews = { @@ -50,9 +50,15 @@ export const SubnetDetailsSidePanelViews = { "", SubnetActionTypes.DeleteReservedRange, ], - [SubnetActionTypes.ReserveStaticIP]: ["", SubnetActionTypes.ReserveStaticIP], - [SubnetActionTypes.EditStaticIP]: ["", SubnetActionTypes.EditStaticIP], - [SubnetActionTypes.DeleteStaticIP]: ["", SubnetActionTypes.DeleteStaticIP], + [SubnetActionTypes.ReserveStaticDHCPLease]: [ + "", + SubnetActionTypes.ReserveStaticDHCPLease, + ], + [SubnetActionTypes.EditStaticDHCPLease]: [ + "", + SubnetActionTypes.EditStaticDHCPLease, + ], + [SubnetActionTypes.DeleteDHCPLease]: ["", SubnetActionTypes.DeleteDHCPLease], } as const; export type SubnetDetailsSidePanelContent = SidePanelContent<