Commit dfe93a32 authored by cazenave's avatar cazenave
Browse files

test api du smartharvester liste des urls

parent afbaef4e
...@@ -26,7 +26,7 @@ const routes: Routes = [ ...@@ -26,7 +26,7 @@ const routes: Routes = [
{path: 'ontologie', component : OntologieComponent}, {path: 'ontologie', component : OntologieComponent},
{path: 'publish', component : PublishComponent}, {path: 'publish', component : PublishComponent},
{path: 'settingfdp', component : SettingfdpComponent}, {path: 'settingfdp', component : SettingfdpComponent},
{path: 'settingsmartapi', component : SettingsmartapiComponent}, {path: 'settingsmartharvester', component : SettingsmartapiComponent},
{path: 'swaggerapi', component : SwaggereditorComponent}, {path: 'swaggerapi', component : SwaggereditorComponent},
{path: 'elasticsearch', component : ElasticsearchComponent}, {path: 'elasticsearch', component : ElasticsearchComponent},
{path: 'publishapi', component : PublishapiComponent}, {path: 'publishapi', component : PublishapiComponent},
......
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
<button mat-menu-item [matMenuTriggerFor]="subMenuSetting">Settings</button> <button mat-menu-item [matMenuTriggerFor]="subMenuSetting">Settings</button>
<mat-menu #subMenuSetting="matMenu"> <mat-menu #subMenuSetting="matMenu">
<button mat-menu-item routerLink="/settingfdp" routerLinkActive="active">FDP setting</button> <button mat-menu-item routerLink="/settingfdp" routerLinkActive="active">FDP setting</button>
<button mat-menu-item routerLink="/settingsmartapi" routerLinkActive="active">SmartAPI setting</button> <button mat-menu-item routerLink="/settingsmartharvester" routerLinkActive="active">SmartHarvester setting</button>
<button mat-menu-item routerLink="/elasticsearch" routerLinkActive="active">Elasticsearch setting</button> <button mat-menu-item routerLink="/elasticsearch" routerLinkActive="active">Elasticsearch setting</button>
</mat-menu> </mat-menu>
</mat-menu> </mat-menu>
......
...@@ -4,10 +4,8 @@ ...@@ -4,10 +4,8 @@
<div> <div>
<button type="submit" (click)="listdatasets()" class="btn btn-primary">List datasets</button> <button type="submit" (click)="listdatasets()" class="btn btn-primary">List datasets</button>
</div> </div>
<p><strong>Total datasets found: {{dataresult}}</strong></p>
<p><strong>Examples of datasets found: </strong></p>
<ul> <ul>
<li *ngFor="let item of itemsdatasets; let i = index"><a href={{item.url}} >{{item.entity_id}} {{item.name}} </a> <br> {{item.description}}</li> <li *ngFor="let item of dataresult"><a href={{item}} target="_blank" >{{item}} </a> </li>
</ul> </ul>
</form> </form>
...@@ -17,3 +15,4 @@ ...@@ -17,3 +15,4 @@
<br><br> <br><br>
<button class="next-step-button" routerLink="/ontologie" routerLinkActive="active" >Next step</button> <button class="next-step-button" routerLink="/ontologie" routerLinkActive="active" >Next step</button>
...@@ -32,21 +32,23 @@ export class DatasetsComponent implements OnInit { ...@@ -32,21 +32,23 @@ export class DatasetsComponent implements OnInit {
var myInit = { method: 'GET', headers: myHeaders}; var myInit = { method: 'GET', headers: myHeaders};
//appler smart havester pour récuprer l'api à lancer //appeler smart havester pour récuperer l'api à lancer
// http://smart-harvester.eu/openapi/inrae/datasetlist
// https://data.inrae.fr/api/search?q=*&per_page=10&type=dataset&start=16000&show_entity_ids=true&show_my_data=true
var myRequest = new Request('https://data.inrae.fr/api/search?q=*&per_page=10&type=dataset&start=0&show_entity_ids=true&show_my_data=true',myInit);
var myRequest = new Request(this.appConfig.smartapiurl+'harvest/allurls',myInit);
fetch(myRequest, myInit) fetch(myRequest, myInit)
.then(response => { .then(response => {
response.json() response.json()
.then(data => { .then(data => {
this.dataresult =JSON.stringify(data['data']['total_count']); this.dataresult =data;
this.itemsdatasets = data['data']['items']; //this.itemsdatasets = data['data']['items'];
for (var i = 0; i < this.itemsdatasets.length; i++) { console.log(this.dataresult);
this.createdataset(data['data']['items'][i]); // for (var i = 0; i < this.itemsdatasets.length; i++) {
} // this.createdataset(data['data']['items'][i]);
// }
}); });
}); });
return null; return null;
...@@ -74,7 +76,7 @@ s:new\n\ ...@@ -74,7 +76,7 @@ s:new\n\
a dcat:Dataset, dcat:Resource;\n\ a dcat:Dataset, dcat:Resource;\n\
dct:description '+ description +';\n\ dct:description '+ description +';\n\
dct:hasVersion "1.0";\n\ dct:hasVersion "1.0";\n\
dct:isPartOf c:d01757b2-178f-44f0-a4b0-c13d15fd307d;\n\ dct:isPartOf c:55500bc8-b379-44ff-b41b-f41c504d56ec;\n\
dct:language language:en;\n\ dct:language language:en;\n\
dct:license <http://rdflicense.appspot.com/rdflicense/cc-by-nc-nd3.0>;\n\ dct:license <http://rdflicense.appspot.com/rdflicense/cc-by-nc-nd3.0>;\n\
dct:title '+ name +';\n\ dct:title '+ name +';\n\
......
<p>publishapi works!</p> <p>publishapi works!</p>
<button (click)="goToLink()">OpenAPI editor</button>
<br><br> <br><br>
<br><br> <br><br>
......
...@@ -5,6 +5,9 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; ...@@ -5,6 +5,9 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ParseXmlService { export class ParseXmlService {
constructor(private http:HttpClient) { } constructor(private http:HttpClient) { }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<div> <div>
<br> <br>
<button type="submit" class="btn btn-primary">Save SmartApi setting</button> <button type="submit" class="btn btn-primary">Save SmartHarvester setting</button>
</div> </div>
</form> </form>
\ No newline at end of file
...@@ -3,5 +3,5 @@ import { ApiService } from 'src/app/api.service'; ...@@ -3,5 +3,5 @@ import { ApiService } from 'src/app/api.service';
export const environment = { export const environment = {
production: true, production: true,
apiurl: 'sandbox9.cines.fr', apiurl: 'sandbox9.cines.fr',
token: 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhN2FkZDNkOS1mZTUwLTQ4ZGEtYTNmNC0zY2I1NjljM2Y5YmEiLCJpYXQiOjE2MDAwNzUxMzEsImV4cCI6MTYwMTI4NDczMX0.gRLsRdoEeIoqPNSZfegKIzdK1bfF16ALJ6xJPOAkVOA' token: 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI5MjU1NjY3Yi04MmY5LTQ1Y2MtOWE4Mi1jOTE0ZThmMjI4OWYiLCJpYXQiOjE2MDE4ODcwNTQsImV4cCI6MTYwMzA5NjY1NH0.26TS5m7t3sInRgdJ6kH4ocU2sB3j9I-3uHAHU4Wt4gA'
}; };
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment