From da8bc416c2aa42bbda62c46d500a1b028b9efd97 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Thu, 27 Dec 2018 19:19:17 +0300 Subject: [PATCH] problems: handle tag click in table view --- src/panel-triggers/components/Problems.tsx | 26 +++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/panel-triggers/components/Problems.tsx b/src/panel-triggers/components/Problems.tsx index bc2fe22..a25b752 100644 --- a/src/panel-triggers/components/Problems.tsx +++ b/src/panel-triggers/components/Problems.tsx @@ -71,7 +71,9 @@ export class ProblemList extends PureComponent + }, { Header: 'Time', className: 'last-change', width: timeColWidth, accessor: 'lastchangeUnix', id: 'lastchange', @@ -192,11 +194,23 @@ function ProblemCell(props: RTCell) { ); } -function TagCell(props: RTCell) { - const tags = props.value || []; - return [ - tags.map(tag => ) - ]; +interface TagCellProps extends RTCell { + onTagClick: (tag: ZBXTag, datasource: string) => void; +} + +class TagCell extends PureComponent { + handleTagClick = (tag: ZBXTag) => { + if (this.props.onTagClick) { + this.props.onTagClick(tag, this.props.original.datasource); + } + } + + render() { + const tags = this.props.value || []; + return [ + tags.map(tag => ) + ]; + } } function CustomExpander(props: RTCell) {