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

Side by Side Diff: appengine/swarming/elements/res/imp/common/common-aliases.html

Issue 2269643002: Extract shared filters and aliasing code (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Documentation Created 4 years, 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!--
jcgregorio 2016/08/23 13:07:44 I normally expect .html files under /res/imp/ to c
kjlubick 2016/08/23 17:43:19 All behaviors now end in -behavior.html
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 window.SwarmingBehaviors.Aliases contains any aliases used by swarming
7 apps, including gpu and android names.
8
9 To use it, include
10 behaviors: [SwarmingBehaviors.Aliases]
11 in the creation of your Polymer element.
12 -->
13 <!--Import this to initialize SwarmingBehaviors-->
stephana 2016/08/23 12:41:51 IMO, this should be in a JS file.
jcgregorio 2016/08/23 13:07:44 A JS file can't have <link rel="import" href="swar
kjlubick 2016/08/23 17:43:19 This is now a standalone JS.
14 <link rel="import" href="swarming-app.html">
15 <script>
16 (function(){
17 var ANDROID_ALIASES = {
18 "bullhead": "Nexus 5X",
19 "flo": "Nexus 7 (2013)",
20 "flounder": "Nexus 9",
21 "foster": "NVIDIA Shield",
22 "fugu": "Nexus Player",
23 "grouper": "Nexus 7 (2012)",
24 "hammerhead": "Nexus 5",
25 "m0": "Galaxy S3",
26 "mako": "Nexus 4",
27 "manta": "Nexus 10",
28 "shamu": "Nexus 6",
29 "sprout": "Android One",
30 };
31
32 var UNKNOWN = "unknown";
33
34 var GPU_ALIASES = {
35 "1002": "AMD",
36 "1002:6779": "AMD Radeon HD 6450/7450/8450",
37 "1002:6821": "AMD Radeon HD 8870M",
38 "1002:683d": "AMD Radeon HD 7770/8760",
39 "1002:9830": "AMD Radeon HD 8400",
40 "102b": "Matrox",
41 "102b:0522": "Matrox MGA G200e",
42 "102b:0532": "Matrox MGA G200eW",
43 "102b:0534": "Matrox G200eR2",
44 "10de": "NVIDIA",
45 "10de:08a4": "NVIDIA GeForce 320M",
46 "10de:08aa": "NVIDIA GeForce 320M",
47 "10de:0fe9": "NVIDIA GeForce GT 750M Mac Edition",
48 "10de:104a": "NVIDIA GeForce GT 610",
49 "10de:11c0": "NVIDIA GeForce GTX 660",
50 "10de:1244": "NVIDIA GeForce GTX 550 Ti",
51 "10de:1401": "NVIDIA GeForce GTX 960",
52 "8086": "Intel",
53 "8086:0412": "Intel Haswell Integrated",
54 "8086:041a": "Intel Xeon Integrated",
55 "8086:0a2e": "Intel Haswell Integrated",
56 "8086:0d26": "Intel Crystal Well Integrated",
57 "8086:22b1": "Intel Braswell Integrated",
58 }
59
60 // For consistency, all aliases are displayed like:
61 // Nexus 5X (bullhead)
62 // This regex matches a string like "ALIAS (ORIG)", with ORIG as group 1.
63 var ALIAS_REGEXP = /.+ \((.*)\)/;
64
65 // This behavior wraps up all the shared bot-list functionality by
66 // extending SwarmingBehaviors.SwarmingBehavior
67 SwarmingBehaviors.Aliases = {
68
69 properties: {
70 DIMENSIONS_WITH_ALIASES: {
71 type: Array,
72 value: function(){
73 return ["device_type", "gpu"];
74 },
75 },
76 },
77
78 _androidAlias: function(dt) {
79 return ANDROID_ALIASES[dt] || UNKNOWN;
80 },
81
82 // _applyAlias is the consistent way to modify a string to show its alias.
83 _applyAlias: function(orig, alias) {
84 return alias +" ("+orig+")";
85 },
86
87 _gpuAlias: function(gpu) {
88 return GPU_ALIASES[gpu] || UNKNOWN;
89 },
90
91 // _unalias will return the base dimension/state with its alias removed
92 // if it had one. This is handy for sorting and filtering.
93 _unalias: function(str) {
94 var match = ALIAS_REGEXP.exec(str);
95 if (match) {
96 return match[1];
97 }
98 return str;
99 },
100 };
101 })()
102 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698