diff --git a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.html b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.html
index ed75d8633..b278a9855 100644
--- a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.html
+++ b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.html
@@ -83,6 +83,7 @@
[diffEditorText]="diffEditorText"
[initialEntries]="initialEntries"
[showDiffEditor]="compare && showDiffEditor"
+ (enableSaveButton)="onEnableSaveButton($event)"
>
@@ -96,6 +97,7 @@
(action)="saveDictionary.emit()"
[label]="'dictionary-overview.save-changes' | translate"
[type]="iconButtonTypes.primary"
+ [disabled]="!saveButtonEnabled()"
icon="iqser:check"
>
diff --git a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts
index b9e754cd1..679c8aa95 100644
--- a/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts
+++ b/apps/red-ui/src/app/modules/shared/components/dictionary-manager/dictionary-manager.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild } from '@angular/core';
+import { ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, Output, signal, SimpleChanges, ViewChild } from '@angular/core';
import { Debounce, IconButtonTypes, List, LoadingService } from '@iqser/common-ui';
import { firstValueFrom, Observable, of } from 'rxjs';
import { catchError, map, take, tap } from 'rxjs/operators';
@@ -27,6 +27,7 @@ const HELP_MODE_KEYS = {
})
export class DictionaryManagerComponent implements OnChanges {
readonly iconButtonTypes = IconButtonTypes;
+ readonly saveButtonEnabled = signal(true);
@Input() type: DictionaryType = 'dictionary';
@Input() entityType?: string;
@@ -92,6 +93,7 @@ export class DictionaryManagerComponent implements OnChanges {
this._onDossierChanged(dossier.dossierTemplateId, dossier.id)
.pipe(take(1))
+ // eslint-disable-next-line rxjs/no-ignored-subscription
.subscribe(entries => {
this.diffEditorText = entries;
this.showDiffEditor = true;
@@ -210,6 +212,10 @@ export class DictionaryManagerComponent implements OnChanges {
}
}
+ onEnableSaveButton(value: boolean) {
+ this.saveButtonEnabled.set(value);
+ }
+
private _applySearchDecorations() {
this._searchDecorations = this.editor.codeEditor?.deltaDecorations(this._searchDecorations, []) || [];
diff --git a/apps/red-ui/src/app/modules/shared/components/editor/editor.component.html b/apps/red-ui/src/app/modules/shared/components/editor/editor.component.html
index dc7e0038e..0a113be28 100644
--- a/apps/red-ui/src/app/modules/shared/components/editor/editor.component.html
+++ b/apps/red-ui/src/app/modules/shared/components/editor/editor.component.html
@@ -4,6 +4,7 @@
*ngIf="!showDiffEditor"
[(ngModel)]="value"
[options]="editorOptions"
+ (paste)="onPaste()"
>
('revert') initialEntries: List;
@Input() canEdit = false;
+ @Output() enableSaveButton = new EventEmitter();
/**
* Used as [modified] input on diff editor
@@ -43,7 +43,7 @@ export class EditorComponent implements OnInit, OnChanges {
private _diffEditor: IDiffEditor;
private _decorations: string[] = [];
- constructor(private readonly _userPreferenceService: UserPreferenceService, private readonly _editorThemeService: EditorThemeService) {}
+ constructor(private readonly _loadingService: LoadingService, private readonly _editorThemeService: EditorThemeService) {}
get currentEntries(): string[] {
return this.value.split('\n');
@@ -97,6 +97,8 @@ export class EditorComponent implements OnInit, OnChanges {
const newDecorations = this.currentEntries.filter(entry => this._isNew(entry)).map(entry => this._getDecoration(entry));
this._decorations = this.codeEditor.deltaDecorations(this._decorations, newDecorations);
this.diffValue = this.value;
+ this._loadingService.stop();
+ this.enableSaveButton.emit(true);
}
revert() {
@@ -105,6 +107,11 @@ export class EditorComponent implements OnInit, OnChanges {
this._diffEditor?.getModifiedEditor().setValue(this.diffValue);
}
+ onPaste() {
+ this._loadingService.start();
+ this.enableSaveButton.emit(false);
+ }
+
private _defineThemes(): void {
for (const theme of this._editorThemeService.themes) {
(window as any).monaco.editor.defineTheme(theme, this._editorThemeService.configurations[theme]);