Merge pull request #1243 from notFloran/fix-webui-issues

[WebUI] fix issues with folders/port plugins
This commit is contained in:
Nicolas Hennion
2018-02-25 15:15:19 +01:00
committed by GitHub
5 changed files with 23 additions and 6 deletions

View File

@@ -1,8 +1,10 @@
<div class="table-row" ng-if="vm.folders.length > 0">
<div class="table-cell text-left title">FOLDERS</div>
<div class="table-cell"></div>
<div class="table-cell">Size</div>
</div>
<div class="table-row" ng-repeat="folder in vm.folders">
<div class="table-cell text-left">{{ folder.path }}</div>
<div class="table-cell"></div>
<div class="table-cell" ng-class="vm.getDecoration(folder)">{{ folder.size | bytes }}</div>
</div>

View File

@@ -20,16 +20,26 @@ export default function GlancesPluginPortsController($scope, GlancesStats) {
}, this);
}
vm.getDecoration = function (port) {
vm.getPortDecoration = function (port) {
if (port.status === null) {
return 'careful';
}
if (port.status === false) {
} else if (port.status === false) {
return 'critical';
} else if (port.rtt_warning !== null && port.status > port.rtt_warning) {
return 'warning';
}
if (port.rtt_warning !== null && port.status > port.rtt_warning) {
return 'ok';
};
vm.getWebDecoration = function (web) {
var okCodes = [200, 301, 302];
if (web.status === null) {
return 'careful';
} else if (okCodes.indexOf(web.status) === -1) {
return 'critical';
} else if (web.rtt_warning !== null && web.elapsed > web.rtt_warning) {
return 'warning';
}

View File

@@ -3,10 +3,15 @@
20}}
</div>
<div class="table-cell"></div>
<div ng-switch="port.status" ng-class="vm.getDecoration(port)" class="table-cell">
<div ng-switch="port.status" ng-class="vm.getPortDecoration(port)" class="table-cell" ng-if="port.host">
<span ng-switch-when="null">Scanning</span>
<span ng-switch-when="false">Timeout</span>
<span ng-switch-when="true">Open</span>
<span ng-switch-default>{{port.status * 1000.0 | number:0}}ms</span>
</div>
<div ng-switch="port.status" ng-class="vm.getWebDecoration(port)" class="table-cell" ng-if="port.url">
<span ng-switch-when="null">Scanning</span>
<span ng-switch-when="Error">Error</span>
<span ng-switch-default>Code {{ port.status }}</span>
</div>
</div>

View File

Binary file not shown.

View File

Binary file not shown.