conflicts
[arvados-workbench2.git] / src / store / workbench / workbench-actions.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { Dispatch } from 'redux';
6 import { RootState } from "~/store/store";
7 import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
8 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
9 import { loadFavoritePanel } from '~/store/favorite-panel/favorite-panel-action';
10 import { openProjectPanel, projectPanelActions, setIsProjectPanelTrashed } from '~/store/project-panel/project-panel-action';
11 import { activateSidePanelTreeItem, initSidePanelTree, SidePanelTreeCategory, loadSidePanelTreeProjects } from '~/store/side-panel-tree/side-panel-tree-actions';
12 import { loadResource, updateResources } from '~/store/resources/resources-actions';
13 import { favoritePanelActions } from '~/store/favorite-panel/favorite-panel-action';
14 import { projectPanelColumns } from '~/views/project-panel/project-panel';
15 import { favoritePanelColumns } from '~/views/favorite-panel/favorite-panel';
16 import { matchRootRoute } from '~/routes/routes';
17 import { setSidePanelBreadcrumbs, setProcessBreadcrumbs, setSharedWithMeBreadcrumbs, setTrashBreadcrumbs, setBreadcrumbs } from '~/store/breadcrumbs/breadcrumbs-actions';
18 import { navigateToProject } from '~/store/navigation/navigation-action';
19 import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog';
20 import { ServiceRepository } from '~/services/services';
21 import { getResource } from '~/store/resources/resources';
22 import { getProjectPanelCurrentUuid } from '~/store/project-panel/project-panel-action';
23 import * as projectCreateActions from '~/store/projects/project-create-actions';
24 import * as projectMoveActions from '~/store/projects/project-move-actions';
25 import * as projectUpdateActions from '~/store/projects/project-update-actions';
26 import * as collectionCreateActions from '~/store/collections/collection-create-actions';
27 import * as collectionCopyActions from '~/store/collections/collection-copy-actions';
28 import * as collectionUpdateActions from '~/store/collections/collection-update-actions';
29 import * as collectionMoveActions from '~/store/collections/collection-move-actions';
30 import * as processesActions from '~/store/processes/processes-actions';
31 import * as processMoveActions from '~/store/processes/process-move-actions';
32 import * as processUpdateActions from '~/store/processes/process-update-actions';
33 import * as processCopyActions from '~/store/processes/process-copy-actions';
34 import { trashPanelColumns } from "~/views/trash-panel/trash-panel";
35 import { loadTrashPanel, trashPanelActions } from "~/store/trash-panel/trash-panel-action";
36 import { initProcessLogsPanel } from '~/store/process-logs-panel/process-logs-panel-actions';
37 import { loadProcessPanel } from '~/store/process-panel/process-panel-actions';
38 import { sharedWithMePanelActions } from '~/store/shared-with-me-panel/shared-with-me-panel-actions';
39 import { loadSharedWithMePanel } from '~/store/shared-with-me-panel/shared-with-me-panel-actions';
40 import { CopyFormDialogData } from '~/store/copy-dialog/copy-dialog';
41 import { loadWorkflowPanel, workflowPanelActions } from '~/store/workflow-panel/workflow-panel-actions';
42 import { loadSshKeysPanel } from '~/store/auth/auth-action';
43 import { loadMyAccountPanel } from '~/store/my-account/my-account-panel-actions';
44 import { workflowPanelColumns } from '~/views/workflow-panel/workflow-panel-view';
45 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
46 import { getProgressIndicator } from '~/store/progress-indicator/progress-indicator-reducer';
47 import { ResourceKind, extractUuidKind } from '~/models/resource';
48 import { FilterBuilder } from '~/services/api/filter-builder';
49 import { GroupContentsResource } from '~/services/groups-service/groups-service';
50 import { unionize, ofType, UnionOf, MatchCases } from '~/common/unionize';
51 import { loadRunProcessPanel } from '~/store/run-process-panel/run-process-panel-actions';
52 import { loadCollectionFiles } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
53 import { SnackbarKind } from '~/store/snackbar/snackbar-actions';
54 import { collectionPanelActions } from "~/store/collection-panel/collection-panel-action";
55 import { CollectionResource } from "~/models/collection";
56 import { searchResultsPanelActions, loadSearchResultsPanel } from '~/store/search-results-panel/search-results-panel-actions';
57 import { searchResultsPanelColumns } from '~/views/search-results-panel/search-results-panel-view';
58 import { loadVirtualMachinesPanel } from '~/store/virtual-machines/virtual-machines-actions';
59 import { loadRepositoriesPanel } from '~/store/repositories/repositories-actions';
60 import { loadKeepServicesPanel } from '~/store/keep-services/keep-services-actions';
61 import { loadUsersPanel, userBindedActions } from '~/store/users/users-actions';
62 import { userPanelColumns } from '~/views/user-panel/user-panel';
63 import { loadComputeNodesPanel } from '~/store/compute-nodes/compute-nodes-actions';
64
65 export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
66
67 export const isWorkbenchLoading = (state: RootState) => {
68     const progress = getProgressIndicator(WORKBENCH_LOADING_SCREEN)(state.progressIndicator);
69     return progress ? progress.working : false;
70 };
71
72 const handleFirstTimeLoad = (action: any) =>
73     async (dispatch: Dispatch<any>, getState: () => RootState) => {
74         try {
75             await dispatch(action);
76         } finally {
77             if (isWorkbenchLoading(getState())) {
78                 dispatch(progressIndicatorActions.STOP_WORKING(WORKBENCH_LOADING_SCREEN));
79             }
80         }
81     };
82
83 export const loadWorkbench = () =>
84     async (dispatch: Dispatch, getState: () => RootState) => {
85         dispatch(progressIndicatorActions.START_WORKING(WORKBENCH_LOADING_SCREEN));
86         const { auth, router } = getState();
87         const { user } = auth;
88         if (user) {
89             const userResource = await dispatch<any>(loadResource(user.uuid));
90             if (userResource) {
91                 dispatch(projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
92                 dispatch(favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns }));
93                 dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns }));
94                 dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
95                 dispatch(workflowPanelActions.SET_COLUMNS({ columns: workflowPanelColumns }));
96                 dispatch(searchResultsPanelActions.SET_COLUMNS({ columns: searchResultsPanelColumns }));
97                 dispatch(userBindedActions.SET_COLUMNS({ columns: userPanelColumns }));
98                 dispatch<any>(initSidePanelTree());
99                 if (router.location) {
100                     const match = matchRootRoute(router.location.pathname);
101                     if (match) {
102                         dispatch(navigateToProject(userResource.uuid));
103                     }
104                 }
105             } else {
106                 dispatch(userIsNotAuthenticated);
107             }
108         } else {
109             dispatch(userIsNotAuthenticated);
110         }
111     };
112
113 export const loadFavorites = () =>
114     handleFirstTimeLoad(
115         (dispatch: Dispatch) => {
116             dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.FAVORITES));
117             dispatch<any>(loadFavoritePanel());
118             dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.FAVORITES));
119         });
120
121 export const loadTrash = () =>
122     handleFirstTimeLoad(
123         (dispatch: Dispatch) => {
124             dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
125             dispatch<any>(loadTrashPanel());
126             dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.TRASH));
127         });
128
129 export const loadProject = (uuid: string) =>
130     handleFirstTimeLoad(
131         async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
132             const userUuid = services.authService.getUuid();
133             dispatch(setIsProjectPanelTrashed(false));
134             if (userUuid) {
135                 if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) {
136                     // Load another users home projects
137                     dispatch(finishLoadingProject(uuid));
138                 } else if (userUuid !== uuid) {
139                     const match = await loadGroupContentsResource({ uuid, userUuid, services });
140                     match({
141                         OWNED: async project => {
142                             await dispatch(activateSidePanelTreeItem(uuid));
143                             dispatch<any>(setSidePanelBreadcrumbs(uuid));
144                             dispatch(finishLoadingProject(project));
145                         },
146                         SHARED: project => {
147                             dispatch<any>(setSharedWithMeBreadcrumbs(uuid));
148                             dispatch(activateSidePanelTreeItem(uuid));
149                             dispatch(finishLoadingProject(project));
150                         },
151                         TRASHED: project => {
152                             dispatch<any>(setTrashBreadcrumbs(uuid));
153                             dispatch(setIsProjectPanelTrashed(true));
154                             dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
155                             dispatch(finishLoadingProject(project));
156                         }
157                     });
158                 } else {
159                     await dispatch(activateSidePanelTreeItem(userUuid));
160                     dispatch<any>(setSidePanelBreadcrumbs(userUuid));
161                     dispatch(finishLoadingProject(userUuid));
162                 }
163             }
164         });
165
166 export const createProject = (data: projectCreateActions.ProjectCreateFormDialogData) =>
167     async (dispatch: Dispatch) => {
168         const newProject = await dispatch<any>(projectCreateActions.createProject(data));
169         if (newProject) {
170             dispatch(snackbarActions.OPEN_SNACKBAR({
171                 message: "Project has been successfully created.",
172                 hideDuration: 2000
173             }));
174             await dispatch<any>(loadSidePanelTreeProjects(newProject.ownerUuid));
175             dispatch<any>(reloadProjectMatchingUuid([newProject.ownerUuid]));
176         }
177     };
178
179 export const moveProject = (data: MoveToFormDialogData) =>
180     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
181         try {
182             const oldProject = getResource(data.uuid)(getState().resources);
183             const oldOwnerUuid = oldProject ? oldProject.ownerUuid : '';
184             const movedProject = await dispatch<any>(projectMoveActions.moveProject(data));
185             if (movedProject) {
186                 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Project has been moved', hideDuration: 2000 }));
187                 if (oldProject) {
188                     await dispatch<any>(loadSidePanelTreeProjects(oldProject.ownerUuid));
189                 }
190                 dispatch<any>(reloadProjectMatchingUuid([oldOwnerUuid, movedProject.ownerUuid, movedProject.uuid]));
191             }
192         } catch (e) {
193             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
194         }
195     };
196
197 export const updateProject = (data: projectUpdateActions.ProjectUpdateFormDialogData) =>
198     async (dispatch: Dispatch) => {
199         const updatedProject = await dispatch<any>(projectUpdateActions.updateProject(data));
200         if (updatedProject) {
201             dispatch(snackbarActions.OPEN_SNACKBAR({
202                 message: "Project has been successfully updated.",
203                 hideDuration: 2000
204             }));
205             await dispatch<any>(loadSidePanelTreeProjects(updatedProject.ownerUuid));
206             dispatch<any>(reloadProjectMatchingUuid([updatedProject.ownerUuid, updatedProject.uuid]));
207         }
208     };
209
210 export const loadCollection = (uuid: string) =>
211     handleFirstTimeLoad(
212         async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
213             const userUuid = services.authService.getUuid();
214             if (userUuid) {
215                 const match = await loadGroupContentsResource({ uuid, userUuid, services });
216                 match({
217                     OWNED: async collection => {
218                         dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
219                         dispatch(updateResources([collection]));
220                         await dispatch(activateSidePanelTreeItem(collection.ownerUuid));
221                         dispatch(setSidePanelBreadcrumbs(collection.ownerUuid));
222                         dispatch(loadCollectionFiles(collection.uuid));
223                     },
224                     SHARED: collection => {
225                         dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
226                         dispatch(updateResources([collection]));
227                         dispatch<any>(setSharedWithMeBreadcrumbs(collection.ownerUuid));
228                         dispatch(activateSidePanelTreeItem(collection.ownerUuid));
229                         dispatch(loadCollectionFiles(collection.uuid));
230                     },
231                     TRASHED: collection => {
232                         dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
233                         dispatch(updateResources([collection]));
234                         dispatch(setTrashBreadcrumbs(''));
235                         dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
236                         dispatch(loadCollectionFiles(collection.uuid));
237                     },
238
239                 });
240             }
241         });
242
243 export const createCollection = (data: collectionCreateActions.CollectionCreateFormDialogData) =>
244     async (dispatch: Dispatch) => {
245         const collection = await dispatch<any>(collectionCreateActions.createCollection(data));
246         if (collection) {
247             dispatch(snackbarActions.OPEN_SNACKBAR({
248                 message: "Collection has been successfully created.",
249                 hideDuration: 2000
250             }));
251             dispatch<any>(updateResources([collection]));
252             dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
253         }
254     };
255
256 export const updateCollection = (data: collectionUpdateActions.CollectionUpdateFormDialogData) =>
257     async (dispatch: Dispatch) => {
258         const collection = await dispatch<any>(collectionUpdateActions.updateCollection(data));
259         if (collection) {
260             dispatch(snackbarActions.OPEN_SNACKBAR({
261                 message: "Collection has been successfully updated.",
262                 hideDuration: 2000
263             }));
264             dispatch<any>(updateResources([collection]));
265             dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
266         }
267     };
268
269 export const copyCollection = (data: CopyFormDialogData) =>
270     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
271         try {
272             const copyToProject = getResource(data.ownerUuid)(getState().resources);
273             const collection = await dispatch<any>(collectionCopyActions.copyCollection(data));
274             if (copyToProject && collection) {
275                 dispatch<any>(reloadProjectMatchingUuid([copyToProject.uuid]));
276                 dispatch(snackbarActions.OPEN_SNACKBAR({
277                     message: 'Collection has been copied.',
278                     hideDuration: 3000,
279                     kind: SnackbarKind.SUCCESS,
280                     link: collection.ownerUuid
281                 }));
282             }
283         } catch (e) {
284             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000, kind: SnackbarKind.ERROR }));
285         }
286     };
287
288 export const moveCollection = (data: MoveToFormDialogData) =>
289     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
290         try {
291             const collection = await dispatch<any>(collectionMoveActions.moveCollection(data));
292             dispatch<any>(updateResources([collection]));
293             dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
294             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Collection has been moved.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
295         } catch (e) {
296             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
297         }
298     };
299
300 export const loadProcess = (uuid: string) =>
301     handleFirstTimeLoad(
302         async (dispatch: Dispatch, getState: () => RootState) => {
303             dispatch<any>(loadProcessPanel(uuid));
304             const process = await dispatch<any>(processesActions.loadProcess(uuid));
305             await dispatch<any>(activateSidePanelTreeItem(process.containerRequest.ownerUuid));
306             dispatch<any>(setProcessBreadcrumbs(uuid));
307             dispatch(loadDetailsPanel(uuid));
308         });
309
310 export const updateProcess = (data: processUpdateActions.ProcessUpdateFormDialogData) =>
311     async (dispatch: Dispatch) => {
312         try {
313             const process = await dispatch<any>(processUpdateActions.updateProcess(data));
314             if (process) {
315                 dispatch(snackbarActions.OPEN_SNACKBAR({
316                     message: "Process has been successfully updated.",
317                     hideDuration: 2000
318                 }));
319                 dispatch<any>(updateResources([process]));
320                 dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
321             }
322         } catch (e) {
323             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
324         }
325     };
326
327 export const moveProcess = (data: MoveToFormDialogData) =>
328     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
329         try {
330             const process = await dispatch<any>(processMoveActions.moveProcess(data));
331             dispatch<any>(updateResources([process]));
332             dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
333             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process has been moved.', hideDuration: 2000 }));
334         } catch (e) {
335             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
336         }
337     };
338
339 export const copyProcess = (data: CopyFormDialogData) =>
340     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
341         try {
342             const process = await dispatch<any>(processCopyActions.copyProcess(data));
343             dispatch<any>(updateResources([process]));
344             dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
345             dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process has been copied.', hideDuration: 2000 }));
346         } catch (e) {
347             dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
348         }
349     };
350
351 export const loadProcessLog = (uuid: string) =>
352     handleFirstTimeLoad(
353         async (dispatch: Dispatch) => {
354             const process = await dispatch<any>(processesActions.loadProcess(uuid));
355             dispatch<any>(setProcessBreadcrumbs(uuid));
356             dispatch<any>(initProcessLogsPanel(uuid));
357             await dispatch<any>(activateSidePanelTreeItem(process.containerRequest.ownerUuid));
358         });
359
360 export const resourceIsNotLoaded = (uuid: string) =>
361     snackbarActions.OPEN_SNACKBAR({
362         message: `Resource identified by ${uuid} is not loaded.`
363     });
364
365 export const userIsNotAuthenticated = snackbarActions.OPEN_SNACKBAR({
366     message: 'User is not authenticated'
367 });
368
369 export const couldNotLoadUser = snackbarActions.OPEN_SNACKBAR({
370     message: 'Could not load user'
371 });
372
373 export const reloadProjectMatchingUuid = (matchingUuids: string[]) =>
374     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
375         const currentProjectPanelUuid = getProjectPanelCurrentUuid(getState());
376         if (currentProjectPanelUuid && matchingUuids.some(uuid => uuid === currentProjectPanelUuid)) {
377             dispatch<any>(loadProject(currentProjectPanelUuid));
378         }
379     };
380
381 export const loadSharedWithMe = handleFirstTimeLoad(async (dispatch: Dispatch) => {
382     dispatch<any>(loadSharedWithMePanel());
383     await dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.SHARED_WITH_ME));
384     await dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.SHARED_WITH_ME));
385 });
386
387 export const loadRunProcess = handleFirstTimeLoad(
388     async (dispatch: Dispatch) => {
389         await dispatch<any>(loadRunProcessPanel());
390     }
391 );
392
393 export const loadWorkflow = handleFirstTimeLoad(async (dispatch: Dispatch<any>) => {
394     dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.WORKFLOWS));
395     await dispatch(loadWorkflowPanel());
396     dispatch(setSidePanelBreadcrumbs(SidePanelTreeCategory.WORKFLOWS));
397 });
398
399 export const loadSearchResults = handleFirstTimeLoad(
400     async (dispatch: Dispatch<any>) => {
401         await dispatch(loadSearchResultsPanel());
402     });
403
404 export const loadVirtualMachines = handleFirstTimeLoad(
405     async (dispatch: Dispatch<any>) => {
406         await dispatch(loadVirtualMachinesPanel());
407         dispatch(setBreadcrumbs([{ label: 'Virtual Machines' }]));
408     });
409
410 export const loadRepositories = handleFirstTimeLoad(
411     async (dispatch: Dispatch<any>) => {
412         await dispatch(loadRepositoriesPanel());
413         dispatch(setBreadcrumbs([{ label: 'Repositories' }]));
414     });
415
416 export const loadSshKeys = handleFirstTimeLoad(
417     async (dispatch: Dispatch<any>) => {
418         await dispatch(loadSshKeysPanel());
419     });
420
421 export const loadMyAccount = handleFirstTimeLoad(
422     (dispatch: Dispatch<any>) => {
423         dispatch(loadMyAccountPanel());
424     });
425
426 export const loadKeepServices = handleFirstTimeLoad(
427     async (dispatch: Dispatch<any>) => {
428         await dispatch(loadKeepServicesPanel());
429     });
430
431 export const loadUsers = handleFirstTimeLoad(
432     async (dispatch: Dispatch<any>) => {
433         await dispatch(loadUsersPanel());
434         dispatch(setBreadcrumbs([{ label: 'Users' }]));
435     });
436
437 export const loadComputeNodes = handleFirstTimeLoad(
438     async (dispatch: Dispatch<any>) => {
439         await dispatch(loadComputeNodesPanel());
440     });
441
442 const finishLoadingProject = (project: GroupContentsResource | string) =>
443     async (dispatch: Dispatch<any>) => {
444         const uuid = typeof project === 'string' ? project : project.uuid;
445         dispatch(openProjectPanel(uuid));
446         dispatch(loadDetailsPanel(uuid));
447         if (typeof project !== 'string') {
448             dispatch(updateResources([project]));
449         }
450     };
451
452 const loadGroupContentsResource = async (params: {
453     uuid: string,
454     userUuid: string,
455     services: ServiceRepository
456 }) => {
457     const filters = new FilterBuilder()
458         .addEqual('uuid', params.uuid)
459         .getFilters();
460     const { items } = await params.services.groupsService.contents(params.userUuid, {
461         filters,
462         recursive: true,
463         includeTrash: true,
464     });
465     const resource = items.shift();
466     let handler: GroupContentsHandler;
467     if (resource) {
468         handler = (resource.kind === ResourceKind.COLLECTION || resource.kind === ResourceKind.PROJECT) && resource.isTrashed
469             ? groupContentsHandlers.TRASHED(resource)
470             : groupContentsHandlers.OWNED(resource);
471     } else {
472         const kind = extractUuidKind(params.uuid);
473         let resource: GroupContentsResource;
474         if (kind === ResourceKind.COLLECTION) {
475             resource = await params.services.collectionService.get(params.uuid);
476         } else if (kind === ResourceKind.PROJECT) {
477             resource = await params.services.projectService.get(params.uuid);
478         } else {
479             resource = await params.services.containerRequestService.get(params.uuid);
480         }
481         handler = groupContentsHandlers.SHARED(resource);
482     }
483     return (cases: MatchCases<typeof groupContentsHandlersRecord, GroupContentsHandler, void>) =>
484         groupContentsHandlers.match(handler, cases);
485
486 };
487
488 const groupContentsHandlersRecord = {
489     TRASHED: ofType<GroupContentsResource>(),
490     SHARED: ofType<GroupContentsResource>(),
491     OWNED: ofType<GroupContentsResource>(),
492 };
493
494 const groupContentsHandlers = unionize(groupContentsHandlersRecord);
495
496 type GroupContentsHandler = UnionOf<typeof groupContentsHandlers>;