-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feature flags: add service * Feature flags: adapt navigation side menu * New page "Search with AQL" (#624) * New page "Search with AQL" * Improve "Search with AQL" page * add feature toggle for data explorer for the manager role * search-with-aql to search-by-manager feature name * testing * test fixes * test fixes * add: FeatureService, HttpClient, HttpHandler, * test datafilter fix * FeatureActivatedDirective not standalone --------- Co-authored-by: Andreas Kling <[email protected]>
- Loading branch information
Showing
30 changed files
with
469 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { HttpClient, HttpErrorResponse } from '@angular/common/http' | ||
import { Injectable } from '@angular/core' | ||
import { Observable, throwError } from 'rxjs' | ||
import { catchError, map, shareReplay } from 'rxjs/operators' | ||
import { AppConfigService } from 'src/app/config/app-config.service' | ||
import { IFeature } from '../../../shared/models/feature/feature.interface' | ||
import { AvailableFeatures } from '../../../shared/models/feature/available-features.enum' | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class FeatureService { | ||
private baseUrl: string | ||
|
||
private features: Observable<AvailableFeatures[]> | ||
|
||
constructor( | ||
private appConfigService: AppConfigService, | ||
private httpClient: HttpClient | ||
) { | ||
this.baseUrl = `${this.appConfigService.config.api.baseUrl}` | ||
this.createObservable() | ||
} | ||
|
||
getFeature(): Observable<AvailableFeatures[]> { | ||
return this.features | ||
} | ||
|
||
createObservable(): void { | ||
this.features = this.httpClient.get<IFeature>(`${this.baseUrl}/feature`).pipe( | ||
catchError(this.handleError), | ||
map((res) => { | ||
return Object.values(AvailableFeatures) | ||
.filter((k) => isNaN(Number(k))) | ||
.map((value, index) => | ||
res[value[0].toLowerCase() + value.toString().substring(1)] ? index : null | ||
) | ||
.filter((value) => value != null) | ||
}), | ||
shareReplay(1) | ||
) | ||
} | ||
|
||
handleError(error: HttpErrorResponse): Observable<never> { | ||
return throwError(() => error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { HttpClient, HttpErrorResponse } from '@angular/common/http' | ||
import { Injectable } from '@angular/core' | ||
import { BehaviorSubject, Observable, throwError } from 'rxjs' | ||
import { catchError, tap } from 'rxjs/operators' | ||
import { AppConfigService } from 'src/app/config/app-config.service' | ||
import { IAqlExecutionResponse } from 'src/app/shared/models/aql/execution/aql-execution-response.interface' | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class QueryService { | ||
private baseUrl: string | ||
|
||
private projectData: IAqlExecutionResponse = null | ||
private projectDataSubject$ = new BehaviorSubject(this.projectData) | ||
private query: string | ||
|
||
constructor( | ||
private appConfigService: AppConfigService, | ||
private httpClient: HttpClient | ||
) { | ||
this.baseUrl = `${this.appConfigService.config.api.baseUrl}` | ||
} | ||
|
||
setQuery(query: string) { | ||
this.query = query | ||
} | ||
|
||
getData(): Observable<IAqlExecutionResponse> { | ||
return this.httpClient | ||
.post<IAqlExecutionResponse>(`${this.baseUrl}/query/execute`, { | ||
aql: this.query, | ||
}) | ||
.pipe( | ||
tap((res) => { | ||
this.projectData = res | ||
this.projectDataSubject$.next(res) | ||
}), | ||
catchError(this.handleError) | ||
) | ||
} | ||
|
||
handleError(error: HttpErrorResponse): Observable<never> { | ||
return throwError(() => error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.