1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 14:59:41 +02:00

feat/ee-1991/validate-k8s-workload (#6302)

This commit is contained in:
sunportainer 2022-01-25 18:59:09 +08:00 committed by GitHub
parent 118809a9c0
commit 24893573aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 13 deletions

View file

@ -102,11 +102,18 @@ class KubernetesCreateResourcePoolController {
/* #endregion */
isCreateButtonDisabled() {
return this.state.actionInProgress || (this.formValues.HasQuota && !this.isQuotaValid()) || this.state.isAlreadyExist || this.state.duplicates.ingressHosts.hasRefs;
return (
this.state.actionInProgress ||
(this.formValues.HasQuota && !this.isQuotaValid()) ||
this.state.isAlreadyExist ||
this.state.hasPrefixKube ||
this.state.duplicates.ingressHosts.hasRefs
);
}
onChangeName() {
this.state.isAlreadyExist = _.find(this.resourcePools, (resourcePool) => resourcePool.Namespace.Name === this.formValues.Name) !== undefined;
this.state.hasPrefixKube = /^kube-/.test(this.formValues.Name);
}
isQuotaValid() {
@ -200,6 +207,7 @@ class KubernetesCreateResourcePoolController {
sliderMaxCpu: 0,
viewReady: false,
isAlreadyExist: false,
hasPrefixKube: false,
canUseIngress: endpoint.Kubernetes.Configuration.IngressClasses.length,
duplicates: {
ingressHosts: new KubernetesFormValidationReferences(),