Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions treeherder/webapp/api/performance_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,14 +571,23 @@ def _build_duplicated_summaries_map(self, page):
for push_id, framework_id in keys:
q |= Q(push_id=push_id, framework_id=framework_id)
rows = PerformanceAlertSummary.objects.filter(q).values(
"id", "status", "push_id", "framework_id"
"id", "status", "push_id", "framework_id", "alerts__related_summary_id"
)
result = defaultdict(list)
result_map = defaultdict(dict)
for row in rows:
result[(row["push_id"], row["framework_id"])].append(
{"id": row["id"], "status": row["status"]}
)
return dict(result)
key = (row["push_id"], row["framework_id"])
summary_id = row["id"]

if summary_id not in result_map[key]:
result_map[key][summary_id] = {
"id": summary_id,
"status": row["status"],
"reassigned_to": row["alerts__related_summary_id"],
}
elif row["alerts__related_summary_id"]:
result_map[key][summary_id]["reassigned_to"] = row["alerts__related_summary_id"]

return {k: list(v.values()) for k, v in result_map.items()}

def _build_tc_metadata_map(self, page):
"""
Expand Down
19 changes: 17 additions & 2 deletions treeherder/webapp/api/performance_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,29 @@ def get_duplicated_summaries(self, performance_alert_summary):
for summary in duplicated_summaries_map.get(key, [])
if summary["id"] != performance_alert_summary.id
]
return list(

rows = (
PerformanceAlertSummary.objects.filter(
push=performance_alert_summary.push, framework=performance_alert_summary.framework
)
.exclude(id=performance_alert_summary.id)
.values("id", "status")
.values("id", "status", "alerts__related_summary_id")
)

result_map = {}
for row in rows:
summary_id = row["id"]
if summary_id not in result_map:
result_map[summary_id] = {
"id": summary_id,
"status": row["status"],
"reassigned_to": row["alerts__related_summary_id"],
}
elif row["alerts__related_summary_id"]:
result_map[summary_id]["reassigned_to"] = row["alerts__related_summary_id"]

return list(result_map.values())

class Meta:
model = PerformanceAlertSummary
fields = [
Expand Down
42 changes: 29 additions & 13 deletions ui/perfherder/alerts/AlertHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
import { getJobsUrl, getPerfCompareBaseURL } from '../../helpers/url';
import { toMercurialShortDateStr } from '../../helpers/display';
import SimpleTooltip from '../../shared/SimpleTooltip';
import Clipboard from '../../shared/Clipboard';

import Assignee from './Assignee';
import TagsList from './TagsList';
Expand Down Expand Up @@ -230,19 +231,34 @@ const AlertHeader = ({
{alertSummary.duplicated_summaries.length > 0 && (
<Row>
Duplicated summaries:
{alertSummary.duplicated_summaries.map((summary, index) => (
<Link
key={summary.id}
className="text-dark me-1"
target="_blank"
to={`/perfherder/alerts?id=${summary.id}&hideDwnToInv=0`}
id={`duplicated alert summary ${summary.id.toString()} `}
style={{ marginLeft: '5px' }}
>
Alert #{summary.id} - {getStatus(summary.status)}
{alertSummary.duplicated_summaries.length - 1 !== index && ', '}
</Link>
))}
{alertSummary.duplicated_summaries.map((summary, index) => {
const isReassigned = getStatus(summary.status) === 'reassigned';
return (
<span
key={summary.id}
className="d-inline-flex align-items-center"
style={{ marginLeft: '5px' }}
>
<Link
className="text-dark me-1"
target="_blank"
to={`/perfherder/alerts?id=${summary.id}&hideDwnToInv=0`}
id={`duplicated alert summary ${summary.id.toString()} `}
>
Alert #{summary.id} - {getStatus(summary.status)}
{isReassigned && summary.reassigned_to && ` to #${summary.reassigned_to}`}
</Link>
{isReassigned && summary.reassigned_to && (
<Clipboard
text={`${summary.reassigned_to}`}
description="Alert ID"
variant="transparent"
/>
)}
{alertSummary.duplicated_summaries.length - 1 !== index && ', '}
</span>
);
})}
</Row>
)}
<Row>
Expand Down