diff --git a/glances/outputs/static/js/components/plugin-docker/component.js b/glances/outputs/static/js/components/plugin-docker/component.js new file mode 100644 index 00000000..8ca79a72 --- /dev/null +++ b/glances/outputs/static/js/components/plugin-docker/component.js @@ -0,0 +1,7 @@ +'use strict'; + +glancesApp.component('glancesPluginDocker', { + controller: GlancesPluginDockerController, + controllerAs: 'vm', + templateUrl: 'components/plugin-docker/view.html' +}); diff --git a/glances/outputs/static/js/components/plugin-docker/controller.js b/glances/outputs/static/js/components/plugin-docker/controller.js new file mode 100644 index 00000000..3785050e --- /dev/null +++ b/glances/outputs/static/js/components/plugin-docker/controller.js @@ -0,0 +1,40 @@ +'use strict'; + +function GlancesPluginDockerController($scope) { + var vm = this; + vm.containers = []; + vm.version = null; + + $scope.$on('data_refreshed', function(event, data) { + var stats = data.stats['docker']; + this.containers = []; + + if(_.isEmpty(stats)) { + return; + } + + for (var i = 0; i < stats['containers'].length; i++) { + var containerData = stats['containers'][i]; + + var container = { + 'id': containerData.Id, + 'name': containerData.Names[0].split('/').splice(-1)[0], + 'status': containerData.Status, + 'cpu': containerData.cpu.total, + 'memory': containerData.memory.usage != undefined ? containerData.memory.usage : '?', + 'ior': containerData.io.ior != undefined ? containerData.io.ior : '?', + 'iow': containerData.io.iow != undefined ? containerData.io.iow : '?', + 'io_time_since_update': containerData.io.time_since_update, + 'rx': containerData.network.rx != undefined ? containerData.network.rx : '?', + 'tx': containerData.network.tx != undefined ? containerData.network.tx : '?', + 'net_time_since_update': containerData.network.time_since_update, + 'command': containerData.Command, + 'image': containerData.Image + }; + + vm.containers.push(container); + } + + vm.version = stats['version']['Version']; + }); +} diff --git a/glances/outputs/static/js/components/plugin-docker/view.html b/glances/outputs/static/js/components/plugin-docker/view.html new file mode 100644 index 00000000..b22b8e4b --- /dev/null +++ b/glances/outputs/static/js/components/plugin-docker/view.html @@ -0,0 +1,28 @@ +
+ CONTAINERS {{ vm.containers.length }} (served by Docker {{ vm.version }}) + +
+
+
Name
+
Status
+
CPU%
+
MEM
+
IOR/s
+
IOW/s
+
RX/s
+
TX/s
+
Command
+
+
+
{{ container.name }}
+
{{ container.status }}
+
{{ container.cpu | number:1 }}
+
{{ container.memory | bytes }}
+
{{ container.ior / container.io_time_since_update | bits }}
+
{{ container.iow / container.io_time_since_update | bits }}
+
{{ container.rx / container.net_time_since_update | bits }}
+
{{ container.tx / container.net_time_since_update | bits }}
+
{{ container.command }}
+
+
+
diff --git a/glances/outputs/static/public/js/main.min.js b/glances/outputs/static/public/js/main.min.js index 4a7e0f1e..97baf8c6 100644 --- a/glances/outputs/static/public/js/main.min.js +++ b/glances/outputs/static/public/js/main.min.js @@ -787,6 +787,55 @@ function GlancesPluginDiskioController($scope, $filter, ARGUMENTS) { 'use strict'; +glancesApp.component('glancesPluginDocker', { + controller: GlancesPluginDockerController, + controllerAs: 'vm', + templateUrl: 'components/plugin-docker/view.html' +}); + +'use strict'; + +function GlancesPluginDockerController($scope) { + var vm = this; + vm.containers = []; + vm.version = null; + + $scope.$on('data_refreshed', function(event, data) { + var stats = data.stats['docker']; + this.containers = []; + + if(_.isEmpty(stats)) { + return; + } + + for (var i = 0; i < stats['containers'].length; i++) { + var containerData = stats['containers'][i]; + + var container = { + 'id': containerData.Id, + 'name': containerData.Names[0].split('/').splice(-1)[0], + 'status': containerData.Status, + 'cpu': containerData.cpu.total, + 'memory': containerData.memory.usage != undefined ? containerData.memory.usage : '?', + 'ior': containerData.io.ior != undefined ? containerData.io.ior : '?', + 'iow': containerData.io.iow != undefined ? containerData.io.iow : '?', + 'io_time_since_update': containerData.io.time_since_update, + 'rx': containerData.network.rx != undefined ? containerData.network.rx : '?', + 'tx': containerData.network.tx != undefined ? containerData.network.tx : '?', + 'net_time_since_update': containerData.network.time_since_update, + 'command': containerData.Command, + 'image': containerData.Image + }; + + vm.containers.push(container); + } + + vm.version = stats['version']['Version']; + }); +} + +'use strict'; + glancesApp.component('glancesPluginFs', { controller: GlancesPluginFsController, controllerAs: 'vm', diff --git a/glances/outputs/static/public/js/templates.min.js b/glances/outputs/static/public/js/templates.min.js index ab382d4c..b9a00fae 100644 --- a/glances/outputs/static/public/js/templates.min.js +++ b/glances/outputs/static/public/js/templates.min.js @@ -5,6 +5,7 @@ $templateCache.put('components/plugin-amps/view.html','
\n $templateCache.put('components/plugin-cloud/view.html','
\n {{ vm.provider }} {{ vm.instance }}\n
\n'); $templateCache.put('components/plugin-cpu/view.html','
\n
\n
\n
\n
\n
CPU
\n
{{ vm.total }}%
\n
\n
\n
user:
\n
\n {{ vm.user }}%\n
\n
\n
\n
system:
\n
\n {{ vm.system }}%\n
\n
\n
\n
idle:
\n
{{ vm.idle }}%
\n
\n
\n
\n \n \n
\n
\n'); $templateCache.put('components/plugin-diskio/view.html','
\n
DISK I/O
\n
R/s
\n
W/s
\n\n
IOR/s
\n
IOW/s
\n
\n
\n
{{(disk.alias ? disk.alias : disk.name) | min_size}}
\n
{{disk.bitrate.txps }}
\n
{{disk.bitrate.rxps }}
\n\n
{{disk.count.txps }}
\n
{{disk.count.rxps }}
\n
\n'); +$templateCache.put('components/plugin-docker/view.html','
\n CONTAINERS {{ vm.containers.length }} (served by Docker {{ vm.version }})\n\n
\n
\n
Name
\n
Status
\n
CPU%
\n
MEM
\n
IOR/s
\n
IOW/s
\n
RX/s
\n
TX/s
\n
Command
\n
\n
\n
{{ container.name }}
\n
{{ container.status }}
\n
{{ container.cpu | number:1 }}
\n
{{ container.memory | bytes }}
\n
{{ container.ior / container.io_time_since_update | bits }}
\n
{{ container.iow / container.io_time_since_update | bits }}
\n
{{ container.rx / container.net_time_since_update | bits }}
\n
{{ container.tx / container.net_time_since_update | bits }}
\n
{{ container.command }}
\n
\n
\n
\n'); $templateCache.put('components/plugin-fs/view.html','
\n
FILE SYS
\n
\n Used\n Free\n
\n
Total
\n
\n
\n
{{ fs.shortMountPoint }} ({{ fs.name }})
\n
\n {{ fs.used | bytes }}\n {{ fs.free | bytes }}\n
\n
{{ fs.size | bytes }}
\n
\n'); $templateCache.put('components/plugin-ip/view.html','
\n  - IP {{ vm.address }}/{{ vm.maskCidr }} Pub {{ vm.publicAddress }}\n
\n'); $templateCache.put('components/plugin-load/view.html','
\n
\n
\n
LOAD
\n
{{ vm.cpucore }}-core
\n
\n
\n
1 min:
\n
\n {{ vm.min1 | number : 2}}\n
\n
\n
\n
5 min:
\n
\n {{ vm.min5 | number : 2}}\n
\n
\n
\n
15 min:
\n
\n {{ vm.min15 | number : 2}}\n
\n
\n
\n
\n');