[ARVADOS-WORKBENCH2] updated: 1.3.1-428-gb546e1dc

Git user git at public.curoverse.com
Mon Apr 8 07:44:55 UTC 2019


Summary of changes:
 src/models/tree.ts                                 |  3 +-
 .../public-favorites-middleware-service.ts         | 29 +++++----
 .../public-favorites/public-favorites-actions.ts   | 14 +++++
 src/store/tree-picker/tree-picker-actions.ts       | 73 +++++++++++++++++++++-
 src/store/workbench/workbench-actions.ts           |  3 +-
 src/views-components/data-explorer/renderers.tsx   | 43 ++++++++++---
 .../favorite-star/favorite-star.tsx                | 15 +++--
 .../project-tree-picker/project-tree-picker.tsx    |  8 ++-
 .../generic-projects-tree-picker.tsx               | 15 ++++-
 .../projects-tree-picker/projects-tree-picker.tsx  |  4 +-
 ...picker.tsx => public-favorites-tree-picker.tsx} |  6 +-
 .../public-favorite-icon/public-favorite-icon.tsx  | 27 --------
 .../public-favorites-panel.tsx                     | 51 +++++++--------
 13 files changed, 194 insertions(+), 97 deletions(-)
 copy src/views-components/projects-tree-picker/{favorites-tree-picker.tsx => public-favorites-tree-picker.tsx} (67%)
 delete mode 100644 src/views-components/public-favorite-icon/public-favorite-icon.tsx

       via  b546e1dc213e7336e2d48f0e73962179b57145ae (commit)
       via  9456a165e6ebdbf1ead5847a619a8f9acdf1932f (commit)
       via  dd1f1d03b17db51c86b2ee7f4217769de5ea31ef (commit)
      from  1147590dd93204fd4d286b48f2573fcb46d7cd9d (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 b546e1dc213e7336e2d48f0e73962179b57145ae
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Mon Apr 8 09:22:02 2019 +0200

    extend-tree-picker
    
    Feature #14941
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/models/tree.ts b/src/models/tree.ts
index bec2f758..60a95342 100644
--- a/src/models/tree.ts
+++ b/src/models/tree.ts
@@ -27,7 +27,8 @@ export enum TreeNodeStatus {
 export enum TreePickerId {
     PROJECTS = 'Projects',
     SHARED_WITH_ME = 'Shared with me',
-    FAVORITES = 'Favorites'
+    FAVORITES = 'Favorites',
+    PUBLIC_FAVORITES = 'Public Favorites'
 }
 
 export const createTree = <T>(): Tree<T> => ({});
diff --git a/src/store/tree-picker/tree-picker-actions.ts b/src/store/tree-picker/tree-picker-actions.ts
index 657d65b7..e4d6d933 100644
--- a/src/store/tree-picker/tree-picker-actions.ts
+++ b/src/store/tree-picker/tree-picker-actions.ts
@@ -16,6 +16,7 @@ import { ProjectsTreePickerItem } from '~/views-components/projects-tree-picker/
 import { OrderBuilder } from '~/services/api/order-builder';
 import { ProjectResource } from '~/models/project';
 import { mapTree } from '../../models/tree';
+import { LinkResource, LinkClass } from "~/models/link";
 
 export const treePickerActions = unionize({
     LOAD_TREE_PICKER_NODE: ofType<{ id: string, pickerId: string }>(),
@@ -37,6 +38,7 @@ export const getProjectsTreePickerIds = (pickerId: string) => ({
     home: `${pickerId}_home`,
     shared: `${pickerId}_shared`,
     favorites: `${pickerId}_favorites`,
+    publicFavorites: `${pickerId}_publicFavorites`
 });
 
 export const getAllNodes = <Value>(pickerId: string, filter = (node: TreeNode<Value>) => true) => (state: TreePicker) =>
@@ -64,10 +66,11 @@ export const getSelectedNodes = <Value>(pickerId: string) => (state: TreePicker)
 
 export const initProjectsTreePicker = (pickerId: string) =>
     async (dispatch: Dispatch, _: () => RootState, services: ServiceRepository) => {
-        const { home, shared, favorites } = getProjectsTreePickerIds(pickerId);
+        const { home, shared, favorites, publicFavorites } = getProjectsTreePickerIds(pickerId);
         dispatch<any>(initUserProject(home));
         dispatch<any>(initSharedProject(shared));
         dispatch<any>(initFavoritesProject(favorites));
+        dispatch<any>(initPublicFavoritesProject(publicFavorites));
     };
 
 interface ReceiveTreePickerDataParams<T> {
@@ -205,6 +208,21 @@ export const initFavoritesProject = (pickerId: string) =>
         }));
     };
 
+export const PUBLIC_FAVORITES_PROJECT_ID = 'Public Favorites';
+export const initPublicFavoritesProject = (pickerId: string) =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(receiveTreePickerData({
+            id: '',
+            pickerId,
+            data: [{ uuid: PUBLIC_FAVORITES_PROJECT_ID, name: PUBLIC_FAVORITES_PROJECT_ID }],
+            extractNodeData: value => ({
+                id: value.uuid,
+                status: TreeNodeStatus.INITIAL,
+                value,
+            }),
+        }));
+    };
+
 interface LoadFavoritesProjectParams {
     pickerId: string;
     includeCollections?: boolean;
@@ -243,6 +261,43 @@ export const loadFavoritesProject = (params: LoadFavoritesProjectParams) =>
         }
     };
 
+export const loadPublicFavoritesProject = (params: LoadFavoritesProjectParams) =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        const { pickerId, includeCollections = false, includeFiles = false } = params;
+        const uuidPrefix = getState().config.uuidPrefix;
+        const uuid = `${uuidPrefix}-j7d0g-fffffffffffffff`;
+        if (uuid) {
+
+            const filters = pipe(
+                (fb: FilterBuilder) => includeCollections
+                    ? fb.addIsA('headUuid', [ResourceKind.PROJECT, ResourceKind.COLLECTION])
+                    : fb.addIsA('headUuid', [ResourceKind.PROJECT]),
+                fb => fb
+                    .addEqual('linkClass', LinkClass.STAR)
+                    .addEqual('ownerUuid', uuid)
+                    .addLike('name', '')
+                    .getFilters(),
+            )(new FilterBuilder());
+
+            const { items } = await services.linkService.list({ filters });
+
+            dispatch<any>(receiveTreePickerData<LinkResource>({
+                id: 'Public Favorites',
+                pickerId,
+                data: items,
+                extractNodeData: item => ({
+                    id: item.headUuid,
+                    value: item,
+                    status: item.headKind === ResourceKind.PROJECT
+                        ? TreeNodeStatus.INITIAL
+                        : includeFiles
+                            ? TreeNodeStatus.INITIAL
+                            : TreeNodeStatus.LOADED
+                }),
+            }));
+        }
+    };
+
 export const receiveTreePickerProjectsData = (id: string, projects: ProjectResource[], pickerId: string) =>
     (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         dispatch(treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
@@ -280,6 +335,22 @@ export const loadFavoriteTreePickerProjects = (id: string) =>
 
     };
 
+export const loadPublicFavoriteTreePickerProjects = (id: string) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const parentId = services.authService.getUuid() || '';
+
+        if (id === '') {
+            dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id: parentId, pickerId: TreePickerId.PUBLIC_FAVORITES }));
+            const { items } = await services.favoriteService.list(parentId);
+            dispatch<any>(receiveTreePickerProjectsData(parentId, items as ProjectResource[], TreePickerId.PUBLIC_FAVORITES));
+        } else {
+            dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id, pickerId: TreePickerId.PUBLIC_FAVORITES }));
+            const { items } = await services.projectService.list(buildParams(id));
+            dispatch<any>(receiveTreePickerProjectsData(id, items, TreePickerId.PUBLIC_FAVORITES));
+        }
+
+    };
+
 const buildParams = (ownerUuid: string) => {
     return {
         filters: new FilterBuilder()
diff --git a/src/views-components/project-tree-picker/project-tree-picker.tsx b/src/views-components/project-tree-picker/project-tree-picker.tsx
index 2ff9b3c4..38622651 100644
--- a/src/views-components/project-tree-picker/project-tree-picker.tsx
+++ b/src/views-components/project-tree-picker/project-tree-picker.tsx
@@ -9,7 +9,7 @@ import { Typography } from "@material-ui/core";
 import { TreePicker, TreePickerProps } from "../tree-picker/tree-picker";
 import { TreeItem, TreeItemStatus } from "~/components/tree/tree";
 import { ProjectResource } from "~/models/project";
-import { treePickerActions, loadProjectTreePickerProjects, loadFavoriteTreePickerProjects } from "~/store/tree-picker/tree-picker-actions";
+import { treePickerActions, loadProjectTreePickerProjects, loadFavoriteTreePickerProjects, loadPublicFavoriteTreePickerProjects } from "~/store/tree-picker/tree-picker-actions";
 import { ListItemTextIcon } from "~/components/list-item-text-icon/list-item-text-icon";
 import { ProjectIcon, FavoriteIcon, ProjectsIcon, ShareMeIcon } from "~/components/icon/icon";
 import { RootState } from "~/store/store";
@@ -46,7 +46,8 @@ const toggleItemOpen = (id: string, status: TreeItemStatus, pickerId: string) =>
                 dispatch<any>(loadProjectTreePickerProjects(id));
             } else if (pickerId === TreePickerId.FAVORITES) {
                 dispatch<any>(loadFavoriteTreePickerProjects(id === services.authService.getUuid() ? '' : id));
-            } else {
+            } else if (pickerId === TreePickerId.PUBLIC_FAVORITES) {
+                dispatch<any>(loadPublicFavoriteTreePickerProjects(id === services.authService.getUuid() ? '' : id));
                 // TODO: load sharedWithMe
             }
         } else {
@@ -67,6 +68,7 @@ export const ProjectTreePicker = connect(undefined, mapDispatchToProps)((props:
             <TreePicker {...props} render={renderTreeItem} pickerId={TreePickerId.PROJECTS} />
             <TreePicker {...props} render={renderTreeItem} pickerId={TreePickerId.SHARED_WITH_ME} />
             <TreePicker {...props} render={renderTreeItem} pickerId={TreePickerId.FAVORITES} />
+            <TreePicker {...props} render={renderTreeItem} pickerId={TreePickerId.PUBLIC_FAVORITES} />
         </div>
     </div>);
 
@@ -78,6 +80,8 @@ const getProjectPickerIcon = (item: TreeItem<ProjectResource>) => {
             return ProjectsIcon;
         case TreePickerId.SHARED_WITH_ME:
             return ShareMeIcon;
+        case TreePickerId.PUBLIC_FAVORITES:
+            return ShareMeIcon;
         default:
             return ProjectIcon;
     }
diff --git a/src/views-components/projects-tree-picker/generic-projects-tree-picker.tsx b/src/views-components/projects-tree-picker/generic-projects-tree-picker.tsx
index fafb0505..8e27d445 100644
--- a/src/views-components/projects-tree-picker/generic-projects-tree-picker.tsx
+++ b/src/views-components/projects-tree-picker/generic-projects-tree-picker.tsx
@@ -16,13 +16,14 @@ import { GroupContentsResource } from '~/services/groups-service/groups-service'
 import { CollectionDirectory, CollectionFile, CollectionFileType } from '~/models/collection-file';
 import { ResourceKind } from '~/models/resource';
 import { TreePickerProps, TreePicker } from "~/views-components/tree-picker/tree-picker";
+import { LinkResource } from "~/models/link";
 
 export interface ProjectsTreePickerRootItem {
     id: string;
     name: string;
 }
 
-export type ProjectsTreePickerItem = ProjectsTreePickerRootItem | GroupContentsResource | CollectionDirectory | CollectionFile;
+export type ProjectsTreePickerItem = ProjectsTreePickerRootItem | GroupContentsResource | CollectionDirectory | CollectionFile | LinkResource;
 type PickedTreePickerProps = Pick<TreePickerProps<ProjectsTreePickerItem>, 'onContextMenu' | 'toggleItemActive' | 'toggleItemOpen' | 'toggleItemSelection'>;
 
 export interface ProjectsTreePickerDataProps {
@@ -45,9 +46,9 @@ const mapStateToProps = (_: any, { rootItemIcon, showSelection }: ProjectsTreePi
 const mapDispatchToProps = (dispatch: Dispatch, { loadRootItem, includeCollections, includeFiles, relatedTreePickers, ...props }: ProjectsTreePickerProps): PickedTreePickerProps => ({
     onContextMenu: () => { return; },
     toggleItemActive: (event, item, pickerId) => {
-        
+
         const { disableActivation = [] } = props;
-        if(disableActivation.some(isEqual(item.id))){
+        if (disableActivation.some(isEqual(item.id))) {
             return;
         }
 
@@ -83,6 +84,14 @@ const mapDispatchToProps = (dispatch: Dispatch, { loadRootItem, includeCollectio
 export const ProjectsTreePicker = connect(mapStateToProps, mapDispatchToProps)(TreePicker);
 
 const getProjectPickerIcon = ({ data }: TreeItem<ProjectsTreePickerItem>, rootIcon: IconType): IconType => {
+    if ('headKind' in data) {
+        switch (data.headKind) {
+            case ResourceKind.COLLECTION:
+                return CollectionIcon;
+            default:
+                return ProjectIcon;
+        }
+    }
     if ('kind' in data) {
         switch (data.kind) {
             case ResourceKind.COLLECTION:
diff --git a/src/views-components/projects-tree-picker/projects-tree-picker.tsx b/src/views-components/projects-tree-picker/projects-tree-picker.tsx
index ae98cf00..653ae604 100644
--- a/src/views-components/projects-tree-picker/projects-tree-picker.tsx
+++ b/src/views-components/projects-tree-picker/projects-tree-picker.tsx
@@ -10,6 +10,7 @@ import { FavoritesTreePicker } from '~/views-components/projects-tree-picker/fav
 import { getProjectsTreePickerIds, SHARED_PROJECT_ID, FAVORITES_PROJECT_ID } from '~/store/tree-picker/tree-picker-actions';
 import { TreeItem } from '~/components/tree/tree';
 import { ProjectsTreePickerItem } from './generic-projects-tree-picker';
+import { PublicFavoritesTreePicker } from './public-favorites-tree-picker';
 
 export interface ProjectsTreePickerProps {
     pickerId: string;
@@ -21,7 +22,7 @@ export interface ProjectsTreePickerProps {
 }
 
 export const ProjectsTreePicker = ({ pickerId, ...props }: ProjectsTreePickerProps) => {
-    const { home, shared, favorites } = getProjectsTreePickerIds(pickerId);
+    const { home, shared, favorites, publicFavorites } = getProjectsTreePickerIds(pickerId);
     const relatedTreePickers = getRelatedTreePickers(pickerId);
     const p = {
         ...props,
@@ -32,6 +33,7 @@ export const ProjectsTreePicker = ({ pickerId, ...props }: ProjectsTreePickerPro
         <HomeTreePicker pickerId={home} {...p} />
         <SharedTreePicker pickerId={shared} {...p} />
         <FavoritesTreePicker pickerId={favorites} {...p} />
+        <PublicFavoritesTreePicker pickerId={publicFavorites} {...p} />
     </div>;
 };
 
diff --git a/src/views-components/projects-tree-picker/public-favorites-tree-picker.tsx b/src/views-components/projects-tree-picker/public-favorites-tree-picker.tsx
new file mode 100644
index 00000000..2d1f9756
--- /dev/null
+++ b/src/views-components/projects-tree-picker/public-favorites-tree-picker.tsx
@@ -0,0 +1,17 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { connect } from 'react-redux';
+import { ProjectsTreePicker, ProjectsTreePickerProps } from '~/views-components/projects-tree-picker/generic-projects-tree-picker';
+import { Dispatch } from 'redux';
+import { FavoriteIcon } from '~/components/icon/icon';
+import { loadPublicFavoritesProject } from '~/store/tree-picker/tree-picker-actions';
+
+export const PublicFavoritesTreePicker = connect(() => ({
+    rootItemIcon: FavoriteIcon,
+}), (dispatch: Dispatch): Pick<ProjectsTreePickerProps, 'loadRootItem'> => ({
+    loadRootItem: (_, pickerId, includeCollections, includeFiles) => {
+        dispatch<any>(loadPublicFavoritesProject({ pickerId, includeCollections, includeFiles }));
+    },
+}))(ProjectsTreePicker);
\ No newline at end of file

commit 9456a165e6ebdbf1ead5847a619a8f9acdf1932f
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Wed Apr 3 11:00:35 2019 +0200

    context-menus-in-public-favorite-panel
    
    Feature #14941
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/store/public-favorites/public-favorites-actions.ts b/src/store/public-favorites/public-favorites-actions.ts
index ae6815b6..b5aa9fce 100644
--- a/src/store/public-favorites/public-favorites-actions.ts
+++ b/src/store/public-favorites/public-favorites-actions.ts
@@ -9,6 +9,8 @@ import { checkPublicFavorite } from "./public-favorites-reducer";
 import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions";
 import { ServiceRepository } from "~/services/services";
 import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
+import { getResource } from '~/store/resources/resources';
+import { LinkResource } from "~/models/link";
 
 export const publicFavoritesActions = unionize({
     TOGGLE_PUBLIC_FAVORITE: ofType<{ resourceUuid: string }>(),
@@ -66,3 +68,15 @@ export const updatePublicFavorites = (resourceUuids: string[]) =>
                 dispatch(publicFavoritesActions.UPDATE_PUBLIC_FAVORITES(results));
             });
     };
+
+export const getHeadUuid = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const resource = getResource<LinkResource>(uuid)(getState().resources);
+        return resource!.headUuid;
+    };
+
+export const getIsAdmin = () =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const resource = getState().auth.user!.isAdmin;
+        return resource;
+    };
diff --git a/src/views/public-favorites-panel/public-favorites-panel.tsx b/src/views/public-favorites-panel/public-favorites-panel.tsx
index 3970418f..7af4edc7 100644
--- a/src/views/public-favorites-panel/public-favorites-panel.tsx
+++ b/src/views/public-favorites-panel/public-favorites-panel.tsx
@@ -31,6 +31,7 @@ import { createTree } from '~/models/tree';
 import { getSimpleObjectTypeFilters } from '~/store/resource-type-filters/resource-type-filters';
 import { PUBLIC_FAVORITE_PANEL_ID } from '~/store/public-favorites-panel/public-favorites-action';
 import { PublicFavoritesState } from '~/store/public-favorites/public-favorites-reducer';
+import { getHeadUuid, getIsAdmin } from '~/store/public-favorites/public-favorites-actions';
 
 type CssRules = "toolbar" | "button";
 
@@ -113,24 +114,25 @@ const mapStateToProps = ({ publicFavorites }: RootState): PublicFavoritePanelDat
 
 const mapDispatchToProps = (dispatch: Dispatch): PublicFavoritePanelActionProps => ({
     onContextMenu: (event, resourceUuid) => {
-        const kind = resourceKindToContextMenuKind(resourceUuid);
+        const isAdmin = dispatch<any>(getIsAdmin());
+        const kind = resourceKindToContextMenuKind(dispatch<any>(getHeadUuid(resourceUuid)), isAdmin);
         if (kind) {
             dispatch<any>(openContextMenu(event, {
                 name: '',
-                uuid: resourceUuid,
+                uuid: dispatch<any>(getHeadUuid(resourceUuid)),
                 ownerUuid: '',
                 kind: ResourceKind.NONE,
                 menuKind: kind
             }));
         }
-        dispatch<any>(loadDetailsPanel(resourceUuid));
+        dispatch<any>(loadDetailsPanel(dispatch<any>(getHeadUuid(resourceUuid))));
     },
     onDialogOpen: (ownerUuid: string) => { return; },
-    onItemClick: (resourceUuid: string) => {
-        dispatch<any>(loadDetailsPanel(resourceUuid));
+    onItemClick: (uuid: string) => {
+        dispatch<any>(loadDetailsPanel(dispatch<any>(getHeadUuid(uuid))));
     },
     onItemDoubleClick: uuid => {
-        dispatch<any>(navigateTo(uuid));
+        dispatch<any>(navigateTo(dispatch<any>(getHeadUuid(uuid))));
     }
 });
 

commit dd1f1d03b17db51c86b2ee7f4217769de5ea31ef
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Tue Apr 2 14:59:30 2019 +0200

    public-fav-panel
    
    Feature #14941
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/store/public-favorites-panel/public-favorites-middleware-service.ts b/src/store/public-favorites-panel/public-favorites-middleware-service.ts
index 3f686498..c7bbf8dd 100644
--- a/src/store/public-favorites-panel/public-favorites-middleware-service.ts
+++ b/src/store/public-favorites-panel/public-favorites-middleware-service.ts
@@ -17,7 +17,7 @@ import { FavoritePanelColumnNames } from '~/views/favorite-panel/favorite-panel'
 import { publicFavoritePanelActions } from '~/store/public-favorites-panel/public-favorites-action';
 import { DataColumns } from '~/components/data-table/data-table';
 import { serializeSimpleObjectTypeFilters } from '../resource-type-filters/resource-type-filters';
-import { LinkResource } from '~/models/link';
+import { LinkResource, LinkClass } from '~/models/link';
 import { GroupContentsResource, GroupContentsResourcePrefix } from '~/services/groups-service/groups-service';
 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
 import { loadMissingProcessesInformation } from '~/store/project-panel/project-panel-middleware-service';
@@ -54,28 +54,27 @@ export class PublicFavoritesMiddlewareService extends DataExplorerMiddlewareServ
             }
             try {
                 api.dispatch(progressIndicatorActions.START_WORKING(this.getId()));
-                const response = await this.services.favoriteService
-                    .list(this.services.authService.getUuid()!, {
-                        limit: dataExplorer.rowsPerPage,
-                        offset: dataExplorer.page * dataExplorer.rowsPerPage,
-                        linkOrder: linkOrder.getOrder(),
-                        contentOrder: contentOrder.getOrder(),
-                        filters: new FilterBuilder()
-                            .addILike("name", dataExplorer.searchValue)
-                            .addIsA("headUuid", typeFilters)
-                            .getFilters(),
-
-                    });
+                const uuidPrefix = api.getState().config.uuidPrefix;
+                const uuid = `${uuidPrefix}-j7d0g-fffffffffffffff`;
+                const response = await this.services.linkService.list({
+                    limit: dataExplorer.rowsPerPage,
+                    offset: dataExplorer.page * dataExplorer.rowsPerPage,
+                    filters: new FilterBuilder()
+                        .addEqual('linkClass', LinkClass.STAR)
+                        .addILike("name", dataExplorer.searchValue)
+                        .addEqual('ownerUuid', uuid)
+                        .addIsA("headUuid", typeFilters)
+                        .getFilters()
+                });
                 api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId()));
                 api.dispatch(resourcesActions.SET_RESOURCES(response.items));
-                await api.dispatch<any>(loadMissingProcessesInformation(response.items));
                 api.dispatch(publicFavoritePanelActions.SET_ITEMS({
                     items: response.items.map(resource => resource.uuid),
                     itemsAvailable: response.itemsAvailable,
                     page: Math.floor(response.offset / response.limit),
                     rowsPerPage: response.limit
                 }));
-                api.dispatch<any>(updatePublicFavorites(response.items.map(item => item.uuid)));
+                api.dispatch<any>(updatePublicFavorites(response.items.map(item => item.headUuid)));
             } catch (e) {
                 api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId()));
                 api.dispatch(publicFavoritePanelActions.SET_ITEMS({
diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts
index e2276cef..adf3fa15 100644
--- a/src/store/workbench/workbench-actions.ts
+++ b/src/store/workbench/workbench-actions.ts
@@ -93,6 +93,7 @@ import * as groupDetailsPanelActions from '~/store/group-details-panel/group-det
 import { groupDetailsPanelColumns } from '~/views/group-details-panel/group-details-panel';
 import { DataTableFetchMode } from "~/components/data-table/data-table";
 import { loadPublicFavoritePanel, publicFavoritePanelActions } from '~/store/public-favorites-panel/public-favorites-action';
+import { publicFavoritePanelColumns } from '~/views/public-favorites-panel/public-favorites-panel';
 
 export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
 
@@ -120,7 +121,7 @@ export const loadWorkbench = () =>
         if (user) {
             dispatch(projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
             dispatch(favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns }));
-            dispatch(publicFavoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns }));
+            dispatch(publicFavoritePanelActions.SET_COLUMNS({ columns: publicFavoritePanelColumns }));
             dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns }));
             dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
             dispatch(workflowPanelActions.SET_COLUMNS({ columns: workflowPanelColumns }));
diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx
index 8ca4deff..04dbfa7c 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -26,12 +26,11 @@ import { toggleIsActive, toggleIsAdmin } from '~/store/users/users-actions';
 import { LinkResource } from '~/models/link';
 import { navigateTo } from '~/store/navigation/navigation-action';
 import { withResourceData } from '~/views-components/data-explorer/with-resources';
-import { PublicFavorite } from '~/views-components/public-favorite-icon/public-favorite-icon';
 
 const renderName = (item: { name: string; uuid: string, kind: string }) =>
     <Grid container alignItems="center" wrap="nowrap" spacing={16}>
         <Grid item>
-            {renderIcon(item)}
+            {renderIcon(item.kind)}
         </Grid>
         <Grid item>
             <Typography color="primary" style={{ width: 'auto' }}>
@@ -43,11 +42,6 @@ const renderName = (item: { name: string; uuid: string, kind: string }) =>
                 <FavoriteStar resourceUuid={item.uuid} />
             </Typography>
         </Grid>
-        <Grid item>
-            <Typography variant="caption">
-                <PublicFavorite resourceUuid={item.uuid} />
-            </Typography>
-        </Grid>
     </Grid>;
 
 export const ResourceName = connect(
@@ -56,8 +50,8 @@ export const ResourceName = connect(
         return resource || { name: '', uuid: '', kind: '' };
     })(renderName);
 
-const renderIcon = (item: { kind: string }) => {
-    switch (item.kind) {
+const renderIcon = (kind: string) => {
+    switch (kind) {
         case ResourceKind.PROJECT:
             return <ProjectIcon />;
         case ResourceKind.COLLECTION:
@@ -78,7 +72,7 @@ const renderDate = (date?: string) => {
 const renderWorkflowName = (item: { name: string; uuid: string, kind: string, ownerUuid: string }) =>
     <Grid container alignItems="center" wrap="nowrap" spacing={16}>
         <Grid item>
-            {renderIcon(item)}
+            {renderIcon(item.kind)}
         </Grid>
         <Grid item>
             <Typography color="primary" style={{ width: '100px' }}>
@@ -332,6 +326,35 @@ export const ResourceLinkUuid = connect(
         return resource || { uuid: '' };
     })(renderUuid);
 
+const renderLinkNameAndIcon = (item: { name: string; headUuid: string, headKind: string }) =>
+    <Grid container alignItems="center" wrap="nowrap" spacing={16}>
+        <Grid item>
+            {renderIcon(item.headKind)}
+        </Grid>
+        <Grid item>
+            <Typography color="primary" style={{ width: 'auto' }}>
+                {item.name}
+            </Typography>
+        </Grid>
+        <Grid item>
+            <Typography variant="caption">
+                <FavoriteStar resourceUuid={item.headUuid} />
+            </Typography>
+        </Grid>
+    </Grid>;
+
+export const ResourceLinkNameAndIcon = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return resource || { name: '', headUuid: '', headKind: '' };
+    })(renderLinkNameAndIcon);
+
+export const ResourceLinkType = connect(
+    (state: RootState, props: { uuid: string }) => {
+        const resource = getResource<LinkResource>(props.uuid)(state.resources);
+        return { type: resource ? resource.headKind : '' };
+    })((props: { type: string }) => renderType(props.type));
+
 // Process Resources
 const resourceRunProcess = (dispatch: Dispatch, uuid: string) => {
     return (
diff --git a/src/views-components/favorite-star/favorite-star.tsx b/src/views-components/favorite-star/favorite-star.tsx
index 755cc67c..586b442d 100644
--- a/src/views-components/favorite-star/favorite-star.tsx
+++ b/src/views-components/favorite-star/favorite-star.tsx
@@ -18,10 +18,17 @@ const styles: StyleRulesCallback<CssRules> = theme => ({
 
 const mapStateToProps = (state: RootState, props: { resourceUuid: string; className?: string; }) => ({
     ...props,
-    visible: state.favorites[props.resourceUuid],
+    isFavoriteVisible: state.favorites[props.resourceUuid],
+    isPublicFavoriteVisible: state.publicFavorites[props.resourceUuid]
 });
 
 export const FavoriteStar = connect(mapStateToProps)(
-    withStyles(styles)((props: { visible: boolean; className?: string; } & WithStyles<CssRules>) =>
-        props.visible ? <FavoriteIcon className={props.className || props.classes.icon} /> : null
-    ));
+    withStyles(styles)((props: { isFavoriteVisible: boolean; isPublicFavoriteVisible: boolean; className?: string; } & WithStyles<CssRules>) => {
+        if (props.isPublicFavoriteVisible) {
+            return <FavoriteIcon className={props.className || props.classes.icon} />;
+        } else if (props.isFavoriteVisible) {
+            return <FavoriteIcon className={props.className || props.classes.icon} />;
+        } else {
+            return null;
+        }
+    }));
diff --git a/src/views-components/public-favorite-icon/public-favorite-icon.tsx b/src/views-components/public-favorite-icon/public-favorite-icon.tsx
deleted file mode 100644
index 30b3aa9d..00000000
--- a/src/views-components/public-favorite-icon/public-favorite-icon.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import * as React from "react";
-import { FavoriteIcon } from "~/components/icon/icon";
-import { connect } from "react-redux";
-import { RootState } from "~/store/store";
-import { withStyles, StyleRulesCallback, WithStyles } from "@material-ui/core";
-
-type CssRules = "icon";
-
-const styles: StyleRulesCallback<CssRules> = theme => ({
-    icon: {
-        fontSize: "inherit"
-    }
-});
-
-const mapStateToProps = (state: RootState, props: { resourceUuid: string; className?: string; }) => ({
-    ...props,
-    visible: state.publicFavorites[props.resourceUuid],
-});
-
-export const PublicFavorite = connect(mapStateToProps)(
-    withStyles(styles)((props: { visible: boolean; className?: string; } & WithStyles<CssRules>) =>
-        props.visible ? <FavoriteIcon className={props.className || props.classes.icon} /> : null
-    ));
diff --git a/src/views/public-favorites-panel/public-favorites-panel.tsx b/src/views/public-favorites-panel/public-favorites-panel.tsx
index f559a616..3970418f 100644
--- a/src/views/public-favorites-panel/public-favorites-panel.tsx
+++ b/src/views/public-favorites-panel/public-favorites-panel.tsx
@@ -16,9 +16,8 @@ import {
     ProcessStatus,
     ResourceFileSize,
     ResourceLastModifiedDate,
-    ResourceName,
-    ResourceOwner,
-    ResourceType
+    ResourceLinkNameAndIcon,
+    ResourceLinkType
 } from '~/views-components/data-explorer/renderers';
 import { FavoriteIcon } from '~/components/icon/icon';
 import { Dispatch } from 'redux';
@@ -26,12 +25,12 @@ import { openContextMenu, resourceKindToContextMenuKind } from '~/store/context-
 import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
 import { navigateTo } from '~/store/navigation/navigation-action';
 import { ContainerRequestState } from "~/models/container-request";
-import { FavoritesState } from '~/store/favorites/favorites-reducer';
 import { RootState } from '~/store/store';
 import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
 import { createTree } from '~/models/tree';
 import { getSimpleObjectTypeFilters } from '~/store/resource-type-filters/resource-type-filters';
 import { PUBLIC_FAVORITE_PANEL_ID } from '~/store/public-favorites-panel/public-favorites-action';
+import { PublicFavoritesState } from '~/store/public-favorites/public-favorites-reducer';
 
 type CssRules = "toolbar" | "button";
 
@@ -58,14 +57,14 @@ export interface FavoritePanelFilter extends DataTableFilterItem {
     type: ResourceKind | ContainerRequestState;
 }
 
-export const favoritePanelColumns: DataColumns<string> = [
+export const publicFavoritePanelColumns: DataColumns<string> = [
     {
         name: FavoritePanelColumnNames.NAME,
         selected: true,
         configurable: true,
         sortDirection: SortDirection.NONE,
         filters: createTree(),
-        render: uuid => <ResourceName uuid={uuid} />
+        render: uuid => <ResourceLinkNameAndIcon uuid={uuid} />
     },
     {
         name: "Status",
@@ -79,14 +78,7 @@ export const favoritePanelColumns: DataColumns<string> = [
         selected: true,
         configurable: true,
         filters: getSimpleObjectTypeFilters(),
-        render: uuid => <ResourceType uuid={uuid} />
-    },
-    {
-        name: FavoritePanelColumnNames.OWNER,
-        selected: true,
-        configurable: true,
-        filters: createTree(),
-        render: uuid => <ResourceOwner uuid={uuid} />
+        render: uuid => <ResourceLinkType uuid={uuid} />
     },
     {
         name: FavoritePanelColumnNames.FILE_SIZE,
@@ -105,21 +97,21 @@ export const favoritePanelColumns: DataColumns<string> = [
     }
 ];
 
-interface FavoritePanelDataProps {
-    favorites: FavoritesState;
+interface PublicFavoritePanelDataProps {
+    publicFavorites: PublicFavoritesState;
 }
 
-interface FavoritePanelActionProps {
+interface PublicFavoritePanelActionProps {
     onItemClick: (item: string) => void;
     onContextMenu: (event: React.MouseEvent<HTMLElement>, item: string) => void;
     onDialogOpen: (ownerUuid: string) => void;
     onItemDoubleClick: (item: string) => void;
 }
-const mapStateToProps = ({ favorites }: RootState): FavoritePanelDataProps => ({
-    favorites
+const mapStateToProps = ({ publicFavorites }: RootState): PublicFavoritePanelDataProps => ({
+    publicFavorites
 });
 
-const mapDispatchToProps = (dispatch: Dispatch): FavoritePanelActionProps => ({
+const mapDispatchToProps = (dispatch: Dispatch): PublicFavoritePanelActionProps => ({
     onContextMenu: (event, resourceUuid) => {
         const kind = resourceKindToContextMenuKind(resourceUuid);
         if (kind) {
@@ -142,7 +134,7 @@ const mapDispatchToProps = (dispatch: Dispatch): FavoritePanelActionProps => ({
     }
 });
 
-type FavoritePanelProps = FavoritePanelDataProps & FavoritePanelActionProps & DispatchProp
+type FavoritePanelProps = PublicFavoritePanelDataProps & PublicFavoritePanelActionProps & DispatchProp
     & WithStyles<CssRules> & RouteComponentProps<{ id: string }>;
 
 export const PublicFavoritePanel = withStyles(styles)(
@@ -158,8 +150,7 @@ export const PublicFavoritePanel = withStyles(styles)(
                     dataTableDefaultView={
                         <DataTableDefaultView
                             icon={FavoriteIcon}
-                            messages={['Public favorites list is empty.']}
-                            />
+                            messages={['Public favorites list is empty.']} />
                     } />;
             }
         }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list