Merge branch 'new-theme' of code-repo.d4science.org:MaDgIK/openaire-library into new-theme
This commit is contained in:
commit
82dbd33f43
|
@ -281,3 +281,17 @@ export class IndicatorFilterUtils{
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export enum StakeholderEntities {
|
||||
STAKEHOLDER = 'Dashboard',
|
||||
FUNDER = 'Funder',
|
||||
RI = 'Research initiative',
|
||||
ORGANIZATION = 'Research institution',
|
||||
PROJECT = 'Project',
|
||||
|
||||
STAKEHOLDERS = 'Dashboards',
|
||||
FUNDERS = 'Funders',
|
||||
RIS = 'Research initiatives',
|
||||
ORGANIZATIONS = 'Research institutions',
|
||||
PROJECTS = 'Projects'
|
||||
}
|
||||
|
|
|
@ -81,68 +81,5 @@ export class MetricsService {
|
|||
return map;
|
||||
|
||||
}
|
||||
getMetrics (id: string, entityType: string, properties:EnvProperties):any {
|
||||
let url = properties.metricsAPIURL+entityType+"/"+id+"/clicks";
|
||||
let key = url;
|
||||
|
||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||
.pipe(map(res => this.parseMetrics(res["downloads"], res["views"], res["total_downloads"], res["total_views"],
|
||||
res["total_openaire_views"], res["total_openaire_downloads"], res["pageviews"], properties)));
|
||||
}
|
||||
|
||||
|
||||
parseMetrics(downloads: any, views: any, totalDownloads: number, totalViews: number,
|
||||
totalOpenaireViews: number, totalOpenaireDownloads: number, pageViews: number, properties:EnvProperties): any {
|
||||
this.metrics = new Metrics();
|
||||
|
||||
this.metrics.totalDownloads = totalDownloads;
|
||||
this.metrics.totalViews = totalViews;
|
||||
this.metrics.totalOpenaireViews = totalOpenaireViews;
|
||||
this.metrics.totalOpenaireDownloads = totalOpenaireDownloads;
|
||||
this.metrics.pageViews = pageViews;
|
||||
|
||||
this.metrics.infos = new Map<string, {"name": string, "url": string, "numOfDownloads": string, "numOfViews": string, "openaireDownloads": string, "openaireViews": string}>();
|
||||
|
||||
for(let i=0; i<downloads.length; i++) {
|
||||
let id: string = downloads[i]['datasource_id'];
|
||||
if(this.metrics.infos.has(id)) {
|
||||
this.metrics.infos.get(id).numOfDownloads = downloads[i]['value'];
|
||||
this.metrics.infos.get(id).openaireDownloads = downloads[i]['openaire'];
|
||||
} else {
|
||||
let info;//: {"url": string, "numOfDownloads": string, "numOfViews": string};
|
||||
info = {};
|
||||
|
||||
info.name = downloads[i]['datasource_name'];
|
||||
info.url = properties.searchLinkToDataProvider+id;
|
||||
info.numOfDownloads = downloads[i]['value'];
|
||||
info.openaireDownloads = downloads[i]['openaire'];
|
||||
info.numOfViews = "0";
|
||||
info.openaireViews = "0";
|
||||
|
||||
this.metrics.infos.set(id, info);
|
||||
}
|
||||
}
|
||||
|
||||
for(let i=0; i<views.length; i++) {
|
||||
let id: string = views[i]['datasource_id'];
|
||||
if(this.metrics.infos.has(id)) {
|
||||
this.metrics.infos.get(id).numOfViews = views[i]['value'];
|
||||
this.metrics.infos.get(id).openaireViews = views[i]['openaire'];
|
||||
} else {
|
||||
let info;//: {"url": string, "numOfDownloads": string, "numOfViews": string};
|
||||
info = {};
|
||||
|
||||
info.name = views[i]['datasource_name'];
|
||||
info.url = properties.searchLinkToDataProvider + id;
|
||||
info.numOfDownloads = "0";
|
||||
info.openaireDownloads = "0";
|
||||
info.numOfViews = views[i]['value'];
|
||||
info.openaireViews = views[i]['openaire'];
|
||||
|
||||
this.metrics.infos.set(id, info);
|
||||
}
|
||||
}
|
||||
|
||||
return this.metrics;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ declare var UIkit;
|
|||
<div *ngIf="formControl" [id]="id">
|
||||
<div class="input-wrapper" [class.disabled]="formControl.disabled" [class.opened]="opened"
|
||||
[class.focused]="focused" [ngClass]="inputClass" [class.hint]="hint"
|
||||
[class.active]="(formAsControl?.value || type === 'select' || formAsArray?.length > 0 || getLabel(formAsControl?.value)) && !focused"
|
||||
[class.active]="(formAsControl?.value || selectable || formAsArray?.length > 0 || getLabel(formAsControl?.value)) && !focused"
|
||||
[class.danger]="(formControl.invalid && (formControl.touched || !!searchControl?.touched)) || (!!searchControl?.invalid && !!searchControl?.touched)">
|
||||
<div #inputBox class="input-box" [class.select]="selectable" click-outside-or-esc
|
||||
[class.static]="placeholderInfo?.static" (clickOutside)="click($event)">
|
||||
|
@ -74,7 +74,7 @@ declare var UIkit;
|
|||
class="input uk-text-truncate">{{getLabel(formControl.value)}}</div>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="!placeholderInfo?.static">
|
||||
<div *ngIf="!getLabel(formControl.value)" class="input uk-text-truncate">No value selected</div>
|
||||
<div *ngIf="!getLabel(formControl.value)" class="input uk-text-truncate">{{noValueSelected}}</div>
|
||||
<div *ngIf="getLabel(formControl.value)"
|
||||
class="input uk-text-truncate">{{getLabel(formControl.value)}}</div>
|
||||
</ng-container>
|
||||
|
@ -82,7 +82,11 @@ declare var UIkit;
|
|||
<ng-template [ngIf]="type === 'autocomplete'">
|
||||
<input *ngIf="focused" [attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint"
|
||||
#searchInput class="input" [formControl]="searchControl" [class.uk-text-truncate]="!focused">
|
||||
<div *ngIf="!focused" class="input uk-text-truncate">{{getLabel(formAsControl.value)}}</div>
|
||||
<div *ngIf="!focused && !selectable" class="input uk-text-truncate">{{getLabel(formAsControl.value)}}</div>
|
||||
<ng-container *ngIf="!focused && selectable" >
|
||||
<div *ngIf="!getLabel(formControl.value)" class="input uk-text-truncate">{{noValueSelected}}</div>
|
||||
<div *ngIf="getLabel(formControl.value)" class="input uk-text-truncate">{{getLabel(formControl.value)}}</div>
|
||||
</ng-container>
|
||||
</ng-template>
|
||||
<ng-template [ngIf]="type === 'autocomplete_soft'">
|
||||
<input #input class="input" [attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint"
|
||||
|
@ -112,12 +116,12 @@ declare var UIkit;
|
|||
</div>
|
||||
</ng-template>
|
||||
<div
|
||||
*ngIf="(formControl.disabled && disabledIcon) || icon || (type === 'select' && selectArrow) || type === 'autocomplete'"
|
||||
*ngIf="(formControl.disabled && disabledIcon) || icon || (selectable && selectArrow) || type === 'autocomplete'"
|
||||
class="uk-margin-left icon">
|
||||
<icon *ngIf="formControl.disabled && disabledIcon" [name]="disabledIcon" [flex]="true"></icon>
|
||||
<ng-template [ngIf]="formControl.enabled">
|
||||
<icon *ngIf="!searchControl?.value && icon" [name]="icon" [flex]="true"></icon>
|
||||
<icon *ngIf="!icon && type === 'select' && selectArrow" [name]="selectArrow" [flex]="true"></icon>
|
||||
<icon *ngIf="!icon && selectable && selectArrow" [name]="selectArrow" [flex]="true"></icon>
|
||||
<button *ngIf="!!searchControl?.value && type === 'autocomplete'" class="uk-close uk-icon"
|
||||
(click)="resetSearch($event)">
|
||||
<icon [flex]="true" name="close"></icon>
|
||||
|
@ -206,6 +210,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
|
|||
@Input() selectArrow: string = 'arrow_drop_down';
|
||||
@Input() selectedIndex: number = 0;
|
||||
@Input() selectable: boolean = false;
|
||||
@Input() noValueSelected: string = 'No option selected';
|
||||
/** Chips && Autocomplete*/
|
||||
public filteredOptions: Option[] = [];
|
||||
public searchControl: FormControl;
|
||||
|
@ -481,7 +486,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
|
|||
this.searchControl.setValue('');
|
||||
}
|
||||
|
||||
getLabel(value: any) {
|
||||
getLabel(value: any): string {
|
||||
let option = this.optionsArray.find(option => HelperFunctions.equals(option.value, value));
|
||||
return (option) ? option.label : (value);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ export interface EnvProperties {
|
|||
showAddThis?: boolean;
|
||||
showContent?: boolean;
|
||||
enableEoscDataTransfer?:boolean;
|
||||
metricsAPIURL?: string;
|
||||
framesAPIURL?: string;
|
||||
statisticsFrameAPIURL?: string;
|
||||
statisticsFrameNewAPIURL?: string;
|
||||
|
|
Loading…
Reference in New Issue