| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. | |
| 3 Use of this source code is governed under the Apache License, Version 2.0 | |
| 4 that can be found in the LICENSE file. | |
| 5 | |
| 6 It contains the definition of the following Behaviors: | |
| 7 | |
| 8 SwarmingBehaviors.TaskBehavior | |
| 9 | |
| 10 This behavior contains many constants and some functions that are useful | |
| 11 for task-related code. | |
| 12 | |
| 13 It also includes the style module "task-style" to allow for common styles | |
| 14 to be shared across multiple pages. | |
| 15 | |
| 16 --> | |
| 17 <script> | |
| 18 window.SwarmingBehaviors = window.SwarmingBehaviors || {}; | |
| 19 (function(){ | |
| 20 SwarmingBehaviors.TaskBehavior = { | |
| 21 properties: { | |
| 22 BOT_DIED: { | |
| 23 type: String, | |
| 24 value: "BOT_DIED", | |
| 25 }, | |
| 26 CANCELED: { | |
| 27 type: String, | |
| 28 value: "CANCELED", | |
| 29 }, | |
| 30 COMPLETED: { | |
| 31 type: String, | |
| 32 value: "COMPLETED", | |
| 33 }, | |
| 34 COMPLETED_DEDUPED: { | |
| 35 type: String, | |
| 36 value: "COMPLETED (DEDUPED)", | |
| 37 }, | |
| 38 COMPLETED_FAILURE: { | |
| 39 type: String, | |
| 40 value: "COMPLETED (FAILURE)", | |
| 41 }, | |
| 42 COMPLETED_SUCCESS: { | |
| 43 type: String, | |
| 44 value: "COMPLETED (SUCCESS)", | |
| 45 }, | |
| 46 EXPIRED: { | |
| 47 type: String, | |
| 48 value: "EXPIRED", | |
| 49 }, | |
| 50 PENDING: { | |
| 51 type: String, | |
| 52 value: "PENDING", | |
| 53 }, | |
| 54 RUNNING: { | |
| 55 type: String, | |
| 56 value: "RUNNING", | |
| 57 }, | |
| 58 TIMED_OUT: { | |
| 59 type: String, | |
| 60 value: "TIMED_OUT", | |
| 61 }, | |
| 62 }, | |
| 63 | |
| 64 stateClass: function(state) { | |
| 65 if (state === this.CANCELED || state === this.TIMED_OUT || state === thi
s.EXPIRED) { | |
| 66 return "exception"; | |
| 67 } | |
| 68 if (state === this.BOT_DIED) { | |
| 69 return "bot_died"; | |
| 70 } | |
| 71 if (state === this.COMPLETED_FAILURE) { | |
| 72 return "failed_task"; | |
| 73 } | |
| 74 if (state === this.RUNNING || state === this.PENDING) { | |
| 75 return "pending_task"; | |
| 76 } | |
| 77 return ""; | |
| 78 } | |
| 79 }; | |
| 80 })(); | |
| 81 </script> | |
| 82 | |
| 83 <dom-module id="task-style"> | |
| 84 <template> | |
| 85 <style> | |
| 86 /* These colors are from buildbot */ | |
| 87 .failed_task { | |
| 88 background-color: #ffdddd; | |
| 89 } | |
| 90 .bot_died { | |
| 91 background-color: #cccccc; | |
| 92 } | |
| 93 .exception { | |
| 94 background-color: #edd2ff; | |
| 95 } | |
| 96 .pending_task { | |
| 97 background-color: #fffc6c; | |
| 98 } | |
| 99 </style> | |
| 100 </template> | |
| 101 </dom-module> | |
| OLD | NEW |