Commit ab6b4122 authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

Add dataset result download options => DONE

parent da7b9b37
......@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.4.0]
### Added
- #43: Add dataset result download options
- #42: Add instance options: 'Display search', 'Display search multiple' and 'Display documentation'
- #38: Add new search-type: list
- #41: Add dataset option 'Opened result accordion'
......
......@@ -64,11 +64,11 @@
<div class="form-row">
<div class="col-6">
<label for="column_ra">Column RA</label>
<input id="column_ra" type="number" class="form-control" name="column_ra" [ngModel]="getConfigColumnRa()">
<input id="column_ra" type="number" class="form-control" name="column_ra" [ngModel]="getConfigConeSearchCol('column_ra')">
</div>
<div class="col-6">
<label for="column_dec">Column DEC</label>
<input id="column_dec" type="number" class="form-control" name="column_dec" [ngModel]="getConfigColumnDec()">
<input id="column_dec" type="number" class="form-control" name="column_dec" [ngModel]="getConfigConeSearchCol('column_dec')">
</div>
</div>
</div>
......@@ -76,18 +76,43 @@
<hr>
<h4>Config: </h4>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="results_server_link" name="results_server_link" [ngModel]="getConfigResultsServerLinkEnabled()">
<input class="form-check-input" type="checkbox" id="results_server_link" name="results_server_link" [ngModel]="getConfig('results_server_link')">
<label class="form-check-label" for="results_server_link">Display server link to the results</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="opened_datatable" name="opened_datatable" [ngModel]="getConfigOpenedDatatable()">
<input class="form-check-input" type="checkbox" id="opened_datatable" name="opened_datatable" [ngModel]="getConfig('opened_datatable')">
<label class="form-check-label" for="opened_datatable">Open the results datatable accordion</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="selectable_row" name="selectable_row" [ngModel]="model.selectable_row">
<input class="form-check-input" type="checkbox" id="selectable_row" name="selectable_row" [ngModel]="getConfig('selectable_row')">
<label class="form-check-label" for="selectable_row">Datatable rows selectable</label>
</div>
<div class="form-check pt-3">
<input class="form-check-input" type="checkbox" id="download_result_csv" name="download_result_csv" [ngModel]="getConfigDownloadResultFormat('csv')">
<label class="form-check-label" for="download_result_csv">Display download results button in CSV format</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="download_result_ascii" name="download_result_ascii" [ngModel]="getConfigDownloadResultFormat('ascii')">
<label class="form-check-label" for="download_result_ascii">Display download results button in ASCII format</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="download_result_spectra" name="download_result_spectra" [ngModel]="getConfigDownloadResultFormat('spectra')">
<label class="form-check-label" for="download_result_spectra">Display download results button in Spectra format</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="download_result_stamp" name="download_result_stamp" [ngModel]="getConfigDownloadResultFormat('stamp')">
<label class="form-check-label" for="download_result_stamp">Display download results button in Stamp format</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="download_result_vo" name="download_result_vo" [ngModel]="getConfigDownloadResultFormat('vo')">
<label class="form-check-label" for="download_result_vo">Display download results button in VO format</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="download_result_fits" name="download_result_fits" [ngModel]="getConfigDownloadResultFormat('fits')">
<label class="form-check-label" for="download_result_fits">Display download results button in FITS format</label>
</div>
<div class="form-group mt-3">
<ng-content></ng-content>
</div>
......
......@@ -33,33 +33,24 @@ export class FormDatasetComponent {
return false;
}
getConfigColumnRa(): number {
getConfigConeSearchCol(key: string): number {
if (this.model.config && this.model.config.cone_search) {
return this.model.config.cone_search.column_ra;
return this.model.config.cone_search[key];
} else {
return 0;
}
}
getConfigColumnDec(): number {
if (this.model.config && this.model.config.cone_search) {
return this.model.config.cone_search.column_dec;
} else {
return 0;
}
}
getConfigResultsServerLinkEnabled(): boolean {
if (this.model.config && this.model.config.results_server_link) {
return this.model.config.results_server_link.enabled;
} else {
return false;
getConfig(key: string): boolean {
if (this.model.config && this.model.config[key]) {
return this.model.config[key];
}
return false;
}
getConfigOpenedDatatable(): boolean {
if (this.model.config && this.model.config.opened_datatable) {
return this.model.config.opened_datatable;
getConfigDownloadResultFormat(format: string): boolean {
if (this.model.config && this.model.config.download_results_format && this.model.config.download_results_format[format]) {
return this.model.config.download_results_format[format];
}
return false;
}
......@@ -73,9 +64,6 @@ export class FormDatasetComponent {
if (!dataset.vo) {
datasetEmitted.vo = false;
}
if (!dataset.selectable_row) {
datasetEmitted.selectable_row = false;
}
if (this.idDatasetFamilyQueryParam > 0) {
datasetEmitted.id_dataset_family = this.idDatasetFamilyQueryParam;
}
......@@ -85,10 +73,17 @@ export class FormDatasetComponent {
column_ra: this.ngForm.form.value.column_ra,
column_dec: this.ngForm.form.value.column_dec
},
results_server_link: {
enabled: this.ngForm.form.value.results_server_link
},
opened_datatable: this.ngForm.form.value.opened_datatable
results_server_link: this.ngForm.form.value.results_server_link,
opened_datatable: this.ngForm.form.value.opened_datatable,
selectable_row: this.ngForm.form.value.selectable_row,
download_results_format: {
csv: this.ngForm.form.value.download_result_csv,
ascii: this.ngForm.form.value.download_result_ascii,
spectra: this.ngForm.form.value.download_result_spectra,
stamp: this.ngForm.form.value.download_result_stamp,
vo: this.ngForm.form.value.download_result_vo,
fits: this.ngForm.form.value.download_result_fits
}
};
this.submitted.emit(datasetEmitted);
}
......
......@@ -9,17 +9,23 @@ export class Dataset implements Displayable {
count: number;
vo: boolean;
data_path: string;
selectable_row: boolean;
config: {
cone_search: {
enabled: boolean;
column_ra: number;
column_dec: number;
},
results_server_link: {
enabled: boolean;
},
opened_datatable: boolean
};
results_server_link: boolean;
opened_datatable: boolean;
selectable_row: boolean;
download_results_format: {
csv: boolean;
ascii: boolean;
spectra: boolean;
stamp: boolean;
vo: boolean;
fits: boolean;
};
};
project_name: string;
id_dataset_family: number;
......
Supports Markdown
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