2020-04-10 21:54:53 +00:00
|
|
|
angular.module('portainer.agent').controller('NodeSelectorController', [
|
|
|
|
'AgentService',
|
|
|
|
'Notifications',
|
|
|
|
function (AgentService, Notifications) {
|
|
|
|
var ctrl = this;
|
2018-05-06 07:15:57 +00:00
|
|
|
|
2020-04-10 21:54:53 +00:00
|
|
|
this.$onInit = function () {
|
|
|
|
AgentService.agents()
|
|
|
|
.then(function success(data) {
|
|
|
|
ctrl.agents = data;
|
|
|
|
if (!ctrl.model) {
|
|
|
|
ctrl.model = data[0].NodeName;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(function error(err) {
|
|
|
|
Notifications.error('Failure', err, 'Unable to load agents');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
},
|
|
|
|
]);
|