diff --git a/app/lib/components/benchmark_grid.dart b/app/lib/components/benchmark_grid.dart
index fdc52b7e9f..35487ed7a5 100644
--- a/app/lib/components/benchmark_grid.dart
+++ b/app/lib/components/benchmark_grid.dart
@@ -15,6 +15,9 @@ import 'package:http/http.dart' as http;
selector: 'benchmark-grid',
template: r'''
Loading...
+
+
+
benchmarks;
Timer _reloadTimer;
+ bool _isShowArchived = false;
+
+ bool get isShowArchived => _isShowArchived;
+
+ void toggleArchived() {
+ _isShowArchived = !_isShowArchived;
+ reloadData();
+ }
@override
void ngOnInit() {
@@ -47,7 +58,9 @@ class BenchmarkGrid implements OnInit, OnDestroy {
isLoading = true;
Map statusJson = JSON.decode((await _httpClient.get('/api/get-benchmarks')).body);
GetBenchmarksResult result = GetBenchmarksResult.fromJson(statusJson);
- benchmarks = result.benchmarks;
+ benchmarks = result.benchmarks
+ .where((BenchmarkData data) => !data.timeseries.timeseries.isArchived || _isShowArchived)
+ .toList();
isLoading = false;
}
}
diff --git a/app/lib/model.dart b/app/lib/model.dart
index f72305625e..9921c42898 100644
--- a/app/lib/model.dart
+++ b/app/lib/model.dart
@@ -257,6 +257,7 @@ class Timeseries extends Entity {
'Label': string(),
'Unit': string(),
'Goal': number(),
+ 'Archived': boolean(),
}
);
@@ -267,6 +268,7 @@ class Timeseries extends Entity {
String get label => this['Label'];
String get unit => this['Unit'];
double get goal => this['Goal'];
+ bool get isArchived => this['Archived'];
}
class TimeseriesValue extends Entity {
diff --git a/app/test/benchmark_grid_test.dart b/app/test/benchmark_grid_test.dart
index ce952f0ca7..ac61ec5028 100644
--- a/app/test/benchmark_grid_test.dart
+++ b/app/test/benchmark_grid_test.dart
@@ -31,7 +31,7 @@ void main() {
test('should show a grid', () async {
List httpCalls = [];
- await bootstrap(BenchmarkGrid, [
+ var component = await bootstrap(BenchmarkGrid, [
provide(http.Client, useValue: new MockClient((http.Request request) async {
httpCalls.add(request.url.path);
return new http.Response(
@@ -45,8 +45,16 @@ void main() {
await new Future.delayed(Duration.ZERO);
expect(httpCalls, ['/api/get-benchmarks']);
- expect(document.querySelectorAll('benchmark-card'),
- hasLength(_testData['Benchmarks'].length));
+ expect(document.querySelectorAll('benchmark-card'), hasLength(5));
+
+ expect(component.instance.isShowArchived, isFalse);
+ document.body.querySelector('#toggleArchived').click();
+ expect(component.instance.isShowArchived, isTrue);
+
+ await new Future.delayed(Duration.ZERO);
+
+ expect(component.instance.benchmarks, hasLength(10));
+ expect(document.querySelectorAll('benchmark-card'), hasLength(10));
});
});
}
@@ -54,7 +62,7 @@ void main() {
final math.Random _rnd = new math.Random(1234);
final _testData = {
- 'Benchmarks': new List.generate(5, (int i) => {
+ 'Benchmarks': new List.generate(10, (int i) => {
'Timeseries': {
'Key': 'key$i',
'Timeseries': {
@@ -62,6 +70,7 @@ final _testData = {
'Label': 'Series $i',
'Unit': 'ms',
'Goal': i.toDouble(),
+ 'Archived': i % 2 != 0, // make half of them archived
},
},
'Values': new List.generate(_rnd.nextInt(5), (int v) => {
diff --git a/db/schema.go b/db/schema.go
index 55c33b7d49..de90df0cf2 100644
--- a/db/schema.go
+++ b/db/schema.go
@@ -94,6 +94,9 @@ type Timeseries struct {
// The current goal we want to reach for this metric. As of today, all our metrics are smaller
// is better.
Goal float64
+ // Indicates that this series contains old data that's no longer interesting (e.g. it will be
+ // hidden from the UI).
+ Archived bool
}
// TimeseriesEntity contains storage data on a Timeseries.