1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { RootState } from '~/store/store';
7 import { connect } from 'react-redux';
8 import { getProcess } from '~/store/processes/process';
9 import { Dispatch } from 'redux';
10 import { openProcessContextMenu } from '~/store/context-menu/context-menu-actions';
11 import { matchProcessLogRoute } from '~/routes/routes';
12 import { ProcessLogPanelRootDataProps, ProcessLogPanelRootActionProps, ProcessLogPanelRoot } from './process-log-panel-root';
14 const SELECT_OPTIONS = [
15 { label: 'Dispatch', value: 'dispatch' },
16 { label: 'Crunch-run', value: 'crunch-run' },
17 { label: 'Crunchstat', value: 'crunchstat' },
18 { label: 'Hoststat', value: 'hoststat' },
19 { label: 'Node-info', value: 'node-info' },
20 { label: 'Arv-mount', value: 'arv-mount' },
21 { label: 'Stdout', value: 'stdout' },
22 { label: 'Stderr', value: 'stderr' }
25 export interface Log {
33 export interface FilterOption {
38 const mapStateToProps = ({ router, resources }: RootState): ProcessLogPanelRootDataProps => {
39 const pathname = router.location ? router.location.pathname : '';
40 const match = matchProcessLogRoute(pathname);
41 const uuid = match ? match.params.id : '';
43 process: getProcess(uuid)(resources),
44 selectedFilter: SELECT_OPTIONS[0],
45 filters: SELECT_OPTIONS
50 const mapDispatchToProps = (dispatch: Dispatch): ProcessLogPanelRootActionProps => ({
51 onContextMenu: (event: React.MouseEvent<HTMLElement>) => {
52 dispatch<any>(openProcessContextMenu(event));
54 onChange: (filter: FilterOption) => { return; }
57 export const ProcessLogPanel = connect(mapStateToProps, mapDispatchToProps)(ProcessLogPanelRoot);