You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/kubernetes/services/stackService.js

33 lines
840 B

import _ from 'lodash-es';
import angular from 'angular';
class KubernetesStackService {
/* @ngInject */
constructor($async, KubernetesApplicationService) {
this.$async = $async;
this.KubernetesApplicationService = KubernetesApplicationService;
this.getAllAsync = this.getAllAsync.bind(this);
}
/**
* GET
*/
async getAllAsync(namespace) {
try {
const applications = await this.KubernetesApplicationService.get(namespace);
const stacks = _.map(applications, (item) => item.StackName);
return _.uniq(_.without(stacks, '-'));
} catch (err) {
throw err;
}
}
get(namespace) {
return this.$async(this.getAllAsync, namespace);
}
}
export default KubernetesStackService;
angular.module('portainer.kubernetes').service('KubernetesStackService', KubernetesStackService);