Delete file attribute / user warning styles

This commit is contained in:
Adina Țeudan 2021-04-07 15:02:17 +03:00
parent 7289c8675e
commit bf684108e4
4 changed files with 31 additions and 5 deletions

View File

@ -3,16 +3,28 @@
{{ 'confirm-delete-file-attribute.title' | translate: { name: fileAttribute.label } }}
</div>
<div class="inline-dialog-toast toast-error" *ngIf="showToast">
<div translate="confirm-delete-file-attribute.toast-error"></div>
<a (click)="showToast = false" class="toast-close-button">
<mat-icon svgIcon="red:close"></mat-icon>
</a>
</div>
<div class="dialog-content">
<div class="heading" translate="confirm-delete-file-attribute.warning"></div>
<mat-checkbox *ngFor="let checkbox of checkboxes; let idx = index" [(ngModel)]="checkbox.value" color="primary">
<mat-checkbox
*ngFor="let checkbox of checkboxes; let idx = index"
[(ngModel)]="checkbox.value"
color="primary"
[class.error]="!checkbox.value && showToast"
>
{{ 'confirm-delete-file-attribute.checkbox-' + (idx + 1) | translate }}
</mat-checkbox>
</div>
<div class="dialog-actions">
<button [disabled]="!valid" color="primary" mat-flat-button (click)="deleteFileAttribute()">
<button color="primary" mat-flat-button (click)="deleteFileAttribute()">
{{ 'confirm-delete-file-attribute.delete' | translate }}
</button>
<div class="all-caps-label cancel" (click)="cancel()" translate="confirm-delete-file-attribute.cancel"></div>

View File

@ -12,6 +12,7 @@ export class ConfirmDeleteFileAttributeDialogComponent {
public fileAttribute: FileAttributeConfig;
public ruleSetId: string;
public checkboxes = [{ value: false }, { value: false }];
public showToast = false;
constructor(
private readonly _appStateService: AppStateService,
@ -28,8 +29,12 @@ export class ConfirmDeleteFileAttributeDialogComponent {
}
async deleteFileAttribute() {
await this._fileAttributesService.deleteFileAttributesConfiguration(this.ruleSetId, this.fileAttribute.id).toPromise();
this.dialogRef.close(true);
if (this.valid) {
await this._fileAttributesService.deleteFileAttributesConfiguration(this.ruleSetId, this.fileAttribute.id).toPromise();
this.dialogRef.close(true);
} else {
this.showToast = true;
}
}
public cancel() {

View File

@ -11,7 +11,12 @@
<div class="dialog-content">
<div class="heading" translate="confirm-delete-user.warning"></div>
<mat-checkbox *ngFor="let checkbox of checkboxes; let idx = index" [(ngModel)]="checkbox.value" color="primary">
<mat-checkbox
*ngFor="let checkbox of checkboxes; let idx = index"
[(ngModel)]="checkbox.value"
color="primary"
[class.error]="!checkbox.value && showToast"
>
{{ 'confirm-delete-user.checkbox-' + (idx + 1) | translate: { projectsCount: projectsCount } }}
</mat-checkbox>
</div>

View File

@ -29,3 +29,7 @@
}
}
}
.mat-checkbox.error .mat-checkbox-label {
color: $red-1;
}