[arvados] updated: 2.7.0-5844-gb0975ec959

git repository hosting git at public.arvados.org
Fri Jan 26 15:55:45 UTC 2024


Summary of changes:
 .../project-panel-middleware-service.ts            |  2 +-
 .../views-components/data-explorer/renderers.tsx   |  2 +-
 .../project-details-card/project-details-card.tsx  | 55 +++++++++++++---------
 3 files changed, 36 insertions(+), 23 deletions(-)

       via  b0975ec959b82f403a59923af4303227e183d40c (commit)
      from  5b04f19b3c8d308abe01644d83726b63a483364a (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 b0975ec959b82f403a59923af4303227e183d40c
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Fri Jan 26 10:55:36 2024 -0500

    21224: favorites icons works Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/store/project-panel/project-panel-middleware-service.ts b/services/workbench2/src/store/project-panel/project-panel-middleware-service.ts
index 366e15ae04..5c356b5b96 100644
--- a/services/workbench2/src/store/project-panel/project-panel-middleware-service.ts
+++ b/services/workbench2/src/store/project-panel/project-panel-middleware-service.ts
@@ -56,7 +56,7 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService
             try {
                 if (!background) { api.dispatch(progressIndicatorActions.START_WORKING(this.getId())); }
                 const response = await this.services.groupsService.contents(projectUuid, getParams(dataExplorer, !!isProjectTrashed));
-                const resourceUuids = response.items.map(item => item.uuid);
+                const resourceUuids = [...response.items.map(item => item.uuid), projectUuid];
                 api.dispatch<any>(updateFavorites(resourceUuids));
                 api.dispatch<any>(updatePublicFavorites(resourceUuids));
                 api.dispatch(updateResources(response.items));
diff --git a/services/workbench2/src/views-components/data-explorer/renderers.tsx b/services/workbench2/src/views-components/data-explorer/renderers.tsx
index 81e2b55aa9..45565c4a22 100644
--- a/services/workbench2/src/views-components/data-explorer/renderers.tsx
+++ b/services/workbench2/src/views-components/data-explorer/renderers.tsx
@@ -99,7 +99,7 @@ const renderName = (dispatch: Dispatch, item: GroupContentsResource) => {
     );
 };
 
-const FrozenProject = (props: { item: ProjectResource }) => {
+export const FrozenProject = (props: { item: ProjectResource }) => {
     const [fullUsername, setFullusername] = React.useState<any>(null);
     const getFullName = React.useCallback(() => {
         if (props.item.frozenByUuid) {
diff --git a/services/workbench2/src/views-components/project-details-card/project-details-card.tsx b/services/workbench2/src/views-components/project-details-card/project-details-card.tsx
index b75cb9e887..138e18250c 100644
--- a/services/workbench2/src/views-components/project-details-card/project-details-card.tsx
+++ b/services/workbench2/src/views-components/project-details-card/project-details-card.tsx
@@ -20,9 +20,10 @@ import { formatDate } from 'common/formatters';
 import { resourceLabel } from 'common/labels';
 import { ResourceKind } from 'models/resource';
 import { UserResource } from 'models/user';
-import { UserResourceAccountStatus } from 'views-components/data-explorer/renderers';
-
-
+import { UserResourceAccountStatus, FrozenProject } from 'views-components/data-explorer/renderers';
+import { FavoriteStar, PublicFavoriteStar } from 'views-components/favorite-star/favorite-star';
+import { FavoritesState } from 'store/favorites/favorites-reducer';
+import { PublicFavoritesState } from 'store/public-favorites/public-favorites-reducer';
 
 type CssRules = 'root' | 'cardheader' | 'fadeout' | 'nameContainer' | 'activeIndicator' | 'cardcontent' | 'attributesection' | 'attribute' | 'chipsection' | 'tag';
 
@@ -82,19 +83,33 @@ const mapStateToProps = (state: RootState) => {
     };
 };
 
-type DetailsCardProps = {
+type DetailsCardProps = WithStyles<CssRules> & {
     currentResource: ProjectResource | UserResource;
 };
 
+type UserCardProps = WithStyles<CssRules> & {
+    currentResource: UserResource;
+};
+
+type ProjectCardProps = WithStyles<CssRules> & {
+    currentResource: ProjectResource;
+};
+
 export const ProjectDetailsCard = connect(mapStateToProps)(
-    withStyles(styles)((props: DetailsCardProps & WithStyles<CssRules>) => {
-        const { currentResource } = props;
-        return (currentResource.kind as string) === ResourceKind.USER ? <UserCard props={props} /> : <ProjectCard props={props} />;
+    withStyles(styles)((props: DetailsCardProps) => {
+        const { classes, currentResource } = props;
+        switch (currentResource.kind as string) {
+            case ResourceKind.USER:
+                return <UserCard classes={classes} currentResource={currentResource as UserResource} />;
+            case ResourceKind.PROJECT:
+                return <ProjectCard classes={classes} currentResource={currentResource as ProjectResource} />;
+            default:
+                return null;
+        }
     })
 );
 
-const UserCard = ({ props }) => {
-    const { classes, currentResource } = props;
+const UserCard: React.FC<UserCardProps> = ({ classes, currentResource }) => {
     const { fullName, uuid, username, email, isAdmin } = currentResource as UserResource & { fullName: string };
 
     return (
@@ -106,19 +121,15 @@ const UserCard = ({ props }) => {
                         <Typography
                             noWrap
                             variant='h6'
-                            >
+                        >
                             {fullName}
                         </Typography>
-                        <Typography
-                            className={classes.activeIndicator}
-                        >
+                        <Typography className={classes.activeIndicator}>
                             <UserResourceAccountStatus uuid={uuid} />
                         </Typography>
                     </section>
                 }
-                action={
-                <MultiselectToolbar inputSelectedUuid={uuid} />
-                }
+                action={<MultiselectToolbar inputSelectedUuid={uuid} />}
             />
             <CardContent className={classes.cardcontent}>
                 <section className={classes.attributesection}>
@@ -165,8 +176,7 @@ const UserCard = ({ props }) => {
     );
 };
 
-const ProjectCard = ({ props }) => {
-    const { classes, currentResource } = props;
+const ProjectCard: React.FC<ProjectCardProps> = ({ classes, currentResource }) => {
     const { name, uuid, description } = currentResource as ProjectResource;
     return (
         <Card className={classes.root}>
@@ -178,6 +188,9 @@ const ProjectCard = ({ props }) => {
                         variant='h6'
                     >
                         {name}
+                        <FavoriteStar resourceUuid={currentResource.uuid} />
+                        <PublicFavoriteStar resourceUuid={currentResource.uuid} />
+                        {currentResource.kind === ResourceKind.PROJECT && <FrozenProject item={currentResource} />}
                     </Typography>
                 }
                 subheader={
@@ -195,7 +208,6 @@ const ProjectCard = ({ props }) => {
                     )
                 }
                 action={<MultiselectToolbar inputSelectedUuid={uuid} />}
-                
             />
             <CardContent className={classes.cardcontent}>
                 <section className={classes.attributesection}>
@@ -205,7 +217,7 @@ const ProjectCard = ({ props }) => {
                     >
                         <DetailsAttribute
                             label='Type'
-                            value={currentResource.groupClass === GroupClass.FILTER ? 'Filter group' : resourceLabel(ResourceKind.PROJECT)}
+                            value={'groupClass' in currentResource && currentResource.groupClass === GroupClass.FILTER ? 'Filter group' : resourceLabel(ResourceKind.PROJECT)}
                         />
                     </Typography>
                     <Typography
@@ -249,7 +261,8 @@ const ProjectCard = ({ props }) => {
                 </section>
                 <section className={classes.chipsection}>
                     <Typography component='div'>
-                        {typeof currentResource.properties === 'object' &&
+                        {'properties' in currentResource &&
+                            typeof currentResource.properties === 'object' &&
                             Object.keys(currentResource.properties).map((k) =>
                                 Array.isArray(currentResource.properties[k])
                                     ? currentResource.properties[k].map((v: string) => getPropertyChip(k, v, undefined, classes.tag))

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list