19302: sidePanel public faves updates, renamed 2 overloaded symbols Arvados-DCO-1...
authorLisa Knox <lisaknox83@gmail.com>
Tue, 24 Oct 2023 19:56:58 +0000 (15:56 -0400)
committerLisa Knox <lisaknox83@gmail.com>
Tue, 24 Oct 2023 19:56:58 +0000 (15:56 -0400)
src/store/favorites/favorites-actions.ts
src/store/public-favorites/public-favorites-actions.ts
src/store/side-panel-tree/side-panel-tree-actions.ts

index 8697e68666b1c8e52139febaf75bbb7d205392cc..1e23f35cbfd8b4d1beced3aae5ee043c28875a53 100644 (file)
@@ -10,7 +10,7 @@ import { checkFavorite } from "./favorites-reducer";
 import { snackbarActions, SnackbarKind } from "../snackbar/snackbar-actions";
 import { ServiceRepository } from "services/services";
 import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
-import { loadFavorites} from "store/side-panel-tree/side-panel-tree-actions";
+import { loadFavoritesTree} from "store/side-panel-tree/side-panel-tree-actions";
 
 export const favoritesActions = unionize({
     TOGGLE_FAVORITE: ofType<{ resourceUuid: string }>(),
@@ -52,7 +52,7 @@ export const toggleFavorite = (resource: { uuid: string; name: string }) =>
                     kind: SnackbarKind.SUCCESS
                 }));
                 dispatch(progressIndicatorActions.STOP_WORKING("toggleFavorite"));
-                dispatch<any>(loadFavorites())
+                dispatch<any>(loadFavoritesTree())
             })
             .catch((e: any) => {
                 dispatch(progressIndicatorActions.STOP_WORKING("toggleFavorite"));
index 2d4539ada5c3699782b568ed1ce4876a554b2078..363b0b44a97018b6885f68ca1ac0d589ef410f52 100644 (file)
@@ -9,6 +9,7 @@ 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 { loadPublicFavoritesTree } from "store/side-panel-tree/side-panel-tree-actions";
 
 export const publicFavoritesActions = unionize({
     TOGGLE_PUBLIC_FAVORITE: ofType<{ resourceUuid: string }>(),
@@ -48,6 +49,7 @@ export const togglePublicFavorite = (resource: { uuid: string; name: string }) =
                     kind: SnackbarKind.SUCCESS
                 }));
                 dispatch(progressIndicatorActions.STOP_WORKING("togglePublicFavorite"));
+                dispatch<any>(loadPublicFavoritesTree())
             })
             .catch((e: any) => {
                 dispatch(progressIndicatorActions.STOP_WORKING("togglePublicFavorite"));
index 1105285fea98aa4109e45ab9b1b7115c06529950..a76878f27f6b7dc8dadfe424b1d6342a6cf2325f 100644 (file)
@@ -96,9 +96,9 @@ export const loadSidePanelTreeProjects = (projectUuid: string) =>
         const treePicker = getTreePicker(SIDE_PANEL_TREE)(getState().treePicker);
         const node = treePicker ? getNode(projectUuid)(treePicker) : undefined;
         if (projectUuid === SidePanelTreeCategory.PUBLIC_FAVORITES) {
-            await dispatch<any>(loadPublicFavorites);
+            await dispatch<any>(loadPublicFavoritesTree());
         } else if (projectUuid === SidePanelTreeCategory.FAVORITES) {
-            await dispatch<any>(loadFavorites());
+            await dispatch<any>(loadFavoritesTree());
         } else if (node || projectUuid !== '') {
             await dispatch<any>(loadProject(projectUuid));
         }
@@ -124,33 +124,33 @@ const loadProject = (projectUuid: string) =>
         dispatch(resourcesActions.SET_RESOURCES(items));
     };
 
-export const loadFavorites =()=> async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+export const loadFavoritesTree = () => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
     dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id: SidePanelTreeCategory.FAVORITES, pickerId: SIDE_PANEL_TREE }));
 
     const params = {
         filters: new FilterBuilder()
-            .addEqual("link_class", LinkClass.STAR)
+            .addEqual('link_class', LinkClass.STAR)
             .addEqual('tail_uuid', getUserUuid(getState()))
             .addEqual('tail_kind', ResourceKind.USER)
             .getFilters(),
-        order: new OrderBuilder<ProjectResource>()
-            .addDesc('createdAt')
-            .getOrder(),
-        limit: 50
-    }
+        order: new OrderBuilder<ProjectResource>().addDesc('createdAt').getOrder(),
+        limit: 50,
+    };
 
     const { items } = await services.linkService.list(params);
 
-    dispatch(treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
-        id: SidePanelTreeCategory.FAVORITES,
-        pickerId: SIDE_PANEL_TREE,
-        nodes: items.map(item => initTreeNode({ id: item.headUuid, value: item })),
-    }));
+    dispatch(
+        treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
+            id: SidePanelTreeCategory.FAVORITES,
+            pickerId: SIDE_PANEL_TREE,
+            nodes: items.map(item => initTreeNode({ id: item.headUuid, value: item })),
+        })
+    );
 
     dispatch(resourcesActions.SET_RESOURCES(items));
 };
 
-const loadPublicFavorites = async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+export const loadPublicFavoritesTree = () => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
     dispatch(treePickerActions.LOAD_TREE_PICKER_NODE({ id: SidePanelTreeCategory.PUBLIC_FAVORITES, pickerId: SIDE_PANEL_TREE }));
 
     const uuidPrefix = getState().auth.config.uuidPrefix;
@@ -163,19 +163,19 @@ const loadPublicFavorites = async (dispatch: Dispatch, getState: () => RootState
             .addEqual('owner_uuid', publicProjectUuid)
             .addIsA('head_uuid', typeFilters)
             .getFilters(),
-        order: new OrderBuilder<ProjectResource>()
-            .addDesc('createdAt')
-            .getOrder(),
-        limit: TREE_NODE_LIMIT
+        order: new OrderBuilder<ProjectResource>().addDesc('createdAt').getOrder(),
+        limit: TREE_NODE_LIMIT,
     };
 
     const { items } = await services.linkService.list(params);
 
-    dispatch(treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
-        id: SidePanelTreeCategory.PUBLIC_FAVORITES,
-        pickerId: SIDE_PANEL_TREE,
-        nodes: items.map(item => initTreeNode({ id: item.headUuid, value: item })),
-    }));
+    dispatch(
+        treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({
+            id: SidePanelTreeCategory.PUBLIC_FAVORITES,
+            pickerId: SIDE_PANEL_TREE,
+            nodes: items.map(item => initTreeNode({ id: item.headUuid, value: item })),
+        })
+    );
 
     dispatch(resourcesActions.SET_RESOURCES(items));
 };