From 0b2555755fab03010a6fdbec55ad685c1506de7b Mon Sep 17 00:00:00 2001 From: Nick De Villiers Date: Thu, 25 Jul 2024 08:06:11 +0100 Subject: [PATCH] refactor: Use names 'Static DHCP lease' and 'IP assignment' MAASENG-3519 (#5506) - Rename "Static" to "Static (Client configured) - Rename "External" to "Static (Externally managed) - Rename "IP mode" to "IP assignment" - Rename "DHCP" to "Dynamic" - Rename "Auto assign" to "Automatic" --- Fixes [MAASENG-3519](https://warthogs.atlassian.net/browse/MAASENG-3519) --- src/app/base/components/LinkModeSelect/LinkModeSelect.tsx | 2 +- .../networking/NetworkTable/IPColumn/IPColumn.test.tsx | 2 +- .../DeviceNetworkTable/DeviceNetworkTable.tsx | 2 +- .../DiscoveryAddFormFields.test.tsx | 2 +- src/app/store/device/utils/common.test.ts | 6 ++++-- src/app/store/device/utils/common.ts | 4 ++-- src/app/store/utils/node/networking.test.ts | 8 ++++---- src/app/store/utils/node/networking.ts | 6 +++--- 8 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/app/base/components/LinkModeSelect/LinkModeSelect.tsx b/src/app/base/components/LinkModeSelect/LinkModeSelect.tsx index 2e4a6986f3..a484bc55cb 100644 --- a/src/app/base/components/LinkModeSelect/LinkModeSelect.tsx +++ b/src/app/base/components/LinkModeSelect/LinkModeSelect.tsx @@ -12,7 +12,7 @@ type Props = { export enum Label { DefaultOption = "Select IP mode", - Select = "IP mode", + Select = "IP assignment", } const getAvailableLinkModes = ( diff --git a/src/app/base/components/node/networking/NetworkTable/IPColumn/IPColumn.test.tsx b/src/app/base/components/node/networking/NetworkTable/IPColumn/IPColumn.test.tsx index 06eca13502..59848700e5 100644 --- a/src/app/base/components/node/networking/NetworkTable/IPColumn/IPColumn.test.tsx +++ b/src/app/base/components/node/networking/NetworkTable/IPColumn/IPColumn.test.tsx @@ -102,7 +102,7 @@ describe("IPColumn", () => { renderWithMockStore(, { state, }); - expect(screen.getByText("Auto assign")).toBeInTheDocument(); + expect(screen.getByText("Automatic")).toBeInTheDocument(); }); it("can display the failed network status for multiple tests", () => { diff --git a/src/app/devices/views/DeviceDetails/DeviceNetwork/DeviceNetworkTable/DeviceNetworkTable.tsx b/src/app/devices/views/DeviceDetails/DeviceNetwork/DeviceNetworkTable/DeviceNetworkTable.tsx index e97464622b..ae0e9eca33 100644 --- a/src/app/devices/views/DeviceDetails/DeviceNetwork/DeviceNetworkTable/DeviceNetworkTable.tsx +++ b/src/app/devices/views/DeviceDetails/DeviceNetwork/DeviceNetworkTable/DeviceNetworkTable.tsx @@ -279,7 +279,7 @@ const DeviceNetworkTable = ({ systemId }: Props): JSX.Element => { onClick={() => updateSort("ip_mode")} sortKey="ip_mode" > - IP mode + IP assignment ), }, diff --git a/src/app/networkDiscovery/views/DiscoveryAddForm/DiscoveryAddFormFields/DiscoveryAddFormFields.test.tsx b/src/app/networkDiscovery/views/DiscoveryAddForm/DiscoveryAddFormFields/DiscoveryAddFormFields.test.tsx index f39e04094c..93211b59f0 100644 --- a/src/app/networkDiscovery/views/DiscoveryAddForm/DiscoveryAddFormFields/DiscoveryAddFormFields.test.tsx +++ b/src/app/networkDiscovery/views/DiscoveryAddForm/DiscoveryAddFormFields/DiscoveryAddFormFields.test.tsx @@ -128,7 +128,7 @@ describe("DiscoveryAddFormFields", () => { expect( within(ipAssignment).getByRole("option", { - name: "Static", + name: "Static (Client configured)", }) ).toBeInTheDocument(); }); diff --git a/src/app/store/device/utils/common.test.ts b/src/app/store/device/utils/common.test.ts index 9e90b8dd4f..3014770a97 100644 --- a/src/app/store/device/utils/common.test.ts +++ b/src/app/store/device/utils/common.test.ts @@ -33,12 +33,14 @@ describe("device utils", () => { it("handles external IP assignement", () => { expect(getIpAssignmentDisplay(DeviceIpAssignment.EXTERNAL)).toBe( - "External" + "Static (Externally managed)" ); }); it("handles static IP assignment", () => { - expect(getIpAssignmentDisplay(DeviceIpAssignment.STATIC)).toBe("Static"); + expect(getIpAssignmentDisplay(DeviceIpAssignment.STATIC)).toBe( + "Static (Client configured)" + ); }); it("handles unknown IP assignment", () => { diff --git a/src/app/store/device/utils/common.ts b/src/app/store/device/utils/common.ts index aae5c1df30..9152783806 100644 --- a/src/app/store/device/utils/common.ts +++ b/src/app/store/device/utils/common.ts @@ -23,9 +23,9 @@ export const getIpAssignmentDisplay = ( case DeviceIpAssignment.DYNAMIC: return "Dynamic"; case DeviceIpAssignment.EXTERNAL: - return "External"; + return "Static (Externally managed)"; case DeviceIpAssignment.STATIC: - return "Static"; + return "Static (Client configured)"; default: return "Unknown"; } diff --git a/src/app/store/utils/node/networking.test.ts b/src/app/store/utils/node/networking.test.ts index a7ee18937f..1fa1f8ed38 100644 --- a/src/app/store/utils/node/networking.test.ts +++ b/src/app/store/utils/node/networking.test.ts @@ -716,10 +716,10 @@ describe("machine networking utils", () => { it("maps the link modes to display text", () => { expect( getLinkModeDisplay(factory.networkLink({ mode: NetworkLinkMode.AUTO })) - ).toBe("Auto assign"); + ).toBe("Automatic"); expect( getLinkModeDisplay(factory.networkLink({ mode: NetworkLinkMode.DHCP })) - ).toBe("DHCP"); + ).toBe("Dynamic"); expect( getLinkModeDisplay( factory.networkLink({ mode: NetworkLinkMode.LINK_UP }) @@ -730,7 +730,7 @@ describe("machine networking utils", () => { getLinkModeDisplay( factory.networkLink({ mode: NetworkLinkMode.STATIC }) ) - ).toBe("Static assign"); + ).toBe("Static (Client configured)"); }); }); @@ -865,7 +865,7 @@ describe("machine networking utils", () => { const machine = factory.machineDetails({ interfaces: [nic] }); expect( getInterfaceIPAddressOrMode(machine, [fabric], [vlan], null, link) - ).toStrictEqual("Auto assign"); + ).toStrictEqual("Automatic"); }); }); diff --git a/src/app/store/utils/node/networking.ts b/src/app/store/utils/node/networking.ts index 7ce8fcf096..09132e5bb6 100644 --- a/src/app/store/utils/node/networking.ts +++ b/src/app/store/utils/node/networking.ts @@ -467,10 +467,10 @@ export const isInterfaceConnected = ( }; export const LINK_MODE_DISPLAY = { - [NetworkLinkMode.AUTO]: "Auto assign", - [NetworkLinkMode.DHCP]: "DHCP", + [NetworkLinkMode.AUTO]: "Automatic", + [NetworkLinkMode.DHCP]: "Dynamic", [NetworkLinkMode.LINK_UP]: "Unconfigured", - [NetworkLinkMode.STATIC]: "Static assign", + [NetworkLinkMode.STATIC]: "Static (Client configured)", }; /**