Skip to content

Commit 02723ca

Browse files
committed
Fix deployment, ui issue
1 parent 924d327 commit 02723ca

File tree

2 files changed

+204
-205
lines changed

2 files changed

+204
-205
lines changed

applications/osb-portal/src/components/workspace/WorkspaceActionsMenu.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Button from "@mui/material/Button";
77
import { IconButton, Link } from "@mui/material";
88
import Snackbar from "@mui/material/Snackbar";
99
import CloseIcon from "@mui/icons-material/Close";
10-
import { useSelector } from "react-redux";
10+
import { useSelector, useDispatch } from "react-redux";
1111

1212
import { OSBApplications, Workspace } from "../../types/workspace";
1313
import { WorkspaceEditor } from "../index";
@@ -18,13 +18,11 @@ import { bgDarkest, textColor } from "../../theme";
1818
import * as Icons from "../icons";
1919
import PrimaryDialog from "../dialogs/PrimaryDialog";
2020
import { RootState } from "../../store/rootReducer";
21+
import { updateWorkspace, deleteWorkspace, refreshWorkspaces } from "../../store/actions/workspaces";
2122

2223

2324
interface WorkspaceActionsMenuProps {
2425
workspace?: Workspace;
25-
updateWorkspace?: (ws: Workspace) => void;
26-
deleteWorkspace?: (wsId: number) => void;
27-
refreshWorkspaces?: () => void;
2826
isWorkspaceOpen?: boolean;
2927
ButtonComponent?: React.ComponentType<any>;
3028
[other: string]: any;
@@ -41,6 +39,7 @@ const snackbarStyles = {
4139
export const WorkspaceActionsMenu = (props: WorkspaceActionsMenuProps) => {
4240
const { ButtonComponent } = props;
4341
const user = useSelector((state: RootState) => state.user);
42+
const dispatch = useDispatch();
4443

4544
const [editWorkspaceOpen, setEditWorkspaceOpen] = React.useState(false);
4645
const [cloneInProgress, setCloneInProgress] = React.useState<boolean>(false);
@@ -69,7 +68,7 @@ export const WorkspaceActionsMenu = (props: WorkspaceActionsMenuProps) => {
6968
};
7069

7170
const handleDeleteWorkspace = () => {
72-
props.deleteWorkspace(props.workspace.id);
71+
dispatch(deleteWorkspace(props.workspace.id));
7372
handleCloseMenu();
7473

7574
if (window.location.pathname !== "/") {
@@ -78,20 +77,20 @@ export const WorkspaceActionsMenu = (props: WorkspaceActionsMenuProps) => {
7877
};
7978

8079
const handlePublicWorkspace = () => {
81-
props.updateWorkspace({ ...props.workspace, publicable: true });
80+
dispatch(updateWorkspace({ ...props.workspace, publicable: true }));
8281
handleCloseMenu();
8382
};
8483

8584
const handlePrivateWorkspace = () => {
86-
props.updateWorkspace({ ...props.workspace, publicable: false });
85+
dispatch(updateWorkspace({ ...props.workspace, publicable: false }));
8786
handleCloseMenu();
8887
};
8988

9089
const handleFeaturedWorkspace = () => {
91-
props.updateWorkspace({
90+
dispatch(updateWorkspace({
9291
...props.workspace,
9392
featured: !props.workspace.featured,
94-
});
93+
}));
9594
handleCloseMenu();
9695
};
9796

@@ -101,15 +100,15 @@ export const WorkspaceActionsMenu = (props: WorkspaceActionsMenuProps) => {
101100

102101
const handleCloseEditWorkspace = () => {
103102
setEditWorkspaceOpen(false);
104-
props.refreshWorkspaces();
103+
dispatch(refreshWorkspaces());
105104
};
106105

107106
const handleCloneWorkspace = () => {
108107
handleCloseMenu();
109108
setCloneInProgress(true);
110109
WorkspaceService.cloneWorkspace(props.workspace.id).then(
111110
(res) => {
112-
props.refreshWorkspaces();
111+
dispatch(refreshWorkspaces());
113112
setCloneInProgress(false);
114113
setCloneComplete(true);
115114
setClonedWSId(res.id);

0 commit comments

Comments
 (0)