-
+
{{ (dictionary.hint ? 'hint' : 'redaction') | translate }}
diff --git a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.scss b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.scss
index e427f5dce..efff8763d 100644
--- a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.scss
+++ b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.scss
@@ -5,10 +5,6 @@
height: calc(100% - 50px);
}
-.changes-box {
- right: 403px;
-}
-
.left-container {
width: calc(100vw - 353px);
padding: 15px;
diff --git a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts
index 08edd23d5..a95701945 100644
--- a/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts
+++ b/apps/red-ui/src/app/screens/admin/dictionary-overview-screen/dictionary-overview-screen.component.ts
@@ -10,7 +10,6 @@ import { NotificationService, NotificationType } from '../../../notification/not
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { saveAs } from 'file-saver';
-import { DEFAULT_RUL_SET_UUID } from '../../../utils/rule-set-default';
import { ComponentHasChanges } from '../../../utils/can-deactivate.guard';
declare var ace;
@@ -59,18 +58,13 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges {
private readonly _appStateService: AppStateService
) {
super(_translateService);
- this._activatedRoute.params.subscribe((params) => {
- this.dictionary = this._appStateService.dictionaryData[params.type];
- if (!this.dictionary) {
- this._router.navigate(['/ui/admin/dictionaries']);
- } else {
- this._initialize();
- }
- });
+ this._appStateService.activateDictionary(this._activatedRoute.snapshot.params.type, this._activatedRoute.snapshot.params.ruleSetId);
+ this.dictionary = this._appStateService.activeDictionary;
+ this._initialize();
}
private _initialize() {
- this._dictionaryControllerService.getDictionaryForType(this.dictionary.type, DEFAULT_RUL_SET_UUID).subscribe(
+ this._dictionaryControllerService.getDictionaryForType(this.dictionary.type, this.dictionary.ruleSetId).subscribe(
(data) => {
this.initialDictionaryEntries = data.entries.sort((str1, str2) => str1.localeCompare(str2, undefined, { sensitivity: 'accent' }));
this.revert();
@@ -83,7 +77,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges {
openEditDictionaryDialog($event: any) {
$event.stopPropagation();
- this._dialogService.openAddEditDictionaryDialog(this.dictionary, async (newDictionary) => {
+ this._dialogService.openAddEditDictionaryDialog(this.dictionary, this.dictionary.ruleSetId, async (newDictionary) => {
if (newDictionary) {
await this._appStateService.loadDictionaryData();
this.dictionary = this._appStateService.dictionaryData[this.dictionary.type];
@@ -92,7 +86,7 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges {
}
openDeleteDictionaryDialog($event: any) {
- this._dialogService.openDeleteDictionaryDialog($event, this.dictionary, async () => {
+ this._dialogService.openDeleteDictionaryDialog($event, this.dictionary, this.dictionary.ruleSetId, async () => {
await this._appStateService.loadDictionaryData();
this._router.navigate(['/ui/admin/dictionaries']);
});
@@ -186,9 +180,9 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges {
this.processing = true;
let obs: Observable
;
if (entriesToAdd.length > 0) {
- obs = this._dictionaryControllerService.addEntry(entriesToAdd, this.dictionary.type, DEFAULT_RUL_SET_UUID, true);
+ obs = this._dictionaryControllerService.addEntry(entriesToAdd, this.dictionary.type, this.dictionary.ruleSetId, true);
} else {
- obs = this._dictionaryControllerService.deleteEntries(this.initialDictionaryEntries, this.dictionary.type, DEFAULT_RUL_SET_UUID);
+ obs = this._dictionaryControllerService.deleteEntries(this.initialDictionaryEntries, this.dictionary.type, this.dictionary.ruleSetId);
}
obs.subscribe(
diff --git a/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/add-edit-rule-set-dialog/add-edit-rule-set-dialog.component.ts b/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/add-edit-rule-set-dialog/add-edit-rule-set-dialog.component.ts
index 97e5abdc1..cf487b94b 100644
--- a/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/add-edit-rule-set-dialog/add-edit-rule-set-dialog.component.ts
+++ b/apps/red-ui/src/app/screens/admin/rule-sets-listing-screen/add-edit-rule-set-dialog/add-edit-rule-set-dialog.component.ts
@@ -54,7 +54,8 @@ export class AddEditRuleSetDialogComponent {
ruleSetId: this.ruleSet?.ruleSetId,
...this.ruleSetForm.getRawValue()
};
- const res = await this._ruleSetController.createOrUpdateRuleSet(ruleSet).toPromise();
+ await this._ruleSetController.createOrUpdateRuleSet(ruleSet).toPromise();
+ await this._appStateService.loadAllRuleSets();
this.dialogRef.close({ ruleSet });
}
}
diff --git a/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.html b/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.html
index 7432bdffb..3e1eccc64 100644
--- a/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.html
+++ b/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.html
@@ -5,7 +5,7 @@
-
+
diff --git a/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.scss b/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.scss
index ce018878f..1e01118db 100644
--- a/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.scss
+++ b/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.scss
@@ -6,10 +6,6 @@
@include inset-shadow;
}
-.changes-box {
- right: 40px;
-}
-
.page-header .actions {
display: flex;
justify-content: flex-end;
diff --git a/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.ts b/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.ts
index abdf9ec64..1fafe16cc 100644
--- a/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.ts
+++ b/apps/red-ui/src/app/screens/admin/rules-screen/rules-screen.component.ts
@@ -5,7 +5,6 @@ import { RulesControllerService, RuleSetModel } from '@redaction/red-ui-http';
import { NotificationService, NotificationType } from '../../../notification/notification.service';
import { TranslateService } from '@ngx-translate/core';
import { saveAs } from 'file-saver';
-import { DEFAULT_RUL_SET_UUID } from '../../../utils/rule-set-default';
import { ComponentHasChanges } from '../../../utils/can-deactivate.guard';
import { ActivatedRoute } from '@angular/router';
import { AppStateService } from '../../../state/app-state.service';
@@ -26,7 +25,6 @@ export class RulesScreenComponent extends ComponentHasChanges {
public currentLines: string[] = [];
public changedLines: number[] = [];
public activeEditMarkers: any[] = [];
- public ruleSet: RuleSetModel;
@ViewChild('editorComponent', { static: true })
editorComponent: AceEditorComponent;
@@ -40,15 +38,15 @@ export class RulesScreenComponent extends ComponentHasChanges {
private readonly _appStateService: AppStateService,
private readonly _notificationService: NotificationService,
protected readonly _translateService: TranslateService,
- private readonly _actr: ActivatedRoute
+ private readonly _activatedRoute: ActivatedRoute
) {
super(_translateService);
+ this._appStateService.activateRuleSet(_activatedRoute.snapshot.params.ruleSetId);
this._initialize();
- this.ruleSet = this._appStateService.getRuleSetById(this._actr.snapshot.params.ruleSetId);
}
private _initialize() {
- this._rulesControllerService.downloadRules(DEFAULT_RUL_SET_UUID).subscribe(
+ this._rulesControllerService.downloadRules(this._appStateService.activeRuleSetId).subscribe(
(rules) => {
this.rules = rules.rules;
this.revert();
@@ -90,16 +88,22 @@ export class RulesScreenComponent extends ComponentHasChanges {
public async save(): Promise {
this.processing = true;
- this._rulesControllerService.uploadRules({ rules: this.editorComponent.getEditor().getValue(), ruleSetId: DEFAULT_RUL_SET_UUID }).subscribe(
- () => {
- this._initialize();
- this._notificationService.showToastNotification(this._translateService.instant('rules-screen.success.generic'), null, NotificationType.SUCCESS);
- },
- () => {
- this.processing = false;
- this._notificationService.showToastNotification(this._translateService.instant('rules-screen.error.generic'), null, NotificationType.ERROR);
- }
- );
+ this._rulesControllerService
+ .uploadRules({ rules: this.editorComponent.getEditor().getValue(), ruleSetId: this._appStateService.activeRuleSetId })
+ .subscribe(
+ () => {
+ this._initialize();
+ this._notificationService.showToastNotification(
+ this._translateService.instant('rules-screen.success.generic'),
+ null,
+ NotificationType.SUCCESS
+ );
+ },
+ () => {
+ this.processing = false;
+ this._notificationService.showToastNotification(this._translateService.instant('rules-screen.error.generic'), null, NotificationType.ERROR);
+ }
+ );
}
public revert(): void {
diff --git a/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.html b/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.html
index 4226e3577..532e46ffd 100644
--- a/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.html
+++ b/apps/red-ui/src/app/screens/admin/watermark-screen/watermark-screen.component.html
@@ -1,8 +1,10 @@