Skip to content

Commit

Permalink
fix: machine status in the header lp#2044399 (#5221) 3.4 backport (#5222
Browse files Browse the repository at this point in the history
)
  • Loading branch information
petermakowski authored Nov 24, 2023
1 parent 25758c3 commit 2289a6c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MachineHeaderViews } from "app/machines/constants";
import { actions as machineActions } from "app/store/machine";
import type { RootState } from "app/store/root/types";
import { PowerState } from "app/store/types/enum";
import { NodeActions } from "app/store/types/node";
import { NodeActions, NodeStatus } from "app/store/types/node";
import {
generalState as generalStateFactory,
machine as machineFactory,
Expand Down Expand Up @@ -127,6 +127,21 @@ describe("MachineHeader", () => {
expect(screen.getByText(/power on/i)).toBeInTheDocument();
});

it("displays machine status", () => {
state.machine.items[0].status = NodeStatus.DEPLOYED;

renderWithBrowserRouter(
<MachineHeader
setSidePanelContent={jest.fn()}
sidePanelContent={null}
systemId="abc123"
/>,
{ state, route: "/machine/abc123" }
);

expect(screen.getByText(/deployed/i)).toBeInTheDocument();
});

it("displays power status when checking power", () => {
state.machine.statuses["abc123"] = machineStatusFactory({
checkingPower: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const MachineHeader = ({
subtitle={
editingName ? null : (
<div className="u-flex--wrap u-flex--align-center">
<div className="u-nudge-left">
<div className="u-nudge-left u-nudge-right">
{machine.locked ? (
<TooltipButton
aria-label="locked"
Expand All @@ -115,6 +115,7 @@ const MachineHeader = ({
position="btm-left"
/>
) : null}
{machine.status}
</div>
<div>
<PowerIcon
Expand Down

0 comments on commit 2289a6c

Please sign in to comment.