1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +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;

View file

@ -160,6 +160,8 @@ export const ngModule = angular
'namespaces',
'onNamespaceChange',
'isLoading',
'showSystem',
'setSystemResources',
])
);

View file

@ -24,6 +24,7 @@
on-change-namespace-dropdown="(ctrl.onChangeNamespaceDropdown)"
is-apps-loading="ctrl.state.isAppsLoading"
is-system-resources="ctrl.state.isSystemResources"
is-visible="ctrl.state.activeTab === 0"
set-system-resources="(ctrl.setSystemResources)"
hide-stacks-functionality="ctrl.deploymentOptions.hideStacksFunctionality"
>
@ -40,6 +41,8 @@
namespace="ctrl.state.namespaceName"
is-loading="ctrl.state.isAppsLoading"
on-namespace-change="(ctrl.onChangeNamespaceDropdown)"
show-system="ctrl.state.isSystemResources"
set-system-resources="(ctrl.setSystemResources)"
>
</kubernetes-applications-stacks-datatable>
</uib-tab>