- add themes.css
- add DatasetService.ts and InternalIdHandler
This commit is contained in:
parent
427b7b9c91
commit
92d0e94582
11 changed files with 327 additions and 39 deletions
|
@ -14,8 +14,9 @@ import { MessageService } from './message.service';
|
|||
import { GeomonPlatform } from '../../shared/models/platform';
|
||||
import { Dataset, GeomonTimeseries } from '../../shared/models/dataset';
|
||||
|
||||
import { deserialize } from 'class-transformer';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { InternalIdHandler } from '../../common/components/services/internal-id-handler.service';
|
||||
// @Injectable({
|
||||
// providedIn: 'root'
|
||||
// })
|
||||
|
@ -27,7 +28,8 @@ export class DatasetApiService {
|
|||
constructor(
|
||||
private httpClient: HttpClient,
|
||||
protected httpService: HttpService,
|
||||
private messageService: MessageService) {
|
||||
private messageService: MessageService,
|
||||
protected internalDatasetId: InternalIdHandler,) {
|
||||
}
|
||||
|
||||
public getPhenomena(apiUrl: string, params?: any, options?: any) {
|
||||
|
@ -73,13 +75,24 @@ export class DatasetApiService {
|
|||
|
||||
public getDataset(id: string, apiUrl: string, params?: any, options?: HttpRequestOptions): Observable<GeomonTimeseries> {
|
||||
const url = this.createRequestUrl(apiUrl, 'datasets', id);
|
||||
return this.requestApi<GeomonTimeseries>(url, params, options);
|
||||
//.pipe(
|
||||
// map((res) => this.prepareDataset(res, apiUrl))
|
||||
// );
|
||||
return this.requestApi<GeomonTimeseries>(url, params, options)
|
||||
.pipe(
|
||||
map((res) => this.prepareDataset(res, apiUrl))
|
||||
);
|
||||
}
|
||||
|
||||
//#region Helper method
|
||||
|
||||
private prepareDataset(datasetObj:GeomonTimeseries, apiUrl: string) {
|
||||
let dataset = deserialize<GeomonTimeseries>(GeomonTimeseries, JSON.stringify(datasetObj));
|
||||
dataset.url = apiUrl;
|
||||
this.internalDatasetId.generateInternalId(dataset);
|
||||
// if (dataset.seriesParameters) {
|
||||
// dataset.parameters = dataset.seriesParameters;
|
||||
// delete dataset.seriesParameters;
|
||||
// }
|
||||
return dataset;
|
||||
}
|
||||
|
||||
protected createGeomonPlatform(feature: Station): GeomonPlatform {
|
||||
const datasetIds = [];
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue