Newer
Older
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { Criterion, ConeSearch } from '../../store/model';
import { getCriterionStr, getHost as host } from '../../../shared/utils';
templateUrl: 'url-display.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class UrlDisplaySectionComponent {
@Input() criteriaList: Criterion[];
@Input() outputList: number[];
constructor(private toastr: ToastrService) { }
let query: string = host() + '/search/' + this.datasetName + '?a=' + this.outputList.join(';');
query += '&c=' + this.criteriaList.map(criterion => getCriterionStr(criterion)).join(';');
if (this.coneSearch !== null) {
query += '&cs=' + this.coneSearch.ra + ':' + this.coneSearch.dec + ':' + this.coneSearch.radius;
}
copyToClipboard(): void {
const selBox = document.createElement('textarea');
selBox.value = this.getUrl();
document.body.appendChild(selBox);
selBox.select();
document.execCommand('copy');
document.body.removeChild(selBox);
this.toastr.success('Copied');
}
}