15069: Renders property's key/value labels correctly when adding them on search
[arvados.git] / src / views / link-panel / link-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 { RootState } from '~/store/store';
8 import { openContextMenu, resourceKindToContextMenuKind } from '~/store/context-menu/context-menu-actions';
9 import { LinkPanelRoot, LinkPanelRootActionProps, LinkPanelRootDataProps } from '~/views/link-panel/link-panel-root';
10 import { ResourceKind } from '~/models/resource';
11
12 const mapStateToProps = (state: RootState): LinkPanelRootDataProps => {
13     return {
14         resources: state.resources
15     };
16 };
17
18 const mapDispatchToProps = (dispatch: Dispatch): LinkPanelRootActionProps => ({
19     onContextMenu: (event, resourceUuid) => {
20         const kind = resourceKindToContextMenuKind(resourceUuid);
21         if (kind) {
22             dispatch<any>(openContextMenu(event, {
23                 name: '',
24                 uuid: resourceUuid,
25                 ownerUuid: '',
26                 kind: ResourceKind.LINK,
27                 menuKind: kind
28             }));
29         }
30     },
31     onItemClick: (resourceUuid: string) => { return; },
32     onItemDoubleClick: uuid => { return; }
33 });
34
35 export const LinkPanel = connect(mapStateToProps, mapDispatchToProps)(LinkPanelRoot);