fix(edge/groups): show tags for environments [EE-4422] (#7940)

pull/8199/head
Chaim Lev-Ari 2022-12-14 09:17:49 +02:00 committed by GitHub
parent 52e150fa29
commit f38b8234d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View File

@ -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();
}
}

View File

@ -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) */