fix(app): fix exhaused error message [EE-6231] (#10949)

Co-authored-by: testa113 <testa113>
pull/10943/head
Ali 2024-01-15 11:03:38 +13:00 committed by GitHub
parent cb7efd8601
commit d750389c67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -66,7 +66,7 @@
<namespace-selector <namespace-selector
values="ctrl.formValues.ResourcePool.Namespace.Name" values="ctrl.formValues.ResourcePool.Namespace.Name"
on-change="(ctrl.onChangeNamespaceName)" on-change="(ctrl.onChangeNamespaceName)"
validation-data="{hasQuota: ctrl.state.resourcePoolHasQuota, isResourceQuotaCapacityExceeded: ctrl.resourceQuotaCapacityExceeded(), namespaceOptionCount: ctrl.resourcePools.length, isAdmin: ctrl.isAdmin}" validation-data="{hasQuota: ctrl.state.resourcePoolHasQuota, isResourceQuotaCapacityExceeded: ctrl.resourceQuotaCapacityExceeded(), namespaceOptionCount: ctrl.resourcePools.length, isEnvironmentAdmin: ctrl.state.isEnvironmentAdmin}"
is-edit="ctrl.state.isEdit" is-edit="ctrl.state.isEdit"
></namespace-selector> ></namespace-selector>
<!-- kubernetes services options --> <!-- kubernetes services options -->
@ -159,7 +159,7 @@
<namespace-selector <namespace-selector
values="ctrl.formValues.ResourcePool.Namespace.Name" values="ctrl.formValues.ResourcePool.Namespace.Name"
on-change="(ctrl.onChangeNamespaceName)" on-change="(ctrl.onChangeNamespaceName)"
validation-data="{hasQuota: ctrl.state.resourcePoolHasQuota, isResourceQuotaCapacityExceeded: ctrl.resourceQuotaCapacityExceeded(), namespaceOptionCount: ctrl.resourcePools.length, isAdmin: ctrl.isAdmin}" validation-data="{hasQuota: ctrl.state.resourcePoolHasQuota, isResourceQuotaCapacityExceeded: ctrl.resourceQuotaCapacityExceeded(), namespaceOptionCount: ctrl.resourcePools.length, isEnvironmentAdmin: ctrl.state.isEnvironmentAdmin}"
is-edit="ctrl.state.isEdit" is-edit="ctrl.state.isEdit"
></namespace-selector> ></namespace-selector>
<!-- #endregion --> <!-- #endregion -->

View File

@ -121,6 +121,7 @@ class KubernetesCreateApplicationController {
persistedFoldersUseExistingVolumes: false, persistedFoldersUseExistingVolumes: false,
pullImageValidity: false, pullImageValidity: false,
nodePortServices: [], nodePortServices: [],
isEnvironmentAdmin: this.Authentication.hasAuthorizations(['K8sResourcePoolsW']),
}; };
this.isAdmin = this.Authentication.isAdmin(); this.isAdmin = this.Authentication.isAdmin();

View File

@ -4,7 +4,7 @@ type ValidationData = {
hasQuota: boolean; hasQuota: boolean;
isResourceQuotaCapacityExceeded: boolean; isResourceQuotaCapacityExceeded: boolean;
namespaceOptionCount: number; namespaceOptionCount: number;
isAdmin: boolean; isEnvironmentAdmin: boolean;
}; };
const emptyValue = const emptyValue =
@ -17,7 +17,7 @@ export function namespaceSelectorValidation(
hasQuota, hasQuota,
isResourceQuotaCapacityExceeded, isResourceQuotaCapacityExceeded,
namespaceOptionCount, namespaceOptionCount,
isAdmin, isEnvironmentAdmin,
} = validationData || {}; } = validationData || {};
return string() return string()
.required(emptyValue) .required(emptyValue)
@ -25,7 +25,7 @@ export function namespaceSelectorValidation(
.test( .test(
'resourceQuotaCapacityExceeded', 'resourceQuotaCapacityExceeded',
`This namespace has exhausted its resource capacity and you will not be able to deploy the application.${ `This namespace has exhausted its resource capacity and you will not be able to deploy the application.${
isAdmin isEnvironmentAdmin
? '' ? ''
: ' Contact your administrator to expand the capacity of the namespace.' : ' Contact your administrator to expand the capacity of the namespace.'
}`, }`,