<commit_before>import { Component, Input } from '@angular/core';
import { OrganismList } from '../organism-list';
import { Organism } from '../organism';
import { ApiOrganismService }  from '../../core/services/api-organism.service';
import { Subject } from 'rxjs/Subject';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';

import { SpecimenList } from '../specimen-list';
import { ApiSpecimenService }  from '../../core/services/api-specimen.service';
import { Angular2Csv } from 'angular2-csv/Angular2-csv';

@Component({
    selector: 'export-button',
    templateUrl: './export.component.html'
})

export class ExportComponent{
  @Input() query: {[term: string]: any};
  @Input() type: string;
  result:Array<Array<string>> = new Array<Array<string>>();

  constructor(
    private apiOrganismService: ApiOrganismService,
    private apiSpecimenService: ApiSpecimenService
  ){};

//it utilizes the existing library Angular2Csv which is described at https://www.npmjs.com/package/angular2-csv
  export(format: string){
    //remove the pagination to return the full list
    delete this.query['from'];
    this.query['size'] = 10;
    //options for Angular2csv to export
    var options = { 
      fieldSeparator: ','
    };
    var filename:string = "Export result of "+this.type;
    if (format == "tsv"){
      options = {
        fieldSeparator: '\t'
      };
      filename = filename + ".tsv";
    }

    if (this.type == "organism"){
      this.apiOrganismService.getAllInArray(this.query).subscribe((response)=>{
        new Angular2Csv(JSON.stringify(response), filename ,options);
      });
    }else if(this.type == "specimen"){
      this.apiSpecimenService.getAllInArray(this.query).subscribe((response)=>{
        new Angular2Csv(JSON.stringify(response), filename ,options);
      });
    }<commit_msg>remove limit of exported records number<commit_after>import { Component, Input } from '@angular/core';
import { OrganismList } from '../organism-list';
import { Organism } from '../organism';
import { ApiOrganismService }  from '../../core/services/api-organism.service';
import { Subject } from 'rxjs/Subject';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';

import { SpecimenList } from '../specimen-list';
import { ApiSpecimenService }  from '../../core/services/api-specimen.service';
import { Angular2Csv } from 'angular2-csv/Angular2-csv';

@Component({
    selector: 'export-button',
    templateUrl: './export.component.html'
})

export class ExportComponent{
  @Input() query: {[term: string]: any};
  @Input() type: string;
  result:Array<Array<string>> = new Array<Array<string>>();

  constructor(
    private apiOrganismService: ApiOrganismService,
    private apiSpecimenService: ApiSpecimenService
  ){};

//it utilizes the existing library Angular2Csv which is described at https://www.npmjs.com/package/angular2-csv
  export(format: string){
    //remove the pagination to return the full list
    delete this.query['from'];
    this.query['size'] = 100000;
    //options for Angular2csv to export
    var options = { 
      fieldSeparator: ','
    };
    var filename:string = "Export result of "+this.type;
    if (format == "tsv"){
      options = {
        fieldSeparator: '\t'
      };
      filename = filename + ".tsv";
    }

    if (this.type == "organism"){
      this.apiOrganismService.getAllInArray(this.query).subscribe((response)=>{
        new Angular2Csv(JSON.stringify(response), filename ,options);
      });
    }else if(this.type == "specimen"){
      this.apiSpecimenService.getAllInArray(this.query).subscribe((response)=>{
        new Angular2Csv(JSON.stringify(response), filename ,options);
      });
    }
{'fraction_non_alphanumeric': 0.14869888475836432, 'fraction_numerical': 0.006372809346787042, 'mean_word_length': 3.662128712871287, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3511802', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1106, 'n_words': 267}