[ARVADOS-WORKBENCH2] updated: 1.1.4-382-gc2ce837
Git user
git at public.curoverse.com
Tue Jul 24 07:04:37 EDT 2018
Summary of changes:
src/index.tsx | 2 ++
src/store/favorites/favorites-actions.ts | 4 ++--
.../context-menu/action-sets/favorite-action-set.ts | 19 +++++++++++++++++++
src/views-components/context-menu/context-menu.tsx | 3 ++-
src/views/workbench/workbench.tsx | 3 +--
5 files changed, 26 insertions(+), 5 deletions(-)
create mode 100644 src/views-components/context-menu/action-sets/favorite-action-set.ts
via c2ce837bcdbe8605880059d5e0de484ae2ac9f6e (commit)
from 9f72326a9442c6db9c29cbd50db7d047106efc90 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit c2ce837bcdbe8605880059d5e0de484ae2ac9f6e
Author: Daniel Kos <daniel.kos at contractors.roche.com>
Date: Tue Jul 24 13:03:54 2018 +0200
Add refreshing panel list after toggle favorite
Feature #13753
Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos at contractors.roche.com>
diff --git a/src/index.tsx b/src/index.tsx
index caba632..7443aea 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -23,10 +23,12 @@ import { addMenuActionSet, ContextMenuKind } from "./views-components/context-me
import { rootProjectActionSet } from "./views-components/context-menu/action-sets/root-project-action-set";
import { projectActionSet } from "./views-components/context-menu/action-sets/project-action-set";
import { resourceActionSet } from './views-components/context-menu/action-sets/resource-action-set';
+import { favoriteActionSet } from "./views-components/context-menu/action-sets/favorite-action-set";
addMenuActionSet(ContextMenuKind.RootProject, rootProjectActionSet);
addMenuActionSet(ContextMenuKind.Project, projectActionSet);
addMenuActionSet(ContextMenuKind.Resource, resourceActionSet);
+addMenuActionSet(ContextMenuKind.Favorite, favoriteActionSet);
fetchConfig()
.then(config => {
diff --git a/src/store/favorites/favorites-actions.ts b/src/store/favorites/favorites-actions.ts
index 225c9b3..4a176e3 100644
--- a/src/store/favorites/favorites-actions.ts
+++ b/src/store/favorites/favorites-actions.ts
@@ -17,7 +17,7 @@ export const favoritesActions = unionize({
export type FavoritesAction = UnionOf<typeof favoritesActions>;
export const toggleFavorite = (resource: { uuid: string; name: string }) =>
- (dispatch: Dispatch, getState: () => RootState) => {
+ (dispatch: Dispatch, getState: () => RootState): Promise<any> => {
const userUuid = getState().auth.user!.uuid;
dispatch(favoritesActions.TOGGLE_FAVORITE({ resourceUuid: resource.uuid }));
const isFavorite = checkFavorite(resource.uuid, getState().favorites);
@@ -25,7 +25,7 @@ export const toggleFavorite = (resource: { uuid: string; name: string }) =>
? favoriteService.delete({ userUuid, resourceUuid: resource.uuid })
: favoriteService.create({ userUuid, resource });
- promise
+ return promise
.then(fav => {
dispatch(favoritesActions.UPDATE_FAVORITES({ [resource.uuid]: !isFavorite }));
});
diff --git a/src/views-components/context-menu/action-sets/favorite-action-set.ts b/src/views-components/context-menu/action-sets/favorite-action-set.ts
new file mode 100644
index 0000000..807c309
--- /dev/null
+++ b/src/views-components/context-menu/action-sets/favorite-action-set.ts
@@ -0,0 +1,19 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "../context-menu-action-set";
+import { ToggleFavoriteAction } from "./favorite-action";
+import { toggleFavorite } from "../../../store/favorites/favorites-actions";
+import { dataExplorerActions } from "../../../store/data-explorer/data-explorer-action";
+import { FAVORITE_PANEL_ID } from "../../../views/favorite-panel/favorite-panel";
+
+export const favoriteActionSet: ContextMenuActionSet = [[{
+ component: ToggleFavoriteAction,
+ execute: (dispatch, resource) => {
+ debugger;
+ dispatch<any>(toggleFavorite(resource)).then(() => {
+ dispatch<any>(dataExplorerActions.REQUEST_ITEMS({ id : FAVORITE_PANEL_ID }));
+ });
+ }
+}]];
diff --git a/src/views-components/context-menu/context-menu.tsx b/src/views-components/context-menu/context-menu.tsx
index 245fe35..9b339c6 100644
--- a/src/views-components/context-menu/context-menu.tsx
+++ b/src/views-components/context-menu/context-menu.tsx
@@ -58,5 +58,6 @@ const getMenuActionSet = (resource?: ContextMenuResource): ContextMenuActionSet
export enum ContextMenuKind {
RootProject = "RootProject",
Project = "Project",
- Resource = "Resource"
+ Resource = "Resource",
+ Favorite = "Favorite"
}
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 43033d9..912ab87 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -234,11 +234,10 @@ export const Workbench = withStyles(styles)(
renderFavoritePanel = (props: RouteComponentProps<{ id: string }>) => <FavoritePanel
onItemRouteChange={itemId => this.props.dispatch<any>(setFavoriteItem(itemId, ItemMode.ACTIVE))}
onContextMenu={(event, item) => {
- const kind = item.kind === ResourceKind.Project ? ContextMenuKind.Project : ContextMenuKind.Resource;
this.openContextMenu(event, {
uuid: item.uuid,
name: item.name,
- kind,
+ kind: ContextMenuKind.Favorite,
});
}}
onDialogOpen={this.handleCreationDialogOpen}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list