import { unionize, ofType, UnionOf } from '~/common/unionize';
export const collectionPanelActions = unionize({
+ SET_COLLECTION: ofType<CollectionResource>(),
LOAD_COLLECTION: ofType<{ uuid: string }>(),
LOAD_COLLECTION_SUCCESS: ofType<{ item: CollectionResource }>()
});
return collection;
};
-export const createCollectionTag = (data: TagProperty) =>
+export const createCollectionTag = (data: TagProperty) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
const item = getState().collectionPanel.item;
const uuid = item ? item.uuid : '';
export const collectionPanelReducer = (state: CollectionPanelState = initialState, action: CollectionPanelAction) =>
collectionPanelActions.match(action, {
default: () => state,
+ SET_COLLECTION: (item) => ({ ...state, item }),
LOAD_COLLECTION_SUCCESS: ({ item }) => ({ ...state, item }),
});
import { unionize, ofType, UnionOf, MatchCases } from '~/common/unionize';
import { loadRunProcessPanel } from '~/store/run-process-panel/run-process-panel-actions';
import { loadCollectionFiles } from '~/store/collection-panel/collection-panel-files/collection-panel-files-actions';
+import { collectionPanelActions } from "~/store/collection-panel/collection-panel-action";
+import { CollectionResource } from "~/models/collection";
export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen';
const match = await loadGroupContentsResource({ uuid, userUuid, services });
match({
OWNED: async collection => {
+ dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
dispatch(updateResources([collection]));
await dispatch(activateSidePanelTreeItem(collection.ownerUuid));
dispatch(setSidePanelBreadcrumbs(collection.ownerUuid));
dispatch(loadCollectionFiles(collection.uuid));
},
SHARED: collection => {
+ dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
dispatch(updateResources([collection]));
dispatch<any>(setSharedWithMeBreadcrumbs(collection.ownerUuid));
dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.SHARED_WITH_ME));
dispatch(loadCollectionFiles(collection.uuid));
},
TRASHED: collection => {
+ dispatch(collectionPanelActions.SET_COLLECTION(collection as CollectionResource));
dispatch(updateResources([collection]));
dispatch(setTrashBreadcrumbs(''));
dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));