1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

fix(app): sync showSystem between stacks and apps tables [EE-6216] (#10532)

This commit is contained in:
Ali 2023-10-30 19:41:41 +00:00 committed by GitHub
parent 7d868d1dc9
commit 1140804fe9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 18 deletions

View file

@ -20,6 +20,7 @@ angular.module('portainer.kubernetes').component('kubernetesApplicationsDatatabl
onChangeNamespaceDropdown: '<',
isAppsLoading: '<',
isSystemResources: '<',
isVisible: '<',
setSystemResources: '<',
hideStacksFunctionality: '<',
},

View file

@ -4,7 +4,7 @@ import KubernetesApplicationHelper from 'Kubernetes/helpers/application';
import KubernetesNamespaceHelper from 'Kubernetes/helpers/namespaceHelper';
import { KubernetesConfigurationKinds } from 'Kubernetes/models/configuration/models';
angular.module('portainer.docker').controller('KubernetesApplicationsDatatableController', [
angular.module('portainer.kubernetes').controller('KubernetesApplicationsDatatableController', [
'$scope',
'$controller',
'DatatableService',
@ -175,8 +175,15 @@ angular.module('portainer.docker').controller('KubernetesApplicationsDatatableCo
}
};
this.$onChanges = function () {
if (typeof this.isSystemResources !== 'undefined') {
this.$onChanges = function (changes) {
// when the table is visible, sync the show system setting with the stack show system setting
if (changes.isVisible && changes.isVisible.currentValue) {
const storedStacksSettings = DatatableService.getDataTableSettings('kubernetes.applications.stacks');
if (storedStacksSettings && storedStacksSettings.state) {
this.settings.showSystem = storedStacksSettings.state.showSystemResources;
DatatableService.setDataTableSettings(this.settingsKey, this.settings);
}
} else if (typeof this.isSystemResources !== 'undefined') {
this.settings.showSystem = this.isSystemResources;
DatatableService.setDataTableSettings(this.settingsKey, this.settings);
}
@ -223,6 +230,12 @@ angular.module('portainer.docker').controller('KubernetesApplicationsDatatableCo
this.settings = storedSettings;
this.settings.open = false;
// make show system in sync with the stack show system settings
const storedStacksSettings = DatatableService.getDataTableSettings('kubernetes.applications.stacks');
if (storedStacksSettings && storedStacksSettings.state) {
this.settings.showSystem = storedStacksSettings.state.showSystemResources;
}
this.setSystemResources && this.setSystemResources(this.settings.showSystem);
}
this.settingsLoaded = true;