remove required description from plan clone. new version

This commit is contained in:
amentis 2024-07-18 15:39:39 +03:00
parent 728f022a16
commit 6edefb3db9
5 changed files with 5 additions and 11 deletions

View File

@ -91,10 +91,7 @@ public class ClonePlanPersist {
.failOn(ClonePlanPersist._id).failWith(messageSource.getMessage("Validation_Required", new Object[]{ClonePlanPersist._id}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getLabel()))
.failOn(ClonePlanPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ClonePlanPersist._label}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getDescription()))
.failOn(ClonePlanPersist._description).failWith(messageSource.getMessage("Validation_Required", new Object[]{ClonePlanPersist._description}, LocaleContextHolder.getLocale()))
.failOn(ClonePlanPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ClonePlanPersist._label}, LocaleContextHolder.getLocale()))
);
}
}

View File

@ -123,9 +123,6 @@ public class NewVersionPlanPersist {
.iff(() -> !this.isEmpty(item.getLabel()))
.must(() -> this.lessEqualLength(item.getLabel(), PlanEntity._labelLength))
.failOn(NewVersionPlanPersist._label).failWith(this.messageSource.getMessage("Validation_MaxLength", new Object[]{NewVersionPlanPersist._label}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getDescription()))
.failOn(NewVersionPlanPersist._description).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanPersist._description}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> this.isValidGuid(item.getBlueprintId()))
.failOn(NewVersionPlanPersist._blueprintId).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{NewVersionPlanPersist._blueprintId}, LocaleContextHolder.getLocale())),

View File

@ -584,7 +584,7 @@ public class PlanServiceImpl implements PlanService {
this.usageLimitService.checkIncrease(UsageLimitTargetMetric.DESCRIPTION_COUNT);
PlanEntity descriptionPlan = this.queryFactory.query(PlanQuery.class).disableTracking().ids(planId).isActive(IsActive.Active).first();
if (!descriptionPlan.getAccessType().equals(PlanAccessType.Public)) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(descriptionId)), Permission.CloneDescription);
if (descriptionPlan.getAccessType() != null && !descriptionPlan.getAccessType().equals(PlanAccessType.Public)) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(descriptionId)), Permission.CloneDescription);
else this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionAffiliation(descriptionId)), Permission.PublicCloneDescription);
DescriptionEntity existing = this.queryFactory.query(DescriptionQuery.class).disableTracking().ids(descriptionId).isActive(IsActive.Active).first();
@ -699,7 +699,7 @@ public class PlanServiceImpl implements PlanService {
if (!this.conventionService.isValidGuid(model.getId()) || existingPlanEntity == null)
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Plan.class.getSimpleName()}, LocaleContextHolder.getLocale()));
if (!existingPlanEntity.getAccessType().equals(PlanAccessType.Public)) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.planAffiliation( model.getId())), Permission.ClonePlan);
if (existingPlanEntity.getAccessType() != null && !existingPlanEntity.getAccessType().equals(PlanAccessType.Public)) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.planAffiliation( model.getId())), Permission.ClonePlan);
else this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.planAffiliation( model.getId())), Permission.PublicClonePlan);
PlanEntity newPlan = new PlanEntity();

View File

@ -42,7 +42,7 @@ export class PlanCloneDialogEditorModel implements ClonePlanPersist {
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] });
baseValidationArray.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] });
baseValidationArray.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'description')] });
baseValidationArray.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] });
baseValidationArray.push({ key: 'descriptions', validators: [BackendErrorValidator(this.validationErrorModel, 'descriptions')] });
baseContext.validation = baseValidationArray;
return baseContext;

View File

@ -76,7 +76,7 @@ export class PlanNewVersionDialogEditorModel implements NewVersionPlanPersist {
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] });
baseValidationArray.push({ key: 'label', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'label')] });
baseValidationArray.push({ key: 'description', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'description')] });
baseValidationArray.push({ key: 'description', validators: [BackendErrorValidator(this.validationErrorModel, 'description')] });
baseValidationArray.push({ key: 'blueprintId', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'blueprintId')] });
baseValidationArray.push({ key: 'descriptions', validators: [BackendErrorValidator(this.validationErrorModel, 'descriptions')] });
baseValidationArray.push({ key: 'hash', validators: [] });