This commit is contained in:
Michele Artini 2024-01-25 11:45:32 +01:00
parent 28b4145d89
commit 588cbab622
6 changed files with 128 additions and 7 deletions

View File

@ -0,0 +1,65 @@
<RESOURCE_PROFILE>
<HEADER>
<RESOURCE_IDENTIFIER value="42b3f336-66ac-40d4-9702-b155f2801e77_Vm9jYWJ1bGFyeURTUmVzb3VyY2VzL1ZvY2FidWxhcnlEU1Jlc291cmNlVHlwZQ=="/>
<RESOURCE_TYPE value="VocabularyDSResourceType"/>
<RESOURCE_KIND value="VocabularyDSResources"/>
<RESOURCE_URI value=""/>
<DATE_OF_CREATION value="2014-12-01T11:12:40+00:00"/>
</HEADER>
<BODY>
<CONFIGURATION>
<VOCABULARY_NAME code="dnet:compatibility_levels">dnet:compatibility_levels</VOCABULARY_NAME>
<VOCABULARY_DESCRIPTION>dnet:compatibility_levels</VOCABULARY_DESCRIPTION>
<TERMS>
<TERM native_name="OpenAIRE 2.0 (EC funding)" code="openaire2.0" english_name="OpenAIRE 2.0 (EC funding)" encoding="OPENAIRE">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM native_name="OpenAIRE 3.0 (OA, funding)" code="openaire3.0" english_name="OpenAIRE 3.0 (OA, funding)" encoding="OPENAIRE">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM native_name="OpenAIRE 4.0 (inst.&amp;thematic. repo.)" code="openaire4.0" english_name="OpenAIRE 4.0 (inst.&amp;thematic. repo.)" encoding="OPENAIRE">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM native_name="OpenAIRE basic (DRIVER OA)" code="driver" english_name="OpenAIRE Basic (DRIVER OA)" encoding="OPENAIRE">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM native_name="OpenAIRE CRIS v1.1" code="openaire-cris_1.1" english_name="OpenAIRE CRIS v1.1" encoding="OPENAIRE">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM native_name="OpenAIRE Data (funded, referenced datasets)" code="openaire2.0_data" english_name="OpenAIRE Data (funded, referenced datasets)" encoding="OPENAIRE">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM native_name="collected from a compatible aggregator" code="hostedBy" english_name="collected from a compatible aggregator" encoding="OPENAIRE">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM native_name="files" code="files" english_name="files" encoding="OPENAIRE">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM native_name="native" code="native" english_name="native" encoding="OPENAIRE">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM native_name="Not yet registered" code="UNKNOWN" english_name="Not yet registered" encoding="OPENAIRE">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM native_name="under validation" code="notCompatible" english_name="under validation" encoding="OPENAIRE">
<SYNONYMS/>
<RELATIONS/>
</TERM>
</TERMS>
</CONFIGURATION>
<STATUS>
<LAST_UPDATE value="2013-11-18T10:46:36Z"/>
</STATUS>
<SECURITY_PARAMETERS>String</SECURITY_PARAMETERS>
</BODY>
</RESOURCE_PROFILE>

View File

@ -0,0 +1,41 @@
<RESOURCE_PROFILE>
<HEADER>
<RESOURCE_IDENTIFIER value="19933778-e582-4af2-8668-26414b5386c9_Vm9jYWJ1bGFyeURTUmVzb3VyY2VzL1ZvY2FidWxhcnlEU1Jlc291cmNlVHlwZQ=="/>
<RESOURCE_TYPE value="VocabularyDSResourceType"/>
<RESOURCE_KIND value="VocabularyDSResources"/>
<RESOURCE_URI value=""/>
<DATE_OF_CREATION value="2013-11-18T10:46:37+01:00"/>
</HEADER>
<BODY>
<CONFIGURATION>
<VOCABULARY_NAME code="dnet:content_description_typologies">D-Net Content Description Typologies</VOCABULARY_NAME>
<VOCABULARY_DESCRIPTION>D-Net Content Description Typologies</VOCABULARY_DESCRIPTION>
<TERMS>
<TERM code="file::EuropePMC" encoding="OPENAIRE" english_name="file::EuropePMC" native_name="file::EuropePMC">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM code="file::PDF" encoding="OPENAIRE" english_name="file::PDF" native_name="file::PDF">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM code="file::WoS" encoding="OPENAIRE" english_name="file::WoS" native_name="file::WoS">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM code="metadata" encoding="OPENAIRE" english_name="metadata" native_name="metadata">
<SYNONYMS/>
<RELATIONS/>
</TERM>
<TERM code="file::hybrid" encoding="OPENAIRE" english_name="file::hybrid" native_name="file::hybrid">
<SYNONYMS/>
<RELATIONS/>
</TERM>
</TERMS>
</CONFIGURATION>
<STATUS>
<LAST_UPDATE value="2013-11-18T10:46:36Z"/>
</STATUS>
<SECURITY_PARAMETERS>String</SECURITY_PARAMETERS>
</BODY>
</RESOURCE_PROFILE>

View File

@ -6,6 +6,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -29,22 +30,28 @@ public class OtherController extends AbstractDsmController {
@Autowired
private ProtocolService protocolService;
@Value("${dsm.compatibilityLevels.vocabulary}")
private String compatibilityLevelsVocabulary;
@Value("${dsm.contentDescTypes.vocabulary}")
private String contentDescTypesVocabulary;
@GetMapping("/conf")
public Map<String, Iterable<?>> configuration() {
final Map<String, Iterable<?>> map = new LinkedHashMap<>();
final VocabularyClient vocabularyClient = clientFactory.getClient(VocabularyClient.class);
final VocabularyClient vocabularyClient = this.clientFactory.getClient(VocabularyClient.class);
map.put("browsableFields", Arrays.stream(DsmBrowsableFields.values())
.map(f -> new KeyValue<>(f.name(), f.desc))
.collect(Collectors.toList()));
map.put("protocols", protocolService.listProtocols());
map.put("compatibilityLevels", vocabularyClient.listTerms("dnet:compatibilityLevel")
map.put("protocols", this.protocolService.listProtocols());
map.put("compatibilityLevels", vocabularyClient.listTerms(this.compatibilityLevelsVocabulary)
.stream()
.map(VocabularyTerm::getCode)
.sorted()
.collect(Collectors.toList()));
map.put("contentDescTypes", vocabularyClient.listTerms("dnet:content_description_typologies")
map.put("contentDescTypes", vocabularyClient.listTerms(this.contentDescTypesVocabulary)
.stream()
.map(VocabularyTerm::getCode)
.sorted()

View File

@ -2,3 +2,6 @@ server.title = D-NET Datasource Manager
server.description = D-NET Datasource Manager
maven.pom.path = /META-INF/maven/eu.dnetlib.docker/dnet-datasource-manager/effective-pom.xml
dsm.compatibilityLevels.vocabulary = dnet:compatibility_levels
dsm.contentDescTypes.vocabulary = dnet:content_description_typologies

View File

@ -69,6 +69,9 @@
<input matInput formControlName="baseurl" />
<mat-error *ngIf="editApiForm.get('baseurl')?.invalid">
Invalid URL
<span *ngIf="editApiForm.get('baseurl')?.errors?.['pattern']?.['requiredPattern']">
- Required Pattern: {{editApiForm.get('baseurl')?.errors?.['pattern']?.['requiredPattern']}}
</span>
<span *ngIf="editApiForm.get('baseurl')?.hasError('required')">: This field is
<strong>required</strong></span>
</mat-error>

View File

@ -306,17 +306,19 @@ export class DsmEditApiDialog implements OnInit {
this.editApiForm.addControl('apiIdSuffix', new FormControl('', [Validators.required]));
let baseUrlPattern = Validators.pattern('^(http|https|ftp|file|sftp|jar|mongodb):\/\/.*');
if (this.insertMode) {
this.editApiForm.addControl('compatibility', new FormControl('', [Validators.required]));
this.editApiForm.addControl('contentdescription', new FormControl('', [Validators.required]));
this.editApiForm.addControl('protocol', new FormControl('', [Validators.required]));
this.editApiForm.addControl('baseurl', new FormControl('', [Validators.required, Validators.pattern('^(http|https|ftp|file|sftp|jar|mongodb):\/\/')]));
this.editApiForm.addControl('baseurl', new FormControl('', [Validators.required, baseUrlPattern]));
this.editApiForm.addControl('metadataIdentifierPath', new FormControl('', [Validators.required]));
} else {
this.editApiForm.addControl('compatibility', new FormControl(this.data.api.compatibility, [Validators.required]));
this.editApiForm.addControl('compatibility', new FormControl({ value: this.data.api.compatibility, disabled: true }, [Validators.required]));
this.editApiForm.addControl('contentdescription', new FormControl({ value: this.data.api.contentdescription, disabled: true }, [Validators.required]));
this.editApiForm.addControl('protocol', new FormControl({ value: this.data.api.protocol, disabled: true }, [Validators.required]));
this.editApiForm.addControl('baseurl', new FormControl(this.data.api.baseurl, [Validators.required, Validators.pattern('^(http|https|ftp|file|sftp|jar|mongodb):\/\/')]));
this.editApiForm.addControl('baseurl', new FormControl(this.data.api.baseurl, [Validators.required, baseUrlPattern]));
this.editApiForm.addControl('metadataIdentifierPath', new FormControl(this.data.api.metadataIdentifierPath, [Validators.required]));
this.configureSelectedProtocol(this.data.api.protocol);
}