Add typescript paths to top level folders
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / project-action-set.ts
index e0284e85ef670293b63271948909bd0041d899f5..89446850a3b8322346d31665db7c98d8235e7528 100644 (file)
@@ -2,22 +2,28 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
+import { reset } from "redux-form";
+
 import { ContextMenuActionSet } from "../context-menu-action-set";
-import { projectActions } from "../../../store/project/project-action";
-import { ShareIcon, NewProjectIcon } from "../../../components/icon/icon";
-import { FavoriteActionText, FavoriteActionIcon } from "./favorite-action";
-import { favoritesActions, toggleFavorite } from "../../../store/favorites/favorites-actions";
+import { projectActions } from "~/store/project/project-action";
+import { NewProjectIcon } from "~/components/icon/icon";
+import { ToggleFavoriteAction } from "../actions/favorite-action";
+import { toggleFavorite } from "~/store/favorites/favorites-actions";
+import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
+import { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create";
 
 export const projectActionSet: ContextMenuActionSet = [[{
     icon: NewProjectIcon,
     name: "New project",
     execute: (dispatch, resource) => {
+        dispatch(reset(PROJECT_CREATE_DIALOG));
         dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
     }
 }, {
-    name: FavoriteActionText,
-    icon: FavoriteActionIcon,
+    component: ToggleFavoriteAction,
     execute: (dispatch, resource) => {
-        dispatch<any>(toggleFavorite(resource.uuid));
+        dispatch<any>(toggleFavorite(resource)).then(() => {
+            dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
+        });
     }
 }]];