Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change storage layout sidepanel MAASENG-2798 #5335

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/machines/components/MachineForms/MachineForms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const MachineForms = ({
return <AddChassisForm clearSidePanelContent={clearSidePanelContent} />;
case MachineSidePanelViews.ADD_MACHINE:
return <AddMachineForm clearSidePanelContent={clearSidePanelContent} />;
case MachineSidePanelViews.CHANGE_STORAGE_LAYOUT: {
case MachineSidePanelViews.APPLY_STORAGE_LAYOUT: {
if (!systemId || !selectedLayout) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/machines/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const MachineNonActionSidePanelViews = {
ADD_MACHINE: ["machineNonActionForm", "addMachine"],
ADD_SPECIAL_FILESYSTEM: ["machineNonActionForm", "addSpecialFilesystem"],
ADD_VLAN: ["machineNonActionForm", "addVlan"],
CHANGE_STORAGE_LAYOUT: ["machineNonActionForm", "changeStorageLayout"],
APPLY_STORAGE_LAYOUT: ["machineNonActionForm", "applyStorageLayout"],
CREATE_DATASTORE: ["machineNonActionForm", "createDatastore"],
CREATE_RAID: ["machineNonActionForm", "createRaid"],
CREATE_VOLUME_GROUP: ["machineNonActionForm", "createVolumeGroup"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ describe("ChangeStorageLayout", () => {
});

it("correctly dispatches an action to update a machine's storage layout", async () => {
const handleClearSidePanelContent = vi.fn();
const state = rootStateFactory({
machine: machineStateFactory({
items: [machineDetailsFactory({ system_id: "abc123" })],
Expand All @@ -97,7 +98,7 @@ describe("ChangeStorageLayout", () => {
const store = mockStore(state);
renderWithBrowserRouter(
<ChangeStorageLayout
clearSidePanelContent={vi.fn()}
clearSidePanelContent={handleClearSidePanelContent}
selectedLayout={sampleStoragelayout}
systemId="abc123"
/>,
Expand Down Expand Up @@ -128,5 +129,6 @@ describe("ChangeStorageLayout", () => {
},
type: "machine/applyStorageLayout",
});
expect(handleClearSidePanelContent).toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const ChangeStorageLayout = ({
storageLayout: selectedLayout.value,
})
);
clearSidePanelContent();
}}
saved={saved}
saving={saving}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const ChangeStorageLayoutMenu = ({ systemId }: Props) => {
children: option.label,
onClick: () =>
setSidePanelContent({
view: MachineSidePanelViews.CHANGE_STORAGE_LAYOUT,
view: MachineSidePanelViews.APPLY_STORAGE_LAYOUT,
extras: {
systemId,
selectedLayout: option,
Expand Down
2 changes: 2 additions & 0 deletions src/app/store/utils/node/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ export const getSidePanelTitle = (
return "Add VLAN";
case SidePanelViews.CHANGE_SOURCE[1]:
return "Change source";
case SidePanelViews.APPLY_STORAGE_LAYOUT[1]:
return "Change storage layout";
case SidePanelViews.CLEAR_ALL_DISCOVERIES[1]:
return "Clear all discoveries";
case SidePanelViews.CREATE_DATASTORE[1]:
Expand Down
Loading