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 const lines = ['Lorem Ipsum', 'Lorem Ipsum', 'Lorem Ipsum', 'Lorem Ipsum', 'Lorem Ipsum', 'Lorem Ipsum', 'Lorem Ipsum', 'Lorem Ipsum'];
27 export interface Log {
35 export interface FilterOption {
40 const mapStateToProps = ({ router, resources }: RootState): ProcessLogPanelRootDataProps => {
41 const pathname = router.location ? router.location.pathname : '';
42 const match = matchProcessLogRoute(pathname);
43 const uuid = match ? match.params.id : '';
45 process: getProcess(uuid)(resources),
46 selectedFilter: SELECT_OPTIONS[0],
47 filters: SELECT_OPTIONS,
52 const mapDispatchToProps = (dispatch: Dispatch): ProcessLogPanelRootActionProps => ({
53 onContextMenu: (event: React.MouseEvent<HTMLElement>) => {
54 dispatch<any>(openProcessContextMenu(event));
56 onChange: (filter: FilterOption) => { return; }
59 export const ProcessLogPanel = connect(mapStateToProps, mapDispatchToProps)(ProcessLogPanelRoot);