-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add warning accordian in span details
- Loading branch information
1 parent
dcfa684
commit 28d047f
Showing
14 changed files
with
250 additions
and
23 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
40 changes: 40 additions & 0 deletions
40
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/AccordianText.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,40 @@ | ||
/* | ||
Copyright (c) 2017 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. | ||
*/ | ||
|
||
.AccordianText--header { | ||
cursor: pointer; | ||
overflow: hidden; | ||
padding: 0.25em 0.1em; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
} | ||
|
||
.AccordianText--header:hover { | ||
background: #e8e8e8; | ||
} | ||
|
||
.AccordianText--header.is-empty { | ||
background: none; | ||
cursor: initial; | ||
} | ||
|
||
.AccordianText--header.is-high-contrast:not(.is-empty):hover { | ||
background: #ddd; | ||
} | ||
|
||
.AccordianText--emptyIcon { | ||
color: #aaa; | ||
} |
75 changes: 75 additions & 0 deletions
75
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/AccordianText.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,75 @@ | ||
// Copyright (c) 2017 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 IoIosArrowDown from 'react-icons/lib/io/ios-arrow-down'; | ||
import IoIosArrowRight from 'react-icons/lib/io/ios-arrow-right'; | ||
import TextList from './TextList'; | ||
import { TNil } from '../../../../types'; | ||
|
||
import './AccordianText.css'; | ||
|
||
type AccordianTextProps = { | ||
className?: string | TNil; | ||
data: string[]; | ||
highContrast?: boolean; | ||
interactive?: boolean; | ||
isOpen: boolean; | ||
label: string; | ||
onToggle?: null | (() => void); | ||
prefixIcon?: null | React.ReactElement; | ||
}; | ||
|
||
export default function AccordianText(props: AccordianTextProps) { | ||
const { className, data, highContrast, interactive, isOpen, label, onToggle, prefixIcon } = props; | ||
const isEmpty = !Array.isArray(data) || !data.length; | ||
const iconCls = cx('u-align-icon', { 'AccordianKeyValues--emptyIcon': isEmpty }); | ||
let arrow: React.ReactNode | null = null; | ||
let headerProps: Object | null = null; | ||
if (interactive) { | ||
arrow = isOpen ? <IoIosArrowDown className={iconCls} /> : <IoIosArrowRight className={iconCls} />; | ||
headerProps = { | ||
'aria-checked': isOpen, | ||
onClick: isEmpty ? null : onToggle, | ||
role: 'switch', | ||
}; | ||
} | ||
return ( | ||
<div className={cx(className, 'u-tx-ellipsis')}> | ||
<div | ||
className={cx('AccordianText--header', { | ||
'is-empty': isEmpty, | ||
'is-high-contrast': highContrast, | ||
})} | ||
{...headerProps} | ||
> | ||
{arrow} | ||
{React.isValidElement(prefixIcon) && prefixIcon} | ||
<strong> | ||
{label} | ||
{isOpen || ':'} | ||
</strong> | ||
</div> | ||
{isOpen && <TextList data={data} />} | ||
</div> | ||
); | ||
} | ||
|
||
AccordianText.defaultProps = { | ||
className: null, | ||
highContrast: false, | ||
interactive: true, | ||
onToggle: null, | ||
}; |
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
40 changes: 40 additions & 0 deletions
40
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/TextList.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,40 @@ | ||
/* | ||
Copyright (c) 2017 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. | ||
*/ | ||
|
||
.TextListTable { | ||
background: #fff; | ||
border: 1px solid #ddd; | ||
margin-bottom: 0.7em; | ||
max-height: 450px; | ||
overflow: auto; | ||
} | ||
|
||
.TextListTable--body { | ||
vertical-align: baseline; | ||
} | ||
|
||
.TextListTable--row > td { | ||
padding: 0.25rem 0.5rem; | ||
} | ||
|
||
.TextListTable--row:nth-child(2n) > td { | ||
background: #f5f5f5; | ||
} | ||
|
||
.TextListTable--row > td { | ||
padding: 0.25rem 0.5rem; | ||
vertical-align: top; | ||
} |
42 changes: 42 additions & 0 deletions
42
packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/TextList.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,42 @@ | ||
// Copyright (c) 2017 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 './TextList.css'; | ||
|
||
type TextListProps = { | ||
data: string[]; | ||
}; | ||
|
||
export default function TextList(props: TextListProps) { | ||
const { data } = props; | ||
return ( | ||
<div className="TextListTable u-simple-scrollbars"> | ||
<table className="u-width-100"> | ||
<tbody className="TextListTable--body"> | ||
{data.map((row, i) => { | ||
return ( | ||
// `i` is necessary in the key because row.key can repeat | ||
// eslint-disable-next-line react/no-array-index-key | ||
<tr className="TextListTable--row" key={`${i}`}> | ||
<td>{row}</td> | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
</div> | ||
); | ||
} |
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
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.