X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/abf8502a9a1f061f58586b966a4012674d9cb71e..2d9dcf3d61d410328e081b5b00c7175c7eb1d82b:/src/views-components/project-tree-picker/project-tree-picker.tsx

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 bae5d59f..215c31b7 100644
--- a/src/views-components/project-tree-picker/project-tree-picker.tsx
+++ b/src/views-components/project-tree-picker/project-tree-picker.tsx
@@ -9,9 +9,9 @@ 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 { ProjectIcon, FavoriteIcon, ProjectsIcon, ShareMeIcon, PublicFavoriteIcon } from '~/components/icon/icon';
 import { RootState } from "~/store/store";
 import { ServiceRepository } from "~/services/services";
 import { WrappedFieldProps } from 'redux-form';
@@ -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 PublicFavoriteIcon;
         default:
             return ProjectIcon;
     }
@@ -104,3 +108,15 @@ export const ProjectTreePickerField = (props: WrappedFieldProps & PickerIdProp)
 const handleChange = (props: WrappedFieldProps) =>
     (_: any, { id }: TreeItem<ProjectsTreePickerItem>) =>
         props.input.onChange(id);
+
+export const CollectionTreePickerField = (props: WrappedFieldProps & PickerIdProp) =>
+    <div style={{ height: '200px', display: 'flex', flexDirection: 'column' }}>
+        <ProjectsTreePicker
+            pickerId={props.pickerId}
+            toggleItemActive={handleChange(props)}
+            includeCollections />
+        {props.meta.dirty && props.meta.error &&
+            <Typography variant='caption' color='error'>
+                {props.meta.error}
+            </Typography>}
+    </div>;
\ No newline at end of file
