RED-7890: Remove dict items sorting from UI

This commit is contained in:
Adina Țeudan 2023-11-07 16:27:56 +02:00
parent 54303e49eb
commit b9e43535a9

View File

@ -17,15 +17,19 @@ import { getParam, List } from '@iqser/common-ui/lib/utils';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DictionaryScreenComponent implements OnInit {
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
@ViewChild('dictionaryManager', { static: false })
private readonly _dictionaryManager: DictionaryManagerComponent;
readonly currentUser = getCurrentUser<User>();
readonly roles = Roles;
readonly initialEntries$ = new BehaviorSubject<string[]>([]);
readonly initialEntries$ = new BehaviorSubject<List>([]);
isLeavingPage = false;
readonly type: DictionaryType;
readonly entityType = getParam(ENTITY_TYPE);
readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID);
@ViewChild('dictionaryManager', { static: false })
private readonly _dictionaryManager: DictionaryManagerComponent;
get changed() {
return this._dictionaryManager.editor.hasChanges;
}
constructor(
route: ActivatedRoute,
@ -38,10 +42,6 @@ export class DictionaryScreenComponent implements OnInit {
this.type = route.snapshot.routeConfig.path as DictionaryType;
}
get changed() {
return this._dictionaryManager.editor.hasChanges;
}
async ngOnInit() {
await this.#loadEntries();
}
@ -72,7 +72,7 @@ export class DictionaryScreenComponent implements OnInit {
try {
const data = await this._dictionaryService.getForType(this.#dossierTemplateId, this.entityType);
const entries: List = data[DICTIONARY_TYPE_KEY_MAP[this.type]];
this.initialEntries$.next([...entries].sort((str1, str2) => str1.localeCompare(str2, undefined, { sensitivity: 'accent' })));
this.initialEntries$.next(entries);
} catch (e) {
this.initialEntries$.next([]);
} finally {