Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Tools / GardeningServer / lib / revisions.html
1 <!--
2 Copyright 2014 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
5 -->
6 <link rel="import" href="../lib/net.html">
7 <link href="../model/ct-builder-status.html" rel="import">
8
9 <script>
10   // FIXME: Just fetch the latest_builder_info data instead of the entire
11   // alerts structure.
12   var BUILD_DATA_URI = 'https://sheriff-o-matic.appspot.com/alerts';
13
14   var revisions = revisions || {};
15
16   (function() {
17     revisions.parseBuildInfo = function(data) {
18       var groups = data['latest_builder_info'];
19       return new Promise(function(resolve, reject) {
20         var model = new CTBuilderStatus();
21         for (var group in groups) {
22           var modelGroup = new CTBuilderGroup(group);
23           for (var build in groups[group]) {
24             var modelBuilder = new CTBuilderBot(modelGroup, build,
25               groups[group][build]['state'],
26               groups[group][build]['lastUpdateTime']);
27             var revisions = groups[group][build]['revisions'];
28             for (var repository in revisions) {
29               modelBuilder.addRepository(
30                 new CTBuilderRepository(repository, revisions[repository]));
31             }
32             modelGroup.addBuilder(modelBuilder);
33           }
34           model.addGroup(modelGroup);
35         }
36         model.sort();
37         resolve(model);
38       });
39     };
40
41     revisions.load = function() {
42       return net.json(BUILD_DATA_URI).then(revisions.parseBuildInfo);
43     };
44
45   })();
46 </script>