mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 05:45:22 +02:00
refactor(environments): remove endpoints cache [DTD-100] (#6408)
This commit is contained in:
parent
9ef2e27aae
commit
37d4a80769
51 changed files with 155 additions and 353 deletions
|
@ -14,7 +14,7 @@ angular.module('portainer.kubernetes', ['portainer.app', registriesModule, custo
|
|||
parent: 'endpoint',
|
||||
abstract: true,
|
||||
|
||||
onEnter: /* @ngInject */ function onEnter($async, $state, endpoint, EndpointProvider, KubernetesHealthService, KubernetesNamespaceService, Notifications, StateManager) {
|
||||
onEnter: /* @ngInject */ function onEnter($async, $state, endpoint, KubernetesHealthService, KubernetesNamespaceService, Notifications, StateManager) {
|
||||
return $async(async () => {
|
||||
if (![5, 6, 7].includes(endpoint.Type)) {
|
||||
$state.go('portainer.home');
|
||||
|
@ -31,7 +31,6 @@ angular.module('portainer.kubernetes', ['portainer.app', registriesModule, custo
|
|||
}
|
||||
}
|
||||
|
||||
EndpointProvider.setEndpointID(endpoint.Id);
|
||||
await StateManager.updateEndpointState(endpoint);
|
||||
|
||||
if (endpoint.Type === 7 && endpoint.Status === 2) {
|
||||
|
|
|
@ -2,7 +2,7 @@ angular.module('portainer.kubernetes').component('kubernetesResourcePoolsDatatab
|
|||
templateUrl: './resourcePoolsDatatable.html',
|
||||
controller: 'KubernetesResourcePoolsDatatableController',
|
||||
bindings: {
|
||||
endpoint: '<',
|
||||
restrictDefaultNamespace: '<',
|
||||
titleText: '@',
|
||||
titleIcon: '@',
|
||||
dataset: '<',
|
||||
|
|
|
@ -19,7 +19,7 @@ angular.module('portainer.docker').controller('KubernetesResourcePoolsDatatableC
|
|||
};
|
||||
|
||||
this.canManageAccess = function (item) {
|
||||
if (!this.endpoint.Kubernetes.Configuration.RestrictDefaultNamespace) {
|
||||
if (!this.restrictDefaultNamespace) {
|
||||
return !KubernetesNamespaceHelper.isDefaultNamespace(item.Namespace.Name) && !this.isSystemNamespace(item);
|
||||
} else {
|
||||
return !this.isSystemNamespace(item);
|
||||
|
|
|
@ -154,8 +154,8 @@ class KubernetesConfigureController {
|
|||
return;
|
||||
}
|
||||
const promises = [];
|
||||
const oldEndpointID = this.EndpointProvider.endpointID();
|
||||
this.EndpointProvider.setEndpointID(this.endpoint.Id);
|
||||
const oldEndpoint = this.EndpointProvider.currentEndpoint();
|
||||
this.EndpointProvider.setCurrentEndpoint(this.endpoint);
|
||||
|
||||
try {
|
||||
const allResourcePools = await this.KubernetesResourcePoolService.get();
|
||||
|
@ -170,7 +170,7 @@ class KubernetesConfigureController {
|
|||
});
|
||||
});
|
||||
} finally {
|
||||
this.EndpointProvider.setEndpointID(oldEndpointID);
|
||||
this.EndpointProvider.setCurrentEndpoint(oldEndpoint);
|
||||
}
|
||||
|
||||
const responses = await Promise.allSettled(promises);
|
||||
|
@ -222,13 +222,8 @@ class KubernetesConfigureController {
|
|||
});
|
||||
await Promise.all(storagePromises);
|
||||
|
||||
const endpoints = this.EndpointProvider.endpoints();
|
||||
const modifiedEndpoint = _.find(endpoints, (item) => item.Id === this.endpoint.Id);
|
||||
if (modifiedEndpoint) {
|
||||
this.assignFormValuesToEndpoint(modifiedEndpoint, storageClasses, ingressClasses);
|
||||
this.EndpointProvider.setEndpoints(endpoints);
|
||||
}
|
||||
this.Notifications.success('Success', 'Configuration successfully applied');
|
||||
|
||||
this.$state.go('portainer.home');
|
||||
} catch (err) {
|
||||
this.Notifications.error('Failure', err, 'Unable to apply configuration');
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<kubernetes-resource-pools-datatable
|
||||
endpoint="ctrl.endpoint"
|
||||
restrict-default-namespace="ctrl.endpoint.Kubernetes.Configuration.RestrictDefaultNamespace"
|
||||
dataset="ctrl.resourcePools"
|
||||
table-key="kubernetes.resourcePools"
|
||||
order-by="Name"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue