import * as Routes from '~/routes/routes';
import * as WorkbenchActions from '~/store/workbench/workbench-actions';
import { navigateToRootProject } from '~/store/navigation/navigation-action';
+import { dialogActions } from '~/store/dialog/dialog-actions';
export const addRouteChangeHandlers = (history: History, store: RootStore) => {
const handler = handleLocationChange(store);
const userMatch = Routes.matchUsersRoute(pathname);
const linksMatch = Routes.matchLinksRoute(pathname);
+ store.dispatch(dialogActions.CLOSE_ALL_DIALOGS());
+
if (projectMatch) {
store.dispatch(WorkbenchActions.loadProject(projectMatch.params.id));
} else if (collectionMatch) {
export const dialogActions = unionize({
OPEN_DIALOG: ofType<{ id: string, data: any }>(),
- CLOSE_DIALOG: ofType<{ id: string }>()
+ CLOSE_DIALOG: ofType<{ id: string }>(),
+ CLOSE_ALL_DIALOGS: ofType<{}>()
});
export type DialogAction = UnionOf<typeof dialogActions>;
export type DialogState = Record<string, Dialog<any>>;
-export interface Dialog <T> {
+export interface Dialog<T> {
open: boolean;
data: T;
}
export const dialogReducer = (state: DialogState = {}, action: DialogAction) =>
+
dialogActions.match(action, {
OPEN_DIALOG: ({ id, data }) => ({ ...state, [id]: { open: true, data } }),
- CLOSE_DIALOG: ({ id }) => ({
- ...state,
- [id]: state[id] ? { ...state[id], open: false } : { open: false, data: {} } }),
+ CLOSE_DIALOG: ({ id }) => ({
+ ...state,
+ [id]: state[id] ? { ...state[id], open: false } : { open: false, data: {} }
+ }),
+ CLOSE_ALL_DIALOGS: () => ({ }),
default: () => state,
});
-export const getDialog = <T>(state: DialogState, id: string) =>
+export const getDialog = <T>(state: DialogState, id: string) =>
state[id] ? state[id] as Dialog<T> : undefined;
import { dialogActions } from '~/store/dialog/dialog-actions';
import { RootState } from '~/store/store';
import { Dispatch } from 'redux';
-import { getProcess, Process } from '~/store/processes/process';
+import { getProcess } from '~/store/processes/process';
+import { snackbarActions } from '~/store/snackbar/snackbar-actions';
export const PROCESS_INPUT_DIALOG_NAME = 'processInputDialog';
(dispatch: Dispatch<any>, getState: () => RootState) => {
const process = getProcess(processUuid)(getState().resources);
if (process) {
- const data: Process = process;
- dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_INPUT_DIALOG_NAME, data }));
+ const data: any = process;
+ if (data && data.containerRequest.mounts.varLibCwlWorkflowJson && data.containerRequest.mounts.varLibCwlWorkflowJson.content.graph[1].inputs.length > 0) {
+ dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_INPUT_DIALOG_NAME, data }));
+ } else {
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'There are no inputs in this process!' }));
+ }
}
};
\ No newline at end of file
label='Content size' value={data && formatFileSize(data.fileSize)} />
<DetailsAttribute classLabel={classes.label} classValue={classes.value}
label='Owner' value={item && item.ownerUuid} />
- <span onClick={() => dispatch<any>(navigateToProcess(item.properties.container_request))}>
+ <span onClick={() => dispatch<any>(navigateToProcess(item.properties.container_request || item.properties.containerRequest))}>
<DetailsAttribute classLabel={classes.link} label='Link to process' />
</span>
</Grid>