mirror of https://github.com/portainer/portainer
fix(tags): get tags when loading associated endpoints selector EE-4140 (#7857)
parent
7a6ff10268
commit
8f1ac38963
|
@ -3,6 +3,7 @@ import _ from 'lodash-es';
|
||||||
|
|
||||||
import { EdgeTypes } from '@/portainer/environments/types';
|
import { EdgeTypes } from '@/portainer/environments/types';
|
||||||
import { getEnvironments } from '@/portainer/environments/environment.service';
|
import { getEnvironments } from '@/portainer/environments/environment.service';
|
||||||
|
import { getTags } from '@/portainer/tags/tags.service';
|
||||||
|
|
||||||
class AssoicatedEndpointsSelectorController {
|
class AssoicatedEndpointsSelectorController {
|
||||||
/* @ngInject */
|
/* @ngInject */
|
||||||
|
@ -47,6 +48,7 @@ class AssoicatedEndpointsSelectorController {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadData() {
|
loadData() {
|
||||||
|
this.getTags();
|
||||||
this.getAvailableEndpoints();
|
this.getAvailableEndpoints();
|
||||||
this.getAssociatedEndpoints();
|
this.getAssociatedEndpoints();
|
||||||
}
|
}
|
||||||
|
@ -79,6 +81,14 @@ class AssoicatedEndpointsSelectorController {
|
||||||
this.setTableData('associated', response.value, response.totalCount);
|
this.setTableData('associated', response.value, response.totalCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTags() {
|
||||||
|
return this.$async(async () => {
|
||||||
|
let tags = { value: [], totalCount: 0 };
|
||||||
|
tags = await getTags();
|
||||||
|
this.tags = tags;
|
||||||
|
});
|
||||||
|
}
|
||||||
/* #endregion */
|
/* #endregion */
|
||||||
|
|
||||||
/* #region On endpoint click (either available or associated) */
|
/* #region On endpoint click (either available or associated) */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
export function idsToTagNames(tags, ids) {
|
export function idsToTagNames(tags, ids) {
|
||||||
const filteredTags = _.filter(tags, (tag) => _.includes(ids, tag.Id));
|
const filteredTags = _.filter(tags, (tag) => _.includes(ids, tag.ID));
|
||||||
const tagNames = _.map(filteredTags, 'Name');
|
const tagNames = _.map(filteredTags, 'Name');
|
||||||
return tagNames;
|
return tagNames;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue