mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-25 08:33:22 +03:00
[Web UI] Fix folders plugin never displayed
This commit is contained in:
parent
6f512255bb
commit
67ba75c7c1
@ -2,7 +2,7 @@
|
||||
<div class="table-cell text-left title">FOLDERS</div>
|
||||
<div class="table-cell">Size</div>
|
||||
</div>
|
||||
<div class="table-row" ng-repeat="f in statsFolders.folders">
|
||||
<div class="table-cell text-left">{{ f.path }}</div>
|
||||
<div class="table-cell">{{ f.size | bytes }}</div>
|
||||
<div class="table-row" ng-repeat="folder in statsFolders.folders">
|
||||
<div class="table-cell text-left">{{ folder.path }}</div>
|
||||
<div class="table-cell" ng-class="statsFolders.getDecoration(folder)">{{ folder.size | bytes }}</div>
|
||||
</div>
|
||||
|
@ -51,7 +51,7 @@
|
||||
<section id="network" class="plugin table-row-group" ng-show="!arguments.disable_network" ng-include src="'plugins/network.html'"></section>
|
||||
<section id="diskio" class="plugin table-row-group" ng-show="!arguments.disable_diskio && statsDiskio.disks.length > 0" ng-include src="'plugins/diskio.html'"></section>
|
||||
<section id="fs" class="plugin table-row-group" ng-show="!arguments.disable_fs" ng-include src="'plugins/fs.html'"></section>
|
||||
<section id="folders" class="plugin table-row-group" ng-show="show.folders" ng-include src="'plugins/folders.html'"></section>
|
||||
<section id="folders" class="plugin table-row-group" ng-show="!arguments.disable_fs && statsFolders.folders.length > 0" ng-include src="'plugins/folders.html'"></section>
|
||||
<section id="raid" class="plugin table-row-group" ng-show="statsRaid.hasDisks()" ng-include src="'plugins/raid.html'"></section>
|
||||
<section id="sensors" class="plugin table-row-group" ng-show="!arguments.disable_sensors && statsSensors.sensors.length > 0" ng-include src="'plugins/sensors.html'"></section>
|
||||
</div>
|
||||
|
@ -8,6 +8,7 @@ glancesApp.service('GlancesStats', function($http, $injector, $q, GlancesPlugin)
|
||||
'docker': 'GlancesPluginDocker',
|
||||
'ip': 'GlancesPluginIp',
|
||||
'fs': 'GlancesPluginFs',
|
||||
'folders': 'GlancesPluginFolders',
|
||||
'load': 'GlancesPluginLoad',
|
||||
'mem': 'GlancesPluginMem',
|
||||
'memswap': 'GlancesPluginMemSwap',
|
||||
|
@ -1,10 +1,8 @@
|
||||
glancesApp.service('GlancesPluginFolders', function() {
|
||||
var _pluginName = "folders";
|
||||
var _view = {};
|
||||
this.folders = [];
|
||||
|
||||
this.setData = function(data, views) {
|
||||
_view = views[_pluginName];
|
||||
data = data[_pluginName];
|
||||
this.folders = [];
|
||||
|
||||
@ -13,18 +11,26 @@ glancesApp.service('GlancesPluginFolders', function() {
|
||||
|
||||
var folder = {
|
||||
'path': folderData['path'],
|
||||
'size': folderData['size']
|
||||
'size': folderData['size'],
|
||||
'careful': folderData['careful'],
|
||||
'warning': folderData['warning'],
|
||||
'critical': folderData['critical']
|
||||
};
|
||||
|
||||
this.folders.push(folder);
|
||||
}
|
||||
};
|
||||
|
||||
this.getDecoration = function(mountPoint, field) {
|
||||
if(_view[mountPoint][field] == undefined) {
|
||||
return;
|
||||
this.getDecoration = function(folder) {
|
||||
|
||||
if (folder.critical !== null && folder.size > (folder.critical * 1000000)) {
|
||||
return 'critical';
|
||||
} else if (folder.warning !== null && folder.size > (folder.warning * 1000000)) {
|
||||
return 'warning';
|
||||
} else if (folder.careful !== null && folder.size > (folder.careful * 1000000)) {
|
||||
return 'careful';
|
||||
}
|
||||
|
||||
return _view[mountPoint][field].decoration.toLowerCase();
|
||||
return 'ok';
|
||||
};
|
||||
});
|
||||
|
@ -26,6 +26,7 @@ glancesApp.controller('statsController', function ($scope, $rootScope, $interval
|
||||
$scope.statsDiskio = GlancesStats.getPlugin('diskio');
|
||||
$scope.statsDocker = GlancesStats.getPlugin('docker');
|
||||
$scope.statsFs = GlancesStats.getPlugin('fs');
|
||||
$scope.statsFolders = GlancesStats.getPlugin('folders');
|
||||
$scope.statsIp = GlancesStats.getPlugin('ip');
|
||||
$scope.statsLoad = GlancesStats.getPlugin('load');
|
||||
$scope.statsMem = GlancesStats.getPlugin('mem');
|
||||
|
Loading…
Reference in New Issue
Block a user