From c84ccca871a85a4fd853d8d006d8b78b6b558b83 Mon Sep 17 00:00:00 2001 From: Yegor Jbanov Date: Wed, 20 Jul 2016 11:30:45 -0700 Subject: [PATCH] refresh (mostly) without page reload --- app/lib/components/status_table.dart | 16 +++++++++++++--- app/web/index.html | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/lib/components/status_table.dart b/app/lib/components/status_table.dart index a33bc1ed9a..b13a9b2260 100644 --- a/app/lib/components/status_table.dart +++ b/app/lib/components/status_table.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:convert' show JSON; import 'package:angular2/angular2.dart'; @@ -11,11 +12,13 @@ import 'package:http/http.dart' as http; @Component( selector: 'status-table', template: ''' -
Loading...
+
+ Loading... +
+ *ngIf="headerRow != null && headerCol != null && headerCol.length > 0">
  @@ -53,10 +56,16 @@ class StatusTable implements OnInit { List headerCol; /// A sparse Commit X Task matrix of test results. - final resultMatrix = >{}; + Map> resultMatrix = >{}; @override ngOnInit() async { + reloadData(); + new Timer.periodic(const Duration(seconds: 30), (_) => reloadData()); + } + + Future reloadData() async { + isLoading = true; Map statusJson = JSON.decode((await _httpClient.get('/api/get-status')).body); GetStatusResult statusResult = GetStatusResult.fromJson(statusJson); isLoading = false; @@ -65,6 +74,7 @@ class StatusTable implements OnInit { headerCol = []; headerRow = new HeaderRow(); + resultMatrix = >{}; for (BuildStatus status in statuses) { String sha = status.checklist.checklist.commit.sha; resultMatrix[sha] ??= {}; diff --git a/app/web/index.html b/app/web/index.html index 9379c3bdcd..746b8ece5b 100644 --- a/app/web/index.html +++ b/app/web/index.html @@ -8,7 +8,7 @@ - + Flutter Dashboard