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.
7 <link rel="import" href="../lib/sugar.html">
8 <script src="../scripts/results.js"></script>
10 <link rel="import" href="../bower_components/core-animated-pages/core-animated-pages.html">
11 <link rel="import" href="../bower_components/core-animated-pages/transitions/slide-from-right.html">
12 <link rel="import" href="../lib/analytics.html">
13 <link rel="import" href="../lib/ct-scheduled-updater.html">
14 <link rel="import" href="../model/ct-commit-log.html">
15 <link rel="import" href="../model/ct-failures.html">
16 <link rel="import" href="../model/ct-tree-list.html">
17 <link rel="import" href="ct-results-panel.html">
18 <link rel="import" href="ct-router.html">
19 <link rel="import" href="ct-tree-select.html">
20 <link rel="import" href="ct-unexpected-failures.html">
21 <link rel="import" href="ct-view.html">
22 <link rel="import" href="ct-view-handler.html">
24 <polymer-element name="ct-sheriff-o-matic">
29 flex-direction: column;
33 -webkit-user-select: none;
35 background-color: #212121;
40 justify-content: space-between;
47 display: inline-block;
49 text-decoration: none;
62 core-animated-pages > * {
69 <ct-view-handler></ct-view-handler>
73 <a href="{{ tree }}"><img src="../favicon.ico"> <span>Sheriff-o-matic</span></a>
75 <div id="right-toolbar">
76 <ct-last-updated date="{{ failures.lastUpdateDate }}"></ct-last-updated>
77 <ct-tree-select tree="{{ tree }}" treeList="{{ treeList }}"></ct-tree-select>
81 <ct-router id="router" defaultPath="{{ _defaultPath }}">
82 <ct-view path="/{tree}" default>
83 <ct-unexpected-failures id="unexpected" tree="{{ tree }}" commitLog="{{ commitLog }}" failures="{{ failures }}"></ct-unexpected-failures>
85 <ct-view path="/{tree}/failure/{failureGroupKey}">
86 <ct-results-panel id="resultsPanel" group="{{ examinedFailureGroup }}" failureGroupKey="{{ failureGroupKey }}" tree="{{ tree }}"></ct-results-panel>
91 var kUpdateFrequency = 1000 * 30;
96 examinedFailureGroup: null,
97 _pendingFailureGroupKey: '',
100 this.treeList = new CTTreeList();
101 this._defaultPath = '/' + this.treeList.defaultValue();
102 this.commitLog = new CTCommitLog();
103 this.failures = new CTFailures(this.commitLog);
104 this._updater = new CTScheduledUpdater(this.update.bind(this), kUpdateFrequency);
105 this._analytics = new Analytics('UA-55762617-1');
116 this._promise = Promise.all(
117 [this.commitLog.update(),
118 this.failures.update()]).then(this._updateCompleted.bind(this));
121 failureGroupKeyChanged: function() {
122 this.examinedFailureGroup = null;
123 this._pendingFailureGroupKey = this.failureGroupKey;
124 this._updateCompleted();
127 _updateCompleted: function() {
128 this._promise = null;
129 this.$.unexpected.update();
131 if (!this.failures.failures)
133 if (!this._pendingFailureGroupKey)
136 this.examinedFailureGroup = this.failures.failures[this.tree].find(function(group) {
137 return group.key == this._pendingFailureGroupKey;
140 if (!this.examinedFailureGroup) {
141 this.asyncFire('navigate', {
147 this._pendingFailureGroupKey = '';