feat(engine-details): add host-view container component

pull/2255/head
Chaim Lando 2018-09-05 12:23:30 +03:00
parent 65f542f722
commit d612ec9cee
4 changed files with 60 additions and 22 deletions

View File

@ -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() {}]);

View File

@ -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 {};
}
}
]);

View File

@ -0,0 +1,4 @@
<host-overview
engine-details="$ctrl.engineDetails"
host-details="$ctrl.hostDetails"
></host-overview>

View File

@ -0,0 +1,4 @@
angular.module('portainer.docker').component('hostView', {
templateUrl: 'app/docker/views/host/host-view.html',
controller: 'HostViewController'
});