1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 13:29:41 +02:00

feat(k8s): add filter for k8s application type EE-1627 (#5733)

* add filter for k8s application type
This commit is contained in:
Richard Wei 2021-09-30 15:53:03 +13:00 committed by GitHub
parent 34f6e11f1d
commit 75071dfade
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 2 deletions

View file

@ -2,6 +2,7 @@ import { KubernetesApplicationDeploymentTypes, KubernetesApplicationTypes } from
import KubernetesApplicationHelper from 'Kubernetes/helpers/application';
import KubernetesNamespaceHelper from 'Kubernetes/helpers/namespaceHelper';
import { KubernetesConfigurationTypes } from 'Kubernetes/models/configuration/models';
import _ from 'lodash-es';
angular.module('portainer.docker').controller('KubernetesApplicationsDatatableController', [
'$scope',
@ -22,6 +23,14 @@ angular.module('portainer.docker').controller('KubernetesApplicationsDatatableCo
expandedItems: [],
});
this.filters = {
state: {
open: false,
enabled: false,
values: [],
},
};
this.expandAll = function () {
this.state.expandAll = !this.state.expandAll;
this.state.filteredDataSet.forEach((item) => this.expandItem(item, this.state.expandAll));
@ -114,6 +123,19 @@ angular.module('portainer.docker').controller('KubernetesApplicationsDatatableCo
return !this.isSystemNamespace(item);
};
this.applyFilters = function (item) {
return ctrl.filters.state.values.some((filter) => item.ApplicationType === filter.type && filter.display);
};
this.onStateFilterChange = function () {
this.filters.state.enabled = this.filters.state.values.some((filter) => !filter.display);
};
this.prepareTableFromDataset = function () {
const availableTypeFilters = this.dataset.map((item) => ({ type: item.ApplicationType, display: true }));
this.filters.state.values = _.uniqBy(availableTypeFilters, 'type');
};
this.$onInit = function () {
this.isAdmin = Authentication.isAdmin();
this.KubernetesApplicationDeploymentTypes = KubernetesApplicationDeploymentTypes;