Files
puppetboard/puppetboard/static/coffeescript/tables.coffee
Corey Hammerton bce33aee0f puppetboard: Adding Catalog Viewer
This makes use of the available catalog endpoints in pypuppetdb and PuppetDB
and displays to administrators the last compiled catalog for a node,
if the variable ENABLE_CATALOG is True (defaults to False)
2015-08-19 21:01:11 -04:00

57 lines
1.0 KiB
CoffeeScript

$ = 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:
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]]
)
$('.catalog').tablesorter(
sortList: [[0, 0]]
)
$('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()