mirror of https://github.com/portainer/portainer
feat(kubectl-shell): page state refreshes in k8s endpoint do not close shell EE-1628 (#5685)
* converting all kubernetes view reload to partial state heirarchy refresh * updated helm and kube kustom templates headers to use the reusable k8s page header componentpull/5751/head
parent
d4f581a596
commit
7d40a83d03
|
@ -21,7 +21,7 @@ export default class HelmAddRepositoryController {
|
||||||
try {
|
try {
|
||||||
await this.HelmService.addHelmRepository(this.EndpointProvider.currentEndpoint().Id, { url: this.state.repository });
|
await this.HelmService.addHelmRepository(this.EndpointProvider.currentEndpoint().Id, { url: this.state.repository });
|
||||||
this.Notifications.success('Helm repository added successfully');
|
this.Notifications.success('Helm repository added successfully');
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Installation error', err);
|
this.Notifications.error('Installation error', err);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
<rd-header id="view-top">
|
<kubernetes-view-header title="Helm" state="kubernetes.templates.helm" view-ready="true">
|
||||||
<rd-header-title title-text="Helm">
|
Charts
|
||||||
<a data-toggle="tooltip" title="Refresh" ui-sref="kubernetes.templates.helm" ui-sref-opts="{reload: true}">
|
</kubernetes-view-header>
|
||||||
<i class="fa fa-sync" aria-hidden="true"></i>
|
|
||||||
</a>
|
|
||||||
</rd-header-title>
|
|
||||||
<rd-header-content>Charts</rd-header-content>
|
|
||||||
</rd-header>
|
|
||||||
|
|
||||||
<information-panel title-text="Information" ng-if="!$ctrl.state.chart">
|
<information-panel title-text="Information" ng-if="!$ctrl.state.chart">
|
||||||
<span class="small text-muted">
|
<span class="small text-muted">
|
||||||
|
|
|
@ -10,6 +10,12 @@ export default class KubectlShellController {
|
||||||
this.EndpointProvider = EndpointProvider;
|
this.EndpointProvider = EndpointProvider;
|
||||||
this.LocalStorage = LocalStorage;
|
this.LocalStorage = LocalStorage;
|
||||||
this.Notifications = Notifications;
|
this.Notifications = Notifications;
|
||||||
|
|
||||||
|
$window.onbeforeunload = () => {
|
||||||
|
if (this.state.shell.connected) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnect() {
|
disconnect() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<rd-header ng-if="$ctrl.viewReady">
|
<rd-header ng-if="$ctrl.viewReady">
|
||||||
<rd-header-title title-text="{{ $ctrl.title }}">
|
<rd-header-title title-text="{{ $ctrl.title }}">
|
||||||
<a data-toggle="tooltip" title="refresh the view" ui-sref="{{ $ctrl.state }}" ui-sref-opts="{reload: true}" ng-if="$ctrl.viewReady">
|
<a data-toggle="tooltip" title="refresh the view" ui-sref="{{ $ctrl.state }}" ui-sref-opts="{reload: $ctrl.state}" ng-if="$ctrl.viewReady">
|
||||||
<i class="fa fa-sm fa-sync" aria-hidden="true" data-cy="component-refreshTableButton"></i>
|
<i class="fa fa-sm fa-sync" aria-hidden="true" data-cy="component-refreshTableButton"></i>
|
||||||
</a>
|
</a>
|
||||||
</rd-header-title>
|
</rd-header-title>
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
<rd-header id="view-top">
|
<kubernetes-view-header title="Custom Templates" state="kubernetes.templates.custom" view-ready="true">
|
||||||
<rd-header-title title-text="Custom Templates">
|
Custom Templates
|
||||||
<a data-toggle="tooltip" title="Refresh" ui-sref="kubernetes.templates.custom" ui-sref-opts="{reload: true}">
|
</kubernetes-view-header>
|
||||||
<i class="fa fa-sync" aria-hidden="true"></i>
|
|
||||||
</a>
|
|
||||||
</rd-header-title>
|
|
||||||
<rd-header-content>Custom Templates</rd-header-content>
|
|
||||||
</rd-header>
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
|
|
|
@ -44,7 +44,7 @@ export default class KubernetesRegistryAccessController {
|
||||||
await this.EndpointService.updateRegistryAccess(this.endpoint.Id, this.registry.Id, {
|
await this.EndpointService.updateRegistryAccess(this.endpoint.Id, this.registry.Id, {
|
||||||
namespaces,
|
namespaces,
|
||||||
});
|
});
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Failed saving registry access');
|
this.Notifications.error('Failure', err, 'Failed saving registry access');
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class KubernetesApplicationsController {
|
||||||
} finally {
|
} finally {
|
||||||
--actionCount;
|
--actionCount;
|
||||||
if (actionCount === 0) {
|
if (actionCount === 0) {
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class KubernetesApplicationsController {
|
||||||
} finally {
|
} finally {
|
||||||
--actionCount;
|
--actionCount;
|
||||||
if (actionCount === 0) {
|
if (actionCount === 0) {
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ class KubernetesCreateApplicationController {
|
||||||
this.state.updateWebEditorInProgress = true;
|
this.state.updateWebEditorInProgress = true;
|
||||||
await this.StackService.updateKubeStack({ EndpointId: this.endpoint.Id, Id: this.application.StackId }, this.stackFileContent, null);
|
await this.StackService.updateKubeStack({ EndpointId: this.endpoint.Id, Id: this.application.StackId }, this.stackFileContent, null);
|
||||||
this.state.isEditorDirty = false;
|
this.state.isEditorDirty = false;
|
||||||
await this.$state.reload();
|
await this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Failed redeploying application');
|
this.Notifications.error('Failure', err, 'Failed redeploying application');
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -215,7 +215,7 @@ class KubernetesApplicationController {
|
||||||
const revision = _.nth(this.application.Revisions, -2);
|
const revision = _.nth(this.application.Revisions, -2);
|
||||||
await this.KubernetesApplicationService.rollback(this.application, revision);
|
await this.KubernetesApplicationService.rollback(this.application, revision);
|
||||||
this.Notifications.success('Application successfully rolled back');
|
this.Notifications.success('Application successfully rolled back');
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to rollback the application');
|
this.Notifications.error('Failure', err, 'Unable to rollback the application');
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ class KubernetesApplicationController {
|
||||||
const promises = _.map(this.application.Pods, (item) => this.KubernetesPodService.delete(item));
|
const promises = _.map(this.application.Pods, (item) => this.KubernetesPodService.delete(item));
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
this.Notifications.success('Application successfully redeployed');
|
this.Notifications.success('Application successfully redeployed');
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to redeploy the application');
|
this.Notifications.error('Failure', err, 'Unable to redeploy the application');
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ class KubernetesApplicationController {
|
||||||
application.Note = this.formValues.Note;
|
application.Note = this.formValues.Note;
|
||||||
await this.KubernetesApplicationService.patch(this.application, application, true);
|
await this.KubernetesApplicationService.patch(this.application, application, true);
|
||||||
this.Notifications.success('Application successfully updated');
|
this.Notifications.success('Application successfully updated');
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to update application');
|
this.Notifications.error('Failure', err, 'Unable to update application');
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default class KubernetesHelmApplicationController {
|
||||||
if (releases.length > 0) {
|
if (releases.length > 0) {
|
||||||
this.state.release = releases[0];
|
this.state.release = releases[0];
|
||||||
} else {
|
} else {
|
||||||
throw PortainerError(`Release ${this.state.params.name} not found`);
|
throw new PortainerError(`Release ${this.state.params.name} not found`);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to retrieve helm application details');
|
this.Notifications.error('Failure', err, 'Unable to retrieve helm application details');
|
||||||
|
|
|
@ -253,7 +253,7 @@ class KubernetesNodeController {
|
||||||
await this.drainNode();
|
await this.drainNode();
|
||||||
}
|
}
|
||||||
this.Notifications.success('Node updated successfully');
|
this.Notifications.success('Node updated successfully');
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to update node');
|
this.Notifications.error('Failure', err, 'Unable to update node');
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ class KubernetesConfigurationsController {
|
||||||
} finally {
|
} finally {
|
||||||
--actionCount;
|
--actionCount;
|
||||||
if (actionCount === 0) {
|
if (actionCount === 0) {
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ class KubernetesConfigurationController {
|
||||||
} else {
|
} else {
|
||||||
await this.KubernetesConfigurationService.update(this.formValues, this.configuration);
|
await this.KubernetesConfigurationService.update(this.formValues, this.configuration);
|
||||||
this.Notifications.success('Configuration succesfully updated');
|
this.Notifications.success('Configuration succesfully updated');
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to update configuration');
|
this.Notifications.error('Failure', err, 'Unable to update configuration');
|
||||||
|
|
|
@ -98,7 +98,7 @@ class KubernetesResourcePoolAccessController {
|
||||||
const accessConfigMap = KubernetesConfigMapHelper.modifiyNamespaceAccesses(angular.copy(this.accessConfigMap), this.pool.Namespace.Name, newAccesses);
|
const accessConfigMap = KubernetesConfigMapHelper.modifiyNamespaceAccesses(angular.copy(this.accessConfigMap), this.pool.Namespace.Name, newAccesses);
|
||||||
await this.KubernetesConfigMapService.updateAccess(accessConfigMap);
|
await this.KubernetesConfigMapService.updateAccess(accessConfigMap);
|
||||||
this.Notifications.success('Access successfully created');
|
this.Notifications.success('Access successfully created');
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to create accesses');
|
this.Notifications.error('Failure', err, 'Unable to create accesses');
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ class KubernetesResourcePoolAccessController {
|
||||||
const accessConfigMap = KubernetesConfigMapHelper.modifiyNamespaceAccesses(angular.copy(this.accessConfigMap), this.pool.Namespace.Name, newAccesses);
|
const accessConfigMap = KubernetesConfigMapHelper.modifiyNamespaceAccesses(angular.copy(this.accessConfigMap), this.pool.Namespace.Name, newAccesses);
|
||||||
await this.KubernetesConfigMapService.updateAccess(accessConfigMap);
|
await this.KubernetesConfigMapService.updateAccess(accessConfigMap);
|
||||||
this.Notifications.success('Access successfully removed');
|
this.Notifications.success('Access successfully removed');
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to remove accesses');
|
this.Notifications.error('Failure', err, 'Unable to remove accesses');
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -176,7 +176,7 @@ class KubernetesResourcePoolController {
|
||||||
this.checkDefaults();
|
this.checkDefaults();
|
||||||
await this.KubernetesResourcePoolService.patch(oldFormValues, newFormValues);
|
await this.KubernetesResourcePoolService.patch(oldFormValues, newFormValues);
|
||||||
this.Notifications.success('Namespace successfully updated', this.pool.Namespace.Name);
|
this.Notifications.success('Namespace successfully updated', this.pool.Namespace.Name);
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to create namespace');
|
this.Notifications.error('Failure', err, 'Unable to create namespace');
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -238,7 +238,7 @@ class KubernetesResourcePoolController {
|
||||||
await this.KubernetesResourcePoolService.toggleSystem(this.endpoint.Id, namespaceName, !this.isSystem);
|
await this.KubernetesResourcePoolService.toggleSystem(this.endpoint.Id, namespaceName, !this.isSystem);
|
||||||
|
|
||||||
this.Notifications.success('Namespace successfully updated', namespaceName);
|
this.Notifications.success('Namespace successfully updated', namespaceName);
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to create namespace');
|
this.Notifications.error('Failure', err, 'Unable to create namespace');
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -29,7 +29,7 @@ class KubernetesResourcePoolsController {
|
||||||
} finally {
|
} finally {
|
||||||
--actionCount;
|
--actionCount;
|
||||||
if (actionCount === 0) {
|
if (actionCount === 0) {
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ class KubernetesVolumeController {
|
||||||
this.Notifications.success('Applications successfully redeployed');
|
this.Notifications.success('Applications successfully redeployed');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to update volume.');
|
this.Notifications.error('Failure', err, 'Unable to update volume.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ class KubernetesVolumesController {
|
||||||
} finally {
|
} finally {
|
||||||
--actionCount;
|
--actionCount;
|
||||||
if (actionCount === 0) {
|
if (actionCount === 0) {
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ class KubernetesAppGitFormController {
|
||||||
this.state.redeployInProgress = true;
|
this.state.redeployInProgress = true;
|
||||||
await this.StackService.updateKubeGit(this.stack.Id, this.stack.EndpointId, this.namespace, this.formValues);
|
await this.StackService.updateKubeGit(this.stack.Id, this.stack.EndpointId, this.namespace, this.formValues);
|
||||||
this.Notifications.success('Pulled and redeployed stack successfully');
|
this.Notifications.success('Pulled and redeployed stack successfully');
|
||||||
await this.$state.reload();
|
await this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Failed redeploying application');
|
this.Notifications.error('Failure', err, 'Failed redeploying application');
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -33,7 +33,7 @@ class EndpointAccessController {
|
||||||
this.state.actionInProgress = true;
|
this.state.actionInProgress = true;
|
||||||
await this.EndpointService.updateEndpoint(this.$transition$.params().id, this.endpoint);
|
await this.EndpointService.updateEndpoint(this.$transition$.params().id, this.endpoint);
|
||||||
this.Notifications.success('Access successfully updated');
|
this.Notifications.success('Access successfully updated');
|
||||||
this.$state.reload();
|
this.$state.reload(this.$state.current);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.state.actionInProgress = false;
|
this.state.actionInProgress = false;
|
||||||
this.Notifications.error('Failure', err, 'Unable to update accesses');
|
this.Notifications.error('Failure', err, 'Unable to update accesses');
|
||||||
|
|
Loading…
Reference in New Issue