1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
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, setGroupDetailsBreadcrumbs, setGroupsBreadcrumbs } 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-ssh';
43 import { loadMyAccountPanel } from '~/store/my-account/my-account-panel-actions';
44 import { loadSiteManagerPanel } from '~/store/auth/auth-action-session';
45 import { workflowPanelColumns } from '~/views/workflow-panel/workflow-panel-view';
46 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
47 import { getProgressIndicator } from '~/store/progress-indicator/progress-indicator-reducer';
48 import { ResourceKind, extractUuidKind } from '~/models/resource';
49 import { FilterBuilder } from '~/services/api/filter-builder';
50 import { GroupContentsResource } from '~/services/groups-service/groups-service';
51 import { unionize, ofType, UnionOf, MatchCases } from '~/common/unionize';
52 import { loadRunProcessPanel } from '~/store/run-process-panel/run-process-panel-actions';
53 import { loadCollectionFiles } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
54 import { SnackbarKind } from '~/store/snackbar/snackbar-actions';
55 import { collectionPanelActions } from "~/store/collection-panel/collection-panel-action";
56 import { CollectionResource } from "~/models/collection";
57 import { searchResultsPanelActions, loadSearchResultsPanel } from '~/store/search-results-panel/search-results-panel-actions';
58 import { searchResultsPanelColumns } from '~/views/search-results-panel/search-results-panel-view';
59 import { loadVirtualMachinesPanel } from '~/store/virtual-machines/virtual-machines-actions';
60 import { loadRepositoriesPanel } from '~/store/repositories/repositories-actions';
61 import { loadKeepServicesPanel } from '~/store/keep-services/keep-services-actions';
62 import { loadUsersPanel, userBindedActions } from '~/store/users/users-actions';
63 import { loadLinkPanel, linkPanelActions } from '~/store/link-panel/link-panel-actions';
64 import { loadComputeNodesPanel, computeNodesActions } from '~/store/compute-nodes/compute-nodes-actions';
65 import { linkPanelColumns } from '~/views/link-panel/link-panel-root';
66 import { userPanelColumns } from '~/views/user-panel/user-panel';
67 import { computeNodePanelColumns } from '~/views/compute-node-panel/compute-node-panel-root';
68 import { loadApiClientAuthorizationsPanel, apiClientAuthorizationsActions } from '~/store/api-client-authorizations/api-client-authorizations-actions';
69 import { apiClientAuthorizationPanelColumns } from '~/views/api-client-authorization-panel/api-client-authorization-panel-root';
70 import * as groupPanelActions from '~/store/groups-panel/groups-panel-actions';
71 import { groupsPanelColumns } from '~/views/groups-panel/groups-panel';
72 import * as groupDetailsPanelActions from '~/store/group-details-panel/group-details-panel-actions';
73 import { groupDetailsPanelColumns } from '~/views/group-details-panel/group-details-panel';
75 export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
77 export const isWorkbenchLoading = (state: RootState) => {
78 const progress = getProgressIndicator(WORKBENCH_LOADING_SCREEN)(state.progressIndicator);
79 return progress ? progress.working : false;
82 const handleFirstTimeLoad = (action: any) =>
83 async (dispatch: Dispatch<any>, getState: () => RootState) => {
85 await dispatch(action);
87 if (isWorkbenchLoading(getState())) {
88 dispatch(progressIndicatorActions.STOP_WORKING(WORKBENCH_LOADING_SCREEN));
93 export const loadWorkbench = () =>
94 async (dispatch: Dispatch, getState: () => RootState) => {
95 dispatch(progressIndicatorActions.START_WORKING(WORKBENCH_LOADING_SCREEN));
96 const { auth, router } = getState();
97 const { user } = auth;
99 const userResource = await dispatch<any>(loadResource(user.uuid));
101 dispatch(projectPanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
102 dispatch(favoritePanelActions.SET_COLUMNS({ columns: favoritePanelColumns }));
103 dispatch(trashPanelActions.SET_COLUMNS({ columns: trashPanelColumns }));
104 dispatch(sharedWithMePanelActions.SET_COLUMNS({ columns: projectPanelColumns }));
105 dispatch(workflowPanelActions.SET_COLUMNS({ columns: workflowPanelColumns }));
106 dispatch(searchResultsPanelActions.SET_COLUMNS({ columns: searchResultsPanelColumns }));
107 dispatch(userBindedActions.SET_COLUMNS({ columns: userPanelColumns }));
108 dispatch(groupPanelActions.GroupsPanelActions.SET_COLUMNS({ columns: groupsPanelColumns }));
109 dispatch(groupDetailsPanelActions.GroupDetailsPanelActions.SET_COLUMNS({columns: groupDetailsPanelColumns}));
110 dispatch(linkPanelActions.SET_COLUMNS({ columns: linkPanelColumns }));
111 dispatch(computeNodesActions.SET_COLUMNS({ columns: computeNodePanelColumns }));
112 dispatch(apiClientAuthorizationsActions.SET_COLUMNS({ columns: apiClientAuthorizationPanelColumns }));
114 dispatch<any>(initSidePanelTree());
115 if (router.location) {
116 const match = matchRootRoute(router.location.pathname);
118 dispatch(navigateToProject(userResource.uuid));
122 dispatch(userIsNotAuthenticated);
125 dispatch(userIsNotAuthenticated);
129 export const loadFavorites = () =>
131 (dispatch: Dispatch) => {
132 dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.FAVORITES));
133 dispatch<any>(loadFavoritePanel());
134 dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.FAVORITES));
137 export const loadTrash = () =>
139 (dispatch: Dispatch) => {
140 dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
141 dispatch<any>(loadTrashPanel());
142 dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.TRASH));
145 export const loadProject = (uuid: string) =>
147 async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
148 const userUuid = services.authService.getUuid();
149 dispatch(setIsProjectPanelTrashed(false));
151 if (extractUuidKind(uuid) === ResourceKind.USER && userUuid !== uuid) {
152 // Load another users home projects
153 dispatch(finishLoadingProject(uuid));
154 } else if (userUuid !== uuid) {
155 const match = await loadGroupContentsResource({ uuid, userUuid, services });
157 OWNED: async project => {
158 await dispatch(activateSidePanelTreeItem(uuid));
159 dispatch<any>(setSidePanelBreadcrumbs(uuid));
160 dispatch(finishLoadingProject(project));
163 dispatch<any>(setSharedWithMeBreadcrumbs(uuid));
164 dispatch(activateSidePanelTreeItem(uuid));
165 dispatch(finishLoadingProject(project));
167 TRASHED: project => {
168 dispatch<any>(setTrashBreadcrumbs(uuid));
169 dispatch(setIsProjectPanelTrashed(true));
170 dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
171 dispatch(finishLoadingProject(project));
175 await dispatch(activateSidePanelTreeItem(userUuid));
176 dispatch<any>(setSidePanelBreadcrumbs(userUuid));
177 dispatch(finishLoadingProject(userUuid));
182 export const createProject = (data: projectCreateActions.ProjectCreateFormDialogData) =>
183 async (dispatch: Dispatch) => {
184 const newProject = await dispatch<any>(projectCreateActions.createProject(data));
186 dispatch(snackbarActions.OPEN_SNACKBAR({
187 message: "Project has been successfully created.",
190 await dispatch<any>(loadSidePanelTreeProjects(newProject.ownerUuid));
191 dispatch<any>(reloadProjectMatchingUuid([newProject.ownerUuid]));
195 export const moveProject = (data: MoveToFormDialogData) =>
196 async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
198 const oldProject = getResource(data.uuid)(getState().resources);
199 const oldOwnerUuid = oldProject ? oldProject.ownerUuid : '';
200 const movedProject = await dispatch<any>(projectMoveActions.moveProject(data));
202 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Project has been moved', hideDuration: 2000 }));
204 await dispatch<any>(loadSidePanelTreeProjects(oldProject.ownerUuid));
206 dispatch<any>(reloadProjectMatchingUuid([oldOwnerUuid, movedProject.ownerUuid, movedProject.uuid]));
209 dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
213 export const updateProject = (data: projectUpdateActions.ProjectUpdateFormDialogData) =>
214 async (dispatch: Dispatch) => {
215 const updatedProject = await dispatch<any>(projectUpdateActions.updateProject(data));
216 if (updatedProject) {
217 dispatch(snackbarActions.OPEN_SNACKBAR({
218 message: "Project has been successfully updated.",
221 await dispatch<any>(loadSidePanelTreeProjects(updatedProject.ownerUuid));
222 dispatch<any>(reloadProjectMatchingUuid([updatedProject.ownerUuid, updatedProject.uuid]));
226 export const loadCollection = (uuid: string) =>
228 async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
229 const userUuid = services.authService.getUuid();
231 const match = await loadGroupContentsResource({ uuid, userUuid, services });
233 OWNED: async collection => {
234 dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
235 dispatch(updateResources([collection]));
236 await dispatch(activateSidePanelTreeItem(collection.ownerUuid));
237 dispatch(setSidePanelBreadcrumbs(collection.ownerUuid));
238 dispatch(loadCollectionFiles(collection.uuid));
240 SHARED: collection => {
241 dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
242 dispatch(updateResources([collection]));
243 dispatch<any>(setSharedWithMeBreadcrumbs(collection.ownerUuid));
244 dispatch(activateSidePanelTreeItem(collection.ownerUuid));
245 dispatch(loadCollectionFiles(collection.uuid));
247 TRASHED: collection => {
248 dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
249 dispatch(updateResources([collection]));
250 dispatch(setTrashBreadcrumbs(''));
251 dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
252 dispatch(loadCollectionFiles(collection.uuid));
259 export const createCollection = (data: collectionCreateActions.CollectionCreateFormDialogData) =>
260 async (dispatch: Dispatch) => {
261 const collection = await dispatch<any>(collectionCreateActions.createCollection(data));
263 dispatch(snackbarActions.OPEN_SNACKBAR({
264 message: "Collection has been successfully created.",
267 dispatch<any>(updateResources([collection]));
268 dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
272 export const updateCollection = (data: collectionUpdateActions.CollectionUpdateFormDialogData) =>
273 async (dispatch: Dispatch) => {
274 const collection = await dispatch<any>(collectionUpdateActions.updateCollection(data));
276 dispatch(snackbarActions.OPEN_SNACKBAR({
277 message: "Collection has been successfully updated.",
280 dispatch<any>(updateResources([collection]));
281 dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
285 export const copyCollection = (data: CopyFormDialogData) =>
286 async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
288 const copyToProject = getResource(data.ownerUuid)(getState().resources);
289 const collection = await dispatch<any>(collectionCopyActions.copyCollection(data));
290 if (copyToProject && collection) {
291 dispatch<any>(reloadProjectMatchingUuid([copyToProject.uuid]));
292 dispatch(snackbarActions.OPEN_SNACKBAR({
293 message: 'Collection has been copied.',
295 kind: SnackbarKind.SUCCESS,
296 link: collection.ownerUuid
300 dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000, kind: SnackbarKind.ERROR }));
304 export const moveCollection = (data: MoveToFormDialogData) =>
305 async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
307 const collection = await dispatch<any>(collectionMoveActions.moveCollection(data));
308 dispatch<any>(updateResources([collection]));
309 dispatch<any>(reloadProjectMatchingUuid([collection.ownerUuid]));
310 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Collection has been moved.', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
312 dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
316 export const loadProcess = (uuid: string) =>
318 async (dispatch: Dispatch, getState: () => RootState) => {
319 dispatch<any>(loadProcessPanel(uuid));
320 const process = await dispatch<any>(processesActions.loadProcess(uuid));
321 await dispatch<any>(activateSidePanelTreeItem(process.containerRequest.ownerUuid));
322 dispatch<any>(setProcessBreadcrumbs(uuid));
323 dispatch(loadDetailsPanel(uuid));
326 export const updateProcess = (data: processUpdateActions.ProcessUpdateFormDialogData) =>
327 async (dispatch: Dispatch) => {
329 const process = await dispatch<any>(processUpdateActions.updateProcess(data));
331 dispatch(snackbarActions.OPEN_SNACKBAR({
332 message: "Process has been successfully updated.",
335 dispatch<any>(updateResources([process]));
336 dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
339 dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
343 export const moveProcess = (data: MoveToFormDialogData) =>
344 async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
346 const process = await dispatch<any>(processMoveActions.moveProcess(data));
347 dispatch<any>(updateResources([process]));
348 dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
349 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process has been moved.', hideDuration: 2000 }));
351 dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
355 export const copyProcess = (data: CopyFormDialogData) =>
356 async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
358 const process = await dispatch<any>(processCopyActions.copyProcess(data));
359 dispatch<any>(updateResources([process]));
360 dispatch<any>(reloadProjectMatchingUuid([process.ownerUuid]));
361 dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Process has been copied.', hideDuration: 2000 }));
363 dispatch(snackbarActions.OPEN_SNACKBAR({ message: e.message, hideDuration: 2000 }));
367 export const loadProcessLog = (uuid: string) =>
369 async (dispatch: Dispatch) => {
370 const process = await dispatch<any>(processesActions.loadProcess(uuid));
371 dispatch<any>(setProcessBreadcrumbs(uuid));
372 dispatch<any>(initProcessLogsPanel(uuid));
373 await dispatch<any>(activateSidePanelTreeItem(process.containerRequest.ownerUuid));
376 export const resourceIsNotLoaded = (uuid: string) =>
377 snackbarActions.OPEN_SNACKBAR({
378 message: `Resource identified by ${uuid} is not loaded.`
381 export const userIsNotAuthenticated = snackbarActions.OPEN_SNACKBAR({
382 message: 'User is not authenticated'
385 export const couldNotLoadUser = snackbarActions.OPEN_SNACKBAR({
386 message: 'Could not load user'
389 export const reloadProjectMatchingUuid = (matchingUuids: string[]) =>
390 async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
391 const currentProjectPanelUuid = getProjectPanelCurrentUuid(getState());
392 if (currentProjectPanelUuid && matchingUuids.some(uuid => uuid === currentProjectPanelUuid)) {
393 dispatch<any>(loadProject(currentProjectPanelUuid));
397 export const loadSharedWithMe = handleFirstTimeLoad(async (dispatch: Dispatch) => {
398 dispatch<any>(loadSharedWithMePanel());
399 await dispatch<any>(activateSidePanelTreeItem(SidePanelTreeCategory.SHARED_WITH_ME));
400 await dispatch<any>(setSidePanelBreadcrumbs(SidePanelTreeCategory.SHARED_WITH_ME));
403 export const loadRunProcess = handleFirstTimeLoad(
404 async (dispatch: Dispatch) => {
405 await dispatch<any>(loadRunProcessPanel());
409 export const loadWorkflow = handleFirstTimeLoad(async (dispatch: Dispatch<any>) => {
410 dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.WORKFLOWS));
411 await dispatch(loadWorkflowPanel());
412 dispatch(setSidePanelBreadcrumbs(SidePanelTreeCategory.WORKFLOWS));
415 export const loadSearchResults = handleFirstTimeLoad(
416 async (dispatch: Dispatch<any>) => {
417 await dispatch(loadSearchResultsPanel());
420 export const loadLinks = handleFirstTimeLoad(
421 async (dispatch: Dispatch<any>) => {
422 await dispatch(loadLinkPanel());
425 export const loadVirtualMachines = handleFirstTimeLoad(
426 async (dispatch: Dispatch<any>) => {
427 await dispatch(loadVirtualMachinesPanel());
428 dispatch(setBreadcrumbs([{ label: 'Virtual Machines' }]));
431 export const loadRepositories = handleFirstTimeLoad(
432 async (dispatch: Dispatch<any>) => {
433 await dispatch(loadRepositoriesPanel());
434 dispatch(setBreadcrumbs([{ label: 'Repositories' }]));
437 export const loadSshKeys = handleFirstTimeLoad(
438 async (dispatch: Dispatch<any>) => {
439 await dispatch(loadSshKeysPanel());
442 export const loadSiteManager = handleFirstTimeLoad(
443 async (dispatch: Dispatch<any>) => {
444 await dispatch(loadSiteManagerPanel());
447 export const loadMyAccount = handleFirstTimeLoad(
448 (dispatch: Dispatch<any>) => {
449 dispatch(loadMyAccountPanel());
452 export const loadKeepServices = handleFirstTimeLoad(
453 async (dispatch: Dispatch<any>) => {
454 await dispatch(loadKeepServicesPanel());
457 export const loadUsers = handleFirstTimeLoad(
458 async (dispatch: Dispatch<any>) => {
459 await dispatch(loadUsersPanel());
460 dispatch(setBreadcrumbs([{ label: 'Users' }]));
463 export const loadComputeNodes = handleFirstTimeLoad(
464 async (dispatch: Dispatch<any>) => {
465 await dispatch(loadComputeNodesPanel());
468 export const loadApiClientAuthorizations = handleFirstTimeLoad(
469 async (dispatch: Dispatch<any>) => {
470 await dispatch(loadApiClientAuthorizationsPanel());
473 export const loadGroupsPanel = handleFirstTimeLoad(
474 (dispatch: Dispatch<any>) => {
475 dispatch(setGroupsBreadcrumbs());
476 dispatch(groupPanelActions.loadGroupsPanel());
480 export const loadGroupDetailsPanel = (groupUuid: string) =>
482 (dispatch: Dispatch<any>) => {
483 dispatch(setGroupDetailsBreadcrumbs(groupUuid));
484 dispatch(groupDetailsPanelActions.loadGroupDetailsPanel(groupUuid));
487 const finishLoadingProject = (project: GroupContentsResource | string) =>
488 async (dispatch: Dispatch<any>) => {
489 const uuid = typeof project === 'string' ? project : project.uuid;
490 dispatch(openProjectPanel(uuid));
491 dispatch(loadDetailsPanel(uuid));
492 if (typeof project !== 'string') {
493 dispatch(updateResources([project]));
497 const loadGroupContentsResource = async (params: {
500 services: ServiceRepository
502 const filters = new FilterBuilder()
503 .addEqual('uuid', params.uuid)
505 const { items } = await params.services.groupsService.contents(params.userUuid, {
510 const resource = items.shift();
511 let handler: GroupContentsHandler;
513 handler = (resource.kind === ResourceKind.COLLECTION || resource.kind === ResourceKind.PROJECT) && resource.isTrashed
514 ? groupContentsHandlers.TRASHED(resource)
515 : groupContentsHandlers.OWNED(resource);
517 const kind = extractUuidKind(params.uuid);
518 let resource: GroupContentsResource;
519 if (kind === ResourceKind.COLLECTION) {
520 resource = await params.services.collectionService.get(params.uuid);
521 } else if (kind === ResourceKind.PROJECT) {
522 resource = await params.services.projectService.get(params.uuid);
524 resource = await params.services.containerRequestService.get(params.uuid);
526 handler = groupContentsHandlers.SHARED(resource);
528 return (cases: MatchCases<typeof groupContentsHandlersRecord, GroupContentsHandler, void>) =>
529 groupContentsHandlers.match(handler, cases);
533 const groupContentsHandlersRecord = {
534 TRASHED: ofType<GroupContentsResource>(),
535 SHARED: ofType<GroupContentsResource>(),
536 OWNED: ofType<GroupContentsResource>(),
539 const groupContentsHandlers = unionize(groupContentsHandlersRecord);
541 type GroupContentsHandler = UnionOf<typeof groupContentsHandlers>;