Commit 8802ff4a authored by François Agneray's avatar François Agneray
Browse files

Change dataset config format (dataset form)

parent 2e71a632
Pipeline #5416 passed with stages
in 11 minutes and 22 seconds
......@@ -46,7 +46,7 @@ export class FormAttributeListComponent {
}
getVoEnabled(): boolean {
return this.dataset.config.results_format.vo;
return this.dataset.config.download.vo;
}
alreadyExists(columnName: string): boolean {
......
......@@ -57,57 +57,103 @@
</accordion-group>
<accordion-group heading="Cone-search configuration" [isDisabled]="isConeSearchDisabled()">
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="cone_search" name="cone_search" [ngModel]="getConfigConeSearchEnabled()">
<label class="custom-control-label" for="cone_search">Enabled</label>
<input class="custom-control-input" type="checkbox" id="cone_search_enabled" name="cone_search_enabled" [ngModel]="model.config.cone_search.enabled">
<label class="custom-control-label" for="cone_search_enabled">Enabled</label>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="cone_search_opened" name="cone_search_opened" [ngModel]="model.config.cone_search.opened" [disabled]="!ngForm.form.value.cone_search_enabled">
<label class="custom-control-label" for="cone_search_opened">Opened</label>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<label for="column_ra">Column RA</label>
<select id="column_ra" class="form-control" name="column_ra" [ngModel]="getConfigConeSearchCol('column_ra')" [disabled]="!ngForm.form.value.cone_search">
<select id="column_ra" class="form-control" name="column_ra" [ngModel]="model.config.cone_search.column_ra" [disabled]="!ngForm.form.value.cone_search_enabled">
<option *ngFor="let attribute of attributeList" [value]="attribute.id">{{ attribute.form_label }}</option>
</select>
</div>
<div class="col-md-6">
<label for="column_dec">Column DEC</label>
<select id="column_dec" class="form-control" name="column_dec" [ngModel]="getConfigConeSearchCol('column_dec')" [disabled]="!ngForm.form.value.cone_search">
<select id="column_dec" class="form-control" name="column_dec" [ngModel]="model.config.cone_search.column_dec" [disabled]="!ngForm.form.value.cone_search_enabled">
<option *ngFor="let attribute of attributeList" [value]="attribute.id">{{ attribute.form_label }}</option>
</select>
</div>
</div>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="plot_enabled" name="plot_enabled" [ngModel]="getConfigConeSearchCol('plot_enabled')" [disabled]="!ngForm.form.value.cone_search">
<input class="custom-control-input" type="checkbox" id="plot_enabled" name="plot_enabled" [ngModel]="model.config.cone_search.plot_enabled" [disabled]="!ngForm.form.value.cone_search_enabled">
<label class="custom-control-label" for="plot_enabled">Activate plot</label>
</div>
</accordion-group>
<accordion-group heading="Page result configuration">
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="results_server_link" name="results_server_link" [ngModel]="getConfigResultPageModules('results_server_link')">
<label class="custom-control-label" for="results_server_link">Display server link to the results</label>
</div>
<accordion-group heading="Download configuration">
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="opened_datatable" name="opened_datatable" [ngModel]="getConfigResultPageModules('opened_datatable')">
<label class="custom-control-label" for="opened_datatable">Open the results datatable accordion</label>
<input class="custom-control-input" type="checkbox" id="download_enabled" name="download_enabled" [ngModel]="model.config.download.enabled">
<label class="custom-control-label" for="download_enabled">Enabled</label>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="selectable_row" name="selectable_row" [ngModel]="getConfigResultPageModules('selectable_row')">
<label class="custom-control-label" for="selectable_row">Datatable rows selectable</label>
<input class="custom-control-input" type="checkbox" id="download_opened" name="download_opened" [ngModel]="model.config.download.opened" [disabled]="!ngForm.form.value.download_enabled">
<label class="custom-control-label" for="download_opened">Opened</label>
</div>
</accordion-group>
<accordion-group heading="Results format">
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="download_result_csv" name="download_result_csv" [ngModel]="getConfigDownloadResultFormat('csv')">
<input class="custom-control-input" type="checkbox" id="download_result_csv" name="download_result_csv" [ngModel]="model.config.download.csv" [disabled]="!ngForm.form.value.download_enabled">
<label class="custom-control-label" for="download_result_csv">Display download results button in CSV format</label>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="download_result_ascii" name="download_result_ascii" [ngModel]="getConfigDownloadResultFormat('ascii')">
<input class="custom-control-input" type="checkbox" id="download_result_ascii" name="download_result_ascii" [ngModel]="model.config.download.ascii" [disabled]="!ngForm.form.value.download_enabled">
<label class="custom-control-label" for="download_result_ascii">Display download results button in ASCII format</label>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="download_result_vo" name="download_result_vo" [ngModel]="getConfigDownloadResultFormat('vo')">
<input class="custom-control-input" type="checkbox" id="download_result_vo" name="download_result_vo" [ngModel]="model.config.download.vo" [disabled]="!ngForm.form.value.download_enabled">
<label class="custom-control-label" for="download_result_vo">Display download results button in VO format</label>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="download_result_archive" name="download_result_archive" [ngModel]="model.config.download.archive" [disabled]="!ngForm.form.value.download_enabled">
<label class="custom-control-label" for="download_result_archive">Display download results archive button</label>
</div>
</accordion-group>
<accordion-group heading="Summary configuration">
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="summary_enabled" name="summary_enabled" [ngModel]="model.config.summary.enabled">
<label class="custom-control-label" for="summary_enabled">Enabled</label>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="summary_opened" name="summary_opened" [ngModel]="model.config.summary.opened" [disabled]="!ngForm.form.value.summary_enabled">
<label class="custom-control-label" for="summary_opened">Opened</label>
</div>
</accordion-group>
<accordion-group heading="Server link configuration">
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="server_link_enabled" name="server_link_enabled" [ngModel]="model.config.server_link.enabled">
<label class="custom-control-label" for="server_link_enabled">Enabled</label>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="server_link_opened" name="server_link_opened" [ngModel]="model.config.server_link.opened" [disabled]="!ngForm.form.value.server_link_enabled">
<label class="custom-control-label" for="server_link_opened">Opened</label>
</div>
</accordion-group>
<accordion-group heading="SAMP configuration">
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="samp_enabled" name="samp_enabled" [ngModel]="model.config.samp.enabled">
<label class="custom-control-label" for="samp_enabled">Enabled</label>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="samp_opened" name="samp_opened" [ngModel]="model.config.samp.opened" [disabled]="!ngForm.form.value.samp_enabled">
<label class="custom-control-label" for="samp_opened">Opened</label>
</div>
</accordion-group>
<accordion-group heading="Datatable configuration">
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="datatable_enabled" name="datatable_enabled" [ngModel]="model.config.datatable.enabled">
<label class="custom-control-label" for="datatable_enabled">Enabled</label>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="datatable_opened" name="datatable_opened" [ngModel]="model.config.datatable.enabled">
<label class="custom-control-label" for="datatable_opened">Open the results datatable accordion</label>
</div>
<div class="custom-control custom-switch">
<input class="custom-control-input" type="checkbox" id="selectable_row" name="selectable_row" [ngModel]="model.config.datatable.selectable_row">
<label class="custom-control-label" for="selectable_row">Datatable rows selectable</label>
</div>
</accordion-group>
</accordion>
<div class="form-group mt-3">
......
......@@ -32,6 +32,10 @@ export class FormDatasetComponent {
constructor(private modalService: BsModalService) { }
ngOnInit() {
console.log(this.model);
}
openModal(template: TemplateRef<any>) {
this.fileExplorerPristine = true;
this.fileExplorerPath = this.ngForm.controls['data_path'].value;
......@@ -73,35 +77,6 @@ export class FormDatasetComponent {
onChange(surveyName: string): void {
this.changeSurvey.emit(this.surveyList.find(survey => survey.name === surveyName).id_database);
}
getConfigConeSearchEnabled(): boolean {
if (this.model.config && this.model.config.cone_search) {
return this.model.config.cone_search.enabled;
}
return false;
}
getConfigConeSearchCol(key: string): number {
if (this.model.config && this.model.config.cone_search) {
return this.model.config.cone_search[key];
} else {
return 0;
}
}
getConfigResultPageModules(key: string): boolean {
if (this.model.config && this.model.config.result_page_modules && this.model.config.result_page_modules[key]) {
return this.model.config.result_page_modules[key];
}
return false;
}
getConfigDownloadResultFormat(format: string): boolean {
if (this.model.config && this.model.config.results_format && this.model.config.results_format[format]) {
return this.model.config.results_format[format];
}
return false;
}
emit(dataset: Dataset): void {
let datasetEmitted: Dataset;
......@@ -117,20 +92,36 @@ export class FormDatasetComponent {
}
datasetEmitted.config = {
cone_search: {
enabled: this.ngForm.form.value.cone_search,
enabled: this.ngForm.form.value.cone_search_enabled,
opened: this.ngForm.form.value.cone_search_opened,
column_ra: +this.ngForm.form.value.column_ra,
column_dec: +this.ngForm.form.value.column_dec,
plot_enabled: this.ngForm.form.value.plot_enabled
},
result_page_modules: {
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
},
results_format: {
download: {
enabled: this.ngForm.form.value.download_enabled,
opened: this.ngForm.form.value.download_opened,
csv: this.ngForm.form.value.download_result_csv,
ascii: this.ngForm.form.value.download_result_ascii,
vo: this.ngForm.form.value.download_result_vo
vo: this.ngForm.form.value.download_result_vo,
archive: this.ngForm.form.value.download_result_archive,
},
summary: {
enabled: this.ngForm.form.value.summary_enabled,
opened: this.ngForm.form.value.summary_opened
},
server_link: {
enabled: this.ngForm.form.value.server_link_enabled,
opened: this.ngForm.form.value.server_link_opened
},
samp: {
enabled: this.ngForm.form.value.samp_enabled,
opened: this.ngForm.form.value.samp_opened
},
datatable: {
enabled: this.ngForm.form.value.datatable_enabled,
opened: this.ngForm.form.value.datatable_opened,
selectable_row: this.ngForm.form.value.selectable_row
}
};
this.submitted.emit(datasetEmitted);
......
......@@ -15,19 +15,73 @@ export class Dataset implements Displayable {
config: {
cone_search: {
enabled: boolean;
opened: boolean;
column_ra: number;
column_dec: number;
plot_enabled: boolean;
};
result_page_modules: {
results_server_link: boolean;
opened_datatable: boolean;
selectable_row: boolean;
}
results_format: {
},
download: {
enabled: boolean;
opened: boolean;
csv: boolean;
ascii: boolean;
vo: boolean;
};
archive: boolean;
},
summary: {
enabled: boolean;
opened: boolean;
},
server_link: {
enabled: boolean;
opened: boolean;
},
samp: {
enabled: boolean;
opened: boolean;
},
datatable: {
enabled: boolean;
opened: boolean;
selectable_row: boolean;
}
};
constructor() {
this.public = true;
this.config = {
cone_search: {
enabled: false,
opened: false,
column_ra: null,
column_dec: null,
plot_enabled: false
},
download: {
enabled: true,
opened: false,
csv: true,
ascii: true,
vo: false,
archive: true
},
summary: {
enabled: true,
opened: false
},
server_link: {
enabled: false,
opened: false
},
samp: {
enabled: false,
opened: false
},
datatable: {
enabled: true,
opened: false,
selectable_row: false
}
}
}
}
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