prefilling sources ui changes
This commit is contained in:
parent
dad32207e3
commit
9989f5ca69
|
@ -160,9 +160,6 @@ public class ExternalFetcherApiSourceConfigurationPersist extends ExternalFetche
|
|||
this.spec()
|
||||
.must(() -> !this.isEmpty(item.getContentType()))
|
||||
.failOn(ExternalFetcherApiSourceConfigurationPersist._contentType).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalFetcherApiSourceConfigurationPersist._contentType}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.must(() -> !this.isEmpty(item.getFirstPage()))
|
||||
.failOn(ExternalFetcherApiSourceConfigurationPersist._firstPage).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalFetcherApiSourceConfigurationPersist._firstPage}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.must(() -> !this.isNull(item.getHttpMethod()))
|
||||
.failOn(ExternalFetcherApiSourceConfigurationPersist._httpMethod).failWith(messageSource.getMessage("Validation_Required", new Object[]{ExternalFetcherApiSourceConfigurationPersist._httpMethod}, LocaleContextHolder.getLocale())),
|
||||
|
|
|
@ -38,6 +38,7 @@ import { ValidationType } from '../../common/enum/validation-type';
|
|||
import { DescriptionTemplateExternalSelectAuthType } from '@app/core/common/enum/description-template-external-select-auth-type';
|
||||
import { DmpBlueprintFieldCategory } from '@app/core/common/enum/dmp-blueprint-field-category';
|
||||
import { DmpUserType } from '@app/core/common/enum/dmp-user-type';
|
||||
import { PrefillingSourceSystemTargetType } from '@app/core/common/enum/prefilling-source-system-target-type';
|
||||
|
||||
@Injectable()
|
||||
export class EnumUtils {
|
||||
|
@ -398,5 +399,13 @@ export class EnumUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public toPrefillingSourceSystemTargetTypeString(value: PrefillingSourceSystemTargetType): string {
|
||||
switch (value) {
|
||||
case PrefillingSourceSystemTargetType.Label: return this.language.instant('TYPES.PREFILLING-SOURCE-SYSTEM-TARGET-TYPE.LABEL');
|
||||
case PrefillingSourceSystemTargetType.Description: return this.language.instant('TYPES.PREFILLING-SOURCE-SYSTEM-TARGET-TYPE.DESCRIPTION');
|
||||
case PrefillingSourceSystemTargetType.Tags: return this.language.instant('TYPES.PREFILLING-SOURCE-SYSTEM-TARGET-TYPE.TAGS');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,9 +40,6 @@
|
|||
</div>
|
||||
<!-- Fields -->
|
||||
<div class="col-12">
|
||||
<h3>
|
||||
<button mat-button class="action-btn" type="button" (click)="addField()" [disabled]="formGroup.disabled">{{'PREFILLING-SOURCE-EDITOR.ACTIONS.ADD-FIELD' | translate}}</button>
|
||||
</h3>
|
||||
<div *ngFor="let field of formGroup.get('definition').get('fields').controls; let fieldIndex=index;" class="row mb-3">
|
||||
<div class="col-12">
|
||||
<div class="row mb-3 d-flex align-items-center">
|
||||
|
@ -67,12 +64,13 @@
|
|||
<div class="col">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'PREFILLING-SOURCE-EDITOR.FIELDS.SYSTEM-TARGET' | translate}}</mat-label>
|
||||
<input matInput type="text" name="systemFieldTarget" [formControl]="field.get('systemFieldTarget')">
|
||||
<mat-error *ngIf="field.get('systemFieldTarget').hasError('backendError')">{{field.get('systemFieldTarget').getError('backendError').message}}</mat-error>
|
||||
<mat-select [formControl]="field.get('systemFieldTarget')">
|
||||
<mat-option *ngFor="let systemFieldTarget of prefillingSourceSystemTargetTypeEnumValues" [value]="systemFieldTarget">{{enumUtils.toPrefillingSourceSystemTargetTypeString(systemFieldTarget)}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="field.get('systemFieldTarget').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col-12">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'PREFILLING-SOURCE-EDITOR.FIELDS.SEMANTIC-TARGET' | translate}}</mat-label>
|
||||
<app-single-auto-complete placeholder="{{'PREFILLING-SOURCE-EDITOR.FIELDS.SEMANTIC-TARGET' | translate}}" [formControl]="field.get('semanticTarget')" [configuration]="semanticsService.singleAutocompleteConfiguration"> </app-single-auto-complete>
|
||||
|
@ -99,6 +97,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button mat-button class="action-btn" type="button" (click)="addField()" [disabled]="formGroup.disabled">{{'PREFILLING-SOURCE-EDITOR.ACTIONS.ADD-FIELD' | translate}}</button>
|
||||
<button mat-button class="action-btn" *ngIf="formGroup.get('definition').get('fields').value != ''"
|
||||
type="button" (click)="submitFields()" [disabled]="!formGroup.get('definition').get('fields').valid">{{'PREFILLING-SOURCE-EDITOR.ACTIONS.SUBMIT-FIELDS' | translate}}</button>
|
||||
</div>
|
||||
|
|
|
@ -29,6 +29,7 @@ import { PrefillingSourceDefinitionEditorModel, PrefillingSourceEditorModel } fr
|
|||
import { ResultFieldsMappingConfigurationEditorModel } from '@app/ui/external-fetcher/external-fetcher-source-editor.model';
|
||||
import { SemanticsService } from '@app/core/services/semantic/semantics.service';
|
||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import { PrefillingSourceSystemTargetType } from '@app/core/common/enum/prefilling-source-system-target-type';
|
||||
|
||||
@Component({
|
||||
selector: 'app-prefilling-source-editor-component',
|
||||
|
@ -42,6 +43,7 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
|||
isDeleted = false;
|
||||
formGroup: UntypedFormGroup = null;
|
||||
showInactiveDetails = false;
|
||||
prefillingSourceSystemTargetTypeEnumValues = this.enumUtils.getEnumValues<PrefillingSourceSystemTargetType>(PrefillingSourceSystemTargetType);
|
||||
|
||||
protected get canDelete(): boolean {
|
||||
return !this.isDeleted && !this.isNew && this.hasPermission(this.authService.permissionEnum.DeletePrefillingSource);
|
||||
|
@ -190,9 +192,6 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
|||
const definition = new PrefillingSourceDefinitionEditorModel(this.editorModel.validationErrorModel);
|
||||
definition.buildGetConfiguration(this.formGroup.get('definition') as UntypedFormGroup, "definition.");
|
||||
|
||||
this.addFieldMapping("prefilling_id", "getConfiguration");
|
||||
this.addFieldMapping("label", "getConfiguration");
|
||||
this.addFieldMapping("description", "getConfiguration");
|
||||
this.submitFields();
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +220,7 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
|||
)
|
||||
fieldForm.markAsDirty();
|
||||
|
||||
this.removeFieldMapping((this.formGroup.get('definition').get('searchConfiguration') as FormGroup), fieldCode);
|
||||
// this.removeFieldMapping((this.formGroup.get('definition').get('searchConfiguration') as FormGroup), fieldCode);
|
||||
if(this.formGroup.get('definition').get('getEnabled').value == true) this.removeFieldMapping((this.formGroup.get('definition').get('getConfiguration') as FormGroup), fieldCode);
|
||||
}
|
||||
|
||||
|
@ -231,7 +230,7 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
|
|||
if (fieldsFormArray.valid) {
|
||||
for (let i = 0; i < fieldsFormArray.length; i++) {
|
||||
const code = fieldsFormArray.at(i).get('code').value;
|
||||
this.addFieldMapping(code, "searchConfiguration");
|
||||
// this.addFieldMapping(code, "searchConfiguration");
|
||||
if(this.formGroup.get('definition').get('getEnabled').value == true) this.addFieldMapping(code, "getConfiguration");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<mat-error *ngIf="formGroup.get('referenceTypeDependencyIds').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="col-6" *ngIf="referenceTypeSourceIndex != null">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.SOURCE-TYPE' | translate}}</mat-label>
|
||||
<mat-select name="type" [formControl]="formGroup.get('type')" required>
|
||||
|
@ -288,7 +288,7 @@
|
|||
</div>
|
||||
<div class="col-6" *ngIf="formGroup.get('referenceTypeDependencyIds').value">
|
||||
<mat-form-field class="w-100">
|
||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.REFERENCE-TYPE' | translate}}</mat-label>
|
||||
<mat-label>{{'REFERENCE-TYPE-EDITOR.FIELDS.DEPENDENCY' | translate}}</mat-label>
|
||||
<mat-select name="referenceTypeId" [formControl]="case.get('referenceTypeId')">
|
||||
<mat-option *ngFor="let referenceType of referenceTypeDependenciesMap.get(referenceTypeSourceIndex)" [value]="referenceType.id">
|
||||
{{referenceType.code}}
|
||||
|
@ -355,5 +355,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{formGroup.value | json}}
|
||||
</div>
|
|
@ -1529,6 +1529,7 @@
|
|||
"TYPE": "Type",
|
||||
"SEPARATOR": "Separator",
|
||||
"DEPENDENCIES": "Dependencies",
|
||||
"DEPENDENCY": "Dependency",
|
||||
"REQUIRED": "Required",
|
||||
"DEFAULT-VALUE": "Default Value",
|
||||
"CASE": "Case",
|
||||
|
@ -1591,6 +1592,8 @@
|
|||
"PREFILLING-SOURCE-EDITOR": {
|
||||
"NEW": "New Prefilling Source",
|
||||
"FIELDS": {
|
||||
"SOURCE-CONFIGURATION":"Search Source Configuration",
|
||||
"GET-SOURCE-CONFIGURATION": "Get Source Configuration",
|
||||
"LABEL": "Label",
|
||||
"FIELD": "Field",
|
||||
"CODE": "Code",
|
||||
|
@ -1606,7 +1609,7 @@
|
|||
"DELETE": "Delete",
|
||||
"ADD-FIELD": "Add Field",
|
||||
"REMOVE-FIELD": "Remove Field",
|
||||
"SUBMIT-FIELDS": "Submit"
|
||||
"SUBMIT-FIELDS": "Submit Fields"
|
||||
},
|
||||
"CONFIRM-DELETE-DIALOG": {
|
||||
"MESSAGE": "Would you like to delete this Prefilling Source?",
|
||||
|
@ -2489,6 +2492,11 @@
|
|||
"SYSTEM": "System",
|
||||
"EXTRA": "Custom",
|
||||
"REFERENCE-TYPE": "External Reference"
|
||||
},
|
||||
"PREFILLING-SOURCE-SYSTEM-TARGET-TYPE": {
|
||||
"LABEL": "Label",
|
||||
"DESCRIPTION": "Description",
|
||||
"TAGS": "Tags"
|
||||
}
|
||||
},
|
||||
"ADDRESEARCHERS-EDITOR": {
|
||||
|
|
Loading…
Reference in New Issue