1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { RootState } from '~/store/store';
6 import { connect } from 'react-redux';
7 import { getProcess } from '~/store/processes/process';
8 import { Dispatch } from 'redux';
9 import { openProcessContextMenu } from '~/store/context-menu/context-menu-actions';
10 import { ProcessLogPanelRootDataProps, ProcessLogPanelRootActionProps, ProcessLogPanelRoot } from './process-log-panel-root';
11 import { getProcessPanelLogs } from '~/store/process-logs-panel/process-logs-panel';
12 import { setProcessLogsPanelFilter } from '~/store/process-logs-panel/process-logs-panel-actions';
13 import { getProcessLogsPanelCurrentUuid } from '../../store/process-logs-panel/process-logs-panel';
15 export interface Log {
23 export interface FilterOption {
28 const mapStateToProps = (state: RootState): ProcessLogPanelRootDataProps => {
29 const { resources, processLogsPanel } = state;
30 const uuid = getProcessLogsPanelCurrentUuid(state) || '';
32 process: getProcess(uuid)(resources),
33 selectedFilter: { label: processLogsPanel.selectedFilter, value: processLogsPanel.selectedFilter },
34 filters: processLogsPanel.filters.map(filter => ({ label: filter, value: filter })),
35 lines: getProcessPanelLogs(processLogsPanel)
39 const mapDispatchToProps = (dispatch: Dispatch): ProcessLogPanelRootActionProps => ({
40 onContextMenu: (event, process) => {
41 dispatch<any>(openProcessContextMenu(event, process));
44 dispatch(setProcessLogsPanelFilter(filter.value));
48 export const ProcessLogPanel = connect(mapStateToProps, mapDispatchToProps)(ProcessLogPanelRoot);