-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added view for showing detailed trace statistics
Signed-off-by: Philip Dengler <philip.dengler@novatec-gmbh.de>
- Loading branch information
Philip
committed
Jan 7, 2020
1 parent
537bbe2
commit fb61183
Showing
21 changed files
with
2,279 additions
and
53 deletions.
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
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
61 changes: 61 additions & 0 deletions
61
packages/jaeger-ui/src/components/TracePage/TraceTagOverview/DetailTableData.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,61 @@ | ||
/* | ||
Copyright (c) 2018 The Jaeger Authors. | ||
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. | ||
*/ | ||
|
||
.DetailTableData--tr { | ||
border-top: 1px solid #ececec; | ||
} | ||
|
||
.DetailTableData--tr:hover { | ||
background: #fafafa; | ||
color: black; | ||
} | ||
|
||
.DetailTableData--child--td { | ||
border-left: 1px solid rgb(204, 204, 204); | ||
border-right: 1px solid rgb(204, 204, 204); | ||
border-top: 1px solid rgb(230, 230, 230); | ||
border-bottom: 1px solid rgb(230, 230, 230); | ||
width: 10%; | ||
padding-left: 2em; | ||
|
||
max-width: 25em; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
|
||
td { | ||
max-width: 25em; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
|
||
.DetailTableData--serviceBorder { | ||
border-left: 4px solid transparent; | ||
padding-left: 0.6em; | ||
} | ||
|
||
.DetailTableData--td { | ||
border-left: 1px solid rgb(204, 204, 204); | ||
border-right: 1px solid rgb(204, 204, 204); | ||
border-top: 1px solid rgb(230, 230, 230); | ||
border-bottom: 1px solid rgb(230, 230, 230); | ||
width: 9.09%; | ||
padding-left: 1em; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} |
102 changes: 102 additions & 0 deletions
102
packages/jaeger-ui/src/components/TracePage/TraceTagOverview/DetailTableData.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,102 @@ | ||
// Copyright (c) 2018 The Jaeger Authors. | ||
// | ||
// 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 _ from 'lodash'; | ||
import React, { Component } from 'react'; | ||
import './DetailTableData.css'; | ||
|
||
type Props = { | ||
name: string; | ||
searchColor: string; | ||
values: any[]; | ||
columnsArray: any[]; | ||
color: string; | ||
togglePopup: (name: string) => void; | ||
secondTagDropdownTitle: string; | ||
colorToPercent: string; | ||
}; | ||
|
||
type State = { | ||
element: any; | ||
}; | ||
|
||
/** | ||
* Used to render the detail column. | ||
*/ | ||
export default class DetailTableData extends Component<Props, State> { | ||
componentWillMount() { | ||
const element = this.props.values.map(item => { | ||
return { uid: _.uniqueId('id'), value: item }; | ||
}); | ||
|
||
this.setState(prevState => { | ||
return { | ||
...prevState, | ||
element, | ||
}; | ||
}); | ||
} | ||
|
||
render() { | ||
const styleOption1 = { | ||
background: 'rgb(248,248,248)', | ||
color: 'rgb(153,153,153)', | ||
fontStyle: 'italic', | ||
}; | ||
|
||
const styleOption2 = { | ||
background: this.props.colorToPercent, | ||
borderColor: this.props.colorToPercent, | ||
}; | ||
|
||
const styleOption3 = { | ||
background: this.props.searchColor, | ||
borderColor: this.props.searchColor, | ||
}; | ||
const others = 'Others'; | ||
let styleCondition; | ||
if (this.props.name === others) { | ||
styleCondition = styleOption1; | ||
} else if (this.props.searchColor === 'rgb(248,248,248)') { | ||
styleCondition = styleOption2; | ||
} else { | ||
styleCondition = styleOption3; | ||
} | ||
const onClickOption = | ||
this.props.secondTagDropdownTitle === 'sql' && this.props.name !== others | ||
? () => this.props.togglePopup(this.props.name) | ||
: undefined; | ||
return ( | ||
<tr className="DetailTableData--tr" style={styleCondition}> | ||
<td className="DetailTableData--child--td"> | ||
<a role="button" onClick={onClickOption} style={{ color: 'inherit' }}> | ||
<label | ||
title={this.props.name} | ||
className="DetailTableData--serviceBorder" | ||
style={{ borderColor: this.props.color }} | ||
> | ||
{this.props.name} | ||
</label> | ||
</a> | ||
</td> | ||
{this.state.element.map((element: any, index: number) => ( | ||
<td key={element.uid} className="DetailTableData--td"> | ||
{this.props.columnsArray[index + 1].isDecimal ? Number(element.value).toFixed(2) : element.value} | ||
{this.props.columnsArray[index + 1].suffix} | ||
</td> | ||
))} | ||
</tr> | ||
); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/jaeger-ui/src/components/TracePage/TraceTagOverview/Dropdown.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,22 @@ | ||
/* | ||
Copyright (c) 2018 The Jaeger Authors. | ||
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. | ||
*/ | ||
|
||
.DropDown { | ||
padding-top: 0.6em; | ||
padding-bottom: 0.6em; | ||
padding-left: 0.6em; | ||
position: relative; | ||
display: inline-block; | ||
} |
97 changes: 97 additions & 0 deletions
97
packages/jaeger-ui/src/components/TracePage/TraceTagOverview/Dropdown.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,97 @@ | ||
// Copyright (c) 2018 The Jaeger Authors. | ||
// | ||
// 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, { Component } from 'react'; | ||
import { Button, Dropdown, Icon, Menu } from 'antd'; | ||
import './Dropdown.css'; | ||
import { Trace } from '../../../types/trace'; | ||
import { getColumnValues, getColumnValuesSecondDropdown } from './tableValues'; | ||
import { ITableSpan } from './types'; | ||
|
||
type Props = { | ||
position: number; | ||
trace: Trace; | ||
tableValue: ITableSpan[]; | ||
content: string[]; | ||
setDropDownTitle: (title: string) => void; | ||
title: string; | ||
firstDropdownTitle: string; | ||
handler: (tableSpan: ITableSpan[]) => void; | ||
}; | ||
|
||
const serviceName = 'Service Name'; | ||
const operationName = 'Operation Name'; | ||
const noItemSelected = 'No Item selected'; | ||
|
||
/** | ||
* Used to build the Dropdown. | ||
*/ | ||
export default class DropDown extends Component<Props> { | ||
constructor(props: any) { | ||
super(props); | ||
|
||
if (this.props.position === 1) { | ||
this.props.handler(getColumnValues(serviceName, this.props.trace)); | ||
} | ||
} | ||
|
||
/** | ||
* Is called if a tag is clicked. | ||
* @param title name of the clicked tag | ||
*/ | ||
tagIsClicked(title: string) { | ||
this.props.setDropDownTitle(title); | ||
if (this.props.position === 1) { | ||
this.props.handler(getColumnValues(title, this.props.trace)); | ||
} else { | ||
this.props.handler( | ||
getColumnValuesSecondDropdown( | ||
this.props.tableValue, | ||
this.props.firstDropdownTitle, | ||
title, | ||
this.props.trace | ||
) | ||
); | ||
} | ||
} | ||
|
||
render() { | ||
const menu = ( | ||
<Menu> | ||
{this.props.content.map((title: any) => ( | ||
<Menu.Item key={title}> | ||
<a onClick={() => this.tagIsClicked(title)} role="button"> | ||
{title !== serviceName && title !== operationName ? `Tag: ${title}` : `${title}`} | ||
</a> | ||
</Menu.Item> | ||
))} | ||
</Menu> | ||
); | ||
const buttonTitleTag = | ||
this.props.title !== serviceName && | ||
this.props.title !== operationName && | ||
this.props.title !== noItemSelected | ||
? `Tag: ${this.props.title}` | ||
: `${this.props.title}`; | ||
return ( | ||
<div className="DropDown"> | ||
<Dropdown overlay={menu}> | ||
<Button> | ||
{buttonTitleTag} <Icon type="down" /> | ||
</Button> | ||
</Dropdown> | ||
</div> | ||
); | ||
} | ||
} |
Oops, something went wrong.