[llvm-commits] [LNT] r164259 - in /lnt/trunk/lnt/server/ui: static/v4_global_status.js templates/v4_global_status.html
Michael Gottesman
mgottesman at apple.com
Wed Sep 19 15:37:36 PDT 2012
Author: mgottesman
Date: Wed Sep 19 17:37:36 2012
New Revision: 164259
URL: http://llvm.org/viewvc/llvm-project?rev=164259&view=rev
Log:
[LNT] v4_global_status.js: Added batch hide/reset/show to global status
page.
Modified:
lnt/trunk/lnt/server/ui/static/v4_global_status.js
lnt/trunk/lnt/server/ui/templates/v4_global_status.html
Modified: lnt/trunk/lnt/server/ui/static/v4_global_status.js
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/static/v4_global_status.js?rev=164259&r1=164258&r2=164259&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/static/v4_global_status.js (original)
+++ lnt/trunk/lnt/server/ui/static/v4_global_status.js Wed Sep 19 17:37:36 2012
@@ -6,16 +6,42 @@
v4_global_status = {};
(function(_module) {
+
// Assign our input module to a var so that a closure is created
// in our local context.
var m = _module;
/* Globals */
var g = {};
+
+ /* Helper Functions */
+
+ function UrlReplaceBasename(url, new_basename) {
+ // Remove query string.
+ var last_question_index = url.lastIndexOf('?');
+ if (last_question_index != -1)
+ url = url.substring(0, last_question_index);
+ if (url.charAt(url.length-1) == '/') {
+ url = url.substring(0, url.length-1);
+ }
+
+ var without_base = url.substring(0, url.lastIndexOf('/') + 1);
+ return without_base + new_basename;
+ }
+
+ function IsHidden(elem) {
+ return elem.offsetWidth === 0 && elem.offsetHeight === 0;
+ }
- /* Initialization */
+ /* Exported Functions */
+
+ /*
+ @arg field The field we are viewing data for currently (compile time and
+ execution time)
+ */
m.init = function(field) {
g.field = field;
+ g.hidden_columns = [];
// Create a global variable for table.
g.table = $('#data-table')[0];
@@ -61,28 +87,7 @@
}
}
});
- };
-
- /* Helper Functions */
-
- function UrlReplaceBasename(url, new_basename) {
- // Remove query string.
- var last_question_index = url.lastIndexOf('?');
- if (last_question_index != -1)
- url = url.substring(0, last_question_index);
- if (url.charAt(url.length-1) == '/') {
- url = url.substring(0, url.length-1);
- }
-
- var without_base = url.substring(0, url.lastIndexOf('/') + 1);
- return without_base + new_basename;
- }
-
- function IsHidden(elem) {
- return elem.offsetWidth === 0 && elem.offsetHeight === 0;
- }
-
- /* Exported Functions */
+ };
m.reset_table = function() {
g.table.className = 'sortable_rev';
@@ -97,9 +102,26 @@
};
m.toggle_column_visibility = function(_col) {
- var col = _col;
- var classname = 'hide-' + col;
- $(g.table).toggleClass(classname);
+ var index;
+ if ((index = g.hidden_columns.indexOf(_col)) != -1) {
+ g.hidden_columns.splice(index, 1);
+ } else {
+ g.hidden_columns.push(_col);
+ }
+ };
+
+ m.update_table = function() {
+ // Compute base class name.
+ var new_classname = g.table.className.search(/\bsortable\b/) != -1? "sortable" : "sortable_rev";
+
+ // Add rest of hidden columns.
+ var hidden_columns = g.hidden_columns;
+ for (var i = 0, len = hidden_columns.length; i < len; ++i) {
+ new_classname += ' hide-' + hidden_columns[i];
+ }
+
+ g.table.className = new_classname;
+
m.recompute_worst_times();
};
Modified: lnt/trunk/lnt/server/ui/templates/v4_global_status.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_global_status.html?rev=164259&r1=164258&r2=164259&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_global_status.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_global_status.html Wed Sep 19 17:37:36 2012
@@ -99,6 +99,7 @@
{% for m in machines %}
<li><input machine="{{ m.name }}" id="checkbox-{{ m.get_css_name() }}" checked="checked" type="checkbox" onclick="v4_global_status.toggle_column_visibility('{{ m.get_css_name() }}');">{{ m.name }}</input></li>
{% endfor %}
+ <li><button onclick="v4_global_status.update_table();">Set Visibility</button><button onclick="v4_global_status.reset_table();">Reset</button></li>
</ul>
</div>
</div>
More information about the llvm-commits
mailing list