[llvm-commits] [LNT] r164270 - /lnt/trunk/lnt/server/ui/static/v4_global_status.js
Michael Gottesman
mgottesman at apple.com
Wed Sep 19 16:58:39 PDT 2012
Author: mgottesman
Date: Wed Sep 19 18:58:39 2012
New Revision: 164270
URL: http://llvm.org/viewvc/llvm-project?rev=164270&view=rev
Log:
[LNT] v4_global_status.js: Added localStorage support for views so that
the view you pick stays the same even when you leave the page.
Modified:
lnt/trunk/lnt/server/ui/static/v4_global_status.js
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=164270&r1=164269&r2=164270&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 18:58:39 2012
@@ -34,15 +34,17 @@
}
/* 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 = [];
-
+
+ g.hidden_columns = localStorage;
+ var len = g.hidden_columns.length;
+ for (var i = 0; i < len; ++i) {
+ var key = g.hidden_columns.key(i);
+ $('#checkbox-' + key)[0].checked = false;
+ }
+
// Create a global variable for table.
g.table = $('#data-table')[0];
@@ -83,8 +85,9 @@
window.location = UrlReplaceBasename(window.location.toString(),
new_base);
});
- };
-
+ m.update_table();
+ };
+
m.reset_table = function() {
g.table.className = 'sortable_rev';
@@ -93,16 +96,17 @@
val.checked = true;
val.disabled = false;
});
-
+
+ localStorage.clear();
+
m.recompute_worst_times();
};
m.toggle_column_visibility = function(_col) {
- var index;
- if ((index = g.hidden_columns.indexOf(_col)) != -1) {
- g.hidden_columns.splice(index, 1);
+ if (_col in g.hidden_columns) {
+ delete g.hidden_columns[_col];
} else {
- g.hidden_columns.push(_col);
+ g.hidden_columns[_col] = "true";
}
};
@@ -111,9 +115,9 @@
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];
+ var len = g.hidden_columns.length;
+ for (var i = 0; i < len; ++i) {
+ new_classname += ' hide-' + g.hidden_columns.key(i);
}
g.table.className = new_classname;
More information about the llvm-commits
mailing list