mirror of https://github.com/portainer/portainer
feat(container-inspect): add the ability to inspect containers
parent
925326e8aa
commit
7eaaf9a2a7
|
@ -20,6 +20,7 @@ angular.module('portainer', [
|
||||||
'containerConsole',
|
'containerConsole',
|
||||||
'containerLogs',
|
'containerLogs',
|
||||||
'containerStats',
|
'containerStats',
|
||||||
|
'containerInspect',
|
||||||
'serviceLogs',
|
'serviceLogs',
|
||||||
'containers',
|
'containers',
|
||||||
'createContainer',
|
'createContainer',
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
<a class="btn btn-outline-secondary" type="button" ui-sref="stats({id: container.Id})"><i class="fa fa-area-chart space-right" aria-hidden="true"></i>Stats</a>
|
<a class="btn btn-outline-secondary" type="button" ui-sref="stats({id: container.Id})"><i class="fa fa-area-chart space-right" aria-hidden="true"></i>Stats</a>
|
||||||
<a class="btn btn-outline-secondary" type="button" ui-sref="containerlogs({id: container.Id})"><i class="fa fa-exclamation-circle space-right" aria-hidden="true"></i>Logs</a>
|
<a class="btn btn-outline-secondary" type="button" ui-sref="containerlogs({id: container.Id})"><i class="fa fa-exclamation-circle space-right" aria-hidden="true"></i>Logs</a>
|
||||||
<a class="btn btn-outline-secondary" type="button" ui-sref="console({id: container.Id})"><i class="fa fa-terminal space-right" aria-hidden="true"></i>Console</a>
|
<a class="btn btn-outline-secondary" type="button" ui-sref="console({id: container.Id})"><i class="fa fa-terminal space-right" aria-hidden="true"></i>Console</a>
|
||||||
|
<a class="btn btn-outline-secondary" type="button" ui-sref="inspect({id: container.Id})"><i class="fa fa-info-circle space-right" aria-hidden="true"></i>Inspect</a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<rd-header>
|
||||||
|
<rd-header-title title="Container inspect">
|
||||||
|
</rd-header-title>
|
||||||
|
<rd-header-content>
|
||||||
|
<a ui-sref="containers">Containers</a> > <a ui-sref="container({id: containerInfo.Id})">{{ containerInfo.Name|trimcontainername }}</a> > Inspect
|
||||||
|
</rd-header-content>
|
||||||
|
</rd-header>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 col-md-12 col-xs-12">
|
||||||
|
<rd-widget>
|
||||||
|
<rd-widget-header icon="fa-icon-circle" title="Inspect">
|
||||||
|
</rd-widget-header>
|
||||||
|
<rd-widget-body>
|
||||||
|
<pre>{{ containerInfo|json:4 }}</pre>
|
||||||
|
</rd-widget-body>
|
||||||
|
</rd-widget>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,20 @@
|
||||||
|
angular.module('containerInspect', [])
|
||||||
|
.controller('ContainerInspectController', ['$scope', '$transition$', 'Notifications', 'ContainerService',
|
||||||
|
function ($scope, $transition$, Notifications, ContainerService) {
|
||||||
|
function initView() {
|
||||||
|
$('#loadingViewSpinner').show();
|
||||||
|
|
||||||
|
ContainerService.inspect($transition$.params().id)
|
||||||
|
.then(function success(d) {
|
||||||
|
$scope.containerInfo = d;
|
||||||
|
})
|
||||||
|
.catch(function error(e) {
|
||||||
|
Notifications.error('Failure', e, 'Unable to inspect container');
|
||||||
|
})
|
||||||
|
.finally(function final() {
|
||||||
|
$('#loadingViewSpinner').hide();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
initView();
|
||||||
|
}]);
|
|
@ -40,6 +40,9 @@ angular.module('portainer.rest')
|
||||||
exec: {
|
exec: {
|
||||||
method: 'POST', params: {id: '@id', action: 'exec'},
|
method: 'POST', params: {id: '@id', action: 'exec'},
|
||||||
transformResponse: genericHandler
|
transformResponse: genericHandler
|
||||||
|
},
|
||||||
|
inspect: {
|
||||||
|
method: 'GET', params: { id: '@id', action: 'json' }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -105,6 +105,19 @@ function configureRoutes($stateProvider) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.state('inspect', {
|
||||||
|
url: '^/containers/:id/inspect',
|
||||||
|
views: {
|
||||||
|
'content@': {
|
||||||
|
templateUrl: 'app/components/containerInspect/containerInspect.html',
|
||||||
|
controller: 'ContainerInspectController'
|
||||||
|
},
|
||||||
|
'sidebar@': {
|
||||||
|
templateUrl: 'app/components/sidebar/sidebar.html',
|
||||||
|
controller: 'SidebarController'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
.state('dashboard', {
|
.state('dashboard', {
|
||||||
parent: 'root',
|
parent: 'root',
|
||||||
url: '/dashboard',
|
url: '/dashboard',
|
||||||
|
|
|
@ -140,18 +140,11 @@ angular.module('portainer.services')
|
||||||
};
|
};
|
||||||
|
|
||||||
service.containerTop = function(id) {
|
service.containerTop = function(id) {
|
||||||
var deferred = $q.defer();
|
return Container.top({id: id}).$promise;
|
||||||
|
};
|
||||||
Container.top({id: id}).$promise
|
|
||||||
.then(function success(data) {
|
service.inspect = function(id) {
|
||||||
var containerTop = data;
|
return Container.inspect({id: id}).$promise;
|
||||||
deferred.resolve(containerTop);
|
|
||||||
})
|
|
||||||
.catch(function error(err) {
|
|
||||||
deferred.reject(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
return deferred.promise;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
|
|
Loading…
Reference in New Issue