diff --git a/app/edge/components/group-form/groupFormController.js b/app/edge/components/group-form/groupFormController.js index 1bed6652d..50ddd63dd 100644 --- a/app/edge/components/group-form/groupFormController.js +++ b/app/edge/components/group-form/groupFormController.js @@ -2,6 +2,8 @@ import _ from 'lodash-es'; import { confirmDestructiveAsync } from '@/portainer/services/modal.service/confirm'; import { EdgeTypes } from '@/react/portainer/environments/types'; import { getEnvironments } from '@/react/portainer/environments/environment.service'; +import { getTags } from '@/portainer/tags/tags.service'; +import { notifyError } from '@/portainer/services/notifications'; export class EdgeGroupFormController { /* @ngInject */ @@ -19,6 +21,8 @@ export class EdgeGroupFormController { value: null, }; + this.tags = []; + this.associateEndpoint = this.associateEndpoint.bind(this); this.dissociateEndpoint = this.dissociateEndpoint.bind(this); this.getDynamicEndpointsAsync = this.getDynamicEndpointsAsync.bind(this); @@ -88,4 +92,18 @@ export class EdgeGroupFormController { this.endpoints.value = response.value; this.endpoints.state.totalCount = totalCount; } + + getTags() { + return this.$async(async () => { + try { + this.tags = await getTags(); + } catch (err) { + notifyError('Failure', err, 'Unable to retrieve tags'); + } + }); + } + + $onInit() { + this.getTags(); + } } diff --git a/app/portainer/components/associated-endpoints-selector/associatedEndpointsSelectorController.js b/app/portainer/components/associated-endpoints-selector/associatedEndpointsSelectorController.js index 8e8a4d9c0..b6d6a2a11 100644 --- a/app/portainer/components/associated-endpoints-selector/associatedEndpointsSelectorController.js +++ b/app/portainer/components/associated-endpoints-selector/associatedEndpointsSelectorController.js @@ -3,7 +3,6 @@ import _ from 'lodash-es'; import { EdgeTypes } from '@/react/portainer/environments/types'; import { getEnvironments } from '@/react/portainer/environments/environment.service'; -import { getTags } from '@/portainer/tags/tags.service'; class AssoicatedEndpointsSelectorController { /* @ngInject */ @@ -48,7 +47,6 @@ class AssoicatedEndpointsSelectorController { } loadData() { - this.getTags(); this.getAvailableEndpoints(); this.getAssociatedEndpoints(); } @@ -82,13 +80,6 @@ class AssoicatedEndpointsSelectorController { }); } - getTags() { - return this.$async(async () => { - let tags = { value: [], totalCount: 0 }; - tags = await getTags(); - this.tags = tags; - }); - } /* #endregion */ /* #region On endpoint click (either available or associated) */