remove currency from description template field type enum
This commit is contained in:
parent
6ecd52dd2f
commit
6b7a33c0b4
|
@ -20,7 +20,6 @@ public enum FieldType implements DatabaseEnum<String> {
|
|||
TAGS(Names.Tags),
|
||||
REFERENCE_TYPES(Names.ReferenceTypes),
|
||||
DATASET_IDENTIFIER(Names.DatasetIdentifier),
|
||||
CURRENCY(Names.Currency),
|
||||
VALIDATION(Names.Validation);
|
||||
private final String value;
|
||||
|
||||
|
@ -38,7 +37,6 @@ public enum FieldType implements DatabaseEnum<String> {
|
|||
public static final String DatePicker = "datePicker";
|
||||
public static final String Tags = "tags";
|
||||
public static final String DatasetIdentifier = "datasetIdentifier";
|
||||
public static final String Currency = "currency";
|
||||
public static final String Validation = "validation";
|
||||
public static final String ReferenceTypes = "referenceTypes";
|
||||
}
|
||||
|
@ -66,7 +64,7 @@ public enum FieldType implements DatabaseEnum<String> {
|
|||
public static boolean isTextType(FieldType fieldType){
|
||||
return fieldType.equals(FieldType.FREE_TEXT) || fieldType.equals(FieldType.CHECK_BOX) || fieldType.equals(FieldType.TEXT_AREA) ||
|
||||
fieldType.equals(FieldType.RICH_TEXT_AREA) || fieldType.equals(FieldType.UPLOAD) || fieldType.equals(FieldType.BOOLEAN_DECISION) ||
|
||||
fieldType.equals(FieldType.RADIO_BOX) || fieldType.equals(FieldType.CURRENCY);
|
||||
fieldType.equals(FieldType.RADIO_BOX);
|
||||
}
|
||||
|
||||
public static boolean isTextListType(FieldType fieldType){
|
||||
|
|
|
@ -64,7 +64,6 @@ public abstract class BaseFieldDataCommonModelBuilder<Model extends BaseFieldDat
|
|||
case TAGS -> m.setFieldType(FieldType.TAGS);
|
||||
case REFERENCE_TYPES -> m.setFieldType(FieldType.REFERENCE_TYPES);
|
||||
case DATASET_IDENTIFIER -> m.setFieldType(FieldType.DATASET_IDENTIFIER);
|
||||
case CURRENCY -> m.setFieldType(FieldType.CURRENCY);
|
||||
case VALIDATION -> m.setFieldType(FieldType.VALIDATION);
|
||||
default -> throw new MyApplicationException("unrecognized type " + d.getFieldType());
|
||||
}
|
||||
|
|
|
@ -136,10 +136,6 @@ public class FieldPersist {
|
|||
.iff(()-> !this.isEmpty(item.getTextValue()) && fieldType.equals(FieldType.CHECK_BOX) || fieldType.equals(FieldType.BOOLEAN_DECISION) )
|
||||
.must(() -> this.isBoolean(item.getTextValue()))
|
||||
.failOn(FieldPersist._textValue).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.iff(()-> !this.isEmpty(item.getTextValue()) && fieldType.equals(FieldType.CURRENCY))
|
||||
.must(() -> this.isUUID(item.getTextValue()))
|
||||
.failOn(FieldPersist._textValue).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.iff(()-> !this.isNull(item.getTextListValue()) && (fieldType.equals(FieldType.INTERNAL_ENTRIES_DMPS) || fieldType.equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS)))
|
||||
.must(() -> item.getTextListValue().stream().allMatch(this::isUUID))
|
||||
|
|
|
@ -145,10 +145,6 @@ public class RulePersist {
|
|||
.iff(()-> !this.isEmpty(item.getTextValue()) && fieldType.equals(FieldType.CHECK_BOX) || fieldType.equals(FieldType.BOOLEAN_DECISION) )
|
||||
.must(() -> this.isBoolean(item.getTextValue()))
|
||||
.failOn(FieldPersist._textValue).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.iff(()-> !this.isEmpty(item.getTextValue()) && fieldType.equals(FieldType.CURRENCY))
|
||||
.must(() -> this.isUUID(item.getTextValue()))
|
||||
.failOn(FieldPersist._textValue).failWith(messageSource.getMessage("Validation_UnexpectedValue", new Object[]{FieldPersist._textValue}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.iff(()-> !this.isNull(item.getTextListValue()) && (fieldType.equals(FieldType.INTERNAL_ENTRIES_DMPS) || fieldType.equals(FieldType.INTERNAL_ENTRIES_DESCRIPTIONS)))
|
||||
.must(() -> item.getTextListValue().stream().allMatch(this::isUUID))
|
||||
|
|
|
@ -35,7 +35,6 @@ import java.util.List;
|
|||
@JsonSubTypes.Type(value = UploadDataPersist.class, name = FieldType.Names.Upload),
|
||||
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.Validation),
|
||||
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.DatasetIdentifier),
|
||||
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.Currency),
|
||||
@JsonSubTypes.Type(value = SelectDataPersist.class, name = FieldType.Names.Select)
|
||||
})
|
||||
public abstract class BaseFieldDataPersist {
|
||||
|
|
|
@ -118,14 +118,14 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService {
|
|||
for (Object object: item.getOptions()) {
|
||||
StaticOptionEntity staticOption = (StaticOptionEntity) object;
|
||||
if (!this.conventionService.isNullOrEmpty(externalReferenceCriteria.getLike()) && !externalReferenceCriteria.getLike().toUpperCase().contains(staticOption.getValue())) continue;
|
||||
result.put(staticOption.getCode(), staticOption.getValue());
|
||||
rawData.put(staticOption.getCode(), staticOption.getValue());
|
||||
result.put(staticOption.getCode(), staticOption.getValue());
|
||||
result.put(ReferenceEntity.KnownFields.SourceLabel, staticSource.getLabel());
|
||||
result.put(ReferenceEntity.KnownFields.Key, staticSource.getKey());
|
||||
|
||||
}
|
||||
externalDataResult.getRawData().add(rawData);
|
||||
externalDataResult.getResults().add(result);
|
||||
if (!rawData.isEmpty()) externalDataResult.getRawData().add(rawData);
|
||||
if (!result.isEmpty()) externalDataResult.getResults().add(result);
|
||||
}
|
||||
|
||||
return externalDataResult;
|
||||
|
|
|
@ -30,7 +30,6 @@ public class FieldDataHelperServiceProvider {
|
|||
case FREE_TEXT:
|
||||
case TAGS:
|
||||
case DATASET_IDENTIFIER:
|
||||
case CURRENCY:
|
||||
case CHECK_BOX:
|
||||
case BOOLEAN_DECISION:
|
||||
case VALIDATION: {
|
||||
|
|
|
@ -516,7 +516,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
|
|||
}
|
||||
}
|
||||
}
|
||||
case TAGS, CURRENCY -> {
|
||||
case TAGS -> {
|
||||
String[] valuesParsed = this.tryParseJsonAsObjectString(String[].class, value);
|
||||
field.setTextListValue(valuesParsed == null ? List.of(value) : Arrays.stream(valuesParsed).toList()); //TODO Tags, Currency is ids
|
||||
}
|
||||
|
|
|
@ -14,20 +14,5 @@ export enum DescriptionTemplateFieldType {
|
|||
REFERENCE_TYPES = "referenceTypes",
|
||||
TAGS = "tags",
|
||||
DATASET_IDENTIFIER = "datasetIdentifier",
|
||||
CURRENCY = "currency",
|
||||
VALIDATION = "validation"
|
||||
|
||||
//EXTERNAL_SELECT = "externalSelect",
|
||||
// INTERNAL_DMP_ENTRIES_RESEARCHERS = "internalDmpResearchers",
|
||||
// DATA_REPOSITORIES = "dataRepositories",
|
||||
// JOURNAL_REPOSITORIES = "journalRepositories",
|
||||
// PUB_REPOSITORIES = "pubRepositories",
|
||||
// LICENSES = "licenses",
|
||||
// TAXONOMIES = "taxonomies",
|
||||
// PUBLICATIONS = "publications",
|
||||
// REGISTRIES = "registries",
|
||||
// SERVICES = "services",
|
||||
|
||||
// RESEARCHERS = "researchers",
|
||||
// ORGANIZATIONS = "organizations",
|
||||
}
|
|
@ -16,11 +16,6 @@ export class FieldValuePipe implements PipeTransform {
|
|||
let renderStyle = controlValue?.viewStyle?.renderStyle;
|
||||
if (renderStyle && value) {
|
||||
switch (renderStyle) {
|
||||
case DescriptionTemplateFieldType.CURRENCY:
|
||||
if (value) {
|
||||
return JSON.parse(value).name;
|
||||
}
|
||||
break;
|
||||
case DescriptionTemplateFieldType.BOOLEAN_DECISION:
|
||||
return value == 'true' ? 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.YES' : 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.NO';
|
||||
case DescriptionTemplateFieldType.CHECK_BOX:
|
||||
|
|
|
@ -166,7 +166,6 @@ export class EnumUtils {
|
|||
case DescriptionTemplateFieldType.TAGS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.TAGS');
|
||||
case DescriptionTemplateFieldType.REFERENCE_TYPES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.REFERENCE-TYPES');
|
||||
case DescriptionTemplateFieldType.DATASET_IDENTIFIER: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.DATASET-IDENTIFIER');
|
||||
case DescriptionTemplateFieldType.CURRENCY: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.CURRENCY');
|
||||
case DescriptionTemplateFieldType.VALIDATION: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.VALIDATION');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,10 +175,6 @@
|
|||
<img src="/assets/images/editor/icons/date_picker.svg" class="input_icon" alt="DatePicker Icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.DATE_PICKER)}}
|
||||
</button>
|
||||
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.CURRENCY)">
|
||||
<img src="/assets/images/editor/icons/currency.svg" class="input_icon" alt="Currency Icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.CURRENCY)}}
|
||||
</button>
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
|
|
|
@ -553,7 +553,6 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
|
|||
case DescriptionTemplateFieldType.DATE_PICKER:
|
||||
case DescriptionTemplateFieldType.TAGS:
|
||||
case DescriptionTemplateFieldType.DATASET_IDENTIFIER:
|
||||
case DescriptionTemplateFieldType.CURRENCY:
|
||||
case DescriptionTemplateFieldType.VALIDATION: {
|
||||
const data: DescriptionTemplateLabelData = {
|
||||
label: '',
|
||||
|
|
|
@ -78,10 +78,6 @@
|
|||
<img src="/assets/images/editor/icons/date_picker.svg" class="input_icon" alt="DatePicker icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.DATE_PICKER)}}
|
||||
</mat-option>
|
||||
<mat-option [value]="descriptionTemplateFieldTypeEnum.CURRENCY">
|
||||
<img src="/assets/images/editor/icons/currency.svg" class="input_icon" alt="Current icon">
|
||||
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.CURRENCY)}}
|
||||
</mat-option>
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
<!-- APIS -->
|
||||
|
@ -177,7 +173,6 @@
|
|||
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATE_PICKER" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
|
||||
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.TAGS" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
|
||||
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATASET_IDENTIFIER" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
|
||||
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.CURRENCY" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
|
||||
<app-description-template-editor-label-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.VALIDATION" class="col-12" [form]="form"></app-description-template-editor-label-field-component>
|
||||
|
||||
<app-description-template-editor-external-datasets-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_DATASETS" class="col-12" [form]="form"></app-description-template-editor-external-datasets-field-component>
|
||||
|
|
|
@ -151,7 +151,6 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
|
|||
case DescriptionTemplateFieldType.DATE_PICKER:
|
||||
case DescriptionTemplateFieldType.TAGS:
|
||||
case DescriptionTemplateFieldType.DATASET_IDENTIFIER:
|
||||
case DescriptionTemplateFieldType.CURRENCY:
|
||||
case DescriptionTemplateFieldType.VALIDATION: {
|
||||
const data: DescriptionTemplateLabelData = {
|
||||
label: '',
|
||||
|
|
|
@ -42,8 +42,7 @@ export class DescriptionTemplateEditorRuleComponent implements OnInit {
|
|||
isTextType(type: DescriptionTemplateFieldType){
|
||||
return type == DescriptionTemplateFieldType.FREE_TEXT || type == DescriptionTemplateFieldType.CHECK_BOX ||
|
||||
type == DescriptionTemplateFieldType.TEXT_AREA || type == DescriptionTemplateFieldType.RICH_TEXT_AREA ||
|
||||
type == DescriptionTemplateFieldType.BOOLEAN_DECISION || type == DescriptionTemplateFieldType.RADIO_BOX ||
|
||||
type == DescriptionTemplateFieldType.CURRENCY;
|
||||
type == DescriptionTemplateFieldType.BOOLEAN_DECISION || type == DescriptionTemplateFieldType.RADIO_BOX;
|
||||
}
|
||||
|
||||
isTextListType(type: DescriptionTemplateFieldType){
|
||||
|
|
|
@ -797,7 +797,6 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
|
|||
case DescriptionTemplateFieldType.DATE_PICKER:
|
||||
case DescriptionTemplateFieldType.TAGS:
|
||||
case DescriptionTemplateFieldType.DATASET_IDENTIFIER:
|
||||
case DescriptionTemplateFieldType.CURRENCY:
|
||||
case DescriptionTemplateFieldType.VALIDATION:
|
||||
return new DescriptionTemplateLabelDataEditorModel(this.validationErrorModel);
|
||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS:
|
||||
|
|
|
@ -182,17 +182,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.CURRENCY" class="col-12">
|
||||
<div class="row">
|
||||
<mat-form-field class="col-md-12">
|
||||
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup?.get(field.id).get('textValue')" [configuration]="currencyAutoCompleteConfiguration" [required]="isRequired">
|
||||
</app-single-auto-complete>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('textValue').hasError('backendError')">{{propertiesFormGroup?.get(field.id).get('textValue').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('textValue').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.VALIDATION" class="col-12">
|
||||
<div class="row align-items-baseline">
|
||||
<mat-form-field class="col-md-4">
|
||||
|
|
|
@ -43,7 +43,6 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
public singleAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
public multipleAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||
tagsAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
currencyAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||
multipleReferenceAutoCompleteConfiguration: MultipleAutoCompleteConfiguration;
|
||||
|
||||
|
||||
|
@ -123,15 +122,6 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
// }
|
||||
this.datasetIdInitialized = true;
|
||||
break;
|
||||
case DescriptionTemplateFieldType.CURRENCY:
|
||||
this.currencyAutoCompleteConfiguration = {
|
||||
filterFn: this.searchCurrency.bind(this),
|
||||
initialItems: () => this.searchCurrency(''),
|
||||
displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||
valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||
};
|
||||
break;
|
||||
case DescriptionTemplateFieldType.VALIDATION:
|
||||
// const value1 = this.propertiesFormGroup.get(this.field.id).get('value').value;
|
||||
// const disabled1 = this.propertiesFormGroup.get(this.field.id).disabled;
|
||||
|
@ -265,12 +255,6 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
|||
return this.propertiesFormGroup.get(this.field.id).get(name) as UntypedFormControl;
|
||||
}
|
||||
|
||||
searchCurrency(query: string): Observable<any[]> {
|
||||
//TODO refactor
|
||||
return null;
|
||||
// return this.currencyService.get(query);
|
||||
}
|
||||
|
||||
validateId() {
|
||||
//TODO refactor
|
||||
return null;
|
||||
|
|
|
@ -263,7 +263,7 @@ export class VisibilityRulesService {
|
|||
const fieldType: DescriptionTemplateFieldType = rule.field != null && rule.field.data != null ? rule.field.data.fieldType : DescriptionTemplateFieldType.FREE_TEXT;
|
||||
if ([DescriptionTemplateFieldType.FREE_TEXT, DescriptionTemplateFieldType.CHECK_BOX, DescriptionTemplateFieldType.TEXT_AREA,
|
||||
DescriptionTemplateFieldType.RICH_TEXT_AREA, DescriptionTemplateFieldType.UPLOAD, DescriptionTemplateFieldType.BOOLEAN_DECISION,
|
||||
DescriptionTemplateFieldType.RADIO_BOX, DescriptionTemplateFieldType.CURRENCY].includes(fieldType) && field.textValue != null && field.textValue.length > 0) {
|
||||
DescriptionTemplateFieldType.RADIO_BOX].includes(fieldType) && field.textValue != null && field.textValue.length > 0) {
|
||||
if (DescriptionTemplateFieldType.UPLOAD == fieldType){
|
||||
return false; //not apply visibility logic
|
||||
} else {
|
||||
|
|
|
@ -60,9 +60,13 @@
|
|||
<mat-error>
|
||||
{{ 'DMP-FINALISE-DIALOG.VALIDATION.INVALID-DMP' | translate }}
|
||||
</mat-error>
|
||||
<mat-error>
|
||||
{{ dmpErrors }}
|
||||
</mat-error>
|
||||
<ng-container *ngFor="let error of dmpErrors">
|
||||
<div>
|
||||
<mat-error>
|
||||
<i class="fa fa-circle" style="font-size:16px"></i> {{error}}
|
||||
</mat-error>
|
||||
</div>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
<mat-error *ngIf="getFinalizedDescriptions().length === 0 && descriptionsToBeFinalized.length === 0 && isDmpValid">
|
||||
{{'DMP-FINALISE-DIALOG.VALIDATION.AT-LEAST-ONE-DESCRPIPTION-FINALISED' | translate}}
|
||||
|
|
|
@ -1597,7 +1597,6 @@
|
|||
"REFERENCE-TYPES": "Reference Types",
|
||||
"TAGS": "Tags",
|
||||
"DATASET-IDENTIFIER": "Dataset Identifier",
|
||||
"CURRENCY": "Currency",
|
||||
"VALIDATION": "Validator"
|
||||
},
|
||||
"USER-DESCRIPTION-TEMPLATE-ROLE": {
|
||||
|
|
Loading…
Reference in New Issue