зеркало из https://github.com/mozilla/treeherder.git
Bug 1285368 - Add more details to the clipboard for copy summary (#1741)
This commit is contained in:
Родитель
5219f00e7a
Коммит
a84e94f13e
|
@ -279,7 +279,7 @@ perf.controller('AlertsCtrl', [
|
|||
};
|
||||
|
||||
$scope.copyTextToClipboard = function(alertSummary) {
|
||||
clipboard.copyText(alertSummary.getTextualSummary());
|
||||
clipboard.copyText(alertSummary.getTextualSummary(true));
|
||||
};
|
||||
|
||||
$scope.fileBug = function(alertSummary) {
|
||||
|
|
|
@ -78,14 +78,25 @@ treeherder.factory('PhAlerts', [
|
|||
this.updateStatus(status);
|
||||
};
|
||||
});
|
||||
AlertSummary.prototype.getTextualSummary = function() {
|
||||
AlertSummary.prototype.getTextualSummary = function(copySummary) {
|
||||
var resultStr = "";
|
||||
var improved = _.filter(this.alerts, function(alert) {return !alert.is_regression && alert.visible;});
|
||||
var regressed = _.filter(this.alerts, function(alert) {return alert.is_regression && alert.visible;});
|
||||
// add summary header if getting text for clipboard only
|
||||
if (copySummary) {
|
||||
var lastUpdated = new Date(this.last_updated);
|
||||
resultStr += "== Change summary for alert #" + this.id +
|
||||
" (as of " + lastUpdated.toLocaleFormat("%B %d %Y %H:%M UTC") + ") ==\n";
|
||||
}
|
||||
if (regressed.length > 0) {
|
||||
// add a newline if we displayed the header
|
||||
if (copySummary) {
|
||||
resultStr += "\n";
|
||||
}
|
||||
resultStr += "Summary of tests that regressed:\n\n" +
|
||||
_.map(regressed, function(alert) {
|
||||
return " " + alert.title + " - " + alert.amount_pct + "% worse";
|
||||
return " " + alert.title + ": " + alert.prev_value + " -> " +
|
||||
alert.new_value + " (" + alert.amount_pct + "% worse)";
|
||||
}).join('\n') + "\n";
|
||||
}
|
||||
if (improved.length > 0) {
|
||||
|
@ -95,9 +106,15 @@ treeherder.factory('PhAlerts', [
|
|||
}
|
||||
resultStr += "Summary of tests that improved:\n\n" +
|
||||
_.map(improved, function(alert) {
|
||||
return " " + alert.title + " - " + alert.amount_pct + "% better";
|
||||
return " " + alert.title + ": " + alert.prev_value + " -> " +
|
||||
alert.new_value + " (" + alert.amount_pct + "% better)";
|
||||
}).join('\n') + "\n";
|
||||
}
|
||||
// include link to alert if getting text for clipboard only
|
||||
if (copySummary) {
|
||||
var alertLink = window.location.origin + '/perf.html#/alerts?id=' + this.id;
|
||||
resultStr += "\nFor up to date results, see: " + alertLink;
|
||||
}
|
||||
return resultStr;
|
||||
};
|
||||
AlertSummary.prototype.isResolved = function() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче