From d612ec9cee22e06f07e0f542229219a0cd640255 Mon Sep 17 00:00:00 2001 From: Chaim Lando Date: Wed, 5 Sep 2018 12:23:30 +0300 Subject: [PATCH] feat(engine-details): add host-view container component --- .../host-overview/host-overview-controller.js | 25 ++-------- app/docker/views/host/host-view-controller.js | 49 +++++++++++++++++++ app/docker/views/host/host-view.html | 4 ++ app/docker/views/host/host-view.js | 4 ++ 4 files changed, 60 insertions(+), 22 deletions(-) create mode 100644 app/docker/views/host/host-view-controller.js create mode 100644 app/docker/views/host/host-view.html create mode 100644 app/docker/views/host/host-view.js diff --git a/app/docker/components/host-overview/host-overview-controller.js b/app/docker/components/host-overview/host-overview-controller.js index d5714e2de..e5d0d56be 100644 --- a/app/docker/components/host-overview/host-overview-controller.js +++ b/app/docker/components/host-overview/host-overview-controller.js @@ -1,22 +1,3 @@ -angular.module('portainer.docker') -.controller('HostOverviewController', ['$q', '$scope', 'SystemService', 'Notifications', -function HostOverviewController($q, $scope, SystemService, Notifications) { - - function initView() { - $q.all({ - version: SystemService.version(), - info: SystemService.info() - }) - .then(function success(data) { - $scope.version = data.version; - $scope.info = data.info; - }) - .catch(function error(err) { - $scope.info = {}; - $scope.version = {}; - Notifications.error('Failure', err, 'Unable to retrieve engine details'); - }); - } - - initView(); -}]); +angular + .module('portainer.docker') + .controller('HostOverviewController', [function HostOverviewController() {}]); diff --git a/app/docker/views/host/host-view-controller.js b/app/docker/views/host/host-view-controller.js new file mode 100644 index 000000000..7361e5b5e --- /dev/null +++ b/app/docker/views/host/host-view-controller.js @@ -0,0 +1,49 @@ +angular.module('portainer.docker').controller('HostViewController', [ + '$q', + '$scope', + 'SystemService', + 'Notifications', + function HostViewController($q, $scope, SystemService, Notifications) { + var ctrl = this; + this.$onInit = initView; + + this.engineDetails = {}; + this.hostDetails = {}; + + function initView() { + $q.all({ + version: SystemService.version(), + info: SystemService.info() + }) + .then(function success(data) { + ctrl.engineDetails = buildEngineDetails(data); + ctrl.hostDetails = buildHostDetails(data); + }) + .catch(function error(err) { + Notifications.error( + 'Failure', + err, + 'Unable to retrieve engine details' + ); + }); + } + + function buildEngineDetails(data) { + var versionDetails = data.version; + var info = data.info; + return { + releaseVersion: versionDetails.Version, + apiVersion: versionDetails.ApiVersion, + rootDirectory: info.DockerRootDir, + storageDriver: info.Driver, + loggingDriver: info.LoggingDriver, + volumePlugins: info.Plugins.Volume, + networkPlugins: info.Plugins.Network + }; + } + + function buildHostDetails() { + return {}; + } + } +]); diff --git a/app/docker/views/host/host-view.html b/app/docker/views/host/host-view.html new file mode 100644 index 000000000..13cea0a2e --- /dev/null +++ b/app/docker/views/host/host-view.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/app/docker/views/host/host-view.js b/app/docker/views/host/host-view.js new file mode 100644 index 000000000..e321dccb4 --- /dev/null +++ b/app/docker/views/host/host-view.js @@ -0,0 +1,4 @@ +angular.module('portainer.docker').component('hostView', { + templateUrl: 'app/docker/views/host/host-view.html', + controller: 'HostViewController' +});