diff --git a/src/app/search/search-routing.module.ts b/src/app/search/search-routing.module.ts index b8f6be771c4be73aee008fe104f45fe89306d08f..1b6244928aab6701f453a56697fcf50f4eaa50d7 100644 --- a/src/app/search/search-routing.module.ts +++ b/src/app/search/search-routing.module.ts @@ -32,6 +32,10 @@ const routes: Routes = [ imports: [RouterModule.forChild(routes)], exports: [RouterModule] }) +/** + * @class + * @classdesc Search routing module. + */ export class SearchRoutingModule { } export const routedComponents = [ diff --git a/src/app/search/search.module.ts b/src/app/search/search.module.ts index f4c029645f28e4fc81296a448f230994eb752ae9..7209a04449f1ad0907c3b2f897fee99a27b63b44 100644 --- a/src/app/search/search.module.ts +++ b/src/app/search/search.module.ts @@ -34,4 +34,8 @@ import { reducer } from './store/search.reducer'; ], providers: [SearchService] }) +/** + * @class + * @classdesc Search module. + */ export class SearchModule { } diff --git a/src/app/search/store/search.effects.ts b/src/app/search/store/search.effects.ts index bc218a515ce203b3845d598a42d596b9e8b06f91..e4157218e43ecc030b74c7f2936ef526ffd98f9c 100644 --- a/src/app/search/store/search.effects.ts +++ b/src/app/search/store/search.effects.ts @@ -32,6 +32,10 @@ import * as utils from '../../shared/utils'; import { getCriterionStr } from '../../shared/utils'; @Injectable() +/** + * @class + * @classdesc Search effects. + */ export class SearchEffects { constructor( private actions$: Actions, @@ -44,7 +48,7 @@ export class SearchEffects { coneSearch: fromConeSearch.State }> ) { } - + @Effect() initSearchByUrlAction$ = this.actions$.pipe( ofType(searchActions.INIT_SEARCH_BY_URL), diff --git a/src/app/search/store/search.reducer.ts b/src/app/search/store/search.reducer.ts index 8fde14f2978ebfb52265181675a49d6d9091a175..a7bc23d21d67ad4f6187f65c3a1886911ab3a0b0 100644 --- a/src/app/search/store/search.reducer.ts +++ b/src/app/search/store/search.reducer.ts @@ -10,6 +10,11 @@ import * as actions from './search.action'; import { Criterion } from './model'; +/** + * Interface for search state. + * + * @interface State + */ export interface State { pristine: boolean; currentStep: string; @@ -50,6 +55,14 @@ export const initialState: State = { processId: null }; +/** + * Reduces state. + * + * @param {State} state - The state. + * @param {actions} action - The action. + * + * @return State + */ export function reducer(state: State = initialState, action: actions.Actions): State { switch (action.type) { case actions.CHANGE_STEP: diff --git a/src/app/search/store/search.service.ts b/src/app/search/store/search.service.ts index c601660f169b9c57c2dc5a095f55628a933363e8..f5f76ba1f61ee126790d6e04be974860a1079119 100644 --- a/src/app/search/store/search.service.ts +++ b/src/app/search/store/search.service.ts @@ -10,29 +10,65 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + import { environment } from '../../../environments/environment'; @Injectable() +/** + * @class + * @classdesc Search service. + */ export class SearchService { API_PATH: string = environment.apiUrl; instanceName: string = environment.instanceName; constructor(private http: HttpClient) { } - retrieveData(query: string) { + /** + * Retrieves results for the given parameters. + * + * @param {string} query - The query. + * + * @return Observable<any[]> + */ + retrieveData(query: string): Observable<any[]> { return this.http.get<any[]>(this.API_PATH + '/search/' + query); } - getDataLength(query: string) { + /** + * Retrieves results number for the given parameters. + * + * @param {string} query - The query. + * + * @return Observable<{ nb: number }[]> + */ + getDataLength(query: string): Observable<{ nb: number }[]> { return this.http.get<{ nb: number }[]>(this.API_PATH + '/search/' + query); } - executeProcess(typeProcess: string, dname: string, query: string) { + /** + * Executes process with the given parameters. + * + * @param {string} typeProcess - The process type. + * @param {string} dname - The dataset name. + * @param {string} query - The query. + * + * @return Observable<any> + */ + executeProcess(typeProcess: string, dname: string, query: string): Observable<any> { const url = this.API_PATH + '/service/' + this.instanceName + '/' + dname + '/' + typeProcess + query; return this.http.get<any>(url); } - checkProcess(id: string) { + /** + * Checks if process with the given ID is done. + * + * @param {string} id - The process ID. + * + * @return Observable<any> + */ + checkProcess(id: string): Observable<any> { return this.http.head<any>('http://0.0.0.0:8085/' + id + '.csv'); } } diff --git a/src/app/shared/cone-search/store/cone-search.service.ts b/src/app/shared/cone-search/store/cone-search.service.ts index 7f6684731ff39dacefd4675254bb6187f3ed2f64..37c3420e5f1af5b426de2cf6bc6c8885e152f8bb 100644 --- a/src/app/shared/cone-search/store/cone-search.service.ts +++ b/src/app/shared/cone-search/store/cone-search.service.ts @@ -10,7 +10,6 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; -import { DatasetCount } from '../../../search-multiple/store/model'; @Injectable() /**