15012: Uses varargs version of joinFilters().
[arvados-workbench2.git] / src / views / subprocess-panel / subprocess-panel.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { Dispatch } from "redux";
6 import { connect } from "react-redux";
7 import { openProcessContextMenu } from '~/store/context-menu/context-menu-actions';
8 import { SubprocessPanelRoot, SubprocessPanelActionProps, SubprocessPanelDataProps } from '~/views/subprocess-panel/subprocess-panel-root';
9 import { RootState } from "~/store/store";
10 import { navigateTo } from "~/store/navigation/navigation-action";
11 import { loadDetailsPanel } from "~/store/details-panel/details-panel-action";
12 import { getProcess } from "~/store/processes/process";
13
14 const mapDispatchToProps = (dispatch: Dispatch): SubprocessPanelActionProps => ({
15     onContextMenu: (event, resourceUuid, resources) => {
16         const process = getProcess(resourceUuid)(resources);
17         if (process) {
18             dispatch<any>(openProcessContextMenu(event, process));
19         }
20     },
21     onItemClick: (uuid: string) => {
22         dispatch<any>(loadDetailsPanel(uuid));
23     },
24     onItemDoubleClick: uuid => {
25         dispatch<any>(navigateTo(uuid));
26     }
27 });
28
29 const mapStateToProps = (state: RootState): SubprocessPanelDataProps => ({
30     resources: state.resources
31 });
32
33 export const SubprocessPanel = connect(mapStateToProps, mapDispatchToProps)(SubprocessPanelRoot);