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:
parent
34f6e11f1d
commit
75071dfade
2 changed files with 44 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue