-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move filter to query param and highlight filter matches on graphs #310
Merged
tiffon
merged 58 commits into
jaegertracing:master
from
everett980:issue-307-add-node-search-to-tracegraph-and-tracediffgraph
Mar 12, 2019
Merged
Changes from 41 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
bdc0220
Add a TraceGraph view (#273) (#276)
copa2 4112482
Revisions for search and trace detail embed mode (#286)
tiffon 2baf075
Unfocus unit test (#298)
tiffon d90d042
Add a Button to Reset Viewing Layer Zoom (#215) (#290)
everett980 29b340d
Add a copy icon to entries in KeyValuesTable (#204) (#292)
everett980 e0f34e4
Add popover and prevent submit if duration params are invalid (#244) …
everett980 bf70c14
Add indent guides to trace timeline view (#172) (#297)
everett980 07c7f4f
Add ability to search for nodes in TraceDiffGraph and TraceGraph (#307)
everett980 1953db5
Style GraphSearch, Debounce query param updating
everett980 e918deb
Use hex instead of html colors, remove commented code
everett980 181562c
Handle falsy graphSearch value in state, improve typing
everett980 edf4805
Move GraphSearch and use as utility
everett980 d1e05d6
Add tests for GraphSearch
everett980 6ea7d6a
Update create-react-app to 2.1.2 (#302)
tiffon 5fa907b
Add tests for consuming GraphSearch, Add tests for filter-spans
everett980 0122fd7
Improve spy variable name
everett980 f08a609
Ability to open additional menu links in same tab (Resolves #275) (#278)
zablvit 8e2df85
Revive the changelog (#300)
tiffon 7ea05f4
Add SpanID support to filter-spans, Consolidate textFilter & GraphSearch
everett980 2bf1b43
Unify uiFind name, fix refs, improve types, remove commented code
everett980 353d69c
Add tests to new & tested files, merge common/GraphSearch into user
everett980 99b7a6c
Update exisitng test files
everett980 10b5194
Polish filter-spans
everett980 dd9f14c
Merge branch 'jaegertracingmaster' into issue-307-add-node-search-to-…
everett980 0c5b591
Use uppercase types, remove constructor for initial state
everett980 50db264
Update enzyme, Re-enable and add TracePage/index.test.js tests
everett980 9a7e0c1
Merge branch 'jaegertracingmaster' into issue-307-add-node-search-to-…
everett980 ef880c7
Merge branch 'issue-307-add-node-search-to-tracegraph-and-tracediffgr…
everett980 e531d6e
Add tests to TraceDiff/
everett980 fe420c6
Treat all span relationships equally, make ui-find-match css more obv…
everett980 a5178e0
Fix node/edge layering, simplify ui-find-match css
everett980 66f080d
Change diffNode ui match color, scale ui match outline size
everett980 9dc1a4e
Calculate box-shadow size on nodesContainer not drawNode
everett980 f685d47
Fix color attributes to preserve node text color
everett980 b6b40c0
Rename UIFind to UiFind, Update TraceDiffFind
everett980 acd3e66
Finish DiffGraph find css, Render 0 count suffix
everett980 2434056
merge master and update test
everett980 51337fb
Fix git case insensitivity issue
everett980 4313988
Merge branch 'issue-307-add-node-search-to-tracegraph-and-tracediffgr…
everett980 1f5421d
Merge updated graph find, maintain increased test coverage
everett980 69a576a
Remove redundant find, Fix TraceGraph suffix, Fix flow complaint, WIP
everett980 259cd13
Clean up WIP commit
everett980 15c51d5
Clean up CSS, Track only TracePage, Fix span-ancestor-ids logic
everett980 a1f5e59
Ensure scroll to bottom scrolls to last visible span
everett980 aa3f2e5
Move addToUiFind logic to VirtualizedTraceView
everett980 df9bafd
Merge branch 'master' into issue-307-add-node-search-to-tracegraph-an…
everett980 7422720
Merge branch 'issue-307-add-node-search-to-tracegraph-and-tracediffgr…
everett980 c5034fa
Process FOLLOWS_FROM spans in TraceView (#335)
rubenvp8510 95026f9
Move graph utils to new file, Clean up span-ancestor-id loop
everett980 c3d4d14
fix merge again
everett980 bf3386f
Merge branch 'issue-307-add-node-search-to-tracegraph-and-tracediffgr…
everett980 b4afe2d
Update tests after merge
everett980 de6571f
Merge pull request #1 from everett980/issue-239-fix-TracePageHeader-t…
everett980 5386868
Clean up and DRY out tests, Change trackFilter to function
everett980 5971072
Merge branch 'jaegertracingmaster' into issue-307-add-node-search-to-…
everett980 c5f40c8
Fix yarn.lock urls
everett980 8a4b0fb
Fix yarn.lock change %2f back to /
everett980 d3965dc
Merge branch 'master' into issue-307-add-node-search-to-tracegraph-an…
tiffon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
./flow-typed/npm | ||
|
||
[options] | ||
suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore | ||
|
||
[version] | ||
0.71.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,16 @@ | |
|
||
import * as React from 'react'; | ||
import { DirectedGraph, LayoutManager } from '@jaegertracing/plexus'; | ||
import cx from 'classnames'; | ||
import _get from 'lodash/get'; | ||
import { connect } from 'react-redux'; | ||
|
||
import drawNode from './drawNode'; | ||
import { getUiFindVertexKeys, getEdgesAndVertices } from './traceDiffGraphUtils'; | ||
import ErrorMessage from '../../common/ErrorMessage'; | ||
import LoadingIndicator from '../../common/LoadingIndicator'; | ||
import UiFindInput, { extractUiFindFromState } from '../../common/UiFindInput'; | ||
import { fetchedState } from '../../../constants'; | ||
import convPlexus from '../../../model/trace-dag/convPlexus'; | ||
import TraceDag from '../../../model/trace-dag/TraceDag'; | ||
|
||
import type { FetchedTrace } from '../../../types'; | ||
|
||
|
@@ -31,25 +34,47 @@ import './TraceDiffGraph.css'; | |
type Props = { | ||
a: ?FetchedTrace, | ||
b: ?FetchedTrace, | ||
uiFind?: string, | ||
}; | ||
|
||
const { classNameIsSmall } = DirectedGraph.propsFactories; | ||
|
||
function setOnEdgesContainer(state: Object) { | ||
export function setOnEdgesContainer(state: Object) { | ||
const { zoomTransform } = state; | ||
if (!zoomTransform) { | ||
return null; | ||
} | ||
const { k } = zoomTransform; | ||
const opacity = 0.1 + k * 0.9; | ||
return { style: { opacity } }; | ||
return { style: { opacity, zIndex: 1, position: 'absolute', pointerEvents: 'none' } }; | ||
} | ||
|
||
export default class TraceDiffGraph extends React.PureComponent<Props> { | ||
props: Props; | ||
export function setOnNodesContainer(state: Object) { | ||
const { zoomTransform } = state; | ||
const matchSize = 8 + 4 / _get(zoomTransform, 'k', 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like these magic numbers could stand to be consts. |
||
return { | ||
style: { | ||
outline: `transparent solid ${matchSize}px`, | ||
}, | ||
}; | ||
} | ||
|
||
export function setOnNode() { | ||
return { | ||
style: { | ||
outline: 'inherit', | ||
}, | ||
}; | ||
} | ||
|
||
class TraceDiffGraph extends React.PureComponent<Props> { | ||
props: Props; | ||
layoutManager: LayoutManager; | ||
|
||
static defaultProps = { | ||
uiFind: '', | ||
}; | ||
|
||
constructor(props: Props) { | ||
super(props); | ||
this.layoutManager = new LayoutManager({ useDotEdges: true, splines: 'polyline' }); | ||
|
@@ -60,7 +85,12 @@ export default class TraceDiffGraph extends React.PureComponent<Props> { | |
} | ||
|
||
render() { | ||
const { a, b } = this.props; | ||
const { | ||
a, | ||
b, | ||
// Flow requires `= ''` because it does not interpret defaultProps | ||
uiFind = '', | ||
} = this.props; | ||
if (!a || !b) { | ||
return <h1 className="u-mt-vast u-tx-muted ub-tx-center">At least two Traces are needed</h1>; | ||
} | ||
|
@@ -92,27 +122,36 @@ export default class TraceDiffGraph extends React.PureComponent<Props> { | |
if (!aData || !bData) { | ||
return <div className="TraceDiffGraph--graphWrapper" />; | ||
} | ||
const aTraceDag = TraceDag.newFromTrace(aData); | ||
const bTraceDag = TraceDag.newFromTrace(bData); | ||
const diffDag = TraceDag.diff(aTraceDag, bTraceDag); | ||
const { edges, vertices } = convPlexus(diffDag.nodesMap); | ||
const { edges, vertices } = getEdgesAndVertices(aData, bData); | ||
const keys = getUiFindVertexKeys(uiFind, vertices); | ||
everett980 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const dagClassName = cx('TraceDiffGraph--dag', { uiFind }); | ||
|
||
return ( | ||
<div className="TraceDiffGraph--graphWrapper"> | ||
<DirectedGraph | ||
minimap | ||
zoom | ||
arrowScaleDampener={0} | ||
className="TraceDiffGraph--dag" | ||
className={dagClassName} | ||
minimapClassName="TraceDiffGraph--miniMap" | ||
layoutManager={this.layoutManager} | ||
getNodeLabel={drawNode} | ||
getNodeLabel={drawNode(keys)} | ||
everett980 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
setOnRoot={classNameIsSmall} | ||
setOnEdgesContainer={setOnEdgesContainer} | ||
setOnNodesContainer={setOnNodesContainer} | ||
setOnNode={setOnNode} | ||
edges={edges} | ||
vertices={vertices} | ||
/> | ||
<UiFindInput | ||
inputProps={{ | ||
className: 'TraceDiffGraph--uiFind', | ||
suffix: uiFind.length && String(keys.size), | ||
}} | ||
/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default connect(extractUiFindFromState)(TraceDiffGraph); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
packages/jaeger-ui/src/components/TraceDiff/TraceDiffGraph/traceDiffGraphUtils.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// 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 _get from 'lodash/get'; | ||
import _map from 'lodash/map'; | ||
|
||
import convPlexus from '../../../model/trace-dag/convPlexus'; | ||
import TraceDag from '../../../model/trace-dag/TraceDag'; | ||
import filterSpans from '../../../utils/filter-spans'; | ||
|
||
import type { PVertex } from '../../../model/trace-dag/types'; | ||
import type { Trace } from '../../../types/trace'; | ||
|
||
export type vertexKeys = Set<number | string>; | ||
everett980 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
let lastUiFind: string; | ||
let lastVertices: PVertex<Trace>[]; | ||
let uiFindVertexKeys: ?vertexKeys; | ||
|
||
export function getUiFindVertexKeys(uiFind: string, vertices: PVertex<Trace>[]): vertexKeys { | ||
if (uiFind === lastUiFind && vertices === lastVertices && uiFindVertexKeys) { | ||
return uiFindVertexKeys; | ||
} | ||
const newVertexKeys: Set<number | string> = new Set(); | ||
vertices.forEach(({ key, data: { members } }) => { | ||
if (_get(filterSpans(uiFind, _map(members, 'span')), 'size')) { | ||
newVertexKeys.add(key); | ||
} | ||
}); | ||
lastUiFind = uiFind; | ||
lastVertices = vertices; | ||
uiFindVertexKeys = newVertexKeys; | ||
return newVertexKeys; | ||
} | ||
|
||
let lastAData: ?Trace; | ||
let lastBData: ?Trace; | ||
let edgesAndVertices: ?Object; | ||
tiffon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export function getEdgesAndVertices(aData: Trace, bData: Trace) { | ||
if (aData === lastAData && bData === lastBData && edgesAndVertices) { | ||
return edgesAndVertices; | ||
} | ||
lastAData = aData; | ||
lastBData = bData; | ||
const aTraceDag = TraceDag.newFromTrace(aData); | ||
const bTraceDag = TraceDag.newFromTrace(bData); | ||
const diffDag = TraceDag.diff(aTraceDag, bTraceDag); | ||
edgesAndVertices = convPlexus(diffDag.nodesMap); | ||
return edgesAndVertices; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this CSS selector reflects the state of a component,
uiFind
should be prefixed withis-
, e.g. something like.is-uiFind
or.is-find-mode
.