| OLD | NEW |
| (Empty) |
| 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 | |
| 7 <link rel="import" href="../model/ct-builder-list.html"> | |
| 8 <link rel="import" href="ct-bot-failure-card.html"> | |
| 9 <link rel="import" href="ct-builder-failure-card.html"> | |
| 10 <link rel="import" href="ct-trooper-card.html"> | |
| 11 <link rel="import" href="../bower_components/paper-dialog/paper-dialog.html"> | |
| 12 <link rel="import" href="../bower_components/paper-dialog/paper-dialog-transitio
n.html"> | |
| 13 <link rel="import" href="../bower_components/paper-input/paper-input.html"> | |
| 14 | |
| 15 <polymer-element name="ct-failure-card" attributes="group commitLog tree bug"> | |
| 16 <template> | |
| 17 <style> | |
| 18 :host { | |
| 19 display: block; | |
| 20 } | |
| 21 | |
| 22 #container { | |
| 23 display: flex; | |
| 24 } | |
| 25 | |
| 26 /* FIXME: All this paper-button styling should go in a cr-button component
so that | |
| 27 we can use buttons in different places and have them all look the same.
*/ | |
| 28 paper-button { | |
| 29 -webkit-user-select: none; | |
| 30 background: #f5f5f5; | |
| 31 border-radius: 2px; | |
| 32 border: 1px solid #dcdcdc; | |
| 33 color: #444; | |
| 34 padding: 0 16px; | |
| 35 margin-bottom: 5px; | |
| 36 text-align: center; | |
| 37 } | |
| 38 | |
| 39 paper-button:focus { | |
| 40 border: 1px solid #4d90fe; | |
| 41 outline: none; | |
| 42 } | |
| 43 | |
| 44 paper-button:active { | |
| 45 box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); | |
| 46 } | |
| 47 | |
| 48 paper-button:active, paper-button:hover { | |
| 49 background: #f8f8f8; | |
| 50 border-color: #c6c6c6; | |
| 51 box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1); | |
| 52 color: #222; | |
| 53 } | |
| 54 | |
| 55 #buttons { | |
| 56 display: flex; | |
| 57 flex-direction: column; | |
| 58 } | |
| 59 | |
| 60 .card { | |
| 61 display: flex; | |
| 62 flex: 1; | |
| 63 } | |
| 64 | |
| 65 .snoozed { | |
| 66 opacity: 0.5; | |
| 67 } | |
| 68 </style> | |
| 69 <div id="container"> | |
| 70 <div class="card {{ { snoozed: group.isSnoozed } | tokenList }}"> | |
| 71 <!-- FIXME: Refactor the buttons into their own widget so we don't need
cards within cards --> | |
| 72 <template if="{{ group.data.category == 'sheriff' }}"> | |
| 73 <ct-bot-failure-card class='card' group="{{ group.data }}" builderList
="{{ _builderList }}"></ct-bot-failure-card> | |
| 74 </template> | |
| 75 <template if="{{ group.data.category == 'builder' }}"> | |
| 76 <ct-builder-failure-card class='card' group="{{ group.data }}" builder
List="{{ _builderList }}"></ct-builder-failure-card> | |
| 77 </template> | |
| 78 <template if="{{ group.data.category == 'trooper' }}"> | |
| 79 <ct-trooper-card class='card' group="{{ group.data }}"></ct-trooper-ca
rd> | |
| 80 </template> | |
| 81 </div> | |
| 82 <div id="buttons"> | |
| 83 <paper-button id="examine" on-tap="{{ examine }}" label="Examine"></pape
r-button> | |
| 84 <template if="{{ !group.isSnoozed }}"> | |
| 85 <paper-button id="snooze" on-tap="{{ snooze }}" label="Snooze"></paper
-button> | |
| 86 </template> | |
| 87 <template if="{{ group.isSnoozed }}"> | |
| 88 <paper-button id="snooze" on-tap="{{ unsnooze }}" label="Unsnooze"></p
aper-button> | |
| 89 </template> | |
| 90 <paper-button id="link-bug" on-tap="{{ linkBug }}" label="Link Bug"></pa
per-button> | |
| 91 <template if="{{ group.bug !== undefined }}"> | |
| 92 <div> | |
| 93 <a href="{{ group.bug }}"> | |
| 94 {{ group.bugLabel }}</a> | |
| 95 </div> | |
| 96 </template> | |
| 97 </div> | |
| 98 | |
| 99 <paper-dialog heading="Enter bug number" transition="paper-transition-cent
er" id="bugDialog"> | |
| 100 <paper-input label="Bug# or URL" floatingLabel autofocus id="bug"></pape
r-input> | |
| 101 <paper-button label="Remove bug link" on-tap="{{ removeBug }}" dismissiv
e id="dialogRemoveBug"></paper-button> | |
| 102 <paper-button label="OK" on-tap="{{ saveBug }}" affirmative id="dialogOk
"></paper-button> | |
| 103 </paper-dialog> | |
| 104 </div> | |
| 105 </template> | |
| 106 <script> | |
| 107 Polymer({ | |
| 108 group: null, | |
| 109 commitLog: null, | |
| 110 _builderList: null, | |
| 111 tree: '', | |
| 112 | |
| 113 observe: { | |
| 114 group: '_updateCommitList', | |
| 115 commitLog: '_updateCommitList', | |
| 116 'group.data.failures': '_updateBuilderList', | |
| 117 'group.data.failure': '_updateBuilderList', | |
| 118 }, | |
| 119 | |
| 120 examine: function() { | |
| 121 this.fire('ct-examine-failures', this.group); | |
| 122 }, | |
| 123 | |
| 124 snooze: function() { | |
| 125 this.group.snoozeUntil(Date.now() + 60 * 60 * 1000); | |
| 126 }, | |
| 127 | |
| 128 unsnooze: function() { | |
| 129 this.group.unsnooze(); | |
| 130 }, | |
| 131 | |
| 132 _updateCommitList: function() { | |
| 133 if (this.group && this.group.commitList && this.commitLog) | |
| 134 this.group.commitList.update(this.commitLog); | |
| 135 }, | |
| 136 | |
| 137 _updateBuilderList: function() { | |
| 138 if (this.group.data.category == 'sheriff') | |
| 139 this._builderList = new CTBuilderList(this.group.data.failures); | |
| 140 else if (this.group.data.category == 'builder') | |
| 141 this._builderList = new CTBuilderList(this.group.data.failure); | |
| 142 }, | |
| 143 | |
| 144 linkBug: function() { | |
| 145 this.$.bug.value = this.group.bug; | |
| 146 this.$.bugDialog.toggle(); | |
| 147 }, | |
| 148 | |
| 149 saveBug: function() { | |
| 150 this.group.setBug(this.$.bug.value); | |
| 151 }, | |
| 152 | |
| 153 removeBug: function() { | |
| 154 this.group.clearBug(); | |
| 155 }, | |
| 156 }); | |
| 157 </script> | |
| 158 </polymer-element> | |
| OLD | NEW |