[arvados-workbench2] updated: 2.7.0-232-gbf7a90e5

git repository hosting git at public.arvados.org
Fri Dec 1 15:28:08 UTC 2023


Summary of changes:
 src/components/multiselect-toolbar/MultiselectToolbar.tsx   |  9 ++++++---
 src/views-components/multiselect-toolbar/ms-menu-actions.ts | 10 ++++++----
 2 files changed, 12 insertions(+), 7 deletions(-)

       via  bf7a90e5d5d606456e0ec51cc2709d2f1da76d7d (commit)
      from  ee7e972010db2e3e40f9582ba38f33cc063df306 (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 bf7a90e5d5d606456e0ec51cc2709d2f1da76d7d
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Fri Dec 1 10:28:03 2023 -0500

    21128: publicFavorites alt text working Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/src/components/multiselect-toolbar/MultiselectToolbar.tsx b/src/components/multiselect-toolbar/MultiselectToolbar.tsx
index 6cf94dd0..6470cb80 100644
--- a/src/components/multiselect-toolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselect-toolbar/MultiselectToolbar.tsx
@@ -31,6 +31,7 @@ import { isProcessCancelable } from "store/processes/process";
 import { CollectionResource } from "models/collection";
 import { getProcess } from "store/processes/process";
 import { Process } from "store/processes/process";
+import { PublicFavoritesState } from "store/public-favorites/public-favorites-reducer";
 
 type CssRules = "root" | "button";
 
@@ -60,7 +61,8 @@ export type MultiselectToolbarProps = {
 
 type IconProps = {
     resources: ResourcesState;
-    favorites: FavoritesState
+    favorites: FavoritesState;
+    publicFavorites: PublicFavoritesState;
 }
 
 export const MultiselectToolbar = connect(
@@ -270,14 +272,15 @@ export const isExactlyOneSelected = (checkedList: TCheckedList) => {
 
 //--------------------------------------------------//
 
-function mapStateToProps({auth, multiselect, resources, favorites}: RootState) {
+function mapStateToProps({auth, multiselect, resources, favorites, publicFavorites}: RootState) {
     return {
         checkedList: multiselect.checkedList as TCheckedList,
         selectedUuid: isExactlyOneSelected(multiselect.checkedList),
         user: auth && auth.user ? auth.user : null,
         iconProps: {
             resources,
-            favorites
+            favorites,
+            publicFavorites
         }
     }
 }
diff --git a/src/views-components/multiselect-toolbar/ms-menu-actions.ts b/src/views-components/multiselect-toolbar/ms-menu-actions.ts
index 4c6f08cd..e5673453 100644
--- a/src/views-components/multiselect-toolbar/ms-menu-actions.ts
+++ b/src/views-components/multiselect-toolbar/ms-menu-actions.ts
@@ -18,6 +18,7 @@ import { openWebDavS3InfoDialog } from 'store/collections/collection-info-action
 import { openSharingDialog } from 'store/sharing-dialog/sharing-dialog-actions';
 import { togglePublicFavorite } from "store/public-favorites/public-favorites-actions";
 import { publicFavoritePanelActions } from "store/public-favorites-panel/public-favorites-action";
+import { PublicFavoritesState } from 'store/public-favorites/public-favorites-reducer';
 
 export const MultiSelectMenuActionNames: Record<string, string> = {
     ADD_TO_FAVORITES: 'Add to Favorites',
@@ -47,7 +48,7 @@ export type MultiSelectMenuAction = {
     altName?: string;
     altIcon?: IconType;
     isForMulti: boolean;
-    useAlts?: (uuid: string, iconProps: {resources: ResourcesState, favorites: FavoritesState}) => boolean;
+    useAlts?: (uuid: string, iconProps: {resources: ResourcesState, favorites: FavoritesState, publicFavorites: PublicFavoritesState}) => boolean;
     execute(dispatch: Dispatch, resources: ContextMenuResource[], state?: any): void;
     adminOnly?: boolean;
 };
@@ -136,13 +137,14 @@ const msShareAction: MultiSelectMenuAction  = {
 const msTogglePublicFavoriteAction: MultiSelectMenuAction = {
     name: ADD_TO_PUBLIC_FAVORITES,
     icon: PublicFavoriteIcon,
-    hasAlts: false,
+    hasAlts: true,
     altName: 'Remove from public favorites',
     altIcon: PublicFavoriteIcon,
     isForMulti: false,
-    useAlts: (uuid: string, iconProps: {resources: ResourcesState, favorites: FavoritesState}) => false,
+    useAlts: (uuid: string, iconProps) => {
+        return iconProps.publicFavorites[uuid] === true
+    },
     execute: (dispatch, resources) => {
-        console.log(resources)
         dispatch<any>(togglePublicFavorite(resources[0])).then(() => {
             dispatch(publicFavoritePanelActions.REQUEST_ITEMS());
         });

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list