|
|
|
@ -26,6 +26,9 @@ import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
|
|
|
import { MatChipInputEvent } from '@angular/material/chips';
|
|
|
|
|
import { isNullOrUndefined } from 'util';
|
|
|
|
|
import { ExternalDataRepositoryService } from '@app/core/services/external-sources/data-repository/extternal-data-repository.service';
|
|
|
|
|
import { ExternalDatasetService } from '@app/core/services/external-sources/dataset/external-dataset.service';
|
|
|
|
|
import { ExternalRegistryService } from '@app/core/services/external-sources/registry/external-registry.service';
|
|
|
|
|
import { ExternalServiceService } from '@app/core/services/external-sources/service/external-service.service';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-dataset-external-references-editor-component',
|
|
|
|
@ -89,7 +92,10 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|
|
|
|
private language: TranslateService,
|
|
|
|
|
private externalSourcesService: ExternalSourcesService,
|
|
|
|
|
private externalSourcesConfigurationService: ExternalSourcesConfigurationService,
|
|
|
|
|
private externalDataRepositoryService: ExternalDataRepositoryService
|
|
|
|
|
private externalDataRepositoryService: ExternalDataRepositoryService,
|
|
|
|
|
private externalDatasetService: ExternalDatasetService,
|
|
|
|
|
private externalRegistryService: ExternalRegistryService,
|
|
|
|
|
private externalServiceService: ExternalServiceService,
|
|
|
|
|
) { super(); }
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
@ -195,7 +201,7 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
|
.subscribe(result => {
|
|
|
|
|
if (!result) { return; }
|
|
|
|
|
const serviceModel = new ExternalServiceEditorModel(result.abbreviation, result.definition, result.id, result.label, result.reference, result.uri);
|
|
|
|
|
const serviceModel = new ExternalServiceEditorModel(result.abbreviation, result.definition, result.id, result.label, result.reference, result.uri, result.source);
|
|
|
|
|
(<FormArray>this.formGroup.get('services')).push(serviceModel.buildForm());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -254,6 +260,9 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isInternal(element: any): boolean {
|
|
|
|
|
if (element.get('source') == null) {
|
|
|
|
|
console.log(element);
|
|
|
|
|
}
|
|
|
|
|
return element.get('source').value === 'Internal';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -266,4 +275,34 @@ export class DatasetExternalReferencesEditorComponent extends BaseComponent impl
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateExternalDataset(externalDataset: FormGroup) {
|
|
|
|
|
this.externalDatasetService.create(externalDataset.value)
|
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
|
.subscribe(
|
|
|
|
|
(result) => {
|
|
|
|
|
externalDataset.setValue(result);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateRegistry(registry: FormGroup) {
|
|
|
|
|
this.externalRegistryService.create(registry.value)
|
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
|
.subscribe(
|
|
|
|
|
(result) => {
|
|
|
|
|
registry.setValue(result);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateService(service: FormGroup) {
|
|
|
|
|
this.externalServiceService.create(service.value)
|
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
|
.subscribe(
|
|
|
|
|
(result) => {
|
|
|
|
|
service.setValue(result);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|