fix RED-2481
This commit is contained in:
parent
28787b01fa
commit
c94d76f435
@ -1,7 +1,7 @@
|
|||||||
import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core';
|
||||||
import { Debounce, IconButtonTypes, List } from '@iqser/common-ui';
|
import { Debounce, IconButtonTypes, List } from '@iqser/common-ui';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { map, take } from 'rxjs/operators';
|
import { catchError, map, take, tap } from 'rxjs/operators';
|
||||||
import { Dossier } from '@state/model/dossier';
|
import { Dossier } from '@state/model/dossier';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||||
@ -102,18 +102,37 @@ export class DictionaryManagerComponent implements OnChanges {
|
|||||||
this.diffEditorText = '';
|
this.diffEditorText = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const entries =
|
||||||
|
this._dictionary.entries ??
|
||||||
|
this.appStateService.dictionaryData[this._dictionary.dossierTemplateId][this._dictionary.type].entries;
|
||||||
|
|
||||||
const entries = this.appStateService.dictionaryData[this._dictionary.dossierTemplateId][this._dictionary.type].entries;
|
if (entries.length) {
|
||||||
|
this.diffEditorText = this._toString(entries);
|
||||||
|
this.showDiffEditor = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.diffEditorText = this._toString(entries);
|
this._dictionaryService
|
||||||
this.showDiffEditor = true;
|
.getFor(this._dictionary.dossierTemplateId, this._dictionary.type)
|
||||||
|
.pipe(
|
||||||
|
tap(values => (this._dictionary.entries = [...values.entries] ?? [])),
|
||||||
|
catchError(() => {
|
||||||
|
this._dictionary.entries = [];
|
||||||
|
return of({});
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.toPromise()
|
||||||
|
.then(() => {
|
||||||
|
this.diffEditorText = this._toString(this._dictionary.entries);
|
||||||
|
this.showDiffEditor = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get _dictionaries() {
|
get _dictionaries() {
|
||||||
if (!this._dossierTemplate || this._dossierTemplate.name === this.selectDossierTemplate.name) {
|
if (!this._dossierTemplate || this._dossierTemplate.name === this.selectDossierTemplate.name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return Object.values(this.appStateService.dictionaryData[this.dossierTemplate?.dossierTemplateId]);
|
return Object.values(this.appStateService.dictionaryData[this.dossierTemplate?.dossierTemplateId]).filter(dict => !!dict.label);
|
||||||
}
|
}
|
||||||
|
|
||||||
get dossierTemplateIsNotSelected() {
|
get dossierTemplateIsNotSelected() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user