Listable by ID instead of reference

This commit is contained in:
Timo Bejan 2021-08-24 13:33:42 +03:00
parent 02b71ed2e2
commit 275d0f5cb5
4 changed files with 15 additions and 8 deletions

View File

@ -1,10 +1,15 @@
import { Listable } from '@iqser/common-ui';
import { TypeValue } from '@redaction/red-ui-http'; import { TypeValue } from '@redaction/red-ui-http';
export class TypeValueWrapper { export class TypeValueWrapper implements Listable {
entries: string[] = []; entries: string[] = [];
constructor(public typeValue: TypeValue, public label?: string, public virtual?: boolean) {} constructor(public typeValue: TypeValue, public label?: string, public virtual?: boolean) {}
get id() {
return this.typeValue.type;
}
get addToDictionaryAction() { get addToDictionaryAction() {
return this.typeValue.addToDictionaryAction; return this.typeValue.addToDictionaryAction;
} }

View File

@ -6,11 +6,11 @@ import { FileAttributeConfig, FileAttributesConfig, FileAttributesControllerServ
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map, startWith } from 'rxjs/operators'; import { map, startWith } from 'rxjs/operators';
import { Toaster } from '@services/toaster.service'; import { Toaster } from '@services/toaster.service';
import { DefaultListingServices, ListingComponent, TableColumnConfig } from '@iqser/common-ui'; import { DefaultListingServices, Listable, ListingComponent, TableColumnConfig } from '@iqser/common-ui';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
export interface Field { export interface Field extends Listable {
id?: string; id: string;
csvColumn: string; csvColumn: string;
name: string; name: string;
type: FileAttributeConfig.TypeEnum; type: FileAttributeConfig.TypeEnum;
@ -225,6 +225,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
const sample = this.getSample(csvColumn); const sample = this.getSample(csvColumn);
const isNumber = sample && !isNaN(sample); const isNumber = sample && !isNaN(sample);
return { return {
id: btoa(csvColumn),
csvColumn, csvColumn,
name: csvColumn, name: csvColumn,
type: isNumber ? FileAttributeConfig.TypeEnum.NUMBER : FileAttributeConfig.TypeEnum.TEXT, type: isNumber ? FileAttributeConfig.TypeEnum.NUMBER : FileAttributeConfig.TypeEnum.TEXT,

View File

@ -4,13 +4,13 @@ import { Colors, DictionaryControllerService } from '@redaction/red-ui-http';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { AdminDialogService } from '../../services/admin-dialog.service'; import { AdminDialogService } from '../../services/admin-dialog.service';
import { LoadingService } from '@services/loading.service'; import { LoadingService } from '@services/loading.service';
import { CircleButtonTypes, DefaultListingServices, ListingComponent, TableColumnConfig } from '@iqser/common-ui'; import { CircleButtonTypes, DefaultListingServices, Listable, ListingComponent, TableColumnConfig } from '@iqser/common-ui';
import { DefaultColorType } from '@models/default-color-key.model'; import { DefaultColorType } from '@models/default-color-key.model';
import { defaultColorsTranslations } from '../../translations/default-colors-translations'; import { defaultColorsTranslations } from '../../translations/default-colors-translations';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { UserService } from '@services/user.service'; import { UserService } from '@services/user.service';
interface ListItem { interface ListItem extends Listable {
readonly key: string; readonly key: string;
readonly value: string; readonly value: string;
} }
@ -72,6 +72,7 @@ export class DefaultColorsScreenComponent extends ListingComponent<ListItem> imp
const data = await this._dictionaryControllerService.getColors(this._appStateService.activeDossierTemplateId).toPromise(); const data = await this._dictionaryControllerService.getColors(this._appStateService.activeDossierTemplateId).toPromise();
this._colorsObj = data; this._colorsObj = data;
const entities = Object.keys(data).map(key => ({ const entities = Object.keys(data).map(key => ({
id: key,
key, key,
value: data[key] value: data[key]
})); }));

View File

@ -1,6 +1,6 @@
{ {
"OAUTH_URL": "https://red-staging.iqser.cloud/auth/realms/redaction", "OAUTH_URL": "https://dom1.iqser.cloud/auth/realms/redaction",
"API_URL": "https://red-staging.iqser.cloud/redaction-gateway-v1", "API_URL": "https://dom1.iqser.cloud/redaction-gateway-v1",
"OAUTH_CLIENT_ID": "redaction", "OAUTH_CLIENT_ID": "redaction",
"BACKEND_APP_VERSION": "4.4.40", "BACKEND_APP_VERSION": "4.4.40",
"FRONTEND_APP_VERSION": "1.1", "FRONTEND_APP_VERSION": "1.1",