Listable by ID instead of reference
This commit is contained in:
parent
4869feae65
commit
11f157b3b1
@ -1,10 +1,15 @@
|
||||
import { Listable } from '@iqser/common-ui';
|
||||
import { TypeValue } from '@redaction/red-ui-http';
|
||||
|
||||
export class TypeValueWrapper {
|
||||
export class TypeValueWrapper implements Listable {
|
||||
entries: string[] = [];
|
||||
|
||||
constructor(public typeValue: TypeValue, public label?: string, public virtual?: boolean) {}
|
||||
|
||||
get id() {
|
||||
return this.typeValue.type;
|
||||
}
|
||||
|
||||
get addToDictionaryAction() {
|
||||
return this.typeValue.addToDictionaryAction;
|
||||
}
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
import { Component, Inject, Injector } from '@angular/core';
|
||||
import { AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators } from '@angular/forms';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import {Component, Inject, Injector} from '@angular/core';
|
||||
import {AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators} from '@angular/forms';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
|
||||
import * as Papa from 'papaparse';
|
||||
import { FileAttributeConfig, FileAttributesConfig, FileAttributesControllerService } from '@redaction/red-ui-http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, startWith } from 'rxjs/operators';
|
||||
import { Toaster } from '@iqser/common-ui';
|
||||
import { DefaultListingServices, ListingComponent, TableColumnConfig } from '@iqser/common-ui';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import {FileAttributeConfig, FileAttributesConfig, FileAttributesControllerService} from '@redaction/red-ui-http';
|
||||
import {Observable} from 'rxjs';
|
||||
import {map, startWith} from 'rxjs/operators';
|
||||
import {DefaultListingServices, Listable, ListingComponent, TableColumnConfig, Toaster} from '@iqser/common-ui';
|
||||
import {marker as _} from '@biesbjerg/ngx-translate-extract-marker';
|
||||
|
||||
export interface Field {
|
||||
id?: string;
|
||||
export interface Field extends Listable {
|
||||
id: string;
|
||||
csvColumn: string;
|
||||
name: string;
|
||||
type: FileAttributeConfig.TypeEnum;
|
||||
@ -76,7 +75,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
|
||||
header: true,
|
||||
delimiter: this.baseConfigForm.get('delimiter').value
|
||||
});
|
||||
this.baseConfigForm.patchValue({ delimiter: this.parseResult.meta.delimiter });
|
||||
this.baseConfigForm.patchValue({delimiter: this.parseResult.meta.delimiter});
|
||||
|
||||
// Filter duplicate columns
|
||||
if (this.parseResult?.data?.length) {
|
||||
@ -189,7 +188,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
|
||||
|
||||
try {
|
||||
await this._fileAttributesControllerService.setFileAttributesConfig(fileAttributes, this.data.dossierTemplateId).toPromise();
|
||||
this._toaster.success(_('file-attributes-csv-import.save.success'), { params: { count: this.activeFields.length } });
|
||||
this._toaster.success(_('file-attributes-csv-import.save.success'), {params: {count: this.activeFields.length}});
|
||||
} catch (e) {
|
||||
this._toaster.error(_('file-attributes-csv-import.save.error'));
|
||||
}
|
||||
@ -217,7 +216,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
|
||||
if ((this.parseResult?.meta?.fields || []).indexOf(control.value) !== -1) {
|
||||
return null; /* valid option selected */
|
||||
}
|
||||
return { invalidAutocompleteString: { value: control.value } };
|
||||
return {invalidAutocompleteString: {value: control.value}};
|
||||
};
|
||||
}
|
||||
|
||||
@ -225,6 +224,7 @@ export class FileAttributesCsvImportDialogComponent extends ListingComponent<Fie
|
||||
const sample = this.getSample(csvColumn);
|
||||
const isNumber = sample && !isNaN(sample);
|
||||
return {
|
||||
id: btoa(csvColumn),
|
||||
csvColumn,
|
||||
name: csvColumn,
|
||||
type: isNumber ? FileAttributeConfig.TypeEnum.NUMBER : FileAttributeConfig.TypeEnum.TEXT,
|
||||
|
||||
@ -4,13 +4,13 @@ import { Colors, DictionaryControllerService } from '@redaction/red-ui-http';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { AdminDialogService } from '../../services/admin-dialog.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 { defaultColorsTranslations } from '../../translations/default-colors-translations';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { UserService } from '@services/user.service';
|
||||
|
||||
interface ListItem {
|
||||
interface ListItem extends Listable {
|
||||
readonly key: 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();
|
||||
this._colorsObj = data;
|
||||
const entities = Object.keys(data).map(key => ({
|
||||
id: key,
|
||||
key,
|
||||
value: data[key]
|
||||
}));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"OAUTH_URL": "https://red-staging.iqser.cloud/auth/realms/redaction",
|
||||
"API_URL": "https://red-staging.iqser.cloud/redaction-gateway-v1",
|
||||
"OAUTH_URL": "https://dom1.iqser.cloud/auth/realms/redaction",
|
||||
"API_URL": "https://dom1.iqser.cloud/redaction-gateway-v1",
|
||||
"OAUTH_CLIENT_ID": "redaction",
|
||||
"BACKEND_APP_VERSION": "4.4.40",
|
||||
"FRONTEND_APP_VERSION": "1.1",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user