mirror of https://github.com/portainer/portainer
fix(app): improve resource quota error handling [EE-5933] (#10951)
parent
488fcc7cc5
commit
6d71a28584
@ -0,0 +1,19 @@
|
||||
import { SchemaOf, mixed } from 'yup';
|
||||
|
||||
import { DeploymentType } from '../../types';
|
||||
|
||||
type ValidationData = {
|
||||
isQuotaExceeded: boolean;
|
||||
};
|
||||
|
||||
export function deploymentTypeValidation(
|
||||
validationData?: ValidationData
|
||||
): SchemaOf<DeploymentType> {
|
||||
return mixed()
|
||||
.oneOf(['Replicated', 'Global'])
|
||||
.test(
|
||||
'exhaused',
|
||||
`This application would exceed available resources. Please review resource reservations or the instance count.`,
|
||||
() => !validationData?.isQuotaExceeded
|
||||
);
|
||||
}
|
Loading…
Reference in new issue