mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
feat(agent): add agent support (#1828)
This commit is contained in:
parent
77a85bd385
commit
2327d696e0
116 changed files with 1900 additions and 689 deletions
24
app/agent/services/agentService.js
Normal file
24
app/agent/services/agentService.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
angular.module('portainer.agent')
|
||||
.factory('AgentService', ['$q', 'Agent', function AgentServiceFactory($q, Agent) {
|
||||
'use strict';
|
||||
var service = {};
|
||||
|
||||
service.agents = function() {
|
||||
var deferred = $q.defer();
|
||||
|
||||
Agent.query({}).$promise
|
||||
.then(function success(data) {
|
||||
var agents = data.map(function (item) {
|
||||
return new AgentViewModel(item);
|
||||
});
|
||||
deferred.resolve(agents);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
deferred.reject({ msg: 'Unable to retrieve agents', err: err });
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
return service;
|
||||
}]);
|
Loading…
Add table
Add a link
Reference in a new issue