17426: Plugins can replace some of main UI
[arvados.git] / src / store / trash-panel / trash-panel-middleware-service.ts
index b3f0805fd0fb7eeaa44d1927c8a7faad74e39013..bf7fae56ece038391cc7bde875ce7a8baf590a26 100644 (file)
@@ -7,6 +7,7 @@ import {
     listResultsToDataExplorerItemsMeta
 } from "../data-explorer/data-explorer-middleware-service";
 import { RootState } from "../store";
+import { getUserUuid } from "~/common/getuser";
 import { DataColumns } from "~/components/data-table/data-table";
 import { ServiceRepository } from "~/services/services";
 import { SortDirection } from "~/components/data-table/data-column";
@@ -18,6 +19,7 @@ import { GroupContentsResourcePrefix } from "~/services/groups-service/groups-se
 import { ProjectResource } from "~/models/project";
 import { ProjectPanelColumnNames } from "~/views/project-panel/project-panel";
 import { updateFavorites } from "~/store/favorites/favorites-actions";
+import { updatePublicFavorites } from '~/store/public-favorites/public-favorites-actions';
 import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions";
 import { updateResources } from "~/store/resources/resources-actions";
 import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions";
@@ -63,9 +65,10 @@ export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
                 .addOrder(sortDirection, columnName, GroupContentsResourcePrefix.PROJECT);
         }
 
+        const userUuid = getUserUuid(api.getState());
+        if (!userUuid) { return; }
         try {
             api.dispatch(progressIndicatorActions.START_WORKING(this.getId()));
-            const userUuid = this.services.authService.getUuid()!;
             const listResults = await this.services.groupsService
                 .contents(userUuid, {
                     ...dataExplorerToListParams(dataExplorer),
@@ -83,6 +86,7 @@ export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
                 items
             }));
             api.dispatch<any>(updateFavorites(items));
+            api.dispatch<any>(updatePublicFavorites(items));
             api.dispatch(updateResources(listResults.items));
         } catch (e) {
             api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId()));
@@ -102,4 +106,3 @@ const couldNotFetchTrashContents = () =>
         message: 'Could not fetch trash contents.',
         kind: SnackbarKind.ERROR
     });
-