Commit 88f31207 authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

Add server url display as option => DONE

parent c9c6daff
<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>
<h4>Cone-Search: </h4>
<div 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()">
<input id="cone_search" type="checkbox" class="form-control" name="cone_search" [ngModel]="getConfigConeSearchEnabled()">
</div>
<div class="col-auto">
<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]="getConfigColumnRa()">
</div>
<div class="col-auto">
<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]="getConfigColumnDec()">
</div>
</div>
</div>
<div class="form-group">
<hr>
<h4>Config: </h4>
<div class="form-row">
<div class="col-auto">
<label for="results_server_link">Display server link to the results</label>
<input id="results_server_link" type="checkbox" class="form-control" name="results_server_link" [ngModel]="getConfigResultsServerLinkEnabled()">
</div>
<div class="col-auto">
<label for="selectable">Selectable</label>
<input id="selectable" type="checkbox" class="form-control" name="selectable_row" [ngModel]="model.selectable_row">
</div>
</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,7 +26,7 @@ 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 {
......@@ -33,7 +34,7 @@ export class FormDatasetComponent {
}
}
getConfigColumnRa() {
getConfigColumnRa(): number {
if (this.model.config && this.model.config.cone_search) {
return this.model.config.cone_search.column_ra;
} else {
......@@ -41,15 +42,23 @@ export class FormDatasetComponent {
}
}
getConfigColumnDec() {
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;
}
}
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) {
......@@ -69,6 +78,9 @@ 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: {
enabled: this.ngForm.form.value.results_server_link
}
};
this.submitted.emit(datasetEmitted);
......
......@@ -11,6 +11,9 @@ export class Dataset implements Displayable {
data_path: string;
selectable_row: boolean;
config: {
results_server_link: {
enabled: boolean;
};
cone_search: {
enabled: boolean;
column_ra: 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