Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
import { getProcess } from '~/store/processes/process';
import { FilterBuilder } from "~/services/api/filter-builder";
import { OrderBuilder } from "~/services/api/order-builder";
+import { navigateToCollection } from '~/store/navigation/navigation-action';
+import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
export const processLogsPanelActions = unionize({
RESET_PROCESS_LOGS_PANEL: ofType<{}>(),
const logsToLines = (logs: LogResource[]) =>
logs.map(({ properties }) => properties.text);
+export const navigateToLogCollection = (uuid: string) =>
+ async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+ try {
+ await services.collectionService.get(uuid);
+ dispatch<any>(navigateToCollection(uuid));
+ } catch {
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'This collection does not exists!', hideDuration: 2000, kind: SnackbarKind.ERROR }));
+ }
+ };
+
const MAX_AMOUNT_OF_LOGS = 10000;
const SUMMARIZED_FILTER_TYPE = 'Summarized';
color: theme.customs.colors.green700
},
link: {
- alignSelf: 'flex-end',
- textAlign: 'right'
+ fontSize: '0.875rem',
+ color: theme.palette.primary.main,
+ textAlign: 'right',
+ '&:hover': {
+ cursor: 'pointer'
+ }
}
});
export interface ProcessLogMainCardActionProps {
onContextMenu: (event: React.MouseEvent<any>, process: Process) => void;
+ navigateToLogCollection: (uuid: string) => void;
}
export type ProcessLogMainCardProps = ProcessLogMainCardDataProps
& ProcessLogFormActionProps;
export const ProcessLogMainCard = withStyles(styles)(
- ({ classes, process, selectedFilter, filters, onChange, lines, onContextMenu }: ProcessLogMainCardProps & WithStyles<CssRules>) =>
+ ({ classes, process, selectedFilter, filters, onChange, lines, onContextMenu, navigateToLogCollection }: ProcessLogMainCardProps & WithStyles<CssRules>) =>
<Grid item xs={12}>
<Link to={`/processes/${process.containerRequest.uuid}`} className={classes.backLink}>
<BackIcon className={classes.backIcon} /> Back
<ProcessLogForm selectedFilter={selectedFilter} filters={filters} onChange={onChange} />
</Grid>
<Grid item xs={6} className={classes.link}>
- <Typography component='div'>
+ <span onClick={() => navigateToLogCollection(process.containerRequest.logUuid!)}>
Go to Log collection
- </Typography>
+ </span>
</Grid>
</Grid>
<Grid item xs>
import { openProcessContextMenu } from '~/store/context-menu/context-menu-actions';
import { ProcessLogPanelRootDataProps, ProcessLogPanelRootActionProps, ProcessLogPanelRoot } from './process-log-panel-root';
import { getProcessPanelLogs } from '~/store/process-logs-panel/process-logs-panel';
-import { setProcessLogsPanelFilter } from '~/store/process-logs-panel/process-logs-panel-actions';
-import { getProcessLogsPanelCurrentUuid } from '../../store/process-logs-panel/process-logs-panel';
+import { setProcessLogsPanelFilter, navigateToLogCollection } from '~/store/process-logs-panel/process-logs-panel-actions';
+import { getProcessLogsPanelCurrentUuid } from '~/store/process-logs-panel/process-logs-panel';
export interface Log {
object_uuid: string;
},
onChange: filter => {
dispatch(setProcessLogsPanelFilter(filter.value));
+ },
+ navigateToLogCollection: (uuid: string) => {
+ dispatch<any>(navigateToLogCollection(uuid));
}
});