95 lines
4.7 KiB
TypeScript
95 lines
4.7 KiB
TypeScript
import {Component, Input, OnInit} from '@angular/core';
|
|
import {Plugin} from "../../../../utils/entities/adminTool/plugin";
|
|
import {PluginTemplate} from "../../../../utils/entities/adminTool/pluginTemplate";
|
|
import {SearchResearchResultsService} from "../../../../services/searchResearchResults.service";
|
|
import {FetchResearchResults} from "../../../../utils/fetchEntitiesClasses/fetchResearchResults.class";
|
|
import {EnvProperties} from "../../../../utils/properties/env-properties";
|
|
import { properties } from 'src/environments/environment';
|
|
import {RouterHelper} from "../../../../utils/routerHelper.class";
|
|
import {OpenaireEntities} from "../../../../utils/properties/searchFields";
|
|
import {PluginBaseComponent} from "../../utils/base-plugin.component";
|
|
export class PluginResultsNumbers{
|
|
publicationsOnOff:boolean;
|
|
datasetsOnOff:boolean;
|
|
softwareOnOff:boolean;
|
|
otherOnOff:boolean;
|
|
}
|
|
@Component({
|
|
selector: 'plugin-results-numbers',
|
|
template: `
|
|
<div class="plugin2 uk-flex uk-flex-middle uk-flex-wrap" style="grid-gap: 30px;">
|
|
<div class="uk-flex uk-flex-middle">
|
|
<!-- <a *ngIf="editMode" (click)="editClicked.emit({field: 'publicationsOnOff', type: 'boolean'}) ">Edit</a>-->
|
|
<icon [name]="'description'" [type]="'outlined'" [ratio]="2" [flex]="true" [customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
|
|
<a [queryParams]="getParamsForSearchLink('publications')" [routerLink]="properties.searchLinkToAdvancedResults" class="uk-link-reset uk-flex uk-flex-column">
|
|
<span class="uk-text-xsmall">
|
|
{{openaireEntities.PUBLICATIONS}}
|
|
</span>
|
|
<span *ngIf="fetchPublications.searchUtils.totalResults" class="uk-h6 uk-margin-remove" [innerHTML]="fetchPublications.searchUtils.totalResults | numberRound: 1:1">
|
|
</span>
|
|
</a>
|
|
</div>
|
|
<!--<div class="uk-flex uk-flex-middle">
|
|
<icon [name]="'database'" [type]="'outlined'" [ratio]="2" [flex]="true" [customclass]="'uk-margin-small-right uk-text-secondary'"></icon>
|
|
<a [queryparams]="getParamsForSearchLink('datasets')" [routerlink]="properties.searchLinkToAdvancedResults" class="uk-link-reset uk-flex uk-flex-column">
|
|
<span class="uk-text-xsmall">
|
|
{{openaireEntities.DATASETS}}
|
|
</span>
|
|
<span *ngif="fetchDatasets.searchUtils.totalResults" class="uk-h6 uk-margin-remove" [innerhtml]="fetchDatasets.searchUtils.totalResults | numberRound: 1:1">
|
|
</span>
|
|
</a>
|
|
</div>
|
|
<div class="uk-flex uk-flex-middle">
|
|
<icon [name]="'integration_instructions'" [type]="'outlined'" [ratio]="2" [flex]="true" [customclass]="'uk-margin-small-right uk-text-secondary'"></icon>
|
|
<a [queryparams]="getParamsForSearchLink('software')" [routerlink]="properties.searchLinkToAdvancedResults" class="uk-link-reset uk-flex uk-flex-column">
|
|
<span class="uk-text-xsmall">
|
|
{{openaireEntities.SOFTWARE}}
|
|
</span>
|
|
<span *ngif="fetchSoftware.searchUtils.totalResults" class="uk-h6 uk-margin-remove" [innerhtml]="fetchSoftware.searchUtils.totalResults | numberRound: 1:1">
|
|
</span>
|
|
</a>
|
|
</div>-->
|
|
</div>
|
|
|
|
`
|
|
})
|
|
export class PluginResultsNumbersComponent extends PluginBaseComponent{
|
|
get pluginObject():PluginResultsNumbers{
|
|
return this.plugin.object;
|
|
}
|
|
get pluginDefaultObject():PluginResultsNumbers{
|
|
return this.pluginTemplate.object;
|
|
}
|
|
// Variables for publications, research data, projects, content providers, related content providers tabs
|
|
public fetchPublications: FetchResearchResults;
|
|
public fetchDatasets: FetchResearchResults;
|
|
public fetchSoftware: FetchResearchResults;
|
|
public fetchOrps: FetchResearchResults;
|
|
public fetchFeaturedDatasets: FetchResearchResults;
|
|
searchLinkToResults: string = null;
|
|
properties: EnvProperties = properties;
|
|
public routerHelper: RouterHelper = new RouterHelper();
|
|
openaireEntities= OpenaireEntities;
|
|
|
|
constructor(private _searchResearchResultsService: SearchResearchResultsService,) {
|
|
super();
|
|
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
|
|
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
|
|
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
|
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
|
this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService);
|
|
}
|
|
ngOnInit(): void {
|
|
this.searchLinkToResults = this.properties.searchLinkToResults;
|
|
|
|
}
|
|
|
|
public getParamsForSearchLink(type: string = "") {
|
|
if (type) {
|
|
return this.routerHelper.createQueryParams(['type', 'qf', 'sortBy'], [type, 'false', 'resultdateofacceptance,descending']);
|
|
} else {
|
|
return {};
|
|
}
|
|
}
|
|
}
|