forked from jaegertracing/jaeger-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
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
DDG graph node #6
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6da65d7
Initial DDG graph node rendering
tiffon d8a72da
Add DdgNode actions, tests for getNodeLabel/*
tiffon d507832
Merge pull request #386 from everett980/jag-500-create-graph-edges-an…
everett980 721ff66
Misc tweaks to DDG graph node
tiffon 6510306
Merge branch 'ddg-graph-component' into ddg-graph-node
tiffon fc98987
Merge pull request #5 from everett980/ddg-graph-component
everett980 a6cab98
Merge pull request #4 from everett980/ddg-error-and-loading
everett980 ef15710
Add clarifying comment and new lines
everett980 fdea0f7
Merge pull request #398 from everett980/fetch-ddg-action-and-reducer
everett980 9cc93be
Fix typo on README file
leogomes bcc8fa6
Fix typo on README file
yurishkuro 5c9acbe
Fix GA filter category copy-paste
everett980 59f952d
Fix GA filter category copy-paste (#404)
tiffon ea60925
Merge branch 'master' into ddg-graph-node
tiffon 2b56c46
Add focalNodeUrl to DdgNode
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 was deleted.
Oops, something went wrong.
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
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
100 changes: 100 additions & 0 deletions
100
packages/jaeger-ui/src/components/DeepDependencyGraph/getNodeLabel/DdgNode.css
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,100 @@ | ||
/* | ||
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. | ||
*/ | ||
|
||
.DdgNode--core { | ||
background: #fff; | ||
border: 1px solid #bbb; | ||
box-shadow: 0 0px 4px 1px rgba(0, 0, 0, 0.07); | ||
display: flex; | ||
min-width: 125px; | ||
} | ||
|
||
.DdgNode--core.is-focalNode { | ||
border-color: #eb2f96; | ||
} | ||
|
||
.DdgNode--core.is-focalNode::before { | ||
bottom: 0; | ||
content: ''; | ||
left: 0; | ||
outline: 20px solid rgba(255, 255, 255, 0.2); | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
} | ||
.DdgNode--core.is-focalNode::after { | ||
bottom: 0; | ||
content: ''; | ||
left: 0; | ||
outline-offset: 20px; | ||
outline: 1px dashed #ec8cb475; | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
} | ||
|
||
.DdgNode--focalMarker { | ||
align-items: center; | ||
background: #eb2f96; | ||
display: flex; | ||
padding: 0.3rem 0.15rem; | ||
} | ||
|
||
.DdgNode--label { | ||
margin: 0; | ||
padding: 0.5rem 0.5rem 0.3rem 0.75rem; | ||
white-space: nowrap; | ||
} | ||
|
||
.DdgNode--label:not(:first-child) { | ||
padding-top: 0.2rem; | ||
} | ||
|
||
.DdgNode--actionsWrapper { | ||
background: #fff; | ||
border-radius: 3px; | ||
border-bottom-left-radius: 0; | ||
border-bottom-right-radius: 0; | ||
bottom: 100%; | ||
box-shadow: 0 0px 4px 1px rgba(0, 0, 0, 0.1); | ||
left: 1em; | ||
opacity: 0; | ||
pointer-events: none; | ||
position: absolute; | ||
transition: opacity 0.1s; | ||
white-space: nowrap; | ||
} | ||
|
||
.DdgNode:hover > .DdgNode--actionsWrapper { | ||
opacity: 1; | ||
pointer-events: all; | ||
} | ||
|
||
.DdgNode--actionsItem { | ||
align-items: center; | ||
display: flex; | ||
padding: 0.5em; | ||
} | ||
|
||
.DdgNode--actionsItem:not(:hover) { | ||
color: inherit; | ||
} | ||
|
||
.DdgNode--actionsItemText { | ||
font-size: 0.9em; | ||
line-height: normal; | ||
margin-left: 0.5em; | ||
} |
66 changes: 66 additions & 0 deletions
66
packages/jaeger-ui/src/components/DeepDependencyGraph/getNodeLabel/DdgNode.test.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,66 @@ | ||
// 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 React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import DdgNode from './DdgNode'; | ||
import { EViewModifier } from '../../../model/ddg/types'; | ||
|
||
describe('<DdgNode>', () => { | ||
const vertexKey = 'some-key'; | ||
const service = 'some-service'; | ||
const operation = 'some-operation'; | ||
|
||
let wrapper; | ||
let props; | ||
|
||
beforeEach(() => { | ||
props = { | ||
vertexKey, | ||
service, | ||
operation, | ||
isFocalNode: false, | ||
focalNodeUrl: 'some-url', | ||
setViewModifier: jest.fn(), | ||
}; | ||
wrapper = shallow(<DdgNode {...props} />); | ||
}); | ||
|
||
it('does not explode', () => { | ||
expect(wrapper.exists()).toBe(true); | ||
}); | ||
|
||
it('omits the operation if it is null', () => { | ||
expect(wrapper).toMatchSnapshot(); | ||
wrapper.setProps({ operation: null }); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
it('calls setViewModifier on mouse over, out', () => { | ||
const { calls } = props.setViewModifier.mock; | ||
wrapper.simulate('mouseover', { type: 'mouseover' }); | ||
expect(calls.length).toBe(1); | ||
wrapper.simulate('mouseout', { type: 'mouseout' }); | ||
expect(calls.length).toBe(2); | ||
expect(calls[0]).toEqual([vertexKey, EViewModifier.Hovered, true]); | ||
expect(calls[1]).toEqual([vertexKey, EViewModifier.Hovered, false]); | ||
}); | ||
|
||
it('renders correctly when isFocalNode = true and focalNodeUrl = null', () => { | ||
expect(wrapper).toMatchSnapshot(); | ||
wrapper.setProps({ focalNodeUrl: null, isFocalNode: true }); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
68 changes: 68 additions & 0 deletions
68
packages/jaeger-ui/src/components/DeepDependencyGraph/getNodeLabel/DdgNode.tsx
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,68 @@ | ||
// 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 cx from 'classnames'; | ||
|
||
import focalNodeIcon from './focalNodeIcon'; | ||
import setFocusButtonIcon from './setFocusButtonIcon'; | ||
import NewWindowIcon from '../../common/NewWindowIcon'; | ||
import { EViewModifier } from '../../../model/ddg/types'; | ||
|
||
import './DdgNode.css'; | ||
|
||
type TProps = { | ||
vertexKey: string; | ||
service: string; | ||
operation: string | null; | ||
focalNodeUrl: string | null; | ||
isFocalNode: boolean; | ||
viewModifiers: number; | ||
setViewModifier: (vertexKey: string, viewModifier: EViewModifier, isEnabled: boolean) => void; | ||
}; | ||
|
||
export default class Node extends React.PureComponent<TProps> { | ||
onMouseUx = (event: React.MouseEvent<HTMLElement>) => { | ||
const { vertexKey, setViewModifier } = this.props; | ||
setViewModifier(vertexKey, EViewModifier.Hovered, event.type === 'mouseover'); | ||
}; | ||
|
||
render() { | ||
const { focalNodeUrl, isFocalNode, operation, service } = this.props; | ||
return ( | ||
<div className="DdgNode" onMouseOver={this.onMouseUx} onMouseOut={this.onMouseUx}> | ||
<div className={cx('DdgNode--core', { 'is-focalNode': isFocalNode })}> | ||
{isFocalNode && <div className="DdgNode--focalMarker">{focalNodeIcon}</div>} | ||
<div> | ||
<h4 className="DdgNode--label">{service}</h4> | ||
{operation && <div className="DdgNode--label">{operation}</div>} | ||
</div> | ||
</div> | ||
|
||
<div className="DdgNode--actionsWrapper"> | ||
{focalNodeUrl && ( | ||
<a href={focalNodeUrl} className="DdgNode--actionsItem"> | ||
{setFocusButtonIcon} | ||
<span className="DdgNode--actionsItemText">Set focus</span> | ||
</a> | ||
)} | ||
<a className="DdgNode--actionsItem"> | ||
<NewWindowIcon /> | ||
<span className="DdgNode--actionsItemText">View traces</span> | ||
</a> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
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.
Should vertices have an array of
traceID
s to power this? I know Prithvi's payload includes a traceID per pathThere 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.
Let's fill this in after we have the backend wired up.