Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1660)

Unified Diff: appengine/swarming/elements/res/js/alias.js

Issue 2359993002: Medium sized improvements to bot-list and task-list (Closed) Base URL: git@github.com:luci/luci-py@master
Patch Set: condense loop Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/swarming/elements/res/imp/tasklist/task-list.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/elements/res/js/alias.js
diff --git a/appengine/swarming/elements/res/js/alias.js b/appengine/swarming/elements/res/js/alias.js
index b7b006b4b0f8fff669b473f2caac96cb7875cc82..980f34ade6b68a11981b37f533aa9fff48289c37 100644
--- a/appengine/swarming/elements/res/js/alias.js
+++ b/appengine/swarming/elements/res/js/alias.js
@@ -51,6 +51,25 @@ this.swarming.alias = this.swarming.alias || (function(){
"8086:22b1": "Intel Braswell Integrated",
}
+ // Taken from http://developer.android.com/reference/android/os/BatteryManager.html
+ var BATTERY_HEALTH_ALIASES = {
+ 1: "Unknown",
+ 2: "Good",
+ 3: "Overheated",
+ 4: "Dead",
+ 5: "Over Voltage",
+ 6: "Unspecified Failure",
+ 7: "Too Cold",
+ }
+
+ var BATTERY_STATUS_ALIASES = {
+ 1: "Unknown",
+ 2: "Charging",
+ 3: "Discharging",
+ 4: "Not Charging",
+ 5: "Full",
+ }
+
// For consistency, all aliases are displayed like:
// Nexus 5X (bullhead)
// This regex matches a string like "ALIAS (ORIG)", with ORIG as group 1.
@@ -58,12 +77,20 @@ this.swarming.alias = this.swarming.alias || (function(){
var alias = {};
- alias.DIMENSIONS_WITH_ALIASES = ["device_type", "gpu"];
+ alias.DIMENSIONS_WITH_ALIASES = ["device_type", "gpu", "battery_health"];
alias.android = function(dt) {
return ANDROID_ALIASES[dt] || UNKNOWN;
};
+ alias.battery_health = function(bh) {
+ return BATTERY_HEALTH_ALIASES[bh] || UNKNOWN;
+ };
+
+ alias.battery_status = function(bs) {
+ return BATTERY_STATUS_ALIASES[bs] || UNKNOWN;
+ };
+
// alias.apply tries to alias the string "orig" based on what "type" it is.
// If type is in DIMENSIONS_WITH_ALIASES, the appropriate alias (e.g. gpu)
// is automatically applied. Otherwise, "type" is treated as the alias.
@@ -76,7 +103,7 @@ this.swarming.alias = this.swarming.alias || (function(){
return type + " ("+orig+")";
}
var alias = aliaser(orig);
- if (alias !== "unknown") {
+ if (alias !== UNKNOWN) {
return alias + " ("+orig+")";
}
return orig;
@@ -103,6 +130,8 @@ this.swarming.alias = this.swarming.alias || (function(){
var aliasMap = {
"device_type": alias.android,
"gpu": alias.gpu,
+ "battery_health": alias.battery_health,
+ "battery_status": alias.battery_status,
}
return alias;
« no previous file with comments | « appengine/swarming/elements/res/imp/tasklist/task-list.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698