diff --git a/changes/1912-fix-cpu-bug b/changes/1912-fix-cpu-bug new file mode 100644 index 0000000000..b2ccf4c0fd --- /dev/null +++ b/changes/1912-fix-cpu-bug @@ -0,0 +1 @@ +Fixes frontend CPU type bug from API change that was not reflected in frontend UI or tests \ No newline at end of file diff --git a/frontend/pages/hosts/HostDetailsPage/HostDetailsPage.jsx b/frontend/pages/hosts/HostDetailsPage/HostDetailsPage.jsx index 0cf01eeeaa..80ab294597 100644 --- a/frontend/pages/hosts/HostDetailsPage/HostDetailsPage.jsx +++ b/frontend/pages/hosts/HostDetailsPage/HostDetailsPage.jsx @@ -651,7 +651,7 @@ export class HostDetailsPage extends Component { pick(host, [ "status", "memory", - "host_cpu", + "cpu_type", "os_version", "enroll_secret_name", "detail_updated_at", @@ -765,7 +765,7 @@ export class HostDetailsPage extends Component {
CPU - {titleData.host_cpu} + {titleData.cpu_type}
OS diff --git a/frontend/pages/hosts/ManageHostsPage/HostTableConfig.tsx b/frontend/pages/hosts/ManageHostsPage/HostTableConfig.tsx index 4030cae36a..27a22e47dc 100644 --- a/frontend/pages/hosts/ManageHostsPage/HostTableConfig.tsx +++ b/frontend/pages/hosts/ManageHostsPage/HostTableConfig.tsx @@ -216,7 +216,7 @@ const allHostTableHeaders: IHostDataColumn[] = [ title: "CPU", Header: "CPU", disableSortBy: true, - accessor: "host_cpu", + accessor: "cpu_type", Cell: (cellProps) => , }, { @@ -269,7 +269,7 @@ const allHostTableHeaders: IHostDataColumn[] = [ const defaultHiddenColumns = [ "primary_mac", - "host_cpu", + "cpu_type", "memory", "uptime", "uuid", diff --git a/frontend/redux/nodes/entities/hosts/helpers.js b/frontend/redux/nodes/entities/hosts/helpers.js index daa9344272..f0d95c3e54 100644 --- a/frontend/redux/nodes/entities/hosts/helpers.js +++ b/frontend/redux/nodes/entities/hosts/helpers.js @@ -22,7 +22,7 @@ export const parseEntityFunc = (host) => { } const additionalAttrs = { - host_cpu: hostCpuOutput, + cpu_type: hostCpuOutput, target_type: "hosts", }; diff --git a/frontend/redux/nodes/entities/hosts/helpers.tests.js b/frontend/redux/nodes/entities/hosts/helpers.tests.js index cdfabb492b..349ec1c1eb 100644 --- a/frontend/redux/nodes/entities/hosts/helpers.tests.js +++ b/frontend/redux/nodes/entities/hosts/helpers.tests.js @@ -7,7 +7,7 @@ describe("reduxConfig - hosts helpers", () => { cpu_brand: "Intel(R) Xeon(R) CPU E5-2420 0 @ 1.90GHz", cpu_physical_cores: 2, }; - expect(parseEntityFunc(host).host_cpu).toEqual("2 x 1.9 GHz"); + expect(parseEntityFunc(host).cpu_type).toEqual("2 x 1.9 GHz"); }); it("parses a host missing clock speed", () => { @@ -15,26 +15,26 @@ describe("reduxConfig - hosts helpers", () => { cpu_brand: "Intel(R) Xeon(R) CPU E5-242", cpu_physical_cores: 2, }; - expect(parseEntityFunc(host).host_cpu).toEqual("2 x Unknown GHz"); + expect(parseEntityFunc(host).cpu_type).toEqual("2 x Unknown GHz"); }); it("parses a host missing CPU brand", () => { const host = { cpu_physical_cores: 2, }; - expect(parseEntityFunc(host).host_cpu).toEqual("2 x Unknown GHz"); + expect(parseEntityFunc(host).cpu_type).toEqual("2 x Unknown GHz"); }); it("parses a host missing CPU cores", () => { const host = { cpu_brand: "Intel(R) Xeon(R) CPU E5-2420 0 @ 1.90GHz", }; - expect(parseEntityFunc(host).host_cpu).toEqual("Unknown x 1.9 GHz"); + expect(parseEntityFunc(host).cpu_type).toEqual("Unknown x 1.9 GHz"); }); it("parses a host missing CPU info entirely", () => { const host = {}; - expect(parseEntityFunc(host).host_cpu).toEqual(null); + expect(parseEntityFunc(host).cpu_type).toEqual(null); }); }); }); diff --git a/frontend/redux/nodes/entities/targets/helpers.tests.js b/frontend/redux/nodes/entities/targets/helpers.tests.js index 0cb16a17f5..d8dfb98817 100644 --- a/frontend/redux/nodes/entities/targets/helpers.tests.js +++ b/frontend/redux/nodes/entities/targets/helpers.tests.js @@ -39,7 +39,7 @@ describe("targets - helpers", () => { id: 3, cpu_brand: "Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz", cpu_physical_cores: 2, - host_cpu: "2 x 2.9 GHz", + cpu_type: "2 x 2.9 GHz", label: "OS X El Capitan 10.11", name: "osx-10.11", platform: "darwin", @@ -49,7 +49,7 @@ describe("targets - helpers", () => { id: 4, cpu_brand: "Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz", cpu_physical_cores: 2, - host_cpu: "2 x 2.9 GHz", + cpu_type: "2 x 2.9 GHz", label: "Jason Meller's Macbook Pro", name: "jmeller.local", platform: "darwin", diff --git a/frontend/test/stubs.ts b/frontend/test/stubs.ts index 0b07a75902..6203a19832 100644 --- a/frontend/test/stubs.ts +++ b/frontend/test/stubs.ts @@ -79,7 +79,7 @@ export const hostStub = { code_name: "", uptime: 45469000000000, memory: 2094940160, - cpu_type: "6", + cpu_type: "1 x 2.4Ghz", cpu_subtype: "78", cpu_brand: "Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz", cpu_physical_cores: 2, @@ -94,7 +94,6 @@ export const hostStub = { status: "online", display_text: "52883a0ba916", target_type: "hosts", - host_cpu: "1 x 2.4Ghz", }; export const labelStub = {