Commit 48c841b4 authored by Administrator's avatar Administrator
Browse files

list datastets ok

parent 70ac9382
...@@ -6,5 +6,10 @@ ...@@ -6,5 +6,10 @@
<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>{{dataresult}}</strong></p> <p><strong>{{dataresult}}</strong></p>
<p><strong>Datasets examples: </strong></p>
<ul>
<li *ngFor="let item of itemsdatasets; let i = index"><a href={{item.url}} target="_blank" >{{item.entity_id}} {{item.name}} </a> <br> {{item.description}}</li>
</ul>
</form> </form>
...@@ -11,8 +11,8 @@ import { Observable } from 'rxjs'; ...@@ -11,8 +11,8 @@ import { Observable } from 'rxjs';
styleUrls: ['./datasets.component.scss'] styleUrls: ['./datasets.component.scss']
}) })
export class DatasetsComponent implements OnInit { export class DatasetsComponent implements OnInit {
result: Promise<any>;
dataresult: any; dataresult: any;
itemsdatasets: any;
constructor( constructor(
private appConfig: AppConfiguration, private appConfig: AppConfiguration,
...@@ -33,15 +33,15 @@ export class DatasetsComponent implements OnInit { ...@@ -33,15 +33,15 @@ export class DatasetsComponent implements OnInit {
var myInit = { method: 'GET', headers: myHeaders}; var myInit = { method: 'GET', headers: myHeaders};
var myRequest = new Request('https://data.inra.fr/api/search?q=*&type=dataset',myInit); var myRequest = new Request('https://data.inra.fr/api/search?q=*&type=dataset&start=60000&show_entity_ids=true',myInit);
fetch(myRequest, myInit) fetch(myRequest, myInit)
.then(response => { .then(response => {
response.json() response.json()
.then(data => { .then(data => {
this.dataresult = 'Total des datasets trouvés: ' + JSON.stringify(data['data']['total_count']); this.dataresult = 'Total des datasets trouvés: ' + JSON.stringify(data['data']['total_count']);
; this.itemsdatasets = data['data']['items'];
// console.log(this.dataresult); console.log(this.itemsdatasets);
}); });
}); });
......
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