1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-21 14:29:40 +02:00
portainer/app/agent/components/node-selector/nodeSelectorController.js
2020-08-11 09:52:29 +12:00

18 lines
456 B
JavaScript

export class NodeSelectorController {
/* @ngInject */
constructor(AgentService, Notifications) {
Object.assign(this, { AgentService, Notifications });
}
async $onInit() {
try {
const agents = await this.AgentService.agents();
this.agents = agents;
if (!this.model) {
this.model = agents[0].NodeName;
}
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to load agents');
}
}
}