diff --git a/client/src/app/instance/instance.reducer.ts b/client/src/app/instance/instance.reducer.ts index be6b9a59f52e9af870a494c6ba7c55bf944263ac..d80f4abc4f2d28e4c90121d34e8f0c67015c9b02 100644 --- a/client/src/app/instance/instance.reducer.ts +++ b/client/src/app/instance/instance.reducer.ts @@ -14,7 +14,6 @@ import * as search from './store/reducers/search.reducer'; import * as searchMultiple from './store/reducers/search-multiple.reducer'; import * as coneSearch from './store/reducers/cone-search.reducer'; import * as detail from './store/reducers/detail.reducer'; -import * as svomJsonKw from './store/reducers/svom-json-kw.reducer'; import * as archive from './store/reducers/archive.reducer'; /** @@ -27,7 +26,6 @@ export interface State { searchMultiple: searchMultiple.State, coneSearch: coneSearch.State detail: detail.State, - svomJsonKw: svomJsonKw.State, archive: archive.State } @@ -36,7 +34,6 @@ const reducers = { searchMultiple: searchMultiple.searchMultipleReducer, coneSearch: coneSearch.coneSearchReducer, detail: detail.detailReducer, - svomJsonKw: svomJsonKw.svomJsonKwReducer, archive: archive.archiveReducer }; diff --git a/client/src/app/instance/search/components/criteria/criteria-by-family.component.ts b/client/src/app/instance/search/components/criteria/criteria-by-family.component.ts index c7204f8e9399c90147cc4eceef6ceb0f20c182af..edc3ae5cc773c6c0afe38b7bc2b14f4217283bad 100644 --- a/client/src/app/instance/search/components/criteria/criteria-by-family.component.ts +++ b/client/src/app/instance/search/components/criteria/criteria-by-family.component.ts @@ -9,7 +9,7 @@ import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core'; -import { Criterion, SvomKeyword } from 'src/app/instance/store/models'; +import { Criterion } from 'src/app/instance/store/models'; import { Attribute, Option } from 'src/app/metamodel/models'; /** @@ -24,9 +24,6 @@ import { Attribute, Option } from 'src/app/metamodel/models'; export class CriteriaByFamilyComponent { @Input() attributeList: Attribute[]; @Input() criteriaList: Criterion[]; - @Input() svomKeywords: SvomKeyword[]; - @Output() selectSvomAcronym: EventEmitter<string> = new EventEmitter(); - @Output() resetSvomKeywords: EventEmitter<{}> = new EventEmitter(); @Output() addCriterion: EventEmitter<Criterion> = new EventEmitter(); @Output() deleteCriterion: EventEmitter<number> = new EventEmitter(); diff --git a/client/src/app/instance/search/components/criteria/criteria-tabs.component.html b/client/src/app/instance/search/components/criteria/criteria-tabs.component.html index d659ea65ae3b65a642451ce7f58b955ff7a0e342..fa9d3aef3286c6ac5d3fb9cdd32279b4c00f2d3b 100644 --- a/client/src/app/instance/search/components/criteria/criteria-tabs.component.html +++ b/client/src/app/instance/search/components/criteria/criteria-tabs.component.html @@ -16,9 +16,6 @@ <app-criteria-by-family [attributeList]="attributeList | attributeListByFamily:family.id" [criteriaList]="criteriaList" - [svomKeywords]="svomKeywords" - (selectSvomAcronym)="selectSvomAcronym.emit($event)" - (resetSvomKeywords)="resetSvomKeywords.emit()" (addCriterion)="emitAdd($event)" (deleteCriterion)="emitDelete($event)"> </app-criteria-by-family> diff --git a/client/src/app/instance/search/components/criteria/criteria-tabs.component.ts b/client/src/app/instance/search/components/criteria/criteria-tabs.component.ts index 7ed5b94db60583441a66718f4b014ec8a350f8e5..f781372a5cf74bd91196d2375ff945b629262937 100644 --- a/client/src/app/instance/search/components/criteria/criteria-tabs.component.ts +++ b/client/src/app/instance/search/components/criteria/criteria-tabs.component.ts @@ -25,9 +25,6 @@ export class CriteriaTabsComponent { @Input() attributeList: Attribute[]; @Input() criteriaFamilyList: CriteriaFamily[]; @Input() criteriaList: Criterion[]; - @Input() svomKeywords: SvomKeyword[]; - @Output() selectSvomAcronym: EventEmitter<string> = new EventEmitter(); - @Output() resetSvomKeywords: EventEmitter<{}> = new EventEmitter(); @Output() addCriterion: EventEmitter<Criterion> = new EventEmitter(); @Output() deleteCriterion: EventEmitter<number> = new EventEmitter(); diff --git a/client/src/app/instance/search/components/criteria/criterion.component.ts b/client/src/app/instance/search/components/criteria/criterion.component.ts index 6145ccb5a8bd5f777ad765cec2fe1efa35d61f80..c2c9c0ff867771d758c587a3c6c696e4083f5308 100644 --- a/client/src/app/instance/search/components/criteria/criterion.component.ts +++ b/client/src/app/instance/search/components/criteria/criterion.component.ts @@ -11,21 +11,7 @@ import { Component, Input, Output, EventEmitter, ViewChild, SimpleChanges, OnIni import { Attribute } from 'src/app/metamodel/models'; import { Criterion } from 'src/app/instance/store/models'; -import { SearchTypeLoaderDirective } from './search-type/search-type-loader.directive'; -import { AbstractSearchTypeComponent } from './search-type/abstract-search-type.component'; -import { FieldComponent } from './search-type/field.component'; -import { BetweenComponent } from './search-type/between.component'; -import { SelectComponent } from './search-type/select.component'; -import { SelectMultipleComponent } from './search-type/select-multiple.component'; -import { DatalistComponent } from './search-type/datalist.component'; -import { ListComponent } from './search-type/list.component'; -import { RadioComponent } from './search-type/radio.component'; -import { CheckboxComponent } from './search-type/checkbox.component'; -import { BetweenDateComponent } from './search-type/between-date.component'; -import { DateComponent } from './search-type/date.component'; -import { TimeComponent } from './search-type/time.component'; -import { DateTimeComponent } from './search-type/datetime.component'; -import { JsonComponent } from './search-type/json.component'; +import { SearchTypeLoaderDirective, AbstractSearchTypeComponent, getSearchTypeComponent } from './search-type'; @Component({ selector: 'app-criterion', @@ -43,8 +29,10 @@ export class CriterionComponent implements OnInit, OnChanges { public searchTypeComponent: AbstractSearchTypeComponent; ngOnInit() { - const componentRef = this.SearchTypeLoaderDirective.viewContainerRef.createComponent<AbstractSearchTypeComponent>(this.getSearchTypeComponent()); - console.log(componentRef.instance); + const viewContainerRef = this.SearchTypeLoaderDirective.viewContainerRef; + const componentRef = viewContainerRef.createComponent<AbstractSearchTypeComponent>( + getSearchTypeComponent(this.attribute.search_type) + ); componentRef.instance.setAttribute(this.attribute); componentRef.instance.setCriterion(this.criterion); componentRef.instance.setCriteriaList(this.criteriaList); @@ -55,6 +43,10 @@ export class CriterionComponent implements OnInit, OnChanges { if (changes.criterion && !changes.criterion.firstChange) { this.searchTypeComponent.setCriterion(changes.criterion.currentValue); } + + if (changes.criteriaList && !changes.criteriaList.firstChange) { + this.searchTypeComponent.setCriteriaList(changes.criteriaList.currentValue); + } } /** @@ -65,67 +57,4 @@ export class CriterionComponent implements OnInit, OnChanges { emitAdd(): void { this.addCriterion.emit(this.searchTypeComponent.getCriterion()); } - - getSearchTypeComponent() { - let nameOfSearchTypeComponent = null; - switch(this.attribute.search_type) { - case 'field': { - nameOfSearchTypeComponent = FieldComponent; - break; - } - case 'between': { - nameOfSearchTypeComponent = BetweenComponent; - break; - } - case 'select': { - nameOfSearchTypeComponent = SelectComponent; - break; - } - case 'select-multiple': { - nameOfSearchTypeComponent = SelectMultipleComponent; - break; - } - case 'datalist': { - nameOfSearchTypeComponent = DatalistComponent; - break; - } - case 'list': { - nameOfSearchTypeComponent = ListComponent; - break; - } - case 'radio': { - nameOfSearchTypeComponent = RadioComponent; - break; - } - case 'checkbox': { - nameOfSearchTypeComponent = CheckboxComponent; - break; - } - case 'between-date': { - nameOfSearchTypeComponent = BetweenDateComponent; - break; - } - case 'date': { - nameOfSearchTypeComponent = DateComponent; - break; - } - case 'time': { - nameOfSearchTypeComponent = TimeComponent; - break; - } - case 'date-time': { - nameOfSearchTypeComponent = DateTimeComponent; - break; - } - case 'json': { - nameOfSearchTypeComponent = JsonComponent; - break; - } - default: { - nameOfSearchTypeComponent = null; - break; - } - } - return nameOfSearchTypeComponent; - } } diff --git a/client/src/app/instance/search/components/criteria/search-type/between-date.component.html b/client/src/app/instance/search/components/criteria/search-type/between-date.component.html index a0f849148797c06e26c69c89b936836ae7e82028..776a39f64a1a0403874f9de82e1063829b1862f8 100644 --- a/client/src/app/instance/search/components/criteria/search-type/between-date.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/between-date.component.html @@ -1,7 +1,7 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-sm-0"> - <div class="operator_readonly">bw</div> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-sm-0"> + <div class="operator_readonly">BW</div> </div> <div class="w-100 d-block d-sm-none"></div> <div class="col pl-sm-1"> diff --git a/client/src/app/instance/search/components/criteria/search-type/between.component.html b/client/src/app/instance/search/components/criteria/search-type/between.component.html index ae9e68b658b98c544906909461875c9c14e3e984..d48fcb25a923daf02ddcb59ef13dd2bbcb1d6bc7 100644 --- a/client/src/app/instance/search/components/criteria/search-type/between.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/between.component.html @@ -1,7 +1,7 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-3 col-lg-auto pr-sm-1 mb-1 mb-lg-0"> - <div class="operator_readonly">min</div> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-sm-0"> + <div class="operator_readonly">Min</div> </div> <div class="w-100 d-block d-sm-none"></div> <div class="col pl-sm-1 mb-1 mb-sm-0"> @@ -9,7 +9,7 @@ </div> <div class="w-100 d-block d-lg-none"></div> <div class="col col-sm-3 col-lg-auto pr-sm-1 mb-1"> - <div class="operator_readonly">max</div> + <div class="operator_readonly">Max</div> </div> <div class="w-100 d-block d-sm-none"></div> <div class="col pl-sm-1"> diff --git a/client/src/app/instance/search/components/criteria/search-type/checkbox.component.html b/client/src/app/instance/search/components/criteria/search-type/checkbox.component.html index 9cae6f77eda95db993c576f0934e4610adc07ed1..936cd8786ea93bf2d5c03df2b4c4f0158cfb743b 100644 --- a/client/src/app/instance/search/components/criteria/search-type/checkbox.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/checkbox.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-lg-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-lg-0"> <div class="operator_readonly">in</div> </div> <div class="w-100 d-block d-sm-none"></div> diff --git a/client/src/app/instance/search/components/criteria/search-type/datalist.component.html b/client/src/app/instance/search/components/criteria/search-type/datalist.component.html index 4af8b445c943b4532fabf34eb41de654924ed231..e0f39d837b2c9ec00d6e42bec28f201d5565abfc 100644 --- a/client/src/app/instance/search/components/criteria/search-type/datalist.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/datalist.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-sm-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-sm-0"> <select class="custom-select" formControlName="operator" (change)="operatorOnChange()"> <option *ngFor="let o of operators" [ngValue]="o.value">{{ o.label }}</option> </select> diff --git a/client/src/app/instance/search/components/criteria/search-type/date.component.html b/client/src/app/instance/search/components/criteria/search-type/date.component.html index 8c2b7950eb1be667647c3adcf67a680d9fd85f44..557801aa93fa1f738fc5f3bc5c40200cd9a17602 100644 --- a/client/src/app/instance/search/components/criteria/search-type/date.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/date.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-sm-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-sm-0"> <select class="custom-select" formControlName="operator" (change)="operatorOnChange()"> <option *ngFor="let o of operators" [ngValue]="o.value">{{ o.label }}</option> </select> diff --git a/client/src/app/instance/search/components/criteria/search-type/datetime.component.html b/client/src/app/instance/search/components/criteria/search-type/datetime.component.html index c199416c1c6805a4e6bd9820b685e8459f34f2a6..45437cf8579bc7cf5e589cac55e8001967b23f88 100644 --- a/client/src/app/instance/search/components/criteria/search-type/datetime.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/datetime.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-lg-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-lg-0"> <select class="custom-select" formControlName="operator" (change)="operatorOnChange()"> <option *ngFor="let o of operators" [ngValue]="o.value">{{ o.label }}</option> </select> diff --git a/client/src/app/instance/search/components/criteria/search-type/field.component.html b/client/src/app/instance/search/components/criteria/search-type/field.component.html index 84260fca17712e7719866d2431b87bc57448cf1b..9d878f528b1955392136a2082d8a0dbfd4fc9d8a 100644 --- a/client/src/app/instance/search/components/criteria/search-type/field.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/field.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-sm-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-sm-0"> <select class="custom-select" formControlName="operator" (change)="operatorOnChange()"> <option *ngFor="let o of operators" [ngValue]="o.value">{{ o.label }}</option> </select> diff --git a/client/src/app/instance/search/components/criteria/search-type/index.ts b/client/src/app/instance/search/components/criteria/search-type/index.ts index 7150b01bafb61f26522f6b1ed9d517e4c1dade8d..86a6b79373616463e2e8832ff8c0ea8ef17cc5c7 100644 --- a/client/src/app/instance/search/components/criteria/search-type/index.ts +++ b/client/src/app/instance/search/components/criteria/search-type/index.ts @@ -12,6 +12,10 @@ import { DateComponent } from './date.component'; import { TimeComponent } from './time.component'; import { DateTimeComponent } from './datetime.component'; import { JsonComponent }Â from './json.component'; +import { SvomJsonKwComponent } from './svom-json-kw.component'; + +export * from './abstract-search-type.component'; +export * from './search-type-loader.directive'; export const searchTypeComponents = [ SearchTypeLoaderDirective, @@ -27,5 +31,73 @@ export const searchTypeComponents = [ DateComponent, TimeComponent, DateTimeComponent, - JsonComponent + JsonComponent, + SvomJsonKwComponent ]; + +export const getSearchTypeComponent = (searchType: string) => { + let nameOfSearchTypeComponent = null; + switch(searchType) { + case 'field': { + nameOfSearchTypeComponent = FieldComponent; + break; + } + case 'between': { + nameOfSearchTypeComponent = BetweenComponent; + break; + } + case 'select': { + nameOfSearchTypeComponent = SelectComponent; + break; + } + case 'select-multiple': { + nameOfSearchTypeComponent = SelectMultipleComponent; + break; + } + case 'datalist': { + nameOfSearchTypeComponent = DatalistComponent; + break; + } + case 'list': { + nameOfSearchTypeComponent = ListComponent; + break; + } + case 'radio': { + nameOfSearchTypeComponent = RadioComponent; + break; + } + case 'checkbox': { + nameOfSearchTypeComponent = CheckboxComponent; + break; + } + case 'between-date': { + nameOfSearchTypeComponent = BetweenDateComponent; + break; + } + case 'date': { + nameOfSearchTypeComponent = DateComponent; + break; + } + case 'time': { + nameOfSearchTypeComponent = TimeComponent; + break; + } + case 'date-time': { + nameOfSearchTypeComponent = DateTimeComponent; + break; + } + case 'json': { + nameOfSearchTypeComponent = JsonComponent; + break; + } + case 'svom_json_kw': { + nameOfSearchTypeComponent = SvomJsonKwComponent; + break; + } + default: { + nameOfSearchTypeComponent = null; + break; + } + } + return nameOfSearchTypeComponent; +} diff --git a/client/src/app/instance/search/components/criteria/search-type/json.component.html b/client/src/app/instance/search/components/criteria/search-type/json.component.html index 4a3923a18207afe5282e7b0ea69bcecbe5810bf7..0c9b7b95527467d394696d04edbf653593b7a722 100644 --- a/client/src/app/instance/search/components/criteria/search-type/json.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/json.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-lg-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-lg-0"> <div class="operator_readonly">json</div> </div> <div class="w-100 d-block d-sm-none"></div> diff --git a/client/src/app/instance/search/components/criteria/search-type/list.component.html b/client/src/app/instance/search/components/criteria/search-type/list.component.html index 259c3bd6f026f43675dc19de9252f81abafc5bba..49e1f5f3b6c1edbb7bbad6d3ca5dfb9b418300cd 100644 --- a/client/src/app/instance/search/components/criteria/search-type/list.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/list.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-lg-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-lg-0"> <div class="operator_readonly">=</div> </div> <div class="w-100 d-block d-sm-none"></div> diff --git a/client/src/app/instance/search/components/criteria/search-type/radio.component.html b/client/src/app/instance/search/components/criteria/search-type/radio.component.html index 77994fdbb0e8f944b13c27837233136a47a3dfbc..3ace3b9bba7727c0f7f2eb802cff90a63b374dfc 100644 --- a/client/src/app/instance/search/components/criteria/search-type/radio.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/radio.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-sm-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-sm-0"> <select class="custom-select" formControlName="operator" (change)="operatorOnChange()"> <option *ngFor="let o of operators" [ngValue]="o.value">{{ o.label }}</option> </select> diff --git a/client/src/app/instance/search/components/criteria/search-type/select-multiple.component.html b/client/src/app/instance/search/components/criteria/search-type/select-multiple.component.html index 48de3a3d3a17c5636c59a4ae49005727e2e7a989..da9f153148f3f9d4f1035674562c6377d6ca2622 100644 --- a/client/src/app/instance/search/components/criteria/search-type/select-multiple.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/select-multiple.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-lg-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-lg-0"> <div class="operator_readonly">in</div> </div> <div class="w-100 d-block d-sm-none"></div> diff --git a/client/src/app/instance/search/components/criteria/search-type/select.component.html b/client/src/app/instance/search/components/criteria/search-type/select.component.html index 3e74403cdc522839caccafde2258b2e5e645097c..e1d72d96746d5707a90f64382311e3787096d2f2 100644 --- a/client/src/app/instance/search/components/criteria/search-type/select.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/select.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-sm-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-sm-0"> <select class="custom-select" formControlName="operator" (change)="operatorOnChange()"> <option *ngFor="let o of operators" [ngValue]="o.value">{{ o.label }}</option> </select> diff --git a/client/src/app/instance/search/components/criteria/search-type/svom-json-kw.component.html b/client/src/app/instance/search/components/criteria/search-type/svom-json-kw.component.html index 482a50291107fe2c42f6063751789e1e1f16f70a..07e277f16c5afd108d8a695ab2bfaa8a694c14a9 100644 --- a/client/src/app/instance/search/components/criteria/search-type/svom-json-kw.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/svom-json-kw.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-lg-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-lg-0"> <div class="operator_readonly">json</div> </div> <div class="w-100 d-block d-sm-none"></div> diff --git a/client/src/app/instance/search/components/criteria/search-type/svom-json-kw.component.ts b/client/src/app/instance/search/components/criteria/search-type/svom-json-kw.component.ts index 6196a5157fa1d0893f0e5019dd82cccb894990a3..a0ec4f412754fe5deef38724b5087c0ef28bd4c0 100644 --- a/client/src/app/instance/search/components/criteria/search-type/svom-json-kw.component.ts +++ b/client/src/app/instance/search/components/criteria/search-type/svom-json-kw.component.ts @@ -1,15 +1,21 @@ -import { Component } from '@angular/core'; +import { Component, ChangeDetectorRef } from '@angular/core'; import { FormGroup, FormControl, Validators } from '@angular/forms'; +import { HttpClient } from '@angular/common/http'; + +import { map } from 'rxjs/operators'; import { AbstractSearchTypeComponent } from './abstract-search-type.component'; -import { Criterion, JsonCriterion } from 'src/app/instance/store/models'; +import { AppConfigService } from 'src/app/app-config.service'; +import { Criterion, FieldCriterion, JsonCriterion, SvomKeyword } from 'src/app/instance/store/models'; @Component({ selector: 'app-svom-json-kw', templateUrl: 'svom-json-kw.component.html' }) export class SvomJsonKwComponent extends AbstractSearchTypeComponent { - constructor() { + svomKeywords: SvomKeyword[] = []; + + constructor(private changeDetectorRef: ChangeDetectorRef, private http: HttpClient, private config: AppConfigService) { super(); this.form = new FormGroup({ path: new FormControl('', [Validators.required]), @@ -18,6 +24,23 @@ export class SvomJsonKwComponent extends AbstractSearchTypeComponent { }); } + setCriteriaList(criteriaList: Criterion[]): void { + super.setCriteriaList(criteriaList); + if (this.svomKeywords.length < 1 && criteriaList.find((c: Criterion) => c.id === 3)) { + const acronym = (criteriaList.find((c: Criterion) => c.id === 3) as FieldCriterion).value; + this.http.get<{search_kw: SvomKeyword[]}[]>(`${this.config.apiUrl}/search/sp_cards?a=8&c=1::eq::${acronym}`).pipe( + map(data => data[0].search_kw) + ).subscribe(svomKeywords => { + this.svomKeywords = svomKeywords; + this.changeDetectorRef.detectChanges(); + }); + } + + if (this.svomKeywords.length > 0 && !criteriaList.find((c: Criterion) => c.id === 3)) { + this.svomKeywords = []; + } + } + /** * Return new criterion * @@ -30,4 +53,14 @@ export class SvomJsonKwComponent extends AbstractSearchTypeComponent { ...this.form.value } as JsonCriterion; } + + /** + * Transform a SVOM json Keyword to as path value (anis json search) + * + * @param svomKeyword Keyword selected by user + * @returns string path value + */ + getKeywordValue(svomKeyword: SvomKeyword): string { + return `${svomKeyword.extension},${svomKeyword.name}` + } } diff --git a/client/src/app/instance/search/components/criteria/search-type/time.component.html b/client/src/app/instance/search/components/criteria/search-type/time.component.html index 4d940d450c614160079f24e028379a357d4b230a..4be22d32af409726e327b53243821edf0267f399 100644 --- a/client/src/app/instance/search/components/criteria/search-type/time.component.html +++ b/client/src/app/instance/search/components/criteria/search-type/time.component.html @@ -1,6 +1,6 @@ <form [formGroup]="form" novalidate> <div class="row form-group"> - <div class="col col-sm-auto pr-sm-1 mb-1 mb-lg-0"> + <div class="col-md-3 col-sm-auto pr-sm-1 mb-1 mb-lg-0"> <select class="custom-select" formControlName="operator" (change)="operatorOnChange()"> <option *ngFor="let o of operators" [ngValue]="o.value">{{ o.label }}</option> </select> diff --git a/client/src/app/instance/search/containers/criteria.component.html b/client/src/app/instance/search/containers/criteria.component.html index 4562f36f92c1ff462f252b6fe76ef40a5e345164..a9025abf7e7c93d0b966dcad851925c839fea4f2 100644 --- a/client/src/app/instance/search/containers/criteria.component.html +++ b/client/src/app/instance/search/containers/criteria.component.html @@ -25,9 +25,6 @@ [attributeList]="attributeList | async | sortByCriteriaDisplay" [criteriaFamilyList]="criteriaFamilyList | async" [criteriaList]="criteriaList | async" - [svomKeywords]="svomKeywords | async" - (selectSvomAcronym)="selectSvomAcronym($event)" - (resetSvomKeywords)="resetSvomKeywords()" (addCriterion)="addCriterion($event)" (deleteCriterion)="deleteCriterion($event)"> </app-criteria-tabs> diff --git a/client/src/app/instance/search/containers/criteria.component.ts b/client/src/app/instance/search/containers/criteria.component.ts index 1250886478bb2e4dea91e096c79ade9dd6e7780c..3735cba655c3ef0d40beff4841eb313b2c8e61d2 100644 --- a/client/src/app/instance/search/containers/criteria.component.ts +++ b/client/src/app/instance/search/containers/criteria.component.ts @@ -18,8 +18,6 @@ import { ConeSearch, Criterion, Resolver, SvomKeyword } from '../../store/models import * as searchActions from '../../store/actions/search.actions'; import * as coneSearchActions from '../../store/actions/cone-search.actions'; import * as coneSearchSelector from '../../store/selectors/cone-search.selector'; -import * as svomJsonKwActions from '../../store/actions/svom-json-kw.actions'; -import * as svomJsonKwSelector from '../../store/selectors/svom-json-kw.selector'; import * as coneSearchConfigActions from 'src/app/metamodel/actions/cone-search-config.actions'; import * as coneSearchConfigSelector from 'src/app/metamodel/selectors/cone-search-config.selector'; @@ -38,7 +36,6 @@ export class CriteriaComponent extends AbstractSearchComponent { public coneSearchConfig: Observable<ConeSearchConfig>; public coneSearchConfigIsLoading: Observable<boolean>; public coneSearchConfigIsLoaded: Observable<boolean>; - public svomKeywords: Observable<SvomKeyword[]>; constructor(protected store: Store<{ }>) { super(store); @@ -48,7 +45,6 @@ export class CriteriaComponent extends AbstractSearchComponent { this.coneSearchConfig = store.select(coneSearchConfigSelector.selectConeSearchConfig); this.coneSearchConfigIsLoading = store.select(coneSearchConfigSelector.selectConeSearchConfigIsLoading); this.coneSearchConfigIsLoaded = store.select(coneSearchConfigSelector.selectConeSearchConfigIsLoaded); - this.svomKeywords = this.store.select(svomJsonKwSelector.selectSvomKeywords); } ngOnInit(): void { @@ -102,12 +98,4 @@ export class CriteriaComponent extends AbstractSearchComponent { retrieveCoordinates(name: string): void { this.store.dispatch(coneSearchActions.retrieveCoordinates({ name })); } - - selectSvomAcronym(acronymSelected: string): void { - this.store.dispatch(svomJsonKwActions.selectAcronym({ acronymSelected })); - } - - resetSvomKeywords(): void { - Promise.resolve(null).then(() => this.store.dispatch(svomJsonKwActions.resetKw())); - } } diff --git a/client/src/app/instance/store/actions/svom-json-kw.actions.ts b/client/src/app/instance/store/actions/svom-json-kw.actions.ts deleted file mode 100644 index 4ce485e9783ec82278d2d63a98a4fd2f089bde48..0000000000000000000000000000000000000000 --- a/client/src/app/instance/store/actions/svom-json-kw.actions.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file is part of Anis Client. - * - * @copyright Laboratoire d'Astrophysique de Marseille / CNRS - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -import { createAction, props } from '@ngrx/store'; - -import { SvomKeyword } from '../models'; - -export const resetKw = createAction('[SVOM Json Kw] Reset Kw'); -export const selectAcronym = createAction('[SVOM Json Kw] Select Acronym', props<{ acronymSelected: string }>()); -export const loadKwSearchable = createAction('[SVOM Json Kw] Load Kw Searchable'); -export const loadKwSearchableSuccess = createAction('[SVOM Json Kw] Load Kw Searchable Success', props<{ svomKeywords: SvomKeyword[] }>()); -export const loadKwSearchableFail = createAction('[SVOM Json Kw] Load Kw Searchable Fail'); \ No newline at end of file diff --git a/client/src/app/instance/store/effects/index.ts b/client/src/app/instance/store/effects/index.ts index 54904d02d268a79b5399d5e74f70dc83bdb5c542..b588987262f9d04267a81591ebb1b3a41c37b8e3 100644 --- a/client/src/app/instance/store/effects/index.ts +++ b/client/src/app/instance/store/effects/index.ts @@ -2,7 +2,6 @@ import { SearchEffects } from './search.effects'; import { SearchMultipleEffects } from './search-multiple.effects'; import { ConeSearchEffects } from './cone-search.effects'; import { DetailEffects } from './detail.effects'; -import { SvomJsonKwEffects } from './svom-json-kw.effects'; import { ArchiveEffects } from './archive.effects'; export const instanceEffects = [ @@ -10,6 +9,5 @@ export const instanceEffects = [ SearchMultipleEffects, ConeSearchEffects, DetailEffects, - SvomJsonKwEffects, ArchiveEffects ]; diff --git a/client/src/app/instance/store/effects/svom-json-kw.effects.spec.ts b/client/src/app/instance/store/effects/svom-json-kw.effects.spec.ts deleted file mode 100644 index ed3ca655f9ce922c6c0f93729243897bbb2eaf07..0000000000000000000000000000000000000000 --- a/client/src/app/instance/store/effects/svom-json-kw.effects.spec.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { provideMockActions } from '@ngrx/effects/testing'; -import { EffectsMetadata, getEffectsMetadata } from '@ngrx/effects'; -import { provideMockStore } from '@ngrx/store/testing'; -import { Observable } from 'rxjs'; -import { ToastrService } from 'ngx-toastr'; - -import { SvomJsonKwEffects } from './svom-json-kw.effects'; -import { SvomJsonKwService } from '../services/svom-json-kw.service'; -import * as fromSvomJsonKw from '../reducers/svom-json-kw.reducer'; - -describe('[Instance][Store] SvomJsonKwEffects', () => { - let actions = new Observable(); - let effects: SvomJsonKwEffects; - let metadata: EffectsMetadata<SvomJsonKwEffects>; - let svomJsonKwService: SvomJsonKwService; - let toastr: ToastrService; - const initialState = { - instance: { - svomJsonKw: { ...fromSvomJsonKw.initialState } - } - }; - - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [ - SvomJsonKwEffects, - { provide: SvomJsonKwService, useValue: { loadKwSearchable: jest.fn() }}, - { provide: ToastrService, useValue: { success: jest.fn(), error: jest.fn() }}, - provideMockActions(() => actions), - provideMockStore({ initialState }) - ] - }).compileComponents(); - effects = TestBed.inject(SvomJsonKwEffects); - metadata = getEffectsMetadata(effects); - svomJsonKwService = TestBed.inject(SvomJsonKwService); - toastr = TestBed.inject(ToastrService); - }); - - it('should be created', () => { - expect(effects).toBeTruthy(); - }); -}); diff --git a/client/src/app/instance/store/effects/svom-json-kw.effects.ts b/client/src/app/instance/store/effects/svom-json-kw.effects.ts deleted file mode 100644 index 2a50a0edfd4b1b73b5a4ba5abf05e7104fd3b5cb..0000000000000000000000000000000000000000 --- a/client/src/app/instance/store/effects/svom-json-kw.effects.ts +++ /dev/null @@ -1,71 +0,0 @@ -/** - * This file is part of Anis Client. - * - * @copyright Laboratoire d'Astrophysique de Marseille / CNRS - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -import { Injectable } from '@angular/core'; - -import { Actions, createEffect, ofType, concatLatestFrom } from '@ngrx/effects'; -import { Store } from '@ngrx/store'; -import { of } from 'rxjs'; -import { map, tap, mergeMap, catchError } from 'rxjs/operators'; -import { ToastrService } from 'ngx-toastr'; - -import * as svomJsonKwActions from '../actions/svom-json-kw.actions'; -import * as svomJsonKwSelector from '../selectors/svom-json-kw.selector'; - -import { SvomJsonKwService } from '../services/svom-json-kw.service'; - -/** - * @class - * @classdesc Svom Json Kw effects. - */ -@Injectable() -export class SvomJsonKwEffects { - selectAcronym$ = createEffect((): any => - this.actions$.pipe( - ofType(svomJsonKwActions.selectAcronym), - map(() => svomJsonKwActions.loadKwSearchable()) - ) - ); - - loadKwSearchable$ = createEffect(() => - this.actions$.pipe( - ofType(svomJsonKwActions.loadKwSearchable), - concatLatestFrom(() => this.store.select(svomJsonKwSelector.selectAcronymSelected)), - mergeMap(([, acronymSelected]) => this.svomJsonKwService.loadKwSearchable(acronymSelected) - .pipe( - map(svomKeywords => svomJsonKwActions.loadKwSearchableSuccess({ svomKeywords })), - catchError(() => of(svomJsonKwActions.loadKwSearchableFail())) - ) - ) - ) - ); - - loadKwSearchableSuccess$ = createEffect(() => - this.actions$.pipe( - ofType(svomJsonKwActions.loadKwSearchableSuccess), - tap(() => { - this.toastr.success('SVOM Json Keywords was loaded successfully and are now available to product criteria', 'SVOM Json Keywords loaded') - }) - ), { dispatch: false} - ); - - addDatabaseFail$ = createEffect(() => - this.actions$.pipe( - ofType(svomJsonKwActions.loadKwSearchableFail), - tap(() => this.toastr.error('Failure to load Keywords', 'SVOM Json Keywords loaded failed')) - ), { dispatch: false} - ); - - constructor( - private actions$: Actions, - private store: Store<{ }>, - private svomJsonKwService: SvomJsonKwService, - private toastr: ToastrService - ) {} -} diff --git a/client/src/app/instance/store/reducers/svom-json-kw.reducer.spec.ts b/client/src/app/instance/store/reducers/svom-json-kw.reducer.spec.ts deleted file mode 100644 index b5c3ae74ae385531869dbb3dda44ce1cd42d6094..0000000000000000000000000000000000000000 --- a/client/src/app/instance/store/reducers/svom-json-kw.reducer.spec.ts +++ /dev/null @@ -1,82 +0,0 @@ -import * as fromSvomJsonKw from './svom-json-kw.reducer'; -import * as svomJsonKwActions from '../actions/svom-json-kw.actions'; - -describe('[Instance][Store] Svom Json Kw reducer', () => { - it('unknown action should return the default state', () => { - const { initialState } = fromSvomJsonKw; - const action = { type: 'Unknown' }; - const state = fromSvomJsonKw.svomJsonKwReducer(initialState, action); - - expect(state).toBe(initialState); - }); - - it('resetKw action should return the default state', () => { - const { initialState } = fromSvomJsonKw; - const action = svomJsonKwActions.resetKw(); - const state = fromSvomJsonKw.svomJsonKwReducer(initialState, action); - - expect(state).toEqual(initialState); - }); - - it('selectAcronym action should change the acronymSelected', () => { - const { initialState } = fromSvomJsonKw; - const action = svomJsonKwActions.selectAcronym({ acronymSelected: 'OBLC_ECL' }); - const state = fromSvomJsonKw.svomJsonKwReducer(initialState, action); - - expect(state.acronymSelected).toBe('OBLC_ECL'); - expect(state.svomKeywords).toEqual([]); - expect(state.svomKeywordsIsLoading).toBeFalsy(); - expect(state.svomKeywordsIsLoaded).toBeFalsy(); - expect(state).not.toBe(initialState); - }); - - it('loadKwSearchable action should change the svomKeywordsLoading and svomKeywordsLoaded', () => { - const { initialState } = fromSvomJsonKw; - const action = svomJsonKwActions.loadKwSearchable(); - const state = fromSvomJsonKw.svomJsonKwReducer(initialState, action); - - expect(state.acronymSelected).toBeNull(); - expect(state.svomKeywords).toEqual([]); - expect(state.svomKeywordsIsLoading).toBeTruthy(); - expect(state.svomKeywordsIsLoaded).toBeFalsy(); - expect(state).not.toBe(initialState); - }); - - it('loadKwSearchableSuccess action should change the svomKeywords, svomKeywordsLoading and svomKeywordsLoaded', () => { - const { initialState } = fromSvomJsonKw; - const svomKeywords = [ - { - data_type: 'string', - default: '', - extension: 'PrimaryHDU', - name: 'CARD' - }, - { - data_type: 'string', - default: '', - extension: 'PrimaryHDU', - name: 'TIME' - } - ]; - const action = svomJsonKwActions.loadKwSearchableSuccess({ svomKeywords }); - const state = fromSvomJsonKw.svomJsonKwReducer(initialState, action); - - expect(state.acronymSelected).toBeNull(); - expect(state.svomKeywords).toEqual(svomKeywords); - expect(state.svomKeywordsIsLoading).toBeFalsy(); - expect(state.svomKeywordsIsLoaded).toBeTruthy(); - expect(state).not.toBe(initialState); - }); - - it('loadKwSearchableFail action should change the svomKeywordsLoading and svomKeywordsLoaded', () => { - const { initialState } = fromSvomJsonKw; - const action = svomJsonKwActions.loadKwSearchableFail(); - const state = fromSvomJsonKw.svomJsonKwReducer(initialState, action); - - expect(state.acronymSelected).toBeNull(); - expect(state.svomKeywords).toEqual([]); - expect(state.svomKeywordsIsLoading).toBeFalsy(); - expect(state.svomKeywordsIsLoaded).toBeFalsy(); - expect(state).not.toBe(initialState); - }); -}); diff --git a/client/src/app/instance/store/reducers/svom-json-kw.reducer.ts b/client/src/app/instance/store/reducers/svom-json-kw.reducer.ts deleted file mode 100644 index 37c8526080be9f97eaa006dab18595950c64cb4c..0000000000000000000000000000000000000000 --- a/client/src/app/instance/store/reducers/svom-json-kw.reducer.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * This file is part of Anis Client. - * - * @copyright Laboratoire d'Astrophysique de Marseille / CNRS - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -import { createReducer, on } from '@ngrx/store'; - -import { SvomKeyword } from '../models'; -import * as svomJsonKwActions from '../actions/svom-json-kw.actions'; - -/** - * Interface for svom json kw state. - * - * @interface State - */ -export interface State { - acronymSelected: string; - svomKeywords: SvomKeyword[]; - svomKeywordsIsLoading: boolean; - svomKeywordsIsLoaded: boolean; -} - -export const initialState: State = { - acronymSelected: null, - svomKeywords: [], - svomKeywordsIsLoading: false, - svomKeywordsIsLoaded: false -}; - -export const svomJsonKwReducer = createReducer( - initialState, - on(svomJsonKwActions.resetKw, () => ({ - ...initialState - })), - on(svomJsonKwActions.selectAcronym, (state, { acronymSelected }) => ({ - ...state, - acronymSelected - })), - on(svomJsonKwActions.loadKwSearchable, (state) => ({ - ...state, - svomKeywordsIsLoading: true, - svomKeywordsIsLoaded: false - })), - on(svomJsonKwActions.loadKwSearchableSuccess, (state, { svomKeywords }) => ({ - ...state, - svomKeywords, - svomKeywordsIsLoading: false, - svomKeywordsIsLoaded: true - })), - on(svomJsonKwActions.loadKwSearchableFail, (state) => ({ - ...state, - svomKeywordsIsLoading: false, - svomKeywordsIsLoaded: false - })), -); - -export const selectAcronymSelected = (state: State) => state.acronymSelected; -export const selectSvomKeywords = (state: State) => state.svomKeywords; -export const selectSvomKeywordsIsLoading = (state: State) => state.svomKeywordsIsLoading; -export const selectSvomKeywordsIsLoaded = (state: State) => state.svomKeywordsIsLoaded; diff --git a/client/src/app/instance/store/selectors/svom-json-kw.selector.spec.ts b/client/src/app/instance/store/selectors/svom-json-kw.selector.spec.ts deleted file mode 100644 index e3e9604ca9f040164052454c0725d3990afa4822..0000000000000000000000000000000000000000 --- a/client/src/app/instance/store/selectors/svom-json-kw.selector.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import * as svomJsonKwSelector from './svom-json-kw.selector'; -import * as fromSvomJsonKw from '../reducers/svom-json-kw.reducer'; - -describe('[Instance][Store] Svom Json Kw selector', () => { - it('should get selectAcronymSelected', () => { - const state = { instance: { svomJsonKw: { ...fromSvomJsonKw.initialState }}}; - expect(svomJsonKwSelector.selectAcronymSelected(state)).toBeNull(); - }); - - it('should get selectSvomKeywords', () => { - const state = { instance: { svomJsonKw: { ...fromSvomJsonKw.initialState }}}; - expect(svomJsonKwSelector.selectSvomKeywords(state)).toEqual([]); - }); - - it('should get selectSvomKeywordsIsLoading', () => { - const state = { instance: { svomJsonKw: { ...fromSvomJsonKw.initialState }}}; - expect(svomJsonKwSelector.selectSvomKeywordsIsLoading(state)).toBeFalsy(); - }); - - it('should get selectSvomKeywordsIsLoaded', () => { - const state = { instance: { svomJsonKw: { ...fromSvomJsonKw.initialState }}}; - expect(svomJsonKwSelector.selectSvomKeywordsIsLoaded(state)).toBeFalsy(); - }); -}); diff --git a/client/src/app/instance/store/selectors/svom-json-kw.selector.ts b/client/src/app/instance/store/selectors/svom-json-kw.selector.ts deleted file mode 100644 index c178ec6252e68bd9ef6c5f62d1ab836572cfb970..0000000000000000000000000000000000000000 --- a/client/src/app/instance/store/selectors/svom-json-kw.selector.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file is part of Anis Client. - * - * @copyright Laboratoire d'Astrophysique de Marseille / CNRS - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -import { createSelector } from '@ngrx/store'; - -import * as reducer from '../../instance.reducer'; -import * as svomJsonKw from '../reducers/svom-json-kw.reducer'; - -export const selectSvomJsonKwState = createSelector( - reducer.getInstanceState, - (state: reducer.State) => state.svomJsonKw -); - -export const selectAcronymSelected = createSelector( - selectSvomJsonKwState, - svomJsonKw.selectAcronymSelected -); - -export const selectSvomKeywords = createSelector( - selectSvomJsonKwState, - svomJsonKw.selectSvomKeywords -); - -export const selectSvomKeywordsIsLoading = createSelector( - selectSvomJsonKwState, - svomJsonKw.selectSvomKeywordsIsLoading -); - -export const selectSvomKeywordsIsLoaded = createSelector( - selectSvomJsonKwState, - svomJsonKw.selectSvomKeywordsIsLoaded -); diff --git a/client/src/app/instance/store/services/index.ts b/client/src/app/instance/store/services/index.ts index 6ea85f7ae67883198ce83ba02b1e902d97d7e002..612ce58c973061850cee382172153456a9dc7134 100644 --- a/client/src/app/instance/store/services/index.ts +++ b/client/src/app/instance/store/services/index.ts @@ -1,13 +1,11 @@ import { SearchService } from './search.service'; import { ConeSearchService } from './cone-search.service'; import { DetailService } from './detail.service'; -import { SvomJsonKwService } from './svom-json-kw.service'; import { ArchiveService } from './archive.service'; export const instanceServices = [ SearchService, ConeSearchService, DetailService, - SvomJsonKwService, ArchiveService ]; diff --git a/client/src/app/instance/store/services/svom-json-kw.service.spec.ts b/client/src/app/instance/store/services/svom-json-kw.service.spec.ts deleted file mode 100644 index 6a334fd2e614672688049927afef84a0273f165e..0000000000000000000000000000000000000000 --- a/client/src/app/instance/store/services/svom-json-kw.service.spec.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * This file is part of Anis Client. - * - * @copyright Laboratoire d'Astrophysique de Marseille / CNRS - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -import { TestBed, inject } from '@angular/core/testing'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; - -import { SvomJsonKwService } from './svom-json-kw.service'; -import { AppConfigService } from 'src/app/app-config.service'; - -describe('[Instance][Store] SvomJsonKwService', () => { - let service: SvomJsonKwService; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule], - providers: [ - { provide: AppConfigService, useValue: { apiUrl: 'http://testing.com' } }, - SvomJsonKwService - ] - }); - service = TestBed.inject(SvomJsonKwService); - }); - - it('#retrieveData() should return an Observable<any[]>', - inject([HttpTestingController, SvomJsonKwService],(httpMock: HttpTestingController, svomJsonKwService: SvomJsonKwService) => { - const mockResponse = ['myData']; - - svomJsonKwService.loadKwSearchable('OBLC_ECL').subscribe((event: any[]) => { - expect(event).toEqual(mockResponse); - }); - - const mockRequest = httpMock.expectOne('http://testing.com/search/sp_cards?a=8&c=1::eq::OBLC_ECL'); - - expect(mockRequest.cancelled).toBeFalsy(); - expect(mockRequest.request.responseType).toEqual('json'); - mockRequest.flush(mockResponse); - - httpMock.verify(); - } - ) - ); -}); \ No newline at end of file diff --git a/client/src/app/instance/store/services/svom-json-kw.service.ts b/client/src/app/instance/store/services/svom-json-kw.service.ts deleted file mode 100644 index e86072e9d9d94687519559fb8ff638c5dcddc9d4..0000000000000000000000000000000000000000 --- a/client/src/app/instance/store/services/svom-json-kw.service.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file is part of Anis Client. - * - * @copyright Laboratoire d'Astrophysique de Marseille / CNRS - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; - -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; - -import { AppConfigService } from 'src/app/app-config.service'; -import { SvomKeyword } from '../models'; - -/** - * @class - * @classdesc Svom Json Kw service. - */ -@Injectable() -export class SvomJsonKwService { - constructor(private http: HttpClient, private config: AppConfigService) { } - - /** - * Retrieves searchable keywords for the given acronym. - * - * @param {string} acronym - The acronym. - * - * @return Observable<SvomKeyword[]> - */ - loadKwSearchable(acronym: string): Observable<SvomKeyword[]> { - return this.http.get<{search_kw: SvomKeyword[]}[]>(`${this.config.apiUrl}/search/sp_cards?a=8&c=1::eq::${acronym}`).pipe( - map(data => data[0].search_kw) - ); - } -}