| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // TODO(kjlubick): add tests for this code | |
| 6 | |
| 7 this.swarming = this.swarming || {}; | 5 this.swarming = this.swarming || {}; |
| 8 this.swarming.alias = this.swarming.alias || (function(){ | 6 this.swarming.alias = this.swarming.alias || (function(){ |
| 9 var ANDROID_ALIASES = { | 7 var ANDROID_ALIASES = { |
| 10 "angler": "Nexus 6p", | 8 "angler": "Nexus 6p", |
| 11 "bullhead": "Nexus 5X", | 9 "bullhead": "Nexus 5X", |
| 12 "flo": "Nexus 7 (2013)", | 10 "flo": "Nexus 7 (2013)", |
| 13 "flounder": "Nexus 9", | 11 "flounder": "Nexus 9", |
| 14 "foster": "NVIDIA Shield", | 12 "foster": "NVIDIA Shield", |
| 15 "fugu": "Nexus Player", | 13 "fugu": "Nexus Player", |
| 16 "grouper": "Nexus 7 (2012)", | 14 "grouper": "Nexus 7 (2012)", |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 5: "Full", | 68 5: "Full", |
| 71 } | 69 } |
| 72 | 70 |
| 73 // For consistency, all aliases are displayed like: | 71 // For consistency, all aliases are displayed like: |
| 74 // Nexus 5X (bullhead) | 72 // Nexus 5X (bullhead) |
| 75 // This regex matches a string like "ALIAS (ORIG)", with ORIG as group 1. | 73 // This regex matches a string like "ALIAS (ORIG)", with ORIG as group 1. |
| 76 var ALIAS_REGEXP = /.+ \((.*)\)/; | 74 var ALIAS_REGEXP = /.+ \((.*)\)/; |
| 77 | 75 |
| 78 var alias = {}; | 76 var alias = {}; |
| 79 | 77 |
| 80 alias.DIMENSIONS_WITH_ALIASES = ["device_type", "gpu", "battery_health"]; | 78 alias.DIMENSIONS_WITH_ALIASES = ["device_type", "gpu", "battery_health", "batt
ery_status"]; |
| 81 | 79 |
| 82 alias.android = function(dt) { | 80 alias.android = function(dt) { |
| 83 return ANDROID_ALIASES[dt] || UNKNOWN; | 81 return ANDROID_ALIASES[dt] || UNKNOWN; |
| 84 }; | 82 }; |
| 85 | 83 |
| 86 alias.battery_health = function(bh) { | 84 alias.battery_health = function(bh) { |
| 87 return BATTERY_HEALTH_ALIASES[bh] || UNKNOWN; | 85 return BATTERY_HEALTH_ALIASES[bh] || UNKNOWN; |
| 88 }; | 86 }; |
| 89 | 87 |
| 90 alias.battery_status = function(bs) { | 88 alias.battery_status = function(bs) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 127 |
| 130 var aliasMap = { | 128 var aliasMap = { |
| 131 "device_type": alias.android, | 129 "device_type": alias.android, |
| 132 "gpu": alias.gpu, | 130 "gpu": alias.gpu, |
| 133 "battery_health": alias.battery_health, | 131 "battery_health": alias.battery_health, |
| 134 "battery_status": alias.battery_status, | 132 "battery_status": alias.battery_status, |
| 135 } | 133 } |
| 136 | 134 |
| 137 return alias; | 135 return alias; |
| 138 })(); | 136 })(); |
| OLD | NEW |