mirror of https://github.com/portainer/portainer
feat(host-details): get info from agent
parent
dc1ab3ffc3
commit
50e6991745
|
@ -0,0 +1,15 @@
|
|||
angular.module('portainer.agent').factory('Host', [
|
||||
'$resource', 'API_ENDPOINT_ENDPOINTS', 'EndpointProvider',
|
||||
function AgentFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
||||
'use strict';
|
||||
return $resource(
|
||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/host/:action',
|
||||
{
|
||||
endpointId: EndpointProvider.endpointID
|
||||
},
|
||||
{
|
||||
info: { method: 'GET', isArray: false, params: { action: 'info' } }
|
||||
}
|
||||
);
|
||||
}
|
||||
]);
|
|
@ -1,20 +1,15 @@
|
|||
angular.module('portainer.agent').factory('AgentService', [
|
||||
'$q', 'Agent',
|
||||
function AgentServiceFactory($q, Agent) {
|
||||
'$q', 'Agent','HttpRequestHelper', 'Host',
|
||||
function AgentServiceFactory($q, Agent, HttpRequestHelper, Host) {
|
||||
'use strict';
|
||||
var service = {};
|
||||
|
||||
service.agents = agents;
|
||||
service.hostInfo = hostInfo;
|
||||
|
||||
function hostInfo() {
|
||||
return $q.when({
|
||||
PhysicalDeviceVendor: 'hello',
|
||||
DeviceVersion: '1.9',
|
||||
DeviceSerialNumber: '144f',
|
||||
InstalledPCIDevices: ['usb', 'printer'],
|
||||
PhysicalDisk: 'none'
|
||||
});
|
||||
function hostInfo(nodeName) {
|
||||
HttpRequestHelper.setPortainerAgentTargetHeader(nodeName);
|
||||
return Host.info().$promise;
|
||||
}
|
||||
|
||||
function agents() {
|
||||
|
|
|
@ -23,8 +23,7 @@ angular.module('portainer.docker').controller('NodeDetailsViewController', [
|
|||
ctrl.engineDetails = buildEngineDetails(node);
|
||||
ctrl.nodeDetails = buildNodeDetails(node);
|
||||
if (ctrl.state.isAgent) {
|
||||
AgentService.hostInfo(nodeId).then(function onHostInfoLoad(agentHostInfo) {
|
||||
console.log(agentHostInfo);
|
||||
AgentService.hostInfo(node.Hostname).then(function onHostInfoLoad(agentHostInfo) {
|
||||
enhanceHostDetails(ctrl.hostDetails, agentHostInfo);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue