openaire-library/dashboard/plugins/components/featured-datasets/plugin-featured-datasets.co...

37 lines
1.6 KiB
TypeScript

import {Component} from '@angular/core';
import {PluginBaseComponent} from "../../utils/base-plugin.component";
import {FetchResearchResults} from "../../../../utils/fetchEntitiesClasses/fetchResearchResults.class";
import {SearchResearchResultsService} from "../../../../services/searchResearchResults.service";
export class PluginFeaturedDatasets {
title: string = "Featured datasets";
textLine1: string = "Here are listed some of the most important energy datasets as selected by energy experts.";
textLine2: string = "Check them if you want to easily explore and visualize the European energy landscape, using only well-known datasets which you can trust.";
}
@Component({
selector: 'plugin-featured-datasets',
templateUrl: 'plugin-featured-datasets.component.html'
})
export class PluginFeaturedDatasetsComponent extends PluginBaseComponent<PluginFeaturedDatasets> {
default = new PluginFeaturedDatasets();
public fetchFeaturedDatasets: FetchResearchResults;
page = 1;
size = 3;
constructor(private _searchResearchResultsService: SearchResearchResultsService) {
super()
this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService);
this.fetchFeaturedDatasets.searchUtils.size = this.size;
this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", "enermaps", 1, 100, this.properties, "enermaps::selection");
}
public updatePage(event) {
this.page = event.value;
this.fetchFeaturedDatasets.searchUtils.page = event.value;
this.fetchFeaturedDatasets.results = this.fetchFeaturedDatasets.allResults.slice((this.page - 1) * this.size, this.page * this.size);
}
}