diff --git a/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/MultiParentIcon.tsx b/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/MultiParentIcon.tsx new file mode 100644 index 0000000000..2ef3b7cc5c --- /dev/null +++ b/packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/MultiParentIcon.tsx @@ -0,0 +1,117 @@ +// Copyright (c) 2019 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import * as React from 'react'; +import { Button, Dropdown, Menu, Tooltip } from 'antd'; +import { bindActionCreators } from 'redux'; +import { connect, Dispatch } from 'react-redux'; +import { History as RouterHistory, Location } from 'history'; +import { withRouter } from 'react-router-dom'; + +import { FetchedTrace, ReduxState, TNil } from '../../../types'; +import { actions as timelineActions } from './duck'; +import { extractUiFindFromState } from '../../common/UiFindInput'; +import { SpanReference, Trace } from '../../../types/trace'; +import updateUiFind from '../../../utils/update-ui-find'; + +type TDispatchProps = { + focusUiFindMatches: (trace: Trace, uiFind: string | TNil) => void; +}; + +type TReduxProps = { + uiFind: string | TNil; + trace: FetchedTrace | TNil; +}; + +type TOwnProps = { + references: SpanReference[]; + traceID: string; + history: RouterHistory; + location: Location; + match: any; +}; + +type MultiParentIconProps = TDispatchProps & TReduxProps & TOwnProps; + +const linkValueList = (links: SpanReference[], focusUiFindMatches: (spanID: string) => void) => ( + + {links.map(({ spanID, span }, index) => { + let text = spanID; + if (span) { + text = `${span.operationName} (${spanID})`; + } + return ( + // `index` is necessary in the key because url can repeat + // eslint-disable-next-line react/no-array-index-key + + focusUiFindMatches(spanID)}> + {' '} + {text}{' '} + + + ); + })} + +); + +class MultiParentIconImpl extends React.PureComponent { + focusUiFindMatches = (uiFind: string) => { + const { trace, focusUiFindMatches, location, history } = this.props; + if (trace && trace.data) { + updateUiFind({ + location, + history, + uiFind, + }); + focusUiFindMatches(trace.data, uiFind); + } + }; + + render() { + const { references } = this.props; + return ( + + +