mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +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
|
@ -19,6 +19,11 @@
|
|||
refresh-callback="ctrl.getApplications"
|
||||
on-publishing-mode-click="(ctrl.onPublishingModeClick)"
|
||||
is-primary="true"
|
||||
namespaces="ctrl.state.namespaces"
|
||||
namespace="ctrl.state.namespace"
|
||||
on-change-namespace-dropdown="(ctrl.onChangeNamespaceDropdown)"
|
||||
is-system-resources="ctrl.state.isSystemResources"
|
||||
set-system-resources="(ctrl.setSystemResources)"
|
||||
>
|
||||
</kubernetes-applications-datatable>
|
||||
</uib-tab>
|
||||
|
@ -30,6 +35,11 @@
|
|||
order-by="Name"
|
||||
refresh-callback="ctrl.getApplications"
|
||||
remove-action="ctrl.removeStacksAction"
|
||||
namespaces="ctrl.state.namespaces"
|
||||
namespace="ctrl.state.namespace"
|
||||
on-change-namespace-dropdown="(ctrl.onChangeNamespaceDropdown)"
|
||||
is-system-resources="ctrl.state.isSystemResources"
|
||||
set-system-resources="(ctrl.setSystemResources)"
|
||||
>
|
||||
</kubernetes-applications-stacks-datatable>
|
||||
</uib-tab>
|
||||
|
|
|
@ -9,9 +9,22 @@ import { confirmDelete } from '@@/modals/confirm';
|
|||
|
||||
class KubernetesApplicationsController {
|
||||
/* @ngInject */
|
||||
constructor($async, $state, Notifications, KubernetesApplicationService, HelmService, KubernetesConfigurationService, Authentication, LocalStorage, StackService) {
|
||||
constructor(
|
||||
$async,
|
||||
$state,
|
||||
$scope,
|
||||
Notifications,
|
||||
KubernetesApplicationService,
|
||||
HelmService,
|
||||
KubernetesConfigurationService,
|
||||
Authentication,
|
||||
LocalStorage,
|
||||
StackService,
|
||||
KubernetesNamespaceService
|
||||
) {
|
||||
this.$async = $async;
|
||||
this.$state = $state;
|
||||
this.$scope = $scope;
|
||||
this.Notifications = Notifications;
|
||||
this.KubernetesApplicationService = KubernetesApplicationService;
|
||||
this.HelmService = HelmService;
|
||||
|
@ -19,6 +32,7 @@ class KubernetesApplicationsController {
|
|||
this.Authentication = Authentication;
|
||||
this.LocalStorage = LocalStorage;
|
||||
this.StackService = StackService;
|
||||
this.KubernetesNamespaceService = KubernetesNamespaceService;
|
||||
|
||||
this.onInit = this.onInit.bind(this);
|
||||
this.getApplications = this.getApplications.bind(this);
|
||||
|
@ -28,6 +42,8 @@ class KubernetesApplicationsController {
|
|||
this.removeStacksAction = this.removeStacksAction.bind(this);
|
||||
this.removeStacksActionAsync = this.removeStacksActionAsync.bind(this);
|
||||
this.onPublishingModeClick = this.onPublishingModeClick.bind(this);
|
||||
this.onChangeNamespaceDropdown = this.onChangeNamespaceDropdown.bind(this);
|
||||
this.setSystemResources = this.setSystemResources.bind(this);
|
||||
}
|
||||
|
||||
selectTab(index) {
|
||||
|
@ -126,20 +142,34 @@ class KubernetesApplicationsController {
|
|||
});
|
||||
}
|
||||
|
||||
onChangeNamespaceDropdown(namespace) {
|
||||
this.state.namespace = namespace;
|
||||
this.getApplicationsAsync();
|
||||
}
|
||||
|
||||
async getApplicationsAsync() {
|
||||
try {
|
||||
const [applications, configurations] = await Promise.all([this.KubernetesApplicationService.get(), this.KubernetesConfigurationService.get()]);
|
||||
const [applications, configurations] = await Promise.all([
|
||||
this.KubernetesApplicationService.get(this.state.namespace),
|
||||
this.KubernetesConfigurationService.get(this.state.namespace),
|
||||
]);
|
||||
const configuredApplications = KubernetesConfigurationHelper.getApplicationConfigurations(applications, configurations);
|
||||
const { helmApplications, nonHelmApplications } = KubernetesApplicationHelper.getNestedApplications(configuredApplications);
|
||||
|
||||
this.state.applications = [...helmApplications, ...nonHelmApplications];
|
||||
this.state.stacks = KubernetesStackHelper.stacksFromApplications(applications);
|
||||
this.state.ports = KubernetesApplicationHelper.portMappingsFromApplications(applications);
|
||||
|
||||
this.$scope.$apply();
|
||||
} catch (err) {
|
||||
this.Notifications.error('Failure', err, 'Unable to retrieve applications');
|
||||
}
|
||||
}
|
||||
|
||||
setSystemResources(flag) {
|
||||
this.state.isSystemResources = flag;
|
||||
}
|
||||
|
||||
getApplications() {
|
||||
return this.$async(this.getApplicationsAsync);
|
||||
}
|
||||
|
@ -153,7 +183,16 @@ class KubernetesApplicationsController {
|
|||
applications: [],
|
||||
stacks: [],
|
||||
ports: [],
|
||||
namespaces: [],
|
||||
namespace: '',
|
||||
isSystemResources: undefined,
|
||||
};
|
||||
|
||||
this.state.namespaces = await this.KubernetesNamespaceService.get();
|
||||
this.state.namespaces = this.state.namespaces.filter((n) => n.Status !== 'Terminating');
|
||||
this.state.namespaces = _.sortBy(this.state.namespaces, 'Name');
|
||||
this.state.namespace = this.state.namespaces.length ? (this.state.namespaces.find((n) => n.Name === 'default') ? 'default' : this.state.namespaces[0].Name) : '';
|
||||
|
||||
await this.getApplications();
|
||||
|
||||
this.state.viewReady = true;
|
||||
|
|
|
@ -35,7 +35,8 @@ class KubernetesResourcePoolController {
|
|||
KubernetesPodService,
|
||||
KubernetesApplicationService,
|
||||
KubernetesIngressService,
|
||||
KubernetesVolumeService
|
||||
KubernetesVolumeService,
|
||||
KubernetesNamespaceService
|
||||
) {
|
||||
Object.assign(this, {
|
||||
$async,
|
||||
|
@ -54,6 +55,7 @@ class KubernetesResourcePoolController {
|
|||
KubernetesApplicationService,
|
||||
KubernetesIngressService,
|
||||
KubernetesVolumeService,
|
||||
KubernetesNamespaceService,
|
||||
});
|
||||
|
||||
this.IngressClassTypes = KubernetesIngressClassTypes;
|
||||
|
@ -219,6 +221,7 @@ class KubernetesResourcePoolController {
|
|||
return;
|
||||
}
|
||||
await this.KubernetesResourcePoolService.toggleSystem(this.endpoint.Id, namespaceName, !this.isSystem);
|
||||
await this.KubernetesNamespaceService.refreshCacheAsync();
|
||||
|
||||
this.Notifications.success('Namespace successfully updated', namespaceName);
|
||||
this.$state.reload(this.$state.current);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<page-header ng-if="ctrl.state.viewReady" title="'Namespace list'" breadcrumbs="['Namespaces']" reload="true"></page-header>
|
||||
<page-header ng-if="ctrl.state.viewReady" title="'Namespace list'" breadcrumbs="['Namespaces']" on-reload="(ctrl.onReload)" reload="true"></page-header>
|
||||
|
||||
<kubernetes-view-loading view-ready="ctrl.state.viewReady"></kubernetes-view-loading>
|
||||
|
||||
|
|
|
@ -17,6 +17,12 @@ class KubernetesResourcePoolsController {
|
|||
this.getResourcePoolsAsync = this.getResourcePoolsAsync.bind(this);
|
||||
this.removeAction = this.removeAction.bind(this);
|
||||
this.removeActionAsync = this.removeActionAsync.bind(this);
|
||||
this.onReload = this.onReload.bind(this);
|
||||
}
|
||||
|
||||
async onReload() {
|
||||
await this.KubernetesNamespaceService.refreshCacheAsync();
|
||||
this.$state.reload(this.$state.current);
|
||||
}
|
||||
|
||||
async removeActionAsync(selectedItems) {
|
||||
|
@ -48,6 +54,7 @@ class KubernetesResourcePoolsController {
|
|||
}
|
||||
}
|
||||
}
|
||||
await this.KubernetesNamespaceService.refreshCacheAsync();
|
||||
}
|
||||
|
||||
removeAction(selectedItems) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue