Commit af213012 authored by ext.sopra.ncastejon's avatar ext.sopra.ncastejon
Browse files

Add pagination to the url service.

parent 9a62729b
......@@ -9,7 +9,8 @@
</div>
<div class="resource-downloadable-files" *ngFor="let resource of downloadable.value">
<ng-container *ngFor="let format of resource.formats; let i=index">
<app-resource-download-item [format]="format" [resource]="resource" [projections]="projections"
<app-resource-download-item [metadata]="metadata"
[format]="format" [resource]="resource" [projections]="projections"
[isQueryable]="true">
</app-resource-download-item>
</ng-container>
......
......@@ -153,6 +153,7 @@ export class ResourceDownloadItemComponent implements OnInit {
outputFormat +
projectionAndBbox.projection +
projectionAndBbox.bboxRequest;
} else if (this.resource.type === linkFormats.ws) {
if (this.format.name === 'JSON') {
queryableUrl += `/${this.resource.metadataLink.name}/all.json`;
......
......@@ -51,13 +51,10 @@ export class ResultsComponent implements OnInit, OnDestroy {
this._route.queryParams.subscribe((params) => {
if (params && Object.keys(params).length > 0) {
console.log(params);
const filters = this._datasetResearchService.filters;
// Create the ESOptions
const options = this._researchUrlService.getOptionsFromParameters(params);
console.log(options);
this._datasetResearchService.elasticSearchOptions = new ElasticsearchOptions(options);
}
});
......
......@@ -539,6 +539,8 @@ export class DatasetResearchService {
paginationChanged(pageSize: number, pageIndex: number) {
this._elasticsearchOptions.pageSize = pageSize;
this._elasticsearchOptions.pageIndex = pageIndex;
this._researchUrlService.setPaginationParameter(pageIndex);
this._searchChangeSubject.next();
}
......
......@@ -33,6 +33,9 @@ export class ResearchUrlService {
};
options.sortOptions = optionsSort;
this._parameters[key] = params[key];
} else if (key === 'page') {
this._parameters[key] = params[key];
options.pageIndex = Number(params[key]) - 1;
}
});
......@@ -45,6 +48,12 @@ export class ResearchUrlService {
this._location.go(AppRoutes.research.uri, params);
}
setPaginationParameter(pageIndex: number) {
this._parameters['page'] = pageIndex;
const params = this.generateParams();
this._location.go(AppRoutes.research.uri, params);
}
setSortParameter(option: ISortOption) {
// If desc we prefix with '-'
const value = option.order === 'desc' ? `-${option.value}` : option.value;
......
......@@ -93,7 +93,7 @@ export class MapService {
// Subscribe to the error observable and send a notification
this._errorSubscription = errorObservable.subscribe((v) => {
console.log(v);
// console.log(v);
this._notificationService.notify(
new Notification({
message: notificationMessages.geosource.mapError,
......
Markdown is supported
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