problems panel: highlight correlation tag

This commit is contained in:
Alexander Zobnin
2018-12-04 22:56:45 +03:00
parent 286feef3cd
commit 1ffafac026
3 changed files with 12 additions and 5 deletions

View File

@@ -86,17 +86,18 @@ function djb2(str) {
interface EventTagProps { interface EventTagProps {
tag: ZBXTag; tag: ZBXTag;
highlight?: boolean;
} }
function EventTag(props: EventTagProps) { function EventTag(props: EventTagProps) {
const { tag } = props; const { tag, highlight } = props;
const tagColor = getTagColorsFromName(tag.tag); const tagColor = getTagColorsFromName(tag.tag);
const style: React.CSSProperties = { const style: React.CSSProperties = {
background: tagColor.color, background: tagColor.color,
borderColor: tagColor.borderColor, borderColor: tagColor.borderColor,
}; };
return ( return (
<span className="label label-tag zbx-tag" style={style}> <span className={`label label-tag zbx-tag ${highlight ? 'highlighted' : ''}`} style={style}>
{tag.tag}: {tag.value} {tag.tag}: {tag.value}
</span> </span>
); );

View File

@@ -322,7 +322,9 @@ class ProblemDetails extends PureComponent<any, any> {
</div> </div>
} }
<div className="problem-tags"> <div className="problem-tags">
{problem.tags && problem.tags.map(tag => <EventTag key={tag.tag + tag.value} tag={tag} />)} {problem.tags && problem.tags.map(tag =>
<EventTag key={tag.tag + tag.value} tag={tag} highlight={tag.tag === problem.correlation_tag} />)
}
</div> </div>
{problem.acknowledges && !wideLayout && {problem.acknowledges && !wideLayout &&
<div className="problem-ack-container"> <div className="problem-ack-container">

View File

@@ -145,6 +145,10 @@
} }
.label-tag, .zbx-tag { .label-tag, .zbx-tag {
margin-right: 0.6rem; margin-right: 0.6rem;
&.highlighted {
box-shadow: 0 0 10px $orange;
}
} }
} }
@@ -176,7 +180,7 @@
.problem-details { .problem-details {
position: relative; position: relative;
flex: 10 0 auto; flex: 10 1 auto;
padding: 0.5rem 1rem 0.5rem 1.2rem; padding: 0.5rem 1rem 0.5rem 1.2rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -279,7 +283,7 @@
.problem-details-right { .problem-details-right {
// flex: 1 0 auto; flex: 0 0 auto;
padding: 0.5rem 2rem; padding: 0.5rem 2rem;
// background: $dark-4; // background: $dark-4;
color: $text-color-muted; color: $text-color-muted;