-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
105 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
var memoryFormatter = function(colNumber, row){ | ||
var col = $('td:eq('+colNumber+')', row); | ||
col.text(parseInt(col.text()) + ' GB'); | ||
} | ||
|
||
var memoryFilter = function(colNumber, d){ | ||
|
||
// Look for 'between' statement todo: make generic | ||
if(d.search.value.match(/^\d+GB memory \d+GB$/)) | ||
{ | ||
// Add column specific search | ||
d.columns[colNumber].search.value = d.search.value.replace(/(\d+GB) memory (\d+GB)/, function(m, from, to){ | ||
return ' BETWEEN ' + parseInt(from) + ' AND ' + parseInt(to) | ||
}); | ||
// Clear global search | ||
d.search.value = ''; | ||
} | ||
|
||
// Look for a bigger/smaller/equal statement | ||
if(d.search.value.match(/^memory [<>=] \d+GB$/)) | ||
{ | ||
// Add column specific search | ||
d.columns[colNumber].search.value = d.search.value.replace(/.*([<>=] )(\d+GB)$/, function(m, o, content){ | ||
return o + parseInt(content) | ||
}); | ||
// Clear global search | ||
d.search.value = ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,13 @@ | ||
<div class="col-lg-4"> | ||
|
||
<div class="panel panel-default" id="duplicated-computernames-widget"> | ||
<div class="panel-heading" data-container="body"> | ||
<h3 class="panel-title"><i class="fa fa-bug"></i> | ||
<span data-i18n="machine.duplicate_computernames.title"></span> | ||
<list-link data-url="/show/listing/reportdata/clients"></list-link> | ||
</h3> | ||
</div> | ||
<div class="list-group scroll-box"></div> | ||
</div><!-- /panel --> | ||
|
||
</div><!-- /col --> | ||
|
||
<script> | ||
$(document).on('appUpdate', function(e, lang) { | ||
var box = $('#duplicated-computernames-widget div.scroll-box'); | ||
$.getJSON( appUrl + '/module/machine/get_duplicate_computernames', function( data ) { | ||
box.empty(); | ||
if(data.length){ | ||
$.each(data, function(i,d){ | ||
var badge = '<span class="badge pull-right">'+d.count+'</span>'; | ||
if( ! d.computer_name){ | ||
box.append('<a class="list-group-item">'+i18n.t('empty')+badge+'</a>') | ||
} | ||
else{ | ||
box.append('<a href="'+appUrl+'/show/listing/reportdata/clients/#'+d.computer_name+'" class="list-group-item">'+d.computer_name+badge+'</a>') | ||
} | ||
}) | ||
} | ||
else{ | ||
box.append('<span class="list-group-item">'+i18n.t('machine.duplicate_computernames.notfound')+'</span>'); | ||
} | ||
}); | ||
}); | ||
</script> | ||
<?php | ||
|
||
$this->viewWidget( | ||
[ | ||
"type" => "scrollbox", | ||
"widget_id" => "duplicated-computernames-widget", | ||
"api_url" => "/module/machine/get_duplicate_computernames", | ||
"i18n_title" => 'machine.duplicate_computernames.title', | ||
"icon" => "fa-bug", | ||
"listing_link" => "/show/listing/reportdata/clients", | ||
"search_key" => "computer_name", | ||
"i18n_empty_result" => "machine.duplicate_computernames.notfound", | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,35 @@ | ||
<?php $this->view('partials/head'); ?> | ||
|
||
<div class="container"> | ||
|
||
<div class="row"> | ||
|
||
<div class="col-lg-12"> | ||
|
||
<h3><span data-i18n="machine.hardware_report"></span> <span id="total-count" class='label label-primary'>…</span></h3> | ||
|
||
<table class="table table-striped table-condensed table-bordered"> | ||
<thead> | ||
<tr> | ||
<th data-i18n="listing.computername" data-colname='machine.computer_name'></th> | ||
<th data-i18n="serial" data-colname='reportdata.serial_number'></th> | ||
<th data-i18n="username" data-colname='reportdata.long_username'></th> | ||
<th data-i18n="machine.model" data-colname='machine.machine_model'></th> | ||
<th data-i18n="description" data-colname='machine.machine_desc'></th> | ||
<th data-i18n="physical_memory" data-colname='machine.physical_memory'></th> | ||
<th data-i18n="machine.cores" data-colname='machine.number_processors'></th> | ||
<th data-i18n="machine.arch" data-colname='machine.cpu_arch'></th> | ||
<th data-i18n="machine.cpu_speed" data-colname='machine.current_processor_speed'></th> | ||
<th data-i18n="machine.rom_version" data-colname='machine.boot_rom_version'></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td data-i18n="listing.loading" colspan="10" class="dataTables_empty"></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> <!-- /span 12 --> | ||
</div> <!-- /row --> | ||
</div> <!-- /container --> | ||
|
||
<script type="text/javascript"> | ||
|
||
$(document).on('appUpdate', function(e){ | ||
|
||
var oTable = $('.table').DataTable(); | ||
oTable.ajax.reload(); | ||
return; | ||
|
||
}); | ||
|
||
$(document).on('appReady', function(e, lang) { | ||
|
||
// Get column names from data attribute | ||
var columnDefs = [], | ||
col = 0; // Column counter | ||
$('.table th').map(function(){ | ||
columnDefs.push({name: $(this).data('colname'), targets: col}); | ||
col++; | ||
}); | ||
oTable = $('.table').dataTable( { | ||
columnDefs: columnDefs, | ||
ajax: { | ||
url: appUrl + '/datatables/data', | ||
type: "POST", | ||
data: function(d){ | ||
|
||
// Look for 'between' statement todo: make generic | ||
if(d.search.value.match(/^\d+GB memory \d+GB$/)) | ||
{ | ||
// Add column specific search | ||
d.columns[5].search.value = d.search.value.replace(/(\d+GB) memory (\d+GB)/, function(m, from, to){return ' BETWEEN ' + parseInt(from) + ' AND ' + parseInt(to)}); | ||
// Clear global search | ||
d.search.value = ''; | ||
|
||
} | ||
|
||
// Look for a bigger/smaller/equal statement | ||
if(d.search.value.match(/^memory [<>=] \d+GB$/)) | ||
{ | ||
// Add column specific search | ||
d.columns[5].search.value = d.search.value.replace(/.*([<>=] )(\d+GB)$/, function(m, o, content){return o + parseInt(content)}); | ||
// Clear global search | ||
d.search.value = ''; | ||
|
||
//dumpj(out) | ||
} | ||
|
||
} | ||
}, | ||
dom: mr.dt.buttonDom, | ||
buttons: mr.dt.buttons, | ||
createdRow: function( nRow, aData, iDataIndex ) { | ||
// Update name in first column to link | ||
var name=$('td:eq(0)', nRow).html(); | ||
if(name == ''){name = "No Name"}; | ||
var sn=$('td:eq(1)', nRow).html(); | ||
var link = mr.getClientDetailLink(name, sn); | ||
$('td:eq(0)', nRow).html(link); | ||
|
||
var mem=$('td:eq(5)', nRow).html(); | ||
$('td:eq(5)', nRow).html(parseInt(mem) + ' GB'); | ||
} | ||
}); | ||
|
||
}); | ||
</script> | ||
|
||
<?php $this->view('partials/foot'); ?> | ||
<?php | ||
|
||
$this->view('listings/default', | ||
[ | ||
"i18n_title" => 'machine.hardware_report', | ||
"js_link" => "module/machine/js/machine", | ||
"table" => [ | ||
[ | ||
"column" => "machine.computer_name", | ||
"i18n_header" => "listing.computername", | ||
"formatter" => "clientDetail", | ||
"tab_link" => "summary", | ||
], | ||
[ | ||
"column" => "reportdata.serial_number", | ||
"i18n_header" => "displays_info.machineserial", | ||
], | ||
[ | ||
"column" => "reportdata.long_username", | ||
"i18n_header" => "username", | ||
], | ||
["i18n_header" => "machine.model", "column" => 'machine.machine_model'], | ||
["i18n_header" => "description", "column" => 'machine.machine_desc'], | ||
[ | ||
"i18n_header" => "physical_memory", | ||
"column" => 'machine.physical_memory', | ||
"formatter" => "memoryFormatter", | ||
"filter" => "memoryFilter", | ||
], | ||
["i18n_header" => "machine.cores", "column" => 'machine.number_processors'], | ||
["i18n_header" => "machine.arch", "column" => 'machine.cpu_arch'], | ||
["i18n_header" => "machine.cpu_speed", "column" => 'machine.current_processor_speed'], | ||
["i18n_header" => "machine.rom_version", "column" => 'machine.boot_rom_version'], | ||
] | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,12 @@ | ||
<div class="col-lg-4 col-md-6"> | ||
<div class="panel panel-default" id="hardware-model-widget"> | ||
<div class="panel-heading"> | ||
<h3 class="panel-title"><i class="fa fa-laptop"></i> | ||
<span data-i18n="machine.hardware_widget_title"></span> | ||
<list-link data-url="/show/listing/machine/hardware"></list-link> | ||
</h3> | ||
</div> | ||
<div class="list-group scroll-box"></div> | ||
</div><!-- /panel --> | ||
</div><!-- /col --> | ||
|
||
<script> | ||
$(document).on('appUpdate', function(e, lang) { | ||
var box = $('#hardware-model-widget div.scroll-box'); | ||
$.getJSON( appUrl + '/module/machine/get_model_stats', function( data ) { | ||
box.empty(); | ||
if(data.length){ | ||
$.each(data, function(i,d){ | ||
var badge = '<span class="badge pull-right">'+d.count+'</span>'; | ||
box.append('<a href="'+appUrl+'/show/listing/machine/hardware/#'+d.label+'" class="list-group-item">'+d.label+badge+'</a>') | ||
}); | ||
} | ||
else{ | ||
box.append('<span class="list-group-item">'+i18n.t('no_clients')+'</span>'); | ||
} | ||
}); | ||
}); | ||
</script> | ||
<?php | ||
|
||
$this->viewWidget( | ||
[ | ||
"type" => "scrollbox", | ||
"widget_id" => "hardware-model-widget", | ||
"api_url" => "/module/machine/get_model_stats", | ||
"i18n_title" => 'machine.hardware_widget_title', | ||
"icon" => "fa-laptop", | ||
"listing_link" => "/show/listing/machine/hardware", | ||
"search_key" => "label", | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,15 @@ | ||
<div class="col-lg-4 col-md-6"> | ||
|
||
<div class="panel panel-default" id="new-clients-widget"> | ||
<div class="panel-heading" data-container="body" data-i18n="[title]machine.new_clients.tooltip"> | ||
<div class="panel-title"><i class="fa fa-star-o"></i> | ||
<span data-i18n="machine.new_clients.title"></span> | ||
<span class="counter badge"></span> | ||
<list-link data-url="/show/listing/reportdata/clients"></list-link> | ||
</div> | ||
</div> | ||
<div class="list-group scroll-box"> | ||
<span class="list-group-item"><span data-i18n="machine.new_clients.no_new_clients"></span></span> | ||
</div> | ||
</div><!-- /panel --> | ||
|
||
</div><!-- /col --> | ||
|
||
<script> | ||
$(document).on('appUpdate', function(){ | ||
$.getJSON( appUrl + '/module/machine/new_clients', function( data ) { | ||
var scrollBox = $('#new-clients-widget .scroll-box').empty(); | ||
$.each(data, function(index, obj){ | ||
scrollBox | ||
.append($('<a>') | ||
.addClass('list-group-item') | ||
.attr('href', appUrl + '/clients/detail/' + obj.serial_number) | ||
.append(obj.computer_name) | ||
.append($('<span>') | ||
.addClass('pull-right') | ||
.text(function(){ | ||
return moment(obj.reg_timestamp * 1000).fromNow(); | ||
}))) | ||
}); | ||
$('#new-clients-widget .counter').html(data.length); | ||
if( ! data.length){ | ||
scrollBox | ||
.append($('<span>') | ||
.addClass('list-group-item') | ||
.text(i18n.t('no_clients'))) | ||
} | ||
}); | ||
}); | ||
</script> | ||
<?php | ||
|
||
$this->viewWidget( | ||
[ | ||
"type" => "scrollbox", | ||
"widget_id" => "new-clients-widget", | ||
"api_url" => "/module/machine/new_clients", | ||
"i18n_title" => 'machine.new_clients.title', | ||
"icon" => "fa-star-o", | ||
"listing_link" => "/show/listing/reportdata/clients", | ||
"search_key" => "computer_name", | ||
"i18n_tooltip" => "machine.new_clients.tooltip", | ||
"badge" => "reg_timestamp", | ||
"url_type" => "client_detail", | ||
]); |