Rename stakeholders and organizations(UI only) and add explore links to homepage's numbers

This commit is contained in:
Alex Martzios 2021-10-19 16:22:35 +03:00
parent e83f5febf9
commit 7ab16878b0
2 changed files with 692 additions and 675 deletions

View File

@ -1,242 +1,259 @@
<div class="image-front-topbar" <div class="image-front-topbar"
style="background: transparent linear-gradient(180deg, #F4F4F4 0%, #F5F5F5 83%, #FAFAFA 100%) no-repeat;"> style="background: transparent linear-gradient(180deg, #F4F4F4 0%, #F5F5F5 83%, #FAFAFA 100%) no-repeat;">
<div <div
class="uk-section uk-container uk-container-large uk-text-center uk-section uk-section-small uk-margin-large-bottom" class="uk-section uk-container uk-container-large uk-text-center uk-section uk-section-small uk-margin-large-bottom"
uk-parallax="media: @l; y: -200; easing: 0.5"> uk-parallax="media: @l; y: -200; easing: 0.5">
<div class="uk-padding-small"> <div class="uk-padding-small">
<h1 class="uk-margin-top">A new era of monitoring research.</h1> <h1 class="uk-margin-top">A new era of monitoring research.</h1>
<div class="girl-background"> <div class="girl-background">
<h4 class="uk-margin-remove-top">Open data. Open methodologies.</h4> <h4 class="uk-margin-remove-top">Open data. Open methodologies.</h4>
<div class="uk-margin-medium-top uk-text-muted"> <div class="uk-margin-medium-top uk-text-muted">
Work together with us to view, understand and visualize<br>research statistics and indicators. Work together with us to view, understand and visualize<br>research statistics and indicators.
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="uk-section uk-container uk-container-large dashboard-section"> <div class="uk-section uk-container uk-container-large dashboard-section">
<div class="uk-padding-small"> <div class="uk-padding-small">
<div class="dashboard uk-flex uk-flex-center"> <div class="dashboard uk-flex uk-flex-center">
<img class="uk-width-1-2@l" src="/assets/monitor-assets/home/dashboard.png"> <img class="uk-width-1-2@l" src="/assets/monitor-assets/home/dashboard.png">
</div> </div>
<div class="uk-margin-large-top"> <div class="uk-margin-large-top">
<div class="uk-margin-medium-left uk-margin-medium-right uk-margin-large-bottom"> <div class="uk-margin-medium-left uk-margin-medium-right uk-margin-large-bottom">
<div class="uk-child-width-1-3@m uk-grid info" uk-grid> <div class="uk-child-width-1-3@m uk-grid info" uk-grid>
<div [@1]="state.toString()" class="clickable" [class.uk-active]="state === 1" (click)="startAnimation()"> <div [@1]="state.toString()" class="clickable" [class.uk-active]="state === 1" (click)="startAnimation()">
<h5> <h5>
Get a complete picture Get a complete picture
</h5> </h5>
<div class="uk-text-muted"> <div class="uk-text-muted">
Track and discover your organizations research output. Use the OpenAIRE Research Graph to get a 360<span>&#176;</span> Track and discover your organizations research output. Use the OpenAIRE Research Graph to get a
view of your publications-data-code. 360<span>&#176;</span>
</div> view of your publications-data-code.
</div> </div>
<div [@2]="state.toString()" class="clickable" [class.uk-active]="state === 2" (click)="startAnimation(2)"> </div>
<h5> <div [@2]="state.toString()" class="clickable" [class.uk-active]="state === 2" (click)="startAnimation(2)">
Monitor open science compliance <h5>
</h5> Monitor open science compliance
<div class="uk-text-muted"> </h5>
Work with the open science expert community for open and transparent metrics. Discover open science trends <div class="uk-text-muted">
for your organization and see how you fare in EOSC. Work with the open science expert community for open and transparent metrics. Discover open science trends
</div> for your organization and see how you fare in EOSC.
</div> </div>
<div [@3]="state.toString()" class="clickable" [class.uk-active]="state === 3" (click)="startAnimation(3)"> </div>
<h5> <div [@3]="state.toString()" class="clickable" [class.uk-active]="state === 3" (click)="startAnimation(3)">
Turn research results to insights <h5>
</h5> Turn research results to insights
<div class="uk-text-muted"> </h5>
Understand your community. Measure impact, discover trends, connections and collaborations to improve <div class="uk-text-muted">
and optimize your future actions. Understand your community. Measure impact, discover trends, connections and collaborations to improve
</div> and optimize your future actions.
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
<div class="uk-section uk-container uk-container-large"> <div class="uk-section uk-container uk-container-large">
<div class="uk-padding-small hologram uk-position-relative"> <div class="uk-padding-small hologram uk-position-relative">
<div class="uk-grid uk-grid-match uk-child-width-1-2 uk-visible@m" uk-grid> <div class="uk-grid uk-grid-match uk-child-width-1-2 uk-visible@m" uk-grid>
<div uk-parallax="y: 40, -60; easing: 0.5"> <div uk-parallax="y: 40, -60; easing: 0.5">
<div class="uk-margin-large-left uk-margin-large-bottom uk-width-3-4 part"> <div class="uk-margin-large-left uk-margin-large-bottom uk-width-3-4 part">
<h5 class="uk-text-secondary">Global outlook</h5> <h5 class="uk-text-secondary">Global outlook</h5>
<div> <div>
Monitor is built on the OpenAIRE Research Graph. An interconnected scholarly communication shared data Monitor is built on the OpenAIRE Research Graph. An interconnected scholarly communication shared data
resource from open initiatives around the world, of global interest. resource from open initiatives around the world, of global interest.
</div> </div>
</div> </div>
</div> </div>
<div uk-parallax="y: 40, -60; easing: 0.5" class="uk-flex uk-flex-right"> <div uk-parallax="y: 40, -60; easing: 0.5" class="uk-flex uk-flex-right">
<div class="part uk-width-3-4 uk-margin-medium-right"> <div class="part uk-width-3-4 uk-margin-medium-right">
<h5 class="uk-text-secondary">Transparent methodology</h5> <h5 class="uk-text-secondary">Transparent methodology</h5>
<div> <div>
We base our service on open science principles. We rely on open data sources, and document our algorithms We base our service on open science principles. We rely on open data sources, and document our algorithms
for every metric and indicator we publish. for every metric and indicator we publish.
</div> </div>
</div> </div>
</div> </div>
<div uk-parallax="y: -100; easing: 0.5"> <div uk-parallax="y: -100; easing: 0.5">
<div class="part uk-width-3-4 uk-margin-medium-left"> <div class="part uk-width-3-4 uk-margin-medium-left">
<h5 class="uk-text-secondary">Customised to your needs</h5> <h5 class="uk-text-secondary">Customised to your needs</h5>
<div> <div>
Choose from a variety of pre-defined metrics. Select how to visualize them, and who to share with. Use our Choose from a variety of pre-defined metrics. Select how to visualize them, and who to share with. Use our
advanced tools and expertise add add your own metrics. advanced tools and expertise add add your own metrics.
</div> </div>
</div> </div>
</div> </div>
<div uk-parallax="y: -100; easing: 2" class="uk-flex uk-flex-center"> <div uk-parallax="y: -100; easing: 2" class="uk-flex uk-flex-center">
<div class="part uk-width-3-4 uk-margin-large-left"> <div class="part uk-width-3-4 uk-margin-large-left">
<h5 class="uk-text-secondary">Minimum effort to join</h5> <h5 class="uk-text-secondary">Minimum effort to join</h5>
<div> <div>
You only share some information with us to include in out backend aggregating and data mining, and we You only share some information with us to include in out backend aggregating and data mining, and we
deliver a view of your world. As you see fit. deliver a view of your world. As you see fit.
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="uk-hidden@m uk-grid uk-child-width-1-1" uk-grid> <div class="uk-hidden@m uk-grid uk-child-width-1-1" uk-grid>
<div> <div>
<h5 class="uk-text-secondary">Global outlook</h5> <h5 class="uk-text-secondary">Global outlook</h5>
<div> <div>
Monitor is built on the OpenAIRE Research Graph. An interconnected scholarly communication shared data Monitor is built on the OpenAIRE Research Graph. An interconnected scholarly communication shared data
resource from open initiatives around the world, of global interest. resource from open initiatives around the world, of global interest.
</div> </div>
</div> </div>
<div> <div>
<h5 class="uk-text-secondary">Transparent methodology</h5> <h5 class="uk-text-secondary">Transparent methodology</h5>
<div> <div>
We base our service on open science principles. We rely on open data sources, and document our algorithms for We base our service on open science principles. We rely on open data sources, and document our algorithms for
every metric and indicator we publish. every metric and indicator we publish.
</div> </div>
</div> </div>
<div> <div>
<h5 class="uk-text-secondary">Customised to your needs</h5> <h5 class="uk-text-secondary">Customised to your needs</h5>
<div> <div>
Choose from a variety of pre-defined metrics. Select how to visualize them, and who to share with. Use our Choose from a variety of pre-defined metrics. Select how to visualize them, and who to share with. Use our
advanced tools and expertise add add your own metrics. advanced tools and expertise add add your own metrics.
</div> </div>
</div> </div>
<div> <div>
<h5 class="uk-text-secondary">Minimum effort to join</h5> <h5 class="uk-text-secondary">Minimum effort to join</h5>
<div> <div>
You only share some information with us to include in out backend aggregating and data mining, and we deliver You only share some information with us to include in out backend aggregating and data mining, and we deliver
a view of your world. As you see fit. a view of your world. As you see fit.
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="uk-text-center uk-margin-large"> <div class="uk-text-center uk-margin-large">
<a class="uk-button portal-button" routerLink="/about">Learn More</a> <a class="uk-button portal-button" routerLink="/about">Learn More</a>
</div> </div>
</div> </div>
<div class="graph-section"> <div class="graph-section">
<div class="uk-section uk-container uk-margin-large"> <div class="uk-section uk-container uk-margin-large">
<div class="uk-text-center uk-padding-small"> <div class="uk-text-center uk-padding-small">
<h2>Tap into the OpenAIRE Research Graph</h2> <h2>Tap into the OpenAIRE Research Graph</h2>
<div class="uk-flex uk-flex-center"> <div class="uk-flex uk-flex-center">
<div class="uk-width-3-4@m uk-margin-large-top uk-grid uk-child-width-1-5@m uk-child-width-1-2"> <div class="uk-width-3-4@m uk-margin-large-top uk-grid uk-child-width-1-5@m uk-child-width-1-2">
<div *ngIf="publicationsSize" class="uk-margin-medium-bottom uk-text-center"> <div *ngIf="publicationsSize" class="uk-margin-medium-bottom uk-text-center">
<h3 class="uk-margin-remove portal-color"> <h3 class="uk-margin-remove portal-color">
<span class="uk-text-bold number">{{publicationsSize.number|number}}</span>{{publicationsSize.size}} <a class="uk-link-reset"
</h3> href="https://explore.openaire.eu/search/find/research-outcomes?type=publications" target=_blank>
<div class="uk-margin-small uk-text-large uk-text-uppercase">publications</div> <span class="uk-text-bold number">{{publicationsSize.number|number}}</span>{{publicationsSize.size}}
</div> </a>
<div *ngIf="datasetsSize" class="uk-margin-medium-bottom uk-text-center"> </h3>
<h3 class="uk-margin-remove portal-color"> <div class="uk-margin-small uk-text-large uk-text-uppercase">publications</div>
<span class="uk-text-bold number">{{datasetsSize.number|number}}</span>{{datasetsSize.size}} </div>
</h3> <div *ngIf="datasetsSize" class="uk-margin-medium-bottom uk-text-center">
<div class="uk-margin-small uk-text-large uk-text-uppercase">datasets</div> <h3 class="uk-margin-remove portal-color">
</div> <a class="uk-link-reset" href="https://explore.openaire.eu/search/find/research-outcomes?type=datasets"
<div *ngIf="softwareSize" class="uk-margin-medium-bottom uk-text-center"> target=_blank>
<h3 class="uk-margin-remove portal-color"> <span class="uk-text-bold number">{{datasetsSize.number|number}}</span>{{datasetsSize.size}}
<span class="uk-text-bold number">{{softwareSize.number|number}}</span>{{softwareSize.size}} </a>
</h3> </h3>
<div class="uk-margin-small uk-text-large uk-text-uppercase">software</div> <div class="uk-margin-small uk-text-large uk-text-uppercase">datasets</div>
</div> </div>
<div *ngIf="otherSize" class="uk-margin-medium-bottom uk-text-center"> <div *ngIf="softwareSize" class="uk-margin-medium-bottom uk-text-center">
<h3 class="uk-margin-remove portal-color"> <h3 class="uk-margin-remove portal-color">
<span class="uk-text-bold number">{{otherSize.number|number}}</span>{{otherSize.size}} <a class="uk-link-reset" href="https://explore.openaire.eu/search/find/research-outcomes?type=software"
</h3> target="_blank">
<div class="uk-margin-small uk-text-large uk-text-uppercase">other</div> <span class="uk-text-bold number">{{softwareSize.number|number}}</span>{{softwareSize.size}}
</div> </a>
<div *ngIf="fundersSize" class="uk-margin-medium-bottom uk-text-center"> </h3>
<h3 class="uk-margin-remove portal-color"> <div class="uk-margin-small uk-text-large uk-text-uppercase">software</div>
<span class="uk-text-bold number">{{fundersSize.number|number}}</span>{{fundersSize.size}} </div>
</h3> <div *ngIf="otherSize" class="uk-margin-medium-bottom uk-text-center">
<div class="uk-margin-small uk-text-large uk-text-uppercase">Funders</div> <h3 class="uk-margin-remove portal-color">
</div> <a class="uk-link-reset" href="https://explore.openaire.eu/search/find/research-outcomes?type=other"
</div> target="_blank">
</div> <span class="uk-text-bold number">{{otherSize.number|number}}</span>{{otherSize.size}}
</div> </a>
</div> </h3>
<div class="uk-margin-small uk-text-large uk-text-uppercase">other</div>
</div>
<div *ngIf="fundersSize" class="uk-margin-medium-bottom uk-text-center">
<h3 class="uk-margin-remove portal-color">
<a class="uk-link-reset" href="https://explore.openaire.eu/search/find/projects" target="_blank">
<span class="uk-text-bold number">{{fundersSize.number|number}}</span>{{fundersSize.size}}
</a>
</h3>
<div class="uk-margin-small uk-text-large uk-text-uppercase">Funders</div>
</div>
</div>
</div>
</div>
</div>
</div> </div>
<div *ngIf="loading && stakeholders.length === 0" class="uk-container uk-container-large uk-margin-large-bottom"> <div *ngIf="loading && stakeholders.length === 0" class="uk-container uk-container-large uk-margin-large-bottom">
<errorMessages [status]="[status]" [type]="'stakeholders'"></errorMessages> <errorMessages [status]="[status]" [type]="'stakeholders'"></errorMessages>
</div> </div>
<div *ngIf="!loading && stakeholders && stakeholders.length > 0" <div *ngIf="!loading && stakeholders && stakeholders.length > 0"
class="uk-section uk-section-large uk-margin-right uk-margin-left uk-margin-large-top stakeholder-section"> class="uk-section uk-section-large uk-margin-right uk-margin-left uk-margin-large-top stakeholder-section">
<div class="uk-container" uk-filter="target: .stakeholders"> <div class="uk-container" uk-filter="target: .stakeholders">
<ul class="uk-subnav uk-subnav-pill"> <ul class="uk-subnav uk-subnav-pill">
<li class="uk-active" uk-filter-control><a (click)="type = null">All</a></li> <li class="uk-active" uk-filter-control><a (click)="type = null">All</a></li>
<li uk-filter-control="[data-type='funder']"><a (click)="type = 'funder'">Funders</a></li> <li uk-filter-control="[data-type='funder']"><a (click)="type = 'funder'">Funders</a></li>
<li uk-filter-control="[data-type='ri']"><a (click)="type = 'ri'">Research Initiatives</a></li> <li uk-filter-control="[data-type='ri']"><a (click)="type = 'ri'">Research Initiatives</a></li>
<!--<li uk-filter-control="[data-type='project']"><a (click)="type = 'project'">Projects</a></li>--> <!--<li uk-filter-control="[data-type='project']"><a (click)="type = 'project'">Projects</a></li>-->
<li uk-filter-control="[data-type='organization']"><a (click)="type = 'organization'">Organizations</a></li> <li uk-filter-control="[data-type='organization']"><a (click)="type = 'organization'">Institutions</a></li>
</ul> </ul>
<div class="stakeholders uk-margin-large-top uk-child-width-1-1 uk-child-width-1-2@s uk-child-width-1-3@m uk-grid uk-flex-top uk-flex-wrap-top" <div
uk-grid="masonry: true" uk-height-match="target: .uk-card; row: false;"> class="stakeholders uk-margin-large-top uk-child-width-1-1 uk-child-width-1-2@s uk-child-width-1-3@m uk-grid uk-flex-top uk-flex-wrap-top"
<div *ngFor="let stakeholder of stakeholders" [attr.data-type]="stakeholder.type"> uk-grid="masonry: true" uk-height-match="target: .uk-card; row: false;">
<a *ngIf="directLink && hasPermission(stakeholder)" [href]="getStakeholderPageUrl(stakeholder)" target="_blank"> <div *ngFor="let stakeholder of stakeholders" [attr.data-type]="stakeholder.type">
<div class="uk-card uk-card-default uk-text-center uk-position-relative"> <a *ngIf="directLink && hasPermission(stakeholder)" [href]="getStakeholderPageUrl(stakeholder)" target="_blank">
<ng-container *ngTemplateOutlet="stakeholderCard; context: {stakeholder: stakeholder}"></ng-container> <div class="uk-card uk-card-default uk-text-center uk-position-relative">
</div> <ng-container *ngTemplateOutlet="stakeholderCard; context: {stakeholder: stakeholder}"></ng-container>
</a> </div>
<a *ngIf="!directLink && hasPermission(stakeholder)" (click)="confirmModalOpen(stakeholder)"> </a>
<ng-container *ngTemplateOutlet="stakeholderCard; context: {stakeholder: stakeholder}"></ng-container> <a *ngIf="!directLink && hasPermission(stakeholder)" (click)="confirmModalOpen(stakeholder)">
</a> <ng-container *ngTemplateOutlet="stakeholderCard; context: {stakeholder: stakeholder}"></ng-container>
<ng-container *ngIf="!hasPermission(stakeholder)"> </a>
<ng-container *ngTemplateOutlet="stakeholderCard; context: {stakeholder: stakeholder}"></ng-container> <ng-container *ngIf="!hasPermission(stakeholder)">
</ng-container> <ng-container *ngTemplateOutlet="stakeholderCard; context: {stakeholder: stakeholder}"></ng-container>
</div> </ng-container>
<div *ngIf="stakeholdersNumber === 0" [attr.data-type]="type" </div>
class="uk-text-center uk-text-large uk-width-1-1 uk-margin-large-top uk-padding-large"> <div *ngIf="stakeholdersNumber === 0" [attr.data-type]="type"
Nothing here yet. class="uk-text-center uk-text-large uk-width-1-1 uk-margin-large-top uk-padding-large">
</div> Nothing here yet.
</div> </div>
</div> </div>
</div>
</div> </div>
<div style="background: linear-gradient(0deg, #FFFFFF 0%, #EFF3F8 0%, #FAFAFA 100%);"> <div style="background: linear-gradient(0deg, #FFFFFF 0%, #EFF3F8 0%, #FAFAFA 100%);">
<div class="uk-section uk-container uk-text-center uk-margin-large-bottom"> <div class="uk-section uk-container uk-text-center uk-margin-large-bottom">
<div class="uk-padding-small"> <div class="uk-padding-small">
<h3>Contact us to help you.</h3> <h3>Contact us to help you.</h3>
<div class="uk-text-muted uk-margin-medium"> <div class="uk-text-muted uk-margin-medium">
Are you looking for more? Get in touch with our team and let us help you. Are you looking for more? Get in touch with our team and let us help you.
</div> </div>
<a class="uk-button portal-button" routerLink="/contact-us">CONTACT US</a> <a class="uk-button portal-button" routerLink="/contact-us">CONTACT US</a>
</div> </div>
</div> </div>
</div> </div>
<div class="uk-section-muted" <div class="uk-section-muted"
uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}"> uk-scrollspy="{&quot;target&quot;:&quot;[uk-scrollspy-class]&quot;,&quot;cls&quot;:&quot;uk-animation-fade&quot;,&quot;delay&quot;:false}">
<div class="uk-container uk-container-large"> <div class="uk-container uk-container-large">
<other-portals [properties]="properties" portal="monitor"></other-portals> <other-portals [properties]="properties" portal="monitor"></other-portals>
</div> </div>
</div> </div>
<modal-alert #AlertModal (alertOutput)="goToPage($event)"> <modal-alert #AlertModal (alertOutput)="goToPage($event)">
<div class="uk-text-left"> <div class="uk-text-left">
You will be navigated to a new tab. Are you sure that you want to proceed? You will be navigated to a new tab. Are you sure that you want to proceed?
</div> </div>
</modal-alert> </modal-alert>
<ng-template #stakeholderCard let-stakeholder="stakeholder"> <ng-template #stakeholderCard let-stakeholder="stakeholder">
<div class="uk-card uk-card-default uk-text-center" [class.disabled]="!hasPermission(stakeholder)"> <div class="uk-card uk-card-default uk-text-center" [class.disabled]="!hasPermission(stakeholder)">
<div *ngIf="stakeholder.visibility && stakeholder.visibility !== 'PUBLIC'" <div *ngIf="stakeholder.visibility && stakeholder.visibility !== 'PUBLIC'"
class="uk-position-top-right uk-margin-top uk-margin-right uk-flex uk-flex-middle"> class="uk-position-top-right uk-margin-top uk-margin-right uk-flex uk-flex-middle">
<icon [name]="visibilityIcon.get(stakeholder.visibility)"></icon> <icon [name]="visibilityIcon.get(stakeholder.visibility)"></icon>
<span class="space uk-text-small uk-text-capitalize">{{stakeholder.visibility.toLowerCase()}}</span> <span class="space uk-text-small uk-text-capitalize">{{stakeholder.visibility.toLowerCase()}}</span>
</div> </div>
<img *ngIf="stakeholder.logoUrl && stakeholder.isUpload" class="uk-margin-auto" <img *ngIf="stakeholder.logoUrl && stakeholder.isUpload" class="uk-margin-auto"
[src]="properties.utilsService + '/download/' + stakeholder.logoUrl"> [src]="properties.utilsService + '/download/' + stakeholder.logoUrl">
<img *ngIf="stakeholder.logoUrl && !stakeholder.isUpload" class="uk-margin-auto" [src]="stakeholder.logoUrl | urlPrefix"> <img *ngIf="stakeholder.logoUrl && !stakeholder.isUpload" class="uk-margin-auto"
<div class="uk-text-light uk-margin-medium-top">{{stakeholder.name}}</div> [src]="stakeholder.logoUrl | urlPrefix">
</div> <div class="uk-text-light uk-margin-medium-top">{{stakeholder.name}}</div>
</ng-template> </div>
</ng-template>

View File

@ -1,27 +1,27 @@
import {Component, ViewChild} from "@angular/core"; import { Component, ViewChild } from "@angular/core";
import {SearchUtilsClass} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import { SearchUtilsClass } from "../openaireLibrary/searchPages/searchUtils/searchUtils.class";
import {ErrorMessagesComponent} from "../openaireLibrary/utils/errorMessages.component"; import { ErrorMessagesComponent } from "../openaireLibrary/utils/errorMessages.component";
import {ErrorCodes} from "../openaireLibrary/utils/properties/errorCodes"; import { ErrorCodes } from "../openaireLibrary/utils/properties/errorCodes";
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties"; import { EnvProperties } from "../openaireLibrary/utils/properties/env-properties";
import {ActivatedRoute} from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import {AdvancedField, Filter, Value} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class"; import { AdvancedField, Filter, Value } from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
import {SearchFields} from "../openaireLibrary/utils/properties/searchFields"; import { SearchFields } from "../openaireLibrary/utils/properties/searchFields";
import {Session, User} from "../openaireLibrary/login/utils/helper.class"; import { Session, User } from "../openaireLibrary/login/utils/helper.class";
import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; import { StringUtils } from "../openaireLibrary/utils/string-utils.class";
import {UserManagementService} from "../openaireLibrary/services/user-management.service"; import { UserManagementService } from "../openaireLibrary/services/user-management.service";
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service"; import { StakeholderService } from "../openaireLibrary/monitor/services/stakeholder.service";
import {NewSearchPageComponent} from "../openaireLibrary/searchPages/searchUtils/newSearchPage.component"; import { NewSearchPageComponent } from "../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
import {StakeholderInfo} from "../openaireLibrary/monitor/entities/stakeholder"; import { StakeholderInfo } from "../openaireLibrary/monitor/entities/stakeholder";
import {properties} from "../../environments/environment"; import { properties } from "../../environments/environment";
import {Subscriber} from "rxjs"; import { Subscriber } from "rxjs";
@Component({ @Component({
selector: 'search-stakeholders', selector: 'search-stakeholders',
template: ` template: `
<new-search-page pageTitle="OpenAIRE-Monitor | Browse" <new-search-page pageTitle="OpenAIRE-Monitor | Browse"
[hasPrefix]=false [piwikSiteId]="piwikSiteId" [hasPrefix]=false [piwikSiteId]="piwikSiteId"
[formPlaceholderText]="'Search profiles'" [formPlaceholderText]="'Search profiles'"
type="stakeholders" entityType="stakeholder" type="organizations" entityType="stakeholder"
[results]="results" [searchUtils]="searchUtils" [results]="results" [searchUtils]="searchUtils"
[showResultCount]=true [showResultCount]=true
[disableForms]="disableForms" [disableForms]="disableForms"
@ -33,442 +33,442 @@ import {Subscriber} from "rxjs";
` `
}) })
export class SearchStakeholdersComponent { export class SearchStakeholdersComponent {
public piwikSiteId = null; public piwikSiteId = null;
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
private errorMessages: ErrorMessagesComponent; private errorMessages: ErrorMessagesComponent;
public results: StakeholderInfo[] = []; public results: StakeholderInfo[] = [];
public totalResults: StakeholderInfo[] = []; public totalResults: StakeholderInfo[] = [];
public subscriptions = []; public subscriptions = [];
public filters = []; public filters = [];
public searchFields: SearchFields = new SearchFields(); public searchFields: SearchFields = new SearchFields();
public searchUtils: SearchUtilsClass = new SearchUtilsClass(); public searchUtils: SearchUtilsClass = new SearchUtilsClass();
public selectedFields: AdvancedField[] = []; public selectedFields: AdvancedField[] = [];
public disableForms: boolean = false; public disableForms: boolean = false;
public baseUrl: string = null; public baseUrl: string = null;
public fieldIds: string[] = ["q"]; public fieldIds: string[] = ["q"];
public refineFields: string[] = this.searchFields.STAKEHOLDER_SEARCH_FIELDS; public refineFields: string[] = this.searchFields.STAKEHOLDER_SEARCH_FIELDS;
public fieldIdsMap = { public fieldIdsMap = {
["q"]: { ["q"]: {
name: "All fields", name: "All fields",
type: "keyword", type: "keyword",
param: "q", param: "q",
operator: "op", operator: "op",
equalityOperator: "=", equalityOperator: "=",
filterType: null filterType: null
} }
}; };
public keyword = ""; public keyword = "";
public searchLink; public searchLink;
properties: EnvProperties = properties; properties: EnvProperties = properties;
@ViewChild(NewSearchPageComponent, {static: true}) searchPage: NewSearchPageComponent; @ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent;
private user: User; private user: User;
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private _stakeholderService: StakeholderService, private _stakeholderService: StakeholderService,
private userManagementService: UserManagementService) { private userManagementService: UserManagementService) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent(); this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
} }
public ngOnInit() { public ngOnInit() {
this.piwikSiteId = this.properties.piwikSiteId; this.piwikSiteId = this.properties.piwikSiteId;
this.baseUrl = this.properties.searchLinkToStakeholders; this.baseUrl = this.properties.searchLinkToStakeholders;
this.subscriptions.push(this.route.queryParams.subscribe(params => { this.subscriptions.push(this.route.queryParams.subscribe(params => {
this.searchPage.resultsPerPage = 10; this.searchPage.resultsPerPage = 10;
this.keyword = (params['fv0'] ? params['fv0'] : ''); this.keyword = (params['fv0'] ? params['fv0'] : '');
this.keyword = StringUtils.URIDecode(this.keyword); this.keyword = StringUtils.URIDecode(this.keyword);
this.searchUtils.page = (params['page'] === undefined) ? 1 : +params['page']; this.searchUtils.page = (params['page'] === undefined) ? 1 : +params['page'];
this.searchUtils.sortBy = (params['sortBy'] === undefined) ? '' : params['sortBy']; this.searchUtils.sortBy = (params['sortBy'] === undefined) ? '' : params['sortBy'];
this.searchUtils.validateSize(params['size']); this.searchUtils.validateSize(params['size']);
this.searchUtils.baseUrl = this.baseUrl; this.searchUtils.baseUrl = this.baseUrl;
this.searchPage.searchUtils = this.searchUtils; this.searchPage.searchUtils = this.searchUtils;
if (this.searchUtils.sortBy && this.searchUtils.sortBy != "creationdate,descending" && this.searchUtils.sortBy != "creationdate,ascending") { if (this.searchUtils.sortBy && this.searchUtils.sortBy != "creationdate,descending" && this.searchUtils.sortBy != "creationdate,ascending") {
this.searchUtils.sortBy = ""; this.searchUtils.sortBy = "";
} }
this.searchPage.refineFields = this.refineFields; this.searchPage.refineFields = this.refineFields;
this.searchLink = this.properties.searchLinkToStakeholders; this.searchLink = this.properties.searchLinkToStakeholders;
this.selectedFields = []; this.selectedFields = [];
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap, null, params, "stakeholder", null); this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap, null, params, "stakeholder", null);
let queryParams = params; let queryParams = params;
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user; this.user = user;
this.initFunders(queryParams); this.initFunders(queryParams);
})); }));
} else { } else {
this.initFunders(queryParams); this.initFunders(queryParams);
} }
})); }));
} }
ngOnDestroy() { ngOnDestroy() {
this.subscriptions.forEach(subscription => { this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) { if (subscription instanceof Subscriber) {
subscription.unsubscribe(); subscription.unsubscribe();
} }
}); });
} }
/** /**
* Initialize stakeholders from Communities APIs * Initialize stakeholders from Communities APIs
* *
* @param params * @param params
*/ */
private initFunders(params) { private initFunders(params) {
this.subscriptions.push(this._stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL).subscribe( this.subscriptions.push(this._stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL).subscribe(
data => { data => {
if (!data) { if (!data) {
return; return;
} }
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
this.totalResults[i] = data[i]; this.totalResults[i] = data[i];
this.totalResults[i].isManager = this.isManager(data[i]); this.totalResults[i].isManager = this.isManager(data[i]);
this.totalResults[i].isMember = this.isMember(data[i]); this.totalResults[i].isMember = this.isMember(data[i]);
} }
this._getResults(params); this._getResults(params);
}, },
err => { err => {
this.handleError('Error getting stakeholders', err); this.handleError('Error getting stakeholders', err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status); this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.disableForms = false; this.disableForms = false;
} }
)); ));
} }
/** /**
* Get all stakeholders from mock API and apply permission access validator, * Get all stakeholders from mock API and apply permission access validator,
* keyword searching, filter, paging and sorting. * keyword searching, filter, paging and sorting.
* *
* @param params, status * @param params, status
* @private * @private
*/ */
private _getResults(params) { private _getResults(params) {
this.searchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true; this.disableForms = true;
this.results = this.totalResults; this.results = this.totalResults;
this.filters = this.createFilters(); this.filters = this.createFilters();
this.searchUtils.totalResults = 0; this.searchUtils.totalResults = 0;
this.applyParams(params); this.applyParams(params);
} }
/** /**
* Apply permission access validator, * Apply permission access validator,
* keyword searching, filter, paging and sorting. * keyword searching, filter, paging and sorting.
* *
* @param params * @param params
* @param status * @param status
*/ */
public applyParams(params) { public applyParams(params) {
if (this.keyword && this.keyword != '') { if (this.keyword && this.keyword != '') {
this.searchForKeywords(); this.searchForKeywords();
} }
this.checkFilters(params); this.checkFilters(params);
this.sort(); this.sort();
this.searchUtils.totalResults = this.results.length; this.searchUtils.totalResults = this.results.length;
this.filters = this.searchPage.prepareFiltersToShow(this.filters, this.searchUtils.totalResults); this.filters = this.searchPage.prepareFiltersToShow(this.filters, this.searchUtils.totalResults);
this.results = this.results.slice((this.searchUtils.page - 1) * this.searchUtils.size, (this.searchUtils.page * this.searchUtils.size)); this.results = this.results.slice((this.searchUtils.page - 1) * this.searchUtils.size, (this.searchUtils.page * this.searchUtils.size));
this.searchUtils.status = this.errorCodes.DONE; this.searchUtils.status = this.errorCodes.DONE;
if (this.searchUtils.totalResults == 0) { if (this.searchUtils.totalResults == 0) {
this.searchUtils.status = this.errorCodes.NONE; this.searchUtils.status = this.errorCodes.NONE;
} }
this.disableForms = false; this.disableForms = false;
if (this.searchUtils.status == this.errorCodes.DONE) { if (this.searchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!! // Page out of limit!!!
let totalPages: any = this.searchUtils.totalResults / (this.searchUtils.size); let totalPages: any = this.searchUtils.totalResults / (this.searchUtils.size);
if (!(Number.isInteger(totalPages))) { if (!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1); totalPages = (parseInt(totalPages, 10) + 1);
} }
if (totalPages < this.searchUtils.page) { if (totalPages < this.searchUtils.page) {
this.searchUtils.totalResults = 0; this.searchUtils.totalResults = 0;
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
} }
} }
} }
/** /**
* Parse the given keywords into array and check if any of the requirements field of a funder includes * Parse the given keywords into array and check if any of the requirements field of a funder includes
* one of the given words. * one of the given words.
*/ */
private searchForKeywords() { private searchForKeywords() {
let ret = []; let ret = [];
let keywords: string[] = this.keyword.split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1); let keywords: string[] = this.keyword.split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1);
for (let i = 0; i < this.results.length; i++) { for (let i = 0; i < this.results.length; i++) {
for (let keyword of keywords) { for (let keyword of keywords) {
keyword = keyword.toLowerCase(); keyword = keyword.toLowerCase();
if (keyword != '' && (StringUtils.containsWord(this.results[i].name, keyword) || StringUtils.containsWord(this.results[i].index_shortName, keyword) || if (keyword != '' && (StringUtils.containsWord(this.results[i].name, keyword) || StringUtils.containsWord(this.results[i].index_shortName, keyword) ||
StringUtils.containsWord(this.results[i].alias, keyword) || StringUtils.containsWord(this.results[i].description, keyword))) { StringUtils.containsWord(this.results[i].alias, keyword) || StringUtils.containsWord(this.results[i].description, keyword))) {
ret.push(this.results[i]); ret.push(this.results[i]);
break; break;
} }
} }
} }
this.results = ret; this.results = ret;
} }
/** /**
* Check the current results if they satisfy the values of each filter category and * Check the current results if they satisfy the values of each filter category and
* update the number of possible results in each value. * update the number of possible results in each value.
* *
* @param params * @param params
*/ */
private checkFilters(params) { private checkFilters(params) {
let typeResults: StakeholderInfo[] = this.applyFilter('type', params); let typeResults: StakeholderInfo[] = this.applyFilter('type', params);
let accessResults: StakeholderInfo[] = this.results; let accessResults: StakeholderInfo[] = this.results;
let roleResults: StakeholderInfo[] = this.results; let roleResults: StakeholderInfo[] = this.results;
accessResults = this.applyFilter('access', params); accessResults = this.applyFilter('access', params);
roleResults = this.applyFilter('role', params); roleResults = this.applyFilter('role', params);
this.resetFilterNumbers('access'); this.resetFilterNumbers('access');
this.updateFilterNumbers(typeResults.filter(value => { this.updateFilterNumbers(typeResults.filter(value => {
return roleResults.includes(value); return roleResults.includes(value);
}), 'access'); }), 'access');
if (this.user) { if (this.user) {
this.resetFilterNumbers('role'); this.resetFilterNumbers('role');
this.updateFilterNumbers(accessResults.filter(value => { this.updateFilterNumbers(accessResults.filter(value => {
return typeResults.includes(value); return typeResults.includes(value);
}), 'role'); }), 'role');
} }
this.resetFilterNumbers('type'); this.resetFilterNumbers('type');
this.updateFilterNumbers(accessResults.filter(value => { this.updateFilterNumbers(accessResults.filter(value => {
return roleResults.includes(value); return roleResults.includes(value);
}), 'type'); }), 'type');
this.results = accessResults.filter(value => { this.results = accessResults.filter(value => {
return typeResults.includes(value); return typeResults.includes(value);
}) })
this.results = this.results.filter(value => { this.results = this.results.filter(value => {
return roleResults.includes(value); return roleResults.includes(value);
}); });
} }
/** /**
* Apply filter with filterId and return the results * Apply filter with filterId and return the results
* *
* @param filterId * @param filterId
* @param params * @param params
*/ */
private applyFilter(filterId: string, params): StakeholderInfo[] { private applyFilter(filterId: string, params): StakeholderInfo[] {
let results = []; let results = [];
let values: string[] = []; let values: string[] = [];
if (params[filterId]) { if (params[filterId]) {
values = (StringUtils.URIDecode(params[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1); values = (StringUtils.URIDecode(params[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1);
} }
if (filterId == 'type') { if (filterId == 'type') {
for (let i = 0; i < this.results.length; i++) { for (let i = 0; i < this.results.length; i++) {
if (values.length == 0) { if (values.length == 0) {
results.push(this.results[i]); results.push(this.results[i]);
} else { } else {
for (let value of values) { for (let value of values) {
if (this.results[i].type == value.replace(/["']/g, "")) { if (this.results[i].type == value.replace(/["']/g, "")) {
results.push(this.results[i]); results.push(this.results[i]);
break; break;
} }
} }
} }
} }
} else if (filterId == 'access') { } else if (filterId == 'access') {
for (let i = 0; i < this.results.length; i++) { for (let i = 0; i < this.results.length; i++) {
if (values.length == 0) { if (values.length == 0) {
results.push(this.results[i]); results.push(this.results[i]);
} else { } else {
for (let value of values) { for (let value of values) {
if (value.replace(/["']/g, "") == 'public') { if (value.replace(/["']/g, "") == 'public') {
if (this.results[i].visibility === 'PUBLIC') { if (this.results[i].visibility === 'PUBLIC') {
results.push(this.results[i]); results.push(this.results[i]);
break; break;
} }
} else if (value.replace(/["']/g, "") == 'restricted') { } else if (value.replace(/["']/g, "") == 'restricted') {
if (this.results[i].visibility === 'RESTRICTED') { if (this.results[i].visibility === 'RESTRICTED') {
results.push(this.results[i]); results.push(this.results[i]);
break; break;
} }
} /*else if (value.replace(/["']/g, "") == 'private') { } /*else if (value.replace(/["']/g, "") == 'private') {
if (this.results[i].visibility === 'PRIVATE') { if (this.results[i].visibility === 'PRIVATE') {
results.push(this.results[i]); results.push(this.results[i]);
break; break;
} }
}*/ }*/
} }
} }
} }
} else if (filterId == 'role') { } else if (filterId == 'role') {
for (let i = 0; i < this.results.length; i++) { for (let i = 0; i < this.results.length; i++) {
if (values.length == 0) { if (values.length == 0) {
results.push(this.results[i]); results.push(this.results[i]);
} else { } else {
for (let value of values) { for (let value of values) {
if (value.replace(/["']/g, "") == 'manager') { if (value.replace(/["']/g, "") == 'manager') {
if (this.results[i].isManager) { if (this.results[i].isManager) {
results.push(this.results[i]); results.push(this.results[i]);
break; break;
} }
} }
if (value.replace(/["']/g, "") == 'member') { if (value.replace(/["']/g, "") == 'member') {
if (this.results[i].isMember) { if (this.results[i].isMember) {
results.push(this.results[i]); results.push(this.results[i]);
break; break;
} }
} }
} }
} }
} }
} }
return results; return results;
} }
/** /**
* Reset the values of filter with id filterId with zero. * Reset the values of filter with id filterId with zero.
* *
* @param filterId * @param filterId
*/ */
private resetFilterNumbers(filterId: string) { private resetFilterNumbers(filterId: string) {
for (let i = 0; i < this.filters.length; i++) { for (let i = 0; i < this.filters.length; i++) {
if (this.filters[i].filterId == filterId) { if (this.filters[i].filterId == filterId) {
for (let j = 0; j < this.filters[i].values.length; j++) { for (let j = 0; j < this.filters[i].values.length; j++) {
this.filters[i].values[j].number = 0; this.filters[i].values[j].number = 0;
} }
break; break;
} }
} }
} }
/** /**
* Update the values of filter with id filterId based on * Update the values of filter with id filterId based on
* results. * results.
* *
* @param results * @param results
* @param filterId * @param filterId
*/ */
private updateFilterNumbers(results: StakeholderInfo[], filterId: string) { private updateFilterNumbers(results: StakeholderInfo[], filterId: string) {
for (let k = 0; k < results.length; k++) { for (let k = 0; k < results.length; k++) {
for (let i = 0; i < this.filters.length; i++) { for (let i = 0; i < this.filters.length; i++) {
if (this.filters[i].filterId == filterId) { if (this.filters[i].filterId == filterId) {
if (this.filters[i].filterId == 'type') { if (this.filters[i].filterId == 'type') {
for (let j = 0; j < this.filters[i].values.length; j++) { for (let j = 0; j < this.filters[i].values.length; j++) {
if (results[k].type == this.filters[i].values[j].id) { if (results[k].type == this.filters[i].values[j].id) {
this.filters[i].values[j].number++; this.filters[i].values[j].number++;
} }
} }
} else if (this.filters[i].filterId == 'access') { } else if (this.filters[i].filterId == 'access') {
if (results[k].visibility === 'PUBLIC') { if (results[k].visibility === 'PUBLIC') {
this.filters[i].values[0].number++; this.filters[i].values[0].number++;
} else if (results[k].visibility === 'RESTRICTED') { } else if (results[k].visibility === 'RESTRICTED') {
this.filters[i].values[1].number++; this.filters[i].values[1].number++;
} else { } else {
this.filters[i].values[2].number++; this.filters[i].values[2].number++;
} }
} else if (this.filters[i].filterId == 'role') { } else if (this.filters[i].filterId == 'role') {
if (results[k].isManager) { if (results[k].isManager) {
this.filters[i].values[0].number++; this.filters[i].values[0].number++;
} }
if (results[k].isMember) { if (results[k].isMember) {
this.filters[i].values[1].number++; this.filters[i].values[1].number++;
} }
} }
break; break;
} }
} }
} }
} }
/** /**
* Sorting results based on sortBy. * Sorting results based on sortBy.
*/ */
private sort() { private sort() {
if (this.searchUtils.sortBy == '') { if (this.searchUtils.sortBy == '') {
this.results.sort((left, right): number => { this.results.sort((left, right): number => {
if (left.name > right.name) { if (left.name > right.name) {
return 1; return 1;
} else if (left.name < right.name) { } else if (left.name < right.name) {
return -1; return -1;
} else { } else {
return 0; return 0;
} }
}) })
} else if (this.searchUtils.sortBy == 'creationdate,descending') { } else if (this.searchUtils.sortBy == 'creationdate,descending') {
this.results.sort((left, right): number => { this.results.sort((left, right): number => {
if (!right.creationDate || left.creationDate > right.creationDate) { if (!right.creationDate || left.creationDate > right.creationDate) {
return -1; return -1;
} else if (!left.creationDate || left.creationDate < right.creationDate) { } else if (!left.creationDate || left.creationDate < right.creationDate) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
}) })
} else if (this.searchUtils.sortBy == 'creationdate,ascending') { } else if (this.searchUtils.sortBy == 'creationdate,ascending') {
this.results.sort((left, right): number => { this.results.sort((left, right): number => {
if (!right.creationDate || left.creationDate > right.creationDate) { if (!right.creationDate || left.creationDate > right.creationDate) {
return 1; return 1;
} else if (!left.creationDate || left.creationDate < right.creationDate) { } else if (!left.creationDate || left.creationDate < right.creationDate) {
return -1; return -1;
} else { } else {
return 0; return 0;
} }
}) })
} }
} }
private isManager(stakeholder) { private isManager(stakeholder) {
return Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user) return Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user)
|| Session.isCommunityCurator(this.user) || Session.isManager(stakeholder.type, stakeholder.alias, this.user); || Session.isCommunityCurator(this.user) || Session.isManager(stakeholder.type, stakeholder.alias, this.user);
} }
private isMember(stakeholder) { private isMember(stakeholder) {
return this.isManager(stakeholder) || Session.isSubscribedTo(stakeholder.type, stakeholder.alias, this.user); return this.isManager(stakeholder) || Session.isSubscribedTo(stakeholder.type, stakeholder.alias, this.user);
} }
/** /**
* Create Search Stakeholder filters. * Create Search Stakeholder filters.
* *
*/ */
private createFilters(): Filter[] { private createFilters(): Filter[] {
let filter_names = []; let filter_names = [];
let filter_ids = []; let filter_ids = [];
let value_names = []; let value_names = [];
let value_original_ids = []; let value_original_ids = [];
filter_names.push("Type"); filter_names.push("Type");
filter_ids.push("type"); filter_ids.push("type");
value_names.push(["Funders", "Research Initiatives", "Organizations"]); value_names.push(["Funders", "Research Initiatives", "Institutions"]);
value_original_ids.push(["funder", "ri", "organization"]); value_original_ids.push(["funder", "ri", "organization"]);
filter_names.push("Accessibility"); filter_names.push("Accessibility");
filter_ids.push("access"); filter_ids.push("access");
if(!this.user) { if (!this.user) {
value_names.push(["Public", "Restricted"]); value_names.push(["Public", "Restricted"]);
value_original_ids.push(["public", "restricted"]); value_original_ids.push(["public", "restricted"]);
} else { } else {
value_names.push(["Public", "Restricted", "Private"]); value_names.push(["Public", "Restricted", "Private"]);
value_original_ids.push(["public", "restricted", "private"]); value_original_ids.push(["public", "restricted", "private"]);
filter_names.push("Role"); filter_names.push("Role");
filter_ids.push("role"); filter_ids.push("role");
value_names.push(["Manager", "Member"]); value_names.push(["Manager", "Member"]);
value_original_ids.push(["manager", "member"]); value_original_ids.push(["manager", "member"]);
} }
let filters: Filter[] = []; let filters: Filter[] = [];
for (let i = 0; i < filter_names.length; i++) { for (let i = 0; i < filter_names.length; i++) {
let values: Value[] = []; let values: Value[] = [];
for (let j = 0; j < value_names[i].length; j++) { for (let j = 0; j < value_names[i].length; j++) {
let value: Value = {name: value_names[i][j], id: value_original_ids[i][j], number: 0, selected: false}; let value: Value = { name: value_names[i][j], id: value_original_ids[i][j], number: 0, selected: false };
values.push(value); values.push(value);
} }
let filter: Filter = { let filter: Filter = {
title: filter_names[i], title: filter_names[i],
filterId: filter_ids[i], filterId: filter_ids[i],
originalFilterId: this.refineFields[i], originalFilterId: this.refineFields[i],
values: values, values: values,
countSelectedValues: 0, countSelectedValues: 0,
"filterOperator": 'or', "filterOperator": 'or',
valueIsExact: true, valueIsExact: true,
filterType: "checkbox" filterType: "checkbox"
}; };
filters.push(filter); filters.push(filter);
} }
return filters; return filters;
} }
private handleError(message: string, error) { private handleError(message: string, error) {
console.error('Communities Search Page: ' + message, error); console.error('Communities Search Page: ' + message, error);
} }
} }