Skip to content

Commit

Permalink
add periodic hardware sync checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
petermakowski committed Mar 31, 2022
1 parent ef89d8d commit 66ac7bb
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,4 +427,29 @@ describe("DeployFormFields", () => {
// Previous kernel selection should be cleared.
expect(wrapper.find("Select[name='kernel']").prop("value")).toBe("");
});

it("displays 'periodically sync hardware' checkbox", async () => {
if (state.general.osInfo.data) {
state.general.osInfo.data.default_release = "bionic";
}
const store = mockStore(state);
const wrapper = mount(
<Provider store={store}>
<MemoryRouter
initialEntries={[{ pathname: "/machines", key: "testKey" }]}
>
<DeployForm
clearHeaderContent={jest.fn()}
machines={[]}
processingCount={0}
viewingDetails={false}
/>
</MemoryRouter>
</Provider>
);

expect(wrapper.find("FormikField[name='enable_hw_sync']").exists()).toBe(
true
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import { useState } from "react";
import * as React from "react";

import {
Button,
Col,
Icon,
Input,
Notification,
Row,
Select,
Tooltip,
} from "@canonical/react-components";
import classNames from "classnames";
import { useFormikContext } from "formik";
Expand All @@ -24,6 +27,7 @@ import configSelectors from "app/store/config/selectors";
import { osInfo as osInfoSelectors } from "app/store/general/selectors";
import { PodType } from "app/store/pod/constants";
import type { RootState } from "app/store/root/types";
import { breakLines } from "app/utils";

export const DeployFormFields = (): JSX.Element => {
const [deployVmHost, setDeployVmHost] = useState(false);
Expand Down Expand Up @@ -184,6 +188,32 @@ export const DeployFormFields = (): JSX.Element => {
"u-sv2": userDataVisible,
})}
/>
<FormikField
disabled
type="checkbox"
name="enable_hw_sync"
label={
<>
Periodically sync hardware{" "}
<Tooltip
positionElementClassName="u-display-inline-important"
message={breakLines(
"Enable this to make MAAS periodically check the hardware configuration of this machine and reflect any possible change after the deployment."
)}
>
<Button
type="button"
appearance="base"
aria-label="more about periodically sync hardware"
className="u-no-margin--bottom"
>
<Icon name="information" />
</Button>
</Tooltip>
</>
}
help="Hardware sync interval: 6 hours - Admins can change this in the global settings."
/>
{userDataVisible && (
<UploadTextArea
label="Upload script"
Expand Down

0 comments on commit 66ac7bb

Please sign in to comment.