Add all fields in field-value pipe.
This commit is contained in:
parent
1171a38ad1
commit
2f5f34948e
|
@ -13,7 +13,9 @@ export class FieldValuePipe implements PipeTransform {
|
||||||
transform(controlValue: any): string | null {
|
transform(controlValue: any): string | null {
|
||||||
let value = controlValue.value;
|
let value = controlValue.value;
|
||||||
let renderStyle = controlValue.viewStyle?.renderStyle;
|
let renderStyle = controlValue.viewStyle?.renderStyle;
|
||||||
if (renderStyle && controlValue) {
|
if (renderStyle && value) {
|
||||||
|
console.log(renderStyle);
|
||||||
|
console.log(value);
|
||||||
switch (renderStyle) {
|
switch (renderStyle) {
|
||||||
case DatasetProfileFieldViewStyle.Currency:
|
case DatasetProfileFieldViewStyle.Currency:
|
||||||
if (value) {
|
if (value) {
|
||||||
|
@ -47,10 +49,39 @@ export class FieldValuePipe implements PipeTransform {
|
||||||
break;
|
break;
|
||||||
case DatasetProfileFieldViewStyle.TextArea:
|
case DatasetProfileFieldViewStyle.TextArea:
|
||||||
return value;
|
return value;
|
||||||
|
case DatasetProfileFieldViewStyle.Registries:
|
||||||
|
case DatasetProfileFieldViewStyle.Services:
|
||||||
|
case DatasetProfileFieldViewStyle.Researchers:
|
||||||
|
case DatasetProfileFieldViewStyle.Organizations:
|
||||||
|
case DatasetProfileFieldViewStyle.ExternalDatasets:
|
||||||
|
case DatasetProfileFieldViewStyle.DataRepositories:
|
||||||
|
case DatasetProfileFieldViewStyle.PubRepositories:
|
||||||
|
case DatasetProfileFieldViewStyle.JournalRepositories:
|
||||||
|
case DatasetProfileFieldViewStyle.Taxonomies:
|
||||||
|
case DatasetProfileFieldViewStyle.Licenses:
|
||||||
|
case DatasetProfileFieldViewStyle.Publications:
|
||||||
|
case DatasetProfileFieldViewStyle.Tags:
|
||||||
|
return this.parseJson(value);
|
||||||
|
case DatasetProfileFieldViewStyle.InternalDmpEntities:
|
||||||
|
return this.parseJson(value, 'label');
|
||||||
|
case DatasetProfileFieldViewStyle.DatasetIdentifier:
|
||||||
|
case DatasetProfileFieldViewStyle.Validation:
|
||||||
|
if(value && value.identifier) {
|
||||||
|
return value.identifier;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public parseJson(value: any, field: string = 'name') {
|
||||||
|
if(Array.isArray(value)) {
|
||||||
|
return value.map(element => JSON.parse(element)[field]).join(',');
|
||||||
|
} else {
|
||||||
|
return JSON.parse(value)[field];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue