| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2015 The Chromium Authors. All rights reserved. | 2 Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can be | 3 Use of this source code is governed by a BSD-style license that can be |
| 4 found in the LICENSE file. | 4 found in the LICENSE file. |
| 5 --> | 5 --><html><head><link rel="import" href="ct-trooper-card.html"> |
| 6 | 6 <dom-module id="ct-health"> |
| 7 <link rel="import" href="ct-trooper-card.html"> | 7 <template> |
| 8 <polymer-element name="ct-health" attributes="failures" noscript> | |
| 9 <template> | |
| 10 <h2>System Health</h2> | 8 <h2>System Health</h2> |
| 11 <template repeat="{{ group in failures.failures['health'] }}"> | 9 <template is="dom-repeat" items="{{failures.failures['health']}}" as="group"> |
| 12 <template if="{{ group.data.category == 'trooper' }}"> | 10 <template is="dom-if" if="{{computeIf2(group)}}"> |
| 13 <ct-trooper-card class='{{ { snoozed: group.isSnoozed } | tokenList }}' gr
oup="{{ group.data }}"></ct-trooper-card> | 11 <ct-trooper-card group="{{ group.data }}" class$="{{computeClass(group)}}"
></ct-trooper-card> |
| 14 </template> | 12 </template> |
| 15 </template> | 13 </template> |
| 16 <template if="{{ !failures.failures['health'] || failures.failures['health'].l
ength == 0 }}"> | 14 <template is="dom-if" if="{{computeIf(failures)}}"> |
| 17 <ct-party-time></ct-party-time> | 15 <ct-party-time></ct-party-time> |
| 18 </template> | 16 </template> |
| 19 </template> | 17 </template> |
| 20 </polymer-element> | 18 <script> |
| 19 Polymer({ |
| 20 is: 'ct-health', |
| 21 properties: { failures: { notify: true } }, |
| 22 computeIf: function (failures) { |
| 23 return !failures.failures['health'] || failures.failures['health'].lengt
h == 0; |
| 24 }, |
| 25 computeIf2: function (group) { |
| 26 return group.data.category == 'trooper'; |
| 27 }, |
| 28 computeClass: function (group) { |
| 29 return this.tokenList({ snoozed: group.isSnoozed }); |
| 30 }, |
| 31 tokenList: function (obj) { |
| 32 var pieces = []; |
| 33 for (key in obj) { |
| 34 if (obj[key]) { |
| 35 pieces.push(key); |
| 36 } |
| 37 } |
| 38 return pieces.join(' '); |
| 39 } |
| 40 }); |
| 41 </script> |
| 42 </dom-module> |
| OLD | NEW |