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

Update instance config => DONE

parent 8a067f9e
......@@ -12,18 +12,18 @@
<input id="client_url" type="text" class="form-control" name="client_url" [ngModel]="model.client_url" #clientUrl="ngModel">
</div>
<hr>
<hr class="mt-4">
<h4>Search: </h4>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="search_enabled" name="search_enabled" [ngModel]="getConfigSearchEnabled()">
<label class="form-check-label" for="search_enabled">Classic search allowed</label>
<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_enabled" name="search_multiple_enabled" [ngModel]="getConfigSearchMultipleEnabled()">
<label class="form-check-label" for="search_multiple_enabled">Search multiple allowed</label>
<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-group">
<div class="form-group pt-4">
<ng-content></ng-content>
</div>
</form>
......@@ -13,37 +13,26 @@ export class FormInstanceComponent {
@Output() submitted: EventEmitter<Instance> = new EventEmitter();
getConfigSearchEnabled(): boolean {
// if (this.model.config && this.model.config.search) {
// return this.model.config.search.enabled;
// }
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.enabled;
// }
if (this.model.config && this.model.config.search_multiple) {
return this.model.config.search_multiple;
}
return false;
}
emit(instance: Instance) {
// datasetEmitted.config = {
// search: {
// enabled: this.ngForm.form.value.search_enabled,
// display_results_server_link: this.ngForm.form.value.results_server_link,
// opened_datatable: this.ngForm.form.value.opened_datatable
// },
// search_multiple: {
// enabled: this.ngForm.value.search_multiple_enabled
// },
// cone_search: {
// enabled: this.ngForm.form.value.cone_search,
// column_ra: this.ngForm.form.value.column_ra,
// column_dec: this.ngForm.form.value.column_dec
// }
// };
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
};
this.submitted.emit(instanceEmitted);
}
}
......@@ -2,4 +2,8 @@ export class Instance {
name: string;
label: string;
client_url: string;
config: {
search: boolean;
search_multiple: boolean;
};
}
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