From: Daniel Kos Date: Tue, 24 Jul 2018 10:29:17 +0000 (+0200) Subject: Add favorite star, fix post merge compilation problems X-Git-Tag: 1.2.0~31^2~6 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/2953c96ede69c1d518ae05f1a57239aad951d0e7 Add favorite star, fix post merge compilation problems Feature #13753 Arvados-DCO-1.1-Signed-off-by: Daniel Kos --- diff --git a/src/store/favorite-panel/favorite-panel-middleware.ts b/src/store/favorite-panel/favorite-panel-middleware.ts index 27e36b0c..791c6bda 100644 --- a/src/store/favorite-panel/favorite-panel-middleware.ts +++ b/src/store/favorite-panel/favorite-panel-middleware.ts @@ -22,6 +22,7 @@ import { import { FavoritePanelItem, resourceToDataItem } from "../../views/favorite-panel/favorite-panel-item"; import { LinkResource } from "../../models/link"; import { ResourceKind } from "../../models/resource"; +import { checkPresenceInFavorites } from "../favorites/favorites-actions"; export const favoritePanelMiddleware: Middleware = store => next => { next(dataExplorerActions.SET_COLUMNS({ id: FAVORITE_PANEL_ID, columns })); @@ -76,6 +77,7 @@ export const favoritePanelMiddleware: Middleware = store => next => { page: Math.floor(response.offset / response.limit), rowsPerPage: response.limit })); + store.dispatch(checkPresenceInFavorites(response.items.map(item => item.uuid))); }); } else { store.dispatch(dataExplorerActions.SET_ITEMS({ diff --git a/src/views/favorite-panel/favorite-panel.tsx b/src/views/favorite-panel/favorite-panel.tsx index 4c5b5bd8..6f4cedba 100644 --- a/src/views/favorite-panel/favorite-panel.tsx +++ b/src/views/favorite-panel/favorite-panel.tsx @@ -18,6 +18,7 @@ import { ResourceKind } from '../../models/resource'; import { resourceLabel } from '../../common/labels'; import { ProjectIcon, CollectionIcon, ProcessIcon, DefaultIcon } from '../../components/icon/icon'; import { ArvadosTheme } from '../../common/custom-theme'; +import { FavoriteStar } from "../../views-components/favorite-star/favorite-star"; type CssRules = "toolbar" | "button"; @@ -41,6 +42,11 @@ const renderName = (item: FavoritePanelItem) => {item.name} + + + + + ; diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 862fbd51..43033d96 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -233,7 +233,14 @@ export const Workbench = withStyles(styles)( renderFavoritePanel = (props: RouteComponentProps<{ id: string }>) => this.props.dispatch(setFavoriteItem(itemId, ItemMode.ACTIVE))} - onContextMenu={(event, item) => this.openContextMenu(event, item.uuid, ContextMenuKind.Favorite)} + onContextMenu={(event, item) => { + const kind = item.kind === ResourceKind.Project ? ContextMenuKind.Project : ContextMenuKind.Resource; + this.openContextMenu(event, { + uuid: item.uuid, + name: item.name, + kind, + }); + }} onDialogOpen={this.handleCreationDialogOpen} onItemClick={item => { this.props.dispatch(loadDetails(item.uuid, item.kind as ResourceKind));