[ADF-4068] ProcessServices/TaskDetails - disable save button on validation errors (#4414)

* [ADF-4068] StartTaskComponent - fix name and description empty space validation

* [ADF-4068] StartTakComponent - add unit test

* [ADF-4068] ProcessServices - add description validaton on edit task form

* [ADF-4068] ProcessServies - fix build issue

* [ADF-4068] ProcessServices - disable save button on validation errors

* [ADF-4068] - lint

* [ADf-4068] - fix e2e
This commit is contained in:
Silviu Popa
2019-03-13 13:56:31 +02:00
committed by Eugenio Romano
parent 3a7376af9f
commit 9c33eeeb81
3 changed files with 26 additions and 7 deletions

View File

@@ -40,18 +40,25 @@
class="adf-textarea" class="adf-textarea"
[placeholder]="property.default | translate" [placeholder]="property.default | translate"
[(ngModel)]="editedValue" [(ngModel)]="editedValue"
(input)="onTextAreaInputChange()"
[attr.data-automation-id]="'card-textitem-edittextarea-' + property.key"></textarea> [attr.data-automation-id]="'card-textitem-edittextarea-' + property.key"></textarea>
</mat-form-field> </mat-form-field>
<mat-icon <button mat-button
class="adf-textitem-icon adf-update-icon" [disabled]="hasErrors()"
(click)="update()" (click)="update()"
[attr.title]="'CORE.METADATA.ACTIONS.SAVE' | translate" [attr.data-automation-id]="'card-textitem-update-' + property.key"
[attr.data-automation-id]="'card-textitem-update-' + property.key">done</mat-icon> class="adf-textitem-icon adf-update-icon">
<mat-icon
class="adf-update-icon"
[class.adf-button-disabled]="hasErrors()"
[attr.title]="'CORE.METADATA.ACTIONS.SAVE' | translate">done</mat-icon>
</button>
<mat-icon <mat-icon
class="adf-textitem-icon adf-reset-icon" class="adf-textitem-icon adf-reset-icon"
(click)="reset()" (click)="reset()"
[attr.title]="'CORE.METADATA.ACTIONS.CANCEL' | translate" [attr.title]="'CORE.METADATA.ACTIONS.CANCEL' | translate"
[attr.data-automation-id]="'card-textitem-reset-' + property.key">clear</mat-icon> [attr.data-automation-id]="'card-textitem-reset-' + property.key">clear</mat-icon>
</div> </div>
<mat-error [attr.data-automation-id]="'card-textitem-error-' + property.key" class="adf-textitem-editable-error" *ngIf="hasErrors()"> <mat-error [attr.data-automation-id]="'card-textitem-error-' + property.key" class="adf-textitem-editable-error" *ngIf="hasErrors()">
<ul> <ul>

View File

@@ -40,7 +40,7 @@
&-controls { &-controls {
display: flex; display: flex;
mat-icon:hover { mat-icon:not(.adf-button-disabled):hover {
opacity: 1; opacity: 1;
cursor: pointer; cursor: pointer;
} }
@@ -126,4 +126,12 @@
display: block; display: block;
} }
} }
.mat-button.adf-update-icon {
min-width: 40px;
line-height: 0;
margin-top: -4px;
padding: 0;
}
} }

View File

@@ -64,8 +64,8 @@ export class CardViewTextItemComponent implements OnChanges {
return !!this.property.icon; return !!this.property.icon;
} }
hasErrors(): number { hasErrors(): boolean {
return this.errorMessages && this.errorMessages.length; return this.errorMessages && this.errorMessages.length > 0;
} }
setEditMode(editStatus: boolean): void { setEditMode(editStatus: boolean): void {
@@ -92,6 +92,10 @@ export class CardViewTextItemComponent implements OnChanges {
} }
} }
onTextAreaInputChange() {
this.errorMessages = this.property.getValidationErrors(this.editedValue);
}
clicked(): void { clicked(): void {
this.cardViewUpdateService.clicked(this.property); this.cardViewUpdateService.clicked(this.property);
} }