|
@@ -237,6 +237,28 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ function func_size_render(data, type, row, meta) {
|
|
|
+ if(type == 'display') {
|
|
|
+ return dust.filters.fmt_bytes(data);
|
|
|
+ }
|
|
|
+ else return data;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Change the format of date-time depending on how old the
|
|
|
+ // the timestamp is. If older than 6 months, no need to be
|
|
|
+ // show exact time.
|
|
|
+ function func_time_render(data, type, row, meta) {
|
|
|
+ if(type == 'display') {
|
|
|
+ var cutoff = moment().subtract(6, 'months').unix() * 1000;
|
|
|
+ if(data < cutoff) {
|
|
|
+ return moment(Number(data)).format('MMM DD YYYY');
|
|
|
+ } else {
|
|
|
+ return moment(Number(data)).format('MMM DD HH:mm');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
function browse_directory(dir) {
|
|
|
var HELPERS = {
|
|
|
'helper_date_tostring' : function (chunk, ctx, bodies, params) {
|
|
@@ -259,6 +281,22 @@
|
|
|
dust.render('explorer', base.push(d), function(err, out) {
|
|
|
$('#panel').html(out);
|
|
|
|
|
|
+ $('#table-explorer').dataTable( {
|
|
|
+ 'lengthMenu': [ [25, 50, 100, -1], [25, 50, 100, "All"] ],
|
|
|
+ 'columns': [
|
|
|
+ {'searchable': false }, //Permissions
|
|
|
+ null, //Owner
|
|
|
+ null, //Group
|
|
|
+ { 'searchable': false, 'render': func_size_render}, //Size
|
|
|
+ { 'searchable': false, 'render': func_time_render}, //Last Modified
|
|
|
+ { 'searchable': false }, //Replication
|
|
|
+ null, //Block Size
|
|
|
+ null, //Name
|
|
|
+ { 'sortable' : false } //Trash
|
|
|
+ ],
|
|
|
+ "deferRender": true
|
|
|
+ });
|
|
|
+
|
|
|
$('.explorer-browse-links').click(function() {
|
|
|
var type = $(this).attr('inode-type');
|
|
|
var path = $(this).closest('tr').attr('inode-path');
|