Made identifier validation field to work properly
This commit is contained in:
parent
e061448830
commit
2ff9b95fdf
|
@ -145,7 +145,7 @@ public class RemoteFetcher {
|
|||
public Integer findEntries(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet {
|
||||
List<UrlConfiguration> urlConfigs =
|
||||
key != null && !key.isEmpty() ? configLoader.getExternalUrls().getValidations().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
|
||||
: configLoader.getExternalUrls().getLicenses().getUrls();
|
||||
: configLoader.getExternalUrls().getValidations().getUrls();
|
||||
FetchStrategy fetchStrategy = configLoader.getExternalUrls().getLicenses().getFetchMode();
|
||||
List<Map<String, String>> data = this.getAll(urlConfigs, fetchStrategy, externalUrlCriteria);
|
||||
return data.size();
|
||||
|
|
|
@ -969,11 +969,14 @@
|
|||
<type>External</type>
|
||||
<url>https://sandbox.zenodo.org/api/records/?page={page}&size={pageSize}&q={like}</url>
|
||||
<firstPage>1</firstPage>
|
||||
<contenttype>application/vnd.zenodo.v1+json; charset=utf-8</contenttype>
|
||||
<contenttype>application/json</contenttype>
|
||||
<data>
|
||||
<path>$['hits']['hits'][*]</path>
|
||||
<path>$[*]</path>
|
||||
<fields>
|
||||
<id>'conceptrecid'</id>
|
||||
<name>'conceptdoi'</name>
|
||||
<uri>'doi'</uri>
|
||||
<description>'created'</description>
|
||||
</fields>
|
||||
</data>
|
||||
<paginationpath>$['hits']['total']</paginationpath>
|
||||
|
|
|
@ -77,7 +77,7 @@ export class ExternalSourcesService {
|
|||
}
|
||||
|
||||
public validateIdentifier(like: string, type: string): Observable<boolean> {
|
||||
return this.http.get<boolean>(this.actionUrl + 'validation?query=' + like, '&type=' + type);
|
||||
return this.http.get<boolean>(this.actionUrl + 'validation?query=' + like + '&type=' + type, { headers: this.headers });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<mat-option [value]="viewStyleEnum.Organizations">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Organizations)}}</mat-option>
|
||||
<mat-option [value]="viewStyleEnum.DatasetIdentifier">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.DatasetIdentifier)}}</mat-option>
|
||||
<mat-option [value]="viewStyleEnum.Currency">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Currency)}}</mat-option>
|
||||
<mat-option [value]="viewStyleEnum.Validation">{{enumUtils.toDatasetProfileFieldViewStyleString(viewStyleEnum.Validation)}}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="this.form.get('viewStyle').get('renderStyle').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
|
|
@ -264,11 +264,15 @@
|
|||
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col-md-4">
|
||||
<button type="button" mat-button class="lightblue-btn" (click)="validateId()">Validate</button>
|
||||
<div class="col-md-2">
|
||||
<button type="button" mat-button class="lightblue-btn" (click)="validateId()">{{ "TYPES.DATASET-PROFILE-VALIDATOR.ACTION" | translate }}</button>
|
||||
<mat-error *ngIf="form.get('value').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<mat-progress-spinner *ngIf="validationIcon === 'loading'" mode="indeterminate" [diameter]="24"></mat-progress-spinner>
|
||||
<mat-icon *ngIf="validationIcon !== 'loading'" [ngClass]="{'success': validationIcon === 'done', 'fail': validationIcon === 'clear'}">{{validationIcon}}</mat-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -10,6 +10,14 @@
|
|||
.text-area {
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.fail {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline {
|
||||
|
|
|
@ -70,6 +70,8 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
|||
|
||||
datasetIdInitialized: boolean = false;
|
||||
|
||||
validationIcon;
|
||||
|
||||
readonly datasetIdTypes: any[] = [
|
||||
{ name: 'Handle', value: 'handle' },
|
||||
{ name: 'DOI', value: 'doi' },
|
||||
|
@ -225,6 +227,12 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
|||
valueAssign: (item) => typeof (item) == 'string' ? item : JSON.stringify(item)
|
||||
};
|
||||
break;
|
||||
case DatasetProfileFieldViewStyle.Validation:
|
||||
const value1 = this.form.get('value').value;
|
||||
this.form.removeControl('value');
|
||||
this.form.addControl('value', new DatasetIdModel(value1).buildForm());
|
||||
//this.datasetIdInitialized = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.form.get('viewStyle').value.renderStyle === DatasetProfileFieldViewStyle.InternalDmpEntities) {
|
||||
|
@ -429,9 +437,9 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
|||
validateId() {
|
||||
const identifier = this.getDatasetIdControl('identifier').value;
|
||||
const type = this.getDatasetIdControl('type').value;
|
||||
|
||||
this.validationIcon= 'loading';
|
||||
this.externalSourcesService.validateIdentifier(identifier, type).pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
console.log(result);
|
||||
this.validationIcon = result === true ? 'done' : 'clear';
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -1161,6 +1161,9 @@
|
|||
"DATASETS": "Datasets",
|
||||
"EXTERNAL-SOURCE-HINT": "List of values provided by external source(s)"
|
||||
},
|
||||
"DATASET-PROFILE-VALIDATOR": {
|
||||
"ACTION": "Validate"
|
||||
},
|
||||
"RECENT-ACTIVITY-ORDER": {
|
||||
"CREATED": "Created",
|
||||
"LABEL": "Label",
|
||||
|
|
Loading…
Reference in New Issue