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

Merge branch 'develop' into 'master'

Develop

See merge request !28
parents 93527aea 2ede3d38
......@@ -4,7 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [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'
- #33: Add dataset option 'Direct link to the result'
## [3.3.0]
### Added
- #37: Configuration cone search by dataset (form dataset)
## [3.2.0]
......
......@@ -14,7 +14,7 @@ list:
@echo " test > run $(NAME_APP) tests"
@echo " test-watch > run $(NAME_APP) tests on every file change"
@echo " report > open the code coverage report in a browser (only available for Linux)"
@echo " dist > generate the angular dist application (html, css, js)"
@echo " build > generate the angular dist application (html, css, js)"
@echo " logs > display $(NAME_APP) container logs"
@echo " shell > shell into $(NAME_APP) container"
@echo ""
......@@ -48,7 +48,7 @@ test-watch:
report:
xdg-open var/coverage/index.html
dist:
build:
@docker build -t anis-node conf-dev && docker run --init -it --rm --user $(UID):$(GID) \
-v $(CURDIR):/project \
-w /project anis-node ng build --prod --base-href /admin/
......
3.3.0
\ No newline at end of file
3.4.0
\ No newline at end of file
......@@ -19,14 +19,15 @@
</select>
</td>
<td>
<select *ngIf="criteriaForm.controls.search_type.value
&& criteriaForm.controls.search_type.value != 'between'
&& criteriaForm.controls.search_type.value != 'between-date'
&& criteriaForm.controls.search_type.value != 'json'"
class="form-control" name="operator" (change)="operatorOnChange($event.target.value)"
[formControl]="criteriaForm.controls.operator">
<select *ngIf="criteriaForm.controls.search_type.value && criteriaForm.controls.search_type.value != 'between'
&& criteriaForm.controls.search_type.value != 'between-date' && criteriaForm.controls.search_type.value != 'json'
&& criteriaForm.controls.search_type.value != 'list'"
class="form-control"
name="operator"
[formControl]="criteriaForm.controls.operator"
(change)="operatorOnChange($event.target.value)">
<option></option>
<option *ngFor="let operator of operatorList" [value]="operator.value">{{operator.label}}</option>
<option *ngFor="let operator of operatorList" [value]="operator.value">{{ operator.label }}</option>
</select>
</td>
<td>
......@@ -48,7 +49,8 @@
|| (criteriaForm.controls.operator.value && criteriaForm.controls.search_type.value == 'time')
|| (criteriaForm.controls.operator.value && criteriaForm.controls.search_type.value == 'date-time')
|| criteriaForm.controls.search_type.value == 'between'
|| criteriaForm.controls.search_type.value == 'between-date'"
|| criteriaForm.controls.search_type.value == 'between-date'
|| criteriaForm.controls.search_type.value == 'list'"
type="text" class="form-control" name="min"
[placeholder]="getMinValuePlaceholder(criteriaForm.controls.search_type.value)"
[formControl]="criteriaForm.controls.min">
......@@ -62,7 +64,8 @@
|| (criteriaForm.controls.operator.value && criteriaForm.controls.search_type.value == 'time')
|| (criteriaForm.controls.operator.value && criteriaForm.controls.search_type.value == 'date-time')
|| criteriaForm.controls.search_type.value == 'between'
|| criteriaForm.controls.search_type.value == 'between-date'"
|| criteriaForm.controls.search_type.value == 'between-date'
|| criteriaForm.controls.search_type.value == 'list'"
type="text" class="form-control" name="placeholder_min"
[placeholder]="getMinValuePlaceholder(criteriaForm.controls.search_type.value)"
[formControl]="criteriaForm.controls.placeholder_min">
......
......@@ -41,7 +41,9 @@ export class TrCriteriaComponent {
modalRef: BsModalRef;
constructor(private modalService: BsModalService) { }
readonly searchTypesWithOperator: string[] = [
'field', 'select', 'select-multiple', 'datalist', 'radio', 'checkbox', 'date', 'time', 'date-time'
];
_attribute: Attribute;
optionList: Option[] = [];
......@@ -58,12 +60,14 @@ export class TrCriteriaComponent {
criteria_display: new FormControl()
});
generateOptionListValues(template: TemplateRef<any>) {
constructor(private modalService: BsModalService) { }
generateOptionListValues(template: TemplateRef<any>): void {
this.generateOptionList.emit(this._attribute);
this.modalRef = this.modalService.show(template);
}
confirmGeneratedOptionList() {
confirmGeneratedOptionList(): void {
let newOptionList: Option[] = [];
for (let i = 0; i < this.optionListGenerated.length; i++) {
newOptionList.push({
......@@ -76,21 +80,21 @@ export class TrCriteriaComponent {
this.modalRef.hide();
}
criteriaFamilyOnChange(id: string) {
criteriaFamilyOnChange(id: string): void {
if (id === '') {
this.criteriaForm.controls.id_criteria_family.setValue(null);
this.searchTypeOnChange('');
}
}
searchTypeOnChange(type: string) {
searchTypeOnChange(type: string): void {
if (type === '') {
this.criteriaForm.controls.search_type.setValue(null);
this.operatorOnChange('');
}
}
operatorOnChange(operator: string) {
operatorOnChange(operator: string): void {
if (operator === '') {
this.criteriaForm.controls.operator.setValue(null);
this.criteriaForm.controls.min.setValue(null);
......
......@@ -34,10 +34,14 @@
</tr>
</app-table-design>
<app-table-criteria *ngSwitchCase="'criteria'">
<tr *ngFor="let attribute of attributeList" criteria [attribute]="attribute"
<tr *ngFor="let attribute of attributeList"
criteria
[attribute]="attribute"
[optionListGenerated]="optionListGenerated"
[criteriaFamilyList]="criteriaFamilyList" [searchTypeList]="getSettingsSelectOptions('search_type')"
[operatorList]="getSettingsSelectOptions('operator')" (save)="editAttribute.emit($event)"
[criteriaFamilyList]="criteriaFamilyList"
[searchTypeList]="getSettingsSelectOptions('search_type')"
[operatorList]="getSettingsSelectOptions('operator')"
(save)="editAttribute.emit($event)"
(generateOptionList)="generateAttributeOptionList.emit($event)">
</tr>
</app-table-criteria>
......
<form name="form" (ngSubmit)="f.form.valid && emit(f.form.value)" #f="ngForm" novalidate>
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" name="name" [ngModel]="model.name" #name="ngModel" [disabled]="model.name" required>
<input id="name" type="text" class="form-control" name="name" [ngModel]="model.name" [disabled]="model.name" required>
</div>
<div class="form-group">
<label for="label">Label</label>
<input type="text" class="form-control" name="label" [ngModel]="model.label" #label="ngModel" required>
<input id="label" type="text" class="form-control" name="label" [ngModel]="model.label" required>
</div>
<div class="form-group">
<label for="project_name">Project</label>
<select class="form-control" name="project_name" [ngModel]="model.project_name" #projectName="ngModel" [disabled]="model.project_name" required (change)="onChange($event.target.value)">
<option>{{model.project_name}}</option>
<option *ngFor="let project of projectList" [value]="project.name" [selected]="project.name === model.project_name">{{project.label}}</option>
<select id="project_name" class="form-control" name="project_name" [ngModel]="model.project_name" [disabled]="model.project_name" required (change)="onChange($event.target.value)">
<option>{{ model.project_name }}</option>
<option *ngFor="let project of projectList" [value]="project.name" [selected]="project.name === model.project_name">{{ project.label }}</option>
</select>
</div>
<div class="form-group">
<label for="table_ref">Table Ref</label>
<select class="form-control" name="table_ref" [ngModel]="model.table_ref" #tableRef="ngModel" [disabled]="model.table_ref" required>
<option>{{model.table_ref}}</option>
<option *ngFor="let table of tableList" [value]="table" [selected]="table === model.table_ref">{{table}}</option>
<select id="table_ref" class="form-control" name="table_ref" [ngModel]="model.table_ref" [disabled]="model.table_ref" required>
<option>{{ model.table_ref }}</option>
<option *ngFor="let table of tableList" [value]="table" [selected]="table === model.table_ref">{{ table }}</option>
</select>
</div>
<div class="form-group">
<label for="id_dataset_family">Family</label>
<input *ngIf="idDatasetFamilyQueryParam > 0" type="string" class="form-control" name="datasetFamilySelected" value="{{getDatasetFamilyByIdQueryParam().label}}" disabled required>
<select *ngIf="idDatasetFamilyQueryParam === 0" class="form-control" name="id_dataset_family" [ngModel]="model.id_dataset_family" #idDatasetFamily="ngModel" required>
<input id="id_dataset_family" *ngIf="idDatasetFamilyQueryParam > 0" type="text" class="form-control" name="datasetFamilySelected" value="{{ getDatasetFamilyByIdQueryParam().label }}" disabled required>
<select *ngIf="idDatasetFamilyQueryParam === 0" class="form-control" name="id_dataset_family" [ngModel]="model.id_dataset_family" required>
<option></option>
<option *ngFor="let family of datasetFamilyList" [value]="family.id" [selected]="family.id === model.id_dataset_family">{{family.label}}</option>
<option *ngFor="let family of datasetFamilyList" [value]="family.id" [selected]="family.id === model.id_dataset_family">{{ family.label }}</option>
</select>
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea class="form-control" rows="5" name="description" [ngModel]="model.description" #description="ngModel" required>VVDS2h Deep</textarea>
<textarea id="description" class="form-control" rows="5" name="description" [ngModel]="model.description" required>VVDS2h Deep</textarea>
</div>
<div class="form-group">
<label for="data_path">Data path</label>
<input type="text" class="form-control" name="data_path" [ngModel]="model.data_path" #dataPath="ngModel">
<input id="data_path" type="text" class="form-control" name="data_path" [ngModel]="model.data_path">
</div>
<div class="form-group">
<div class="form-row">
<div class="col-auto">
<label for="display">Display</label>
<input type="number" class="form-control" name="display" [ngModel]="model.display" #display="ngModel" required>
<input id="display" type="number" class="form-control" name="display" [ngModel]="model.display" required>
</div>
<div class="col-auto">
<label for="count">Count</label>
<input type="number" class="form-control" name="count" [ngModel]="model.count" #count="ngModel">
<input id="count" type="number" class="form-control" name="count" [ngModel]="model.count">
</div>
<div class="col-auto">
<label>VO format</label>
<input type="checkbox" class="form-control" name="vo" [ngModel]="model.vo" #vo="ngModel">
</div>
<div class="col-auto">
<label>Selectable</label>
<input type="checkbox" class="form-control" name="selectable_row" [ngModel]="model.selectable_row">
<label for="vo">VO format</label>
<input id="vo" type="checkbox" class="form-control" name="vo" [ngModel]="model.vo">
</div>
</div>
</div>
<hr>
<h4>Cone-Search : </h4>
<div class="form-group">
<h4>Cone-Search: </h4>
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" id="cone_search" name="cone_search" [ngModel]="getConfigConeSearchEnabled()">
<label class="form-check-label" for="cone_search">Enabled</label>
</div>
<div *ngIf="ngForm.form.value.cone_search" class="form-group">
<div class="form-row">
<div class="col-auto">
<label for="cone_search">Enabled</label>
<input type="checkbox" class="form-control" name="cone_search" [ngModel]="getConfigConeSearchEnabled()">
</div>
<div class="col-auto">
<div class="col-6">
<label for="column_ra">Column RA</label>
<input 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-auto">
<div class="col-6">
<label for="column_dec">Column DEC</label>
<input 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>
<div class="form-group">
<hr>
<h4>Config: </h4>
<div class="form-check">
<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]="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]="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>
</form>
\ No newline at end of file
......@@ -17,7 +17,8 @@ export class FormDatasetComponent {
@Output() changeProject: EventEmitter<number> = new EventEmitter();
@Output() submitted: EventEmitter<Dataset> = new EventEmitter();
getDatasetFamilyByIdQueryParam() {
getDatasetFamilyByIdQueryParam(): DatasetFamily {
return this.datasetFamilyList.find(datasetFamily => datasetFamily.id === this.idDatasetFamilyQueryParam);
}
......@@ -25,31 +26,36 @@ export class FormDatasetComponent {
this.changeProject.emit(this.projectList.find(project => project.name === projectName).id_database);
}
getConfigConeSearchEnabled() {
getConfigConeSearchEnabled(): boolean {
if (this.model.config && this.model.config.cone_search) {
return this.model.config.cone_search.enabled;
} else {
return false;
}
return false;
}
getConfigColumnRa() {
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() {
if (this.model.config && this.model.config.cone_search) {
return this.model.config.cone_search.column_dec;
} else {
return 0;
getConfig(key: string): boolean {
if (this.model.config && this.model.config[key]) {
return this.model.config[key];
}
return false;
}
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;
}
emit(dataset: Dataset) {
emit(dataset: Dataset): void {
let datasetEmitted: Dataset;
(this.model.name) ? datasetEmitted = {name: this.model.name, ...dataset} : datasetEmitted = dataset;
if (!dataset.data_path) {
......@@ -58,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;
}
......@@ -69,6 +72,17 @@ export class FormDatasetComponent {
enabled: this.ngForm.form.value.cone_search,
column_ra: this.ngForm.form.value.column_ra,
column_dec: this.ngForm.form.value.column_dec
},
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);
......
<form name="form" (ngSubmit)="f.form.valid && emit(f.form.value)" #f="ngForm" novalidate>
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" name="name" [ngModel]="model.name" #name="ngModel" [disabled]="model.name" required>
<input id="name" type="text" class="form-control" name="name" [ngModel]="model.name" #name="ngModel" [disabled]="model.name" required>
</div>
<div class="form-group">
<label for="label">Label</label>
<input type="text" class="form-control" name="label" [ngModel]="model.label" #label="ngModel" required>
<input id="label" type="text" class="form-control" name="label" [ngModel]="model.label" #label="ngModel" required>
</div>
<div class="form-group">
<label for="client_url">Client URL</label>
<input type="text" class="form-control" name="client_url" [ngModel]="model.client_url" #clientUrl="ngModel">
<input id="client_url" type="text" class="form-control" name="client_url" [ngModel]="model.client_url" #clientUrl="ngModel">
</div>
<div class="form-group">
<hr class="mt-4">
<h4>Search: </h4>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="search" name="search" [ngModel]="getConfigSearchEnabled()">
<label class="form-check-label" for="search">Classic search allowed</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="search_multiple" name="search_multiple" [ngModel]="getConfigSearchMultipleEnabled()">
<label class="form-check-label" for="search_multiple">Search multiple allowed</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="documentation" name="documentation" [ngModel]="getConfigDocumentationEnabled()">
<label class="form-check-label" for="documentation">Documentation allowed</label>
</div>
<div class="form-group pt-4">
<ng-content></ng-content>
</div>
</form>
......@@ -12,9 +12,35 @@ export class FormInstanceComponent {
@Input() model: Instance = new Instance();
@Output() submitted: EventEmitter<Instance> = new EventEmitter();
getConfigSearchEnabled(): boolean {
if (this.model.config && this.model.config.search) {
return this.model.config.search;
}
return false;
}
getConfigSearchMultipleEnabled(): boolean {
if (this.model.config && this.model.config.search_multiple) {
return this.model.config.search_multiple;
}
return false;
}
getConfigDocumentationEnabled(): boolean {
if (this.model.config && this.model.config.documentation) {
return this.model.config.documentation;
}
return false;
}
emit(instance: Instance) {
let instanceEmitted: Instance;
(this.model.name) ? instanceEmitted = {name: this.model.name, ...instance} : instanceEmitted = instance;
instanceEmitted.config = {
search: this.ngForm.form.value.search,
search_multiple: this.ngForm.value.search_multiple,
documentation: this.ngForm.value.documentation
};
this.submitted.emit(instanceEmitted);
}
}
......@@ -9,13 +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: 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;
......
......@@ -2,4 +2,9 @@ export class Instance {
name: string;
label: string;
client_url: string;
config: {
search: boolean;
search_multiple: boolean;
documentation: boolean;
};
}
export const VERSIONS = {
anisServer: '3.1.0',
anisClient: '3.1.0',
anisAdmin: '3.1.0'
anisServer: '3.4.0',
anisClient: '3.4.0',
anisAdmin: '3.4.0'
};
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