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', [
|
angular.module('portainer.agent').factory('AgentService', [
|
||||||
'$q', 'Agent',
|
'$q', 'Agent','HttpRequestHelper', 'Host',
|
||||||
function AgentServiceFactory($q, Agent) {
|
function AgentServiceFactory($q, Agent, HttpRequestHelper, Host) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var service = {};
|
var service = {};
|
||||||
|
|
||||||
service.agents = agents;
|
service.agents = agents;
|
||||||
service.hostInfo = hostInfo;
|
service.hostInfo = hostInfo;
|
||||||
|
|
||||||
function hostInfo() {
|
function hostInfo(nodeName) {
|
||||||
return $q.when({
|
HttpRequestHelper.setPortainerAgentTargetHeader(nodeName);
|
||||||
PhysicalDeviceVendor: 'hello',
|
return Host.info().$promise;
|
||||||
DeviceVersion: '1.9',
|
|
||||||
DeviceSerialNumber: '144f',
|
|
||||||
InstalledPCIDevices: ['usb', 'printer'],
|
|
||||||
PhysicalDisk: 'none'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function agents() {
|
function agents() {
|
||||||
|
|
|
@ -23,8 +23,7 @@ angular.module('portainer.docker').controller('NodeDetailsViewController', [
|
||||||
ctrl.engineDetails = buildEngineDetails(node);
|
ctrl.engineDetails = buildEngineDetails(node);
|
||||||
ctrl.nodeDetails = buildNodeDetails(node);
|
ctrl.nodeDetails = buildNodeDetails(node);
|
||||||
if (ctrl.state.isAgent) {
|
if (ctrl.state.isAgent) {
|
||||||
AgentService.hostInfo(nodeId).then(function onHostInfoLoad(agentHostInfo) {
|
AgentService.hostInfo(node.Hostname).then(function onHostInfoLoad(agentHostInfo) {
|
||||||
console.log(agentHostInfo);
|
|
||||||
enhanceHostDetails(ctrl.hostDetails, agentHostInfo);
|
enhanceHostDetails(ctrl.hostDetails, agentHostInfo);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue