Skip to content

Commit

Permalink
First try to eable the connections plugin in the WebUI... (it's a fail)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo authored and notFloran committed Dec 1, 2019
1 parent 8dbc862 commit b037e91
Show file tree
Hide file tree
Showing 8 changed files with 311 additions and 150 deletions.
8 changes: 8 additions & 0 deletions glances/outputs/static/js/components/glances/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ export default function GlancesController($scope, GlancesStats, hotkeys, ARGUMEN
}
});

// k => Show/hide connections stats
hotkeys.add({
combo: 'k',
callback: function () {
ARGUMENTS.disable_connections = !ARGUMENTS.disable_connections;
}
});

// n => Show/hide network stats
hotkeys.add({
combo: 'n',
Expand Down
1 change: 1 addition & 0 deletions glances/outputs/static/js/components/glances/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<div class="col-sm-6 sidebar" ng-if="!vm.arguments.disable_left_sidebar">
<div class="table">
<glances-plugin-network id="plugin-network" class="plugin table-row-group" ng-if="!vm.arguments.disable_network"></glances-plugin-network>
<glances-plugin-connections id="plugin-connections" class="plugin table-row-group" ng-if="!vm.arguments.disable_connections"></glances-plugin-connections>
<glances-plugin-wifi id="plugin-wifi" class="plugin table-row-group" ng-if="!vm.arguments.disable_wifi"></glances-plugin-wifi>
<glances-plugin-ports id="plugin-ports" class="plugin table-row-group" ng-if="!vm.arguments.disable_ports"></glances-plugin-ports>
<glances-plugin-diskio id="plugin-diskio" class="plugin table-row-group" ng-if="!vm.arguments.disable_diskio"></glances-plugin-diskio>
Expand Down
1 change: 1 addition & 0 deletions glances/outputs/static/js/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "./help/component";
import "./plugin-alert/component";
import "./plugin-amps/component";
import "./plugin-cloud/component";
import "./plugin-connections/component";
import "./plugin-cpu/component";
import "./plugin-diskio/component";
import "./plugin-docker/component";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

import angular from "angular";

import GlancesPluginConnectionsController from "./controller";
import template from "./view.html";

export default angular.module("glancesApp").component("glancesPluginConnections", {
controller: GlancesPluginConnectionsController,
controllerAs: "vm",
templateUrl: template,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

export default function GlancesPluginConnectionsController($scope, GlancesStats) {
var vm = this;
var _view = {};

vm.listen = null;
vm.initiated = null;
vm.established = null;
vm.terminated = null;
vm.tracked = null;

vm.$onInit = function () {
loadData(GlancesStats.getData());
};

$scope.$on('data_refreshed', function (event, data) {
loadData(data);
});

var loadData = function (data) {
var stats = data.stats['connections'];
_view = data.views['connections'];

vm.isLinux = data.isLinux;

vm.listen = stats.listen;
vm.initiated = stats.initiated;
vm.established = stats.established;
vm.terminated = stats.terminated;
//vm.tracked = null;
}

vm.getDecoration = function (value) {
if (_view[value] === undefined) {
return;
}

return _view[value].decoration.toLowerCase();
};
}
10 changes: 10 additions & 0 deletions glances/outputs/static/js/components/plugin-connections/view.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="table-row" ng-if="vm.irqs.length > 0">
<div class="table-cell text-left title">IRQ</div>
<div class="table-cell"></div>
<div class="table-cell">Rate/s</div>
</div>
<div class="table-row" ng-repeat="irq in vm.irqs">
<div class="table-cell text-left">{{irq.irq_line}}</div>
<div class="table-cell"></div>
<div class="table-cell"><span>{{irq.irq_rate}}</span></div>
</div>
388 changes: 239 additions & 149 deletions glances/outputs/static/public/glances.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion glances/outputs/static/public/glances.map.js

Large diffs are not rendered by default.

0 comments on commit b037e91

Please sign in to comment.