Allow watermark removal

This commit is contained in:
Adina Țeudan 2021-01-18 20:28:59 +02:00
parent 78a5117f8b
commit 34587f29b1
2 changed files with 10 additions and 4 deletions

View File

@ -92,11 +92,16 @@ export class WatermarkScreenComponent implements OnInit {
const watermark = {
...this.configForm.getRawValue()
};
this._watermarkControllerService.saveWatermark(watermark, this.appStateService.activeRuleSetId).subscribe(
const observable = watermark.text
? this._watermarkControllerService.saveWatermark(watermark, this.appStateService.activeRuleSetId)
: this._watermarkControllerService.deleteWatermark(this.appStateService.activeRuleSetId);
observable.subscribe(
() => {
this._loadWatermark();
this._notificationService.showToastNotification(
this._translateService.instant('watermark-screen.action.success'),
this._translateService.instant(watermark.text ? 'watermark-screen.action.change-success' : 'watermark-screen.action.delete-success'),
null,
NotificationType.SUCCESS
);
@ -190,7 +195,7 @@ export class WatermarkScreenComponent implements OnInit {
private _initForm() {
this.configForm = this._formBuilder.group({
text: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],
text: [{ value: null, disabled: !this.permissionsService.isAdmin() }],
hexColor: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],
opacity: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],
fontSize: [{ value: null, disabled: !this.permissionsService.isAdmin() }, Validators.required],

View File

@ -704,7 +704,8 @@
"action": {
"save": "Save Changes",
"revert": "Revert",
"success": "Watermark updated!",
"change-success": "Watermark updated!",
"delete-success": "Watermark deleted.",
"error": "Failed to update Watermark"
},
"title": "Watermark"