Newer
Older
import { Component, Input } from '@angular/core';
import { Criterion, ConeSearch } from '../../store/model';
import { getCriterionStr, getHost as host } from '../../../shared/utils';
import { Dataset } from 'src/app/metamodel/model';
@Component({
selector: 'app-result-download',
styleUrls: ['download.component.css']
export class DownloadSectionComponent {
@Input() datasetList: Dataset[];
@Input() criteriaList: Criterion[];
@Input() outputList: number[];
getDataset(): Dataset {
return this.datasetList.find(dataset => dataset.name === this.datasetName);
}
getUrl(format: string): string {
let query: string = host() + '/search/' + this.datasetName + '?a=' + this.outputList.join(';');
if (this.criteriaList.length > 0) {
query += '&c=' + this.criteriaList.map(criterion => getCriterionStr(criterion)).join(';');
}
if (this.coneSearch !== null) {
query += '&cs=' + this.coneSearch.ra + ':' + this.coneSearch.dec + ':' + this.coneSearch.radius;
}
query += '&f=' + format
return query;
}