feat(deployment): PO feedback [EE-4416] (#8143)

pull/8168/head
Ali 2 years ago committed by GitHub
parent ce8455953e
commit adc87b8f8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,6 +43,7 @@ class KubernetesConfigureController {
this.configureAsync = this.configureAsync.bind(this); this.configureAsync = this.configureAsync.bind(this);
this.areControllersChanged = this.areControllersChanged.bind(this); this.areControllersChanged = this.areControllersChanged.bind(this);
this.areFormValuesChanged = this.areFormValuesChanged.bind(this); this.areFormValuesChanged = this.areFormValuesChanged.bind(this);
this.areStorageClassesChanged = this.areStorageClassesChanged.bind(this);
this.onBeforeOnload = this.onBeforeOnload.bind(this); this.onBeforeOnload = this.onBeforeOnload.bind(this);
this.limitedFeature = FeatureId.K8S_SETUP_DEFAULT; this.limitedFeature = FeatureId.K8S_SETUP_DEFAULT;
this.limitedFeatureAutoWindow = FeatureId.HIDE_AUTO_UPDATE_WINDOW; this.limitedFeatureAutoWindow = FeatureId.HIDE_AUTO_UPDATE_WINDOW;
@ -298,7 +299,7 @@ class KubernetesConfigureController {
[this.StorageClasses, this.endpoint] = await Promise.all([this.KubernetesStorageService.get(this.state.endpointId), this.EndpointService.endpoint(this.state.endpointId)]); [this.StorageClasses, this.endpoint] = await Promise.all([this.KubernetesStorageService.get(this.state.endpointId), this.EndpointService.endpoint(this.state.endpointId)]);
this.ingressControllers = await getIngressControllerClassMap({ environmentId: this.state.endpointId }); this.ingressControllers = await getIngressControllerClassMap({ environmentId: this.state.endpointId });
this.originalIngressControllers = structuredClone(this.ingressControllers); this.originalIngressControllers = structuredClone(this.ingressControllers) || [];
this.state.autoUpdateSettings = this.endpoint.ChangeWindow; this.state.autoUpdateSettings = this.endpoint.ChangeWindow;
@ -313,8 +314,6 @@ class KubernetesConfigureController {
} }
}); });
this.oldStorageClasses = angular.copy(this.StorageClasses);
this.formValues.UseLoadBalancer = this.endpoint.Kubernetes.Configuration.UseLoadBalancer; this.formValues.UseLoadBalancer = this.endpoint.Kubernetes.Configuration.UseLoadBalancer;
this.formValues.UseServerMetrics = this.endpoint.Kubernetes.Configuration.UseServerMetrics; this.formValues.UseServerMetrics = this.endpoint.Kubernetes.Configuration.UseServerMetrics;
this.formValues.EnableResourceOverCommit = this.endpoint.Kubernetes.Configuration.EnableResourceOverCommit; this.formValues.EnableResourceOverCommit = this.endpoint.Kubernetes.Configuration.EnableResourceOverCommit;
@ -328,7 +327,8 @@ class KubernetesConfigureController {
this.formValues.IngressAvailabilityPerNamespace = this.endpoint.Kubernetes.Configuration.IngressAvailabilityPerNamespace; this.formValues.IngressAvailabilityPerNamespace = this.endpoint.Kubernetes.Configuration.IngressAvailabilityPerNamespace;
this.formValues.AllowNoneIngressClass = this.endpoint.Kubernetes.Configuration.AllowNoneIngressClass; this.formValues.AllowNoneIngressClass = this.endpoint.Kubernetes.Configuration.AllowNoneIngressClass;
this.oldFormValues = Object.assign({}, this.formValues); this.oldStorageClasses = angular.copy(this.StorageClasses);
this.oldFormValues = angular.copy(this.formValues);
} catch (err) { } catch (err) {
this.Notifications.error('Failure', err, 'Unable to retrieve environment configuration'); this.Notifications.error('Failure', err, 'Unable to retrieve environment configuration');
} finally { } finally {
@ -356,15 +356,23 @@ class KubernetesConfigureController {
return !_.isEqual(this.formValues, this.oldFormValues); return !_.isEqual(this.formValues, this.oldFormValues);
} }
areStorageClassesChanged() {
// angular is pesky and modifies this.StorageClasses (adds $$hashkey to each item)
// angular.toJson removes this to make the comparison work
const storageClassesWithoutHashKey = angular.toJson(this.StorageClasses);
const oldStorageClassesWithoutHashKey = angular.toJson(this.oldStorageClasses);
return !_.isEqual(storageClassesWithoutHashKey, oldStorageClassesWithoutHashKey);
}
onBeforeOnload(event) { onBeforeOnload(event) {
if (!this.state.isSaving && (this.areControllersChanged() || this.areFormValuesChanged())) { if (!this.state.isSaving && (this.areControllersChanged() || this.areFormValuesChanged() || this.areStorageClassesChanged())) {
event.preventDefault(); event.preventDefault();
event.returnValue = ''; event.returnValue = '';
} }
} }
uiCanExit() { uiCanExit() {
if (!this.state.isSaving && (this.areControllersChanged() || this.areFormValuesChanged()) && !this.isIngressControllersLoading) { if (!this.state.isSaving && (this.areControllersChanged() || this.areFormValuesChanged() || this.areStorageClassesChanged()) && !this.isIngressControllersLoading) {
return this.ModalService.confirmAsync({ return this.ModalService.confirmAsync({
title: 'Are you sure?', title: 'Are you sure?',
message: 'You currently have unsaved changes in the cluster setup view. Are you sure you want to leave?', message: 'You currently have unsaved changes in the cluster setup view. Are you sure you want to leave?',

@ -157,7 +157,7 @@
</div> </div>
<!-- !helm charts --> <!-- !helm charts -->
<!-- kube --> <!-- kube -->
<div class="col-sm-12 form-section-title"> Kubernetes </div> <div class="col-sm-12 form-section-title"> Kubeconfig </div>
<div class="form-group"> <div class="form-group">
<label for="kubeconfig_expiry" class="col-sm-2 control-label text-left"> Kubeconfig expiry </label> <label for="kubeconfig_expiry" class="col-sm-2 control-label text-left"> Kubeconfig expiry </label>
<div class="col-sm-8"> <div class="col-sm-8">

Loading…
Cancel
Save