Page MenuHomePhorge

No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
diff --git a/puppetboard/static/coffeescript/tables.coffee b/puppetboard/static/coffeescript/tables.coffee
index 1155182..65a3e81 100644
--- a/puppetboard/static/coffeescript/tables.coffee
+++ b/puppetboard/static/coffeescript/tables.coffee
@@ -1,35 +1,52 @@
$ = jQuery
$ ->
+
+$.tablesorter.addParser(
+ id: 'timestamp'
+
+ # Return false so this parser is not auto detected
+ is: (s) ->
+ false
+
+ # Normalize the timestamp to epoch for sorting
+ format: (s) ->
+ moment.utc(s).unix()
+
+ # The return value of our normalization function is an integer
+ type: 'numeric'
+)
+
$('.nodes').tablesorter(
- headers:
- 4:
- sorter: false
- sortList: [[1,0]]
+ headers:
+ 2: sorter: 'timestamp'
+ 3: sorter: 'timestamp'
+ 4: sorter: false
+ sortList: [[1,0]]
)
$('.facts').tablesorter(
- sortList: [[0,0]]
+ sortList: [[0,0]]
)
$('.dashboard').tablesorter(
- headers:
- 3:
- sorter: false
- sortList: [[0, 1]]
+ headers:
+ 2: sorter: 'timestamp'
+ 3: sorter: false
+ sortList: [[0, 1]]
)
$('input.filter-table').parent('div').removeClass('hide')
$("input.filter-table").on "keyup", (e) ->
rex = new RegExp($(this).val(), "i")
$(".searchable tr").hide()
$(".searchable tr").filter( ->
rex.test $(this).text()
).show()
if e.keyCode is 27
$(e.currentTarget).val ""
ev = $.Event("keyup")
ev.keyCode = 13
$(e.currentTarget).trigger(ev)
e.currentTarget.blur()
diff --git a/puppetboard/static/js/tables.js b/puppetboard/static/js/tables.js
index df7673b..ac864dd 100644
--- a/puppetboard/static/js/tables.js
+++ b/puppetboard/static/js/tables.js
@@ -1,49 +1,69 @@
// Generated by CoffeeScript 1.6.3
(function() {
var $;
$ = jQuery;
$(function() {});
+ $.tablesorter.addParser({
+ id: 'timestamp',
+ is: function(s) {
+ return false;
+ },
+ format: function(s) {
+ return moment.utc(s).unix();
+ },
+ type: 'numeric'
+ });
+
$('.nodes').tablesorter({
headers: {
+ 2: {
+ sorter: 'timestamp'
+ },
+ 3: {
+ sorter: 'timestamp'
+ },
4: {
sorter: false
}
},
sortList: [[1, 0]]
});
$('.facts').tablesorter({
sortList: [[0, 0]]
});
$('.dashboard').tablesorter({
headers: {
+ 2: {
+ sorter: 'timestamp'
+ },
3: {
sorter: false
}
},
sortList: [[0, 1]]
});
$('input.filter-table').parent('div').removeClass('hide');
$("input.filter-table").on("keyup", function(e) {
var ev, rex;
rex = new RegExp($(this).val(), "i");
$(".searchable tr").hide();
$(".searchable tr").filter(function() {
return rex.test($(this).text());
}).show();
if (e.keyCode === 27) {
$(e.currentTarget).val("");
ev = $.Event("keyup");
ev.keyCode = 13;
$(e.currentTarget).trigger(ev);
return e.currentTarget.blur();
}
});
}).call(this);

File Metadata

Mime Type
text/x-diff
Expires
Fri, Apr 24, 1:27 PM (1 d, 1 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18896713
Default Alt Text
(2 KB)

Event Timeline