mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
feat(applications): application page performance improvements EE-4956 (#8569)
This commit is contained in:
parent
01ea9afe33
commit
bdde278139
13 changed files with 239 additions and 9 deletions
|
@ -8,6 +8,22 @@
|
|||
</div>
|
||||
Applications
|
||||
</div>
|
||||
<div class="form-group namespaces !mb-0 !mr-0 min-w-[280px]">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
<pr-icon icon="'filter'"></pr-icon>
|
||||
Namespace
|
||||
</span>
|
||||
<select
|
||||
class="form-control"
|
||||
ng-model="$ctrl.state.namespace"
|
||||
ng-change="$ctrl.onChangeNamespace()"
|
||||
data-cy="component-namespaceSelect"
|
||||
ng-options="o.Value as (o.Name + (o.IsSystem ? ' - system' : '')) for o in $ctrl.state.namespaces"
|
||||
>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="searchBar vertical-center !mr-0 min-w-[280px]">
|
||||
<pr-icon icon="'search'" class-name="'searchIcon'"></pr-icon>
|
||||
<input
|
||||
|
|
|
@ -15,5 +15,10 @@ angular.module('portainer.kubernetes').component('kubernetesApplicationsDatatabl
|
|||
refreshCallback: '<',
|
||||
onPublishingModeClick: '<',
|
||||
isPrimary: '<',
|
||||
namespaces: '<',
|
||||
namespace: '<',
|
||||
onChangeNamespaceDropdown: '<',
|
||||
isSystemResources: '<',
|
||||
setSystemResources: '<',
|
||||
},
|
||||
});
|
||||
|
|
|
@ -21,6 +21,8 @@ angular.module('portainer.docker').controller('KubernetesApplicationsDatatableCo
|
|||
this.state = Object.assign(this.state, {
|
||||
expandAll: false,
|
||||
expandedItems: [],
|
||||
namespace: '',
|
||||
namespaces: [],
|
||||
});
|
||||
|
||||
this.filters = {
|
||||
|
@ -70,6 +72,8 @@ angular.module('portainer.docker').controller('KubernetesApplicationsDatatableCo
|
|||
};
|
||||
|
||||
this.onSettingsShowSystemChange = function () {
|
||||
this.updateNamespace();
|
||||
this.setSystemResources(this.settings.showSystem);
|
||||
DatatableService.setDataTableSettings(this.tableKey, this.settings);
|
||||
};
|
||||
|
||||
|
@ -135,6 +139,43 @@ angular.module('portainer.docker').controller('KubernetesApplicationsDatatableCo
|
|||
this.filters.state.values = _.uniqBy(availableTypeFilters, 'type');
|
||||
};
|
||||
|
||||
this.onChangeNamespace = function () {
|
||||
this.onChangeNamespaceDropdown(this.state.namespace);
|
||||
};
|
||||
|
||||
this.updateNamespace = function () {
|
||||
if (this.namespaces) {
|
||||
const namespaces = [{ Name: 'All namespaces', Value: '', IsSystem: false }];
|
||||
this.namespaces.find((ns) => {
|
||||
if (!this.settings.showSystem && ns.IsSystem) {
|
||||
return false;
|
||||
}
|
||||
namespaces.push({ Name: ns.Name, Value: ns.Name, IsSystem: ns.IsSystem });
|
||||
});
|
||||
this.state.namespaces = namespaces;
|
||||
|
||||
if (this.state.namespace && !this.state.namespaces.find((ns) => ns.Name === this.state.namespace)) {
|
||||
if (this.state.namespaces.length > 1) {
|
||||
let defaultNS = this.state.namespaces.find((ns) => ns.Name === 'default');
|
||||
defaultNS = defaultNS || this.state.namespaces[1];
|
||||
this.state.namespace = defaultNS.Value;
|
||||
} else {
|
||||
this.state.namespace = this.state.namespaces[0].Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.$onChanges = function () {
|
||||
if (typeof this.isSystemResources !== 'undefined') {
|
||||
this.settings.showSystem = this.isSystemResources;
|
||||
DatatableService.setDataTableSettings(this.settingsKey, this.settings);
|
||||
}
|
||||
this.state.namespace = this.namespace;
|
||||
this.updateNamespace();
|
||||
this.prepareTableFromDataset();
|
||||
};
|
||||
|
||||
this.$onInit = function () {
|
||||
this.isAdmin = Authentication.isAdmin();
|
||||
this.KubernetesApplicationDeploymentTypes = KubernetesApplicationDeploymentTypes;
|
||||
|
@ -172,7 +213,16 @@ angular.module('portainer.docker').controller('KubernetesApplicationsDatatableCo
|
|||
if (storedSettings !== null) {
|
||||
this.settings = storedSettings;
|
||||
this.settings.open = false;
|
||||
|
||||
this.setSystemResources && this.setSystemResources(this.settings.showSystem);
|
||||
}
|
||||
|
||||
// Set the default selected namespace
|
||||
if (!this.state.namespace) {
|
||||
this.state.namespace = this.namespace;
|
||||
}
|
||||
|
||||
this.updateNamespace();
|
||||
this.onSettingsRepeaterChange();
|
||||
};
|
||||
},
|
||||
|
|
|
@ -10,6 +10,22 @@
|
|||
Stacks
|
||||
</div>
|
||||
<!-- actions -->
|
||||
<div class="form-group namespaces !mb-0 !mr-0 min-w-[280px]">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">
|
||||
<pr-icon icon="'filter'"></pr-icon>
|
||||
Namespace
|
||||
</span>
|
||||
<select
|
||||
class="form-control"
|
||||
ng-model="$ctrl.state.namespace"
|
||||
ng-change="$ctrl.onChangeNamespace()"
|
||||
data-cy="component-namespaceSelect"
|
||||
ng-options="o.Value as (o.Name + (o.IsSystem ? ' - system' : '')) for o in $ctrl.state.namespaces"
|
||||
>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="searchBar vertical-center">
|
||||
<pr-icon icon="'search'" class-name="'!h-3'"></pr-icon>
|
||||
<input
|
||||
|
|
|
@ -10,5 +10,10 @@ angular.module('portainer.kubernetes').component('kubernetesApplicationsStacksDa
|
|||
reverseOrder: '<',
|
||||
refreshCallback: '<',
|
||||
removeAction: '<',
|
||||
namespaces: '<',
|
||||
namespace: '<',
|
||||
onChangeNamespaceDropdown: '<',
|
||||
isSystemResources: '<',
|
||||
setSystemResources: '<',
|
||||
},
|
||||
});
|
||||
|
|
|
@ -13,6 +13,8 @@ angular.module('portainer.kubernetes').controller('KubernetesApplicationsStacksD
|
|||
this.state = Object.assign(this.state, {
|
||||
expandedItems: [],
|
||||
expandAll: false,
|
||||
namespace: '',
|
||||
namespaces: [],
|
||||
});
|
||||
|
||||
var ctrl = this;
|
||||
|
@ -22,6 +24,8 @@ angular.module('portainer.kubernetes').controller('KubernetesApplicationsStacksD
|
|||
});
|
||||
|
||||
this.onSettingsShowSystemChange = function () {
|
||||
this.updateNamespace();
|
||||
this.setSystemResources(this.settings.showSystem);
|
||||
DatatableService.setDataTableSettings(this.tableKey, this.settings);
|
||||
};
|
||||
|
||||
|
@ -76,6 +80,44 @@ angular.module('portainer.kubernetes').controller('KubernetesApplicationsStacksD
|
|||
});
|
||||
};
|
||||
|
||||
this.onChangeNamespace = function () {
|
||||
this.onChangeNamespaceDropdown(this.state.namespace);
|
||||
};
|
||||
|
||||
this.updateNamespace = function () {
|
||||
if (this.namespaces) {
|
||||
const namespaces = [{ Name: 'All namespaces', Value: '', IsSystem: false }];
|
||||
this.namespaces.find((ns) => {
|
||||
if (!this.settings.showSystem && ns.IsSystem) {
|
||||
return false;
|
||||
}
|
||||
namespaces.push({ Name: ns.Name, Value: ns.Name, IsSystem: ns.IsSystem });
|
||||
});
|
||||
this.state.namespaces = namespaces;
|
||||
|
||||
if (this.state.namespace && !this.state.namespaces.find((ns) => ns.Name === this.state.namespace)) {
|
||||
if (this.state.namespaces.length > 1) {
|
||||
let defaultNS = this.state.namespaces.find((ns) => ns.Name === 'default');
|
||||
defaultNS = defaultNS || this.state.namespaces[1];
|
||||
this.state.namespace = defaultNS.Value;
|
||||
} else {
|
||||
this.state.namespace = this.state.namespaces[0].Value;
|
||||
}
|
||||
this.onChangeNamespaceDropdown(this.state.namespace);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.$onChanges = function () {
|
||||
if (typeof this.isSystemResources !== 'undefined') {
|
||||
this.settings.showSystem = this.isSystemResources;
|
||||
DatatableService.setDataTableSettings(this.settingsKey, this.settings);
|
||||
}
|
||||
this.state.namespace = this.namespace;
|
||||
this.updateNamespace();
|
||||
this.prepareTableFromDataset();
|
||||
};
|
||||
|
||||
this.$onInit = function () {
|
||||
this.isAdmin = Authentication.isAdmin();
|
||||
this.KubernetesApplicationDeploymentTypes = KubernetesApplicationDeploymentTypes;
|
||||
|
@ -103,11 +145,20 @@ angular.module('portainer.kubernetes').controller('KubernetesApplicationsStacksD
|
|||
this.filters.state.open = false;
|
||||
}
|
||||
|
||||
var storedSettings = DatatableService.getDataTableSettings(this.tableKey);
|
||||
var storedSettings = DatatableService.getDataTableSettings(this.settingsKey);
|
||||
if (storedSettings !== null) {
|
||||
this.settings = storedSettings;
|
||||
this.settings.open = false;
|
||||
|
||||
this.setSystemResources && this.setSystemResources(this.settings.showSystem);
|
||||
}
|
||||
|
||||
// Set the default selected namespace
|
||||
if (!this.state.namespace) {
|
||||
this.state.namespace = this.namespace;
|
||||
}
|
||||
|
||||
this.updateNamespace();
|
||||
this.onSettingsRepeaterChange();
|
||||
};
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue