[results feed] Only show failing results in results approval UI
Change-Id: Ifec392b8ec17821decba75cf538cdc21a4e6fd09
Reviewed-on: https://dart-review.googlesource.com/c/dart_ci/+/127900
Reviewed-by: Alexander Thomas <athom@google.com>
diff --git a/results_feed/lib/src/components/results_selector_panel.dart b/results_feed/lib/src/components/results_selector_panel.dart
index 4aa67b9..9c666ba 100644
--- a/results_feed/lib/src/components/results_selector_panel.dart
+++ b/results_feed/lib/src/components/results_selector_panel.dart
@@ -48,6 +48,20 @@
@Input()
set changes(Changes changes) {
_changes = changes;
+ recomputeChanges();
+ }
+
+ Changes get changes => _changes;
+ Changes _changes;
+
+ // Removes passing changes if failuresOnly is set. Does not handle changing
+ // failuresOnly from true to false.
+ void recomputeChanges() {
+ if (_changes == null) return;
+ if (failuresOnly) {
+ _changes = Changes(
+ changes.flat.where((change) => change.result != change.expected));
+ }
for (final configurationGroup in changes) {
configurationCheckboxes[configurationGroup] = FixedMixedCheckbox();
for (final resultGroup in configurationGroup) {
@@ -73,34 +87,23 @@
}
@Input()
- bool failuresOnly = false;
+ set failuresOnly(bool value) {
+ _failuresOnly = value;
+ recomputeChanges();
+ }
- Changes _changes;
+ bool get failuresOnly => _failuresOnly;
+
+ bool _failuresOnly = false;
+
Set<Change> _selected;
final checked = Map<Change, bool>();
final resultCheckboxes = Map<List<Change>, FixedMixedCheckbox>();
- final _showResultGroupCheckbox = Map<List<Change>, bool>();
final configurationCheckboxes = Map<List<List<Change>>, FixedMixedCheckbox>();
- final _showConfigurationCheckbox = Map<List<List<Change>>, bool>();
-
- // When pinning results to a blamelist, we select all results.
- // When approving results, we only show checkboxes for the failures.
- bool showCheckbox(Change change) =>
- !failuresOnly || change.result != change.expected;
- bool showResultGroupCheckbox(List<Change> group) =>
- !failuresOnly ||
- _showResultGroupCheckbox.putIfAbsent(
- group, () => group.any(showCheckbox));
- bool showConfigurationCheckbox(List<List<Change>> group) =>
- !failuresOnly ||
- _showConfigurationCheckbox.putIfAbsent(
- group, () => group.any(showResultGroupCheckbox));
int resultLimit = 10;
- Changes get changes => _changes;
-
final preferredTooltipPositions = [
RelativePosition.OffsetBottomLeft,
RelativePosition.OffsetTopLeft
@@ -117,7 +120,7 @@
void initializeSelected() {
if (_selected != null && _changes != null) {
- _selected.addAll(checked.keys.where(showCheckbox));
+ _selected.addAll(checked.keys);
}
}
@@ -147,7 +150,7 @@
assert(event != 'mixed');
bool newChecked = event == 'true';
checkbox.setState(newChecked, false);
- for (final change in resultGroup.where(showCheckbox)) {
+ for (final change in resultGroup) {
setCheckbox(change, newChecked);
}
configurationCheckboxes[configurationGroup].setMixed();
@@ -160,9 +163,9 @@
assert(event != 'mixed');
bool newChecked = event == 'true';
checkbox.setState(newChecked, false);
- for (final subgroup in configurationGroup.where(showResultGroupCheckbox)) {
+ for (final subgroup in configurationGroup) {
resultCheckboxes[subgroup].setState(newChecked, false);
- for (final change in subgroup.where(showCheckbox)) {
+ for (final change in subgroup) {
setCheckbox(change, newChecked);
}
}
diff --git a/results_feed/lib/src/components/results_selector_panel.html b/results_feed/lib/src/components/results_selector_panel.html
index 27eb610..b1202f4 100644
--- a/results_feed/lib/src/components/results_selector_panel.html
+++ b/results_feed/lib/src/components/results_selector_panel.html
@@ -1,7 +1,6 @@
<div *ngFor="let configurationGroup of changes">
<material-chips>
<material-checkbox
- *ngIf="showConfigurationCheckbox(configurationGroup)"
class="result-checkbox"
[checked]="configurationCheckboxes[configurationGroup].checked"
[indeterminate]="configurationCheckboxes[configurationGroup].indeterminate"
@@ -30,7 +29,6 @@
<div *ngFor="let resultGroup of configurationGroup"
class="indent">
<material-checkbox
- *ngIf="showResultGroupCheckbox(resultGroup)"
no-ink
[checked]="resultCheckboxes[resultGroup].checked"
(change)="onResultChange($event, resultGroup, configurationGroup)"
@@ -45,7 +43,6 @@
tooltipTarget
#logs="tooltipTarget">
<material-checkbox
- *ngIf="showCheckbox(change)"
class="result-checkbox"
no-ink
[checked]="checked[change]"
diff --git a/results_feed/pubspec.lock b/results_feed/pubspec.lock
index 463b97f..092dadf 100644
--- a/results_feed/pubspec.lock
+++ b/results_feed/pubspec.lock
@@ -252,7 +252,7 @@
name: dart_internal
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.7"
+ version: "0.1.8"
dart_style:
dependency: transitive
description:
@@ -695,4 +695,4 @@
source: hosted
version: "2.2.0"
sdks:
- dart: ">=2.6.0 <=2.7.0-dev.0.0"
+ dart: ">=2.6.0 <2.8.0"