[results feed] Improve button to create GitHub issue
Sort the tests and configurations in the new issue, and
limit list to 30 tests.
Change-Id: Iaf55d0fcdc0de079860e5d43f1b6e6b04d30b1db
Reviewed-on: https://dart-review.googlesource.com/c/dart_ci/+/132325
Reviewed-by: Jonas Termansen <sortie@google.com>
diff --git a/results_feed/lib/src/components/try_results_component.dart b/results_feed/lib/src/components/try_results_component.dart
index ff1cd31..e4858fc 100644
--- a/results_feed/lib/src/components/try_results_component.dart
+++ b/results_feed/lib/src/components/try_results_component.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'dart:html';
+
import 'package:angular/angular.dart';
import 'package:angular_components/angular_components.dart';
import 'package:angular_components/material_button/material_button.dart';
@@ -142,23 +144,32 @@
tryUpdate();
}
+ void openNewGithubIssue() {
+ window.open(githubNewIssueURL(), '_blank');
+ }
+
String githubNewIssueURL() {
String title = "Failures on ${reviewInfo.title}";
List<Change> failures =
changes.where((change) => change.result != change.expected).toList();
+ failures.sort((a, b) => a.name.compareTo(b.name));
+ int failuresLimit = 30;
String body = [
"There are new test failures on CL [${reviewInfo.title}]"
"(https://dart-review.googlesource.com/c/sdk/+/$review).\n",
"The tests",
"```",
- for (final change in failures)
+ for (final change in failures.take(failuresLimit))
"${change.name} ${change.result} (expected ${change.expected})",
+ if (failures.length > failuresLimit)
+ " and ${failures.length - failuresLimit} more tests",
"```",
"are failing on configurations",
"```",
...{
for (final change in failures) ...change.configurations.configurations
- },
+ }.toList()
+ ..sort(),
"```"
].join('\n');
if (failures.isEmpty) {
diff --git a/results_feed/lib/src/components/try_results_component.html b/results_feed/lib/src/components/try_results_component.html
index b5403fe..d1baf68 100644
--- a/results_feed/lib/src/components/try_results_component.html
+++ b/results_feed/lib/src/components/try_results_component.html
@@ -64,13 +64,12 @@
(click)="approve(true)">
Approve
</material-button>
- <span
+ <material-button
*ngIf="approveEnabled && !approving"
- raised>
- <a href="{{githubNewIssueURL()}}" target="_blank">
- Create GitHub issue
- </a>
- </span>
+ raised
+ (click)="openNewGithubIssue()">
+ Create GitHub issue...
+ </material-button>
</div>
</div>
\ No newline at end of file