Compare commits

..

No commits in common. "master" and "angular-16-irish-monitor" have entirely different histories.

335 changed files with 4670 additions and 12768 deletions

View File

@ -129,7 +129,7 @@ export class ClaimContextSearchFormComponent {
} }
select(communityId, communityLabel) { select(communityId, communityLabel) {
// console.log("SELECT", communityId) console.log("SELECT", communityId)
this.selectedCommunityId = communityId; this.selectedCommunityId = communityId;
this.selectedCommunityLabel = communityLabel; this.selectedCommunityLabel = communityLabel;
this.getCategories(); this.getCategories();

View File

@ -1,7 +1,6 @@
//Classes used in linking / inlinelinking when selecting an entity //Classes used in linking / inlinelinking when selecting an entity
import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {HelperFunctions} from "../../utils/HelperFunctions.class";
import {OpenaireEntities} from "../../utils/properties/searchFields"; import {OpenaireEntities} from "../../utils/properties/searchFields";
import {ClaimsProperties} from "./claims.properties";
export class ClaimResult { export class ClaimResult {
public source: string; public source: string;
@ -29,7 +28,6 @@ export class ClaimResult {
export class ClaimProject { export class ClaimProject {
public funderId: string; public funderId: string;
public funderShortname: string;
public funderName: string; public funderName: string;
public acronym: string; public acronym: string;
public startDate: string; public startDate: string;
@ -39,12 +37,6 @@ export class ClaimProject {
public fundingLevel0: string; public fundingLevel0: string;
public url: string; public url: string;
} }
export class ClaimOrganization {
public name: string;
// public shortName: string;
public url: string;
// public country: string;
}
export class ClaimContext { export class ClaimContext {
public community: string; public community: string;
@ -79,7 +71,6 @@ export class ClaimEntity {
result: ClaimResult; result: ClaimResult;
project: ClaimProject; project: ClaimProject;
context: ClaimContext; context: ClaimContext;
organization: ClaimOrganization;
constructor() { constructor() {
this.warningMessages = []; this.warningMessages = [];
@ -101,7 +92,6 @@ export class ClaimRecord2Insert {
targetAccessRights: string; targetAccessRights: string;
targetEmbargoEndDate: string; targetEmbargoEndDate: string;
claimedInDashboard: string; claimedInDashboard: string;
idSuffix:string;
constructor() { constructor() {
@ -125,12 +115,7 @@ export class ClaimDBContext {
title: string; title: string;
openaireId: string; openaireId: string;
} }
export class ClaimDBOrganization {
openaireId: string;
name: string;
shortName: string;
country: string;
}
export class ClaimDBProject { export class ClaimDBProject {
openaireId: string; openaireId: string;
name: string; name: string;
@ -190,18 +175,17 @@ export class ShowOptions {
} }
initSelectOptions(claimProperties:ClaimsProperties){ initSelectOptions(){
let options =[]; let options =[];
if(this.linkToEntities.indexOf('result')!=-1){ if(this.linkToEntities.indexOf('result')!=-1){
options.push({value: 'result',label: OpenaireEntities.RESULTS}) options.push({value: 'result',label: OpenaireEntities.RESULTS})
} }
if(this.linkToEntities.indexOf('project')!=-1){ if(this.linkToEntities.indexOf('project')!=-1){
options.push({value: 'project',label: claimProperties.SELECT_ENTITIES.projects}) options.push({value: 'project',label: OpenaireEntities.PROJECTS})
} }
if(this.linkToEntities.indexOf('context')!=-1){ if(this.linkToEntities.indexOf('context')!=-1){
options.push({value: 'context',label: OpenaireEntities.COMMUNITIES}) options.push({value: 'context',label: OpenaireEntities.COMMUNITIES})
} }
this.selectOptions = options; this.selectOptions = options;
// console.log(options, claimProperties.SELECT_ENTITIES.projects)
} }
} }

View File

@ -1,25 +1,69 @@
<div class="uk-width-expand" [ngClass]="centerAlign ? 'uk-align-center':''"> <div class="uk-width-xlarge@l uk-width-large" [ngClass]="centerAlign ? 'uk-align-center':''">
<advanced-search-input (searchEmitter)="search(page,size)"> <advanced-search-input (searchEmitter)="search(page,size)">
<div input type="select" [(value)]="showOptions.show" placeholder="Type" hint="Select..." <div input type="select" [(value)]="showOptions.show" placeholder="Type" hint="Select..."
[options]="showOptions.selectOptions" class="uk-width-medium@xl uk-width-auto"></div> [options]="showOptions.selectOptions" class="uk-width-2-5"></div>
<div *ngIf="funderOptions && funderOptions.length > 0" input type="select" [(value)]="selectedFunder" placeholder="Funder" hint="Select Funder..." <div class="uk-width-expand" input type="text" [(value)]="keyword" [searchable]="true" placeholder="Entities to link"
[options]="funderOptions" class="uk-width-expand" (valueChange)="funderChanged($event)"></div> [hint]="'Search for ' + openaireEntities.PROJECTS + '...'" tooltip="true"></div>
<div class="uk-width-expand" input type="text" [(value)]="keyword" [searchable]="true" placeholder="Projects to link"
[hint]="'Search for ' + openaireEntities.PROJECTS + '...'" tooltip="true" [disabled]="isNoProjectFunder"></div>
</advanced-search-input> </advanced-search-input>
</div> </div>
<div *ngIf=" openaireResultsStatus != errorCodes.LOADING && !isNoProjectFunder && this.selectedFunder && openaireResults.length == 0"> <div *ngIf="!showResults">
<div class="uk-text-center uk-text-large uk-text-meta uk-margin-large-top">No {{openaireEntities.PROJECT.toLowerCase()}} results yet... <br>Start <div class="uk-text-center uk-text-large uk-text-meta uk-margin-large-top">No {{openaireEntities.PROJECT.toLowerCase()}} results yet... <br>Start
searching for {{openaireEntities.PROJECTS.toLowerCase()}} to add them in the Basket searching for {{openaireEntities.PROJECTS.toLowerCase()}} to add them in the Basket
</div> </div>
</div> </div>
<div *ngIf=" openaireResultsStatus != errorCodes.LOADING && this.funderOptions.length > 1 && !this.selectedFunder && openaireResultsNum <= 0 "> <div *ngIf="showResults" class="uk-margin-top">
<div class="uk-text-center uk-text-large uk-text-meta uk-margin-large-top">Select funder or search for projects to proceed
</div>
</div>
<div class="uk-margin-top">
<div class="uk-grid" uk-grid> <div class="uk-grid" uk-grid>
<div *ngIf="!isNoProjectFunder && openaireResultsStatus != errorCodes.LOADING && openaireResultsNum > 1 " class="search-filters uk-width-1-1"> <div class="search-filters uk-width-1-1">
<!--<div *ngIf="countFilters()>0 && openaireResultsNum > 0" class="uk-grid uk-flex uk-flex-bottom">
<div class="uk-grid">
<h6 class="uk-text-bold">Filters</h6>
<a *ngIf="countFilters()>1" (click)="clearFilters()"
[class]="((openaireResultsStatus ==
errorCodes.LOADING)?'uk-disabled uk-link-muted':'')+' portal-link '">
Clear All
</a>
</div>
<div *ngIf="countFilters()>0" class="uk-grid uk-grid-small uk-text-small uk-margin-small-top " uk-grid>
<ng-container *ngFor="let filter of rangeFilters " >
<ng-container *ngIf = "filter.selectedFromAndToValues">
<span [title]="'Remove '+ filter.selectedFromAndToValues" (click) = "removeRangeFilter(filter) " >
<span class="selectedFilterLabel ">
<a [class]="((openaireResultsStatus ==
errorCodes.LOADING)?' uk-disabled':' ')+' uk-link-text '">
<span class=" clickable" aria-hidden="true">
<span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>
</span>
</span>
<span class="uk-margin-small-left">{{filter.selectedFromAndToValues}}</span>
</a>
</span>
</span>
</ng-container>
</ng-container>
<ng-container *ngFor="let filter of filters " >
<ng-container *ngIf = "filter.countSelectedValues > 0">
<span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; "
[title]="'Remove '+value.name" (click) = "removeFilter(value, filter) " >
&lt;!&ndash; if no grid on the div above, remove it and move class 'selectedFilterLabel' on top span &ndash;&gt;
<span class="selectedFilterLabel ">
<a [class]="((openaireResultsStatus ==
errorCodes.LOADING)?' uk-disabled':' ')+' uk-link-text '">
<span class=" clickable" aria-hidden="true">
<span class="uk-icon">
<svg width="16" height="16" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="close" ratio="0.8"><path fill="none" stroke="#000" stroke-width="1.6" d="M16,16 L4,4"></path><path fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>
</span>
</span>
<span class="uk-margin-small-left" [innerHtml]="(value.name.length > 34)?value.name.substring(0,34)+'...':value.name"></span>
</a>
</span>
</span>
</ng-container>
</ng-container>
</div>
</div>-->
<!-- <ng-container *ngIf="openaireResultsNum > 0">-->
<div class="uk-grid uk-grid-small" uk-grid> <div class="uk-grid uk-grid-small" uk-grid>
<ng-container *ngFor="let filter of rangeFilters"> <ng-container *ngFor="let filter of rangeFilters">
<div> <div>
@ -60,12 +104,9 @@
role="alert">Service not available role="alert">Service not available
</div> </div>
<div *ngIf="openaireResultsStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" <div *ngIf="openaireResultsStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1"
role="alert"> role="alert"><span class="loading-gif uk-align-center"></span></div>
<loading></loading>
</div>
<claim-results [localStoragePrefix]="localStoragePrefix" [results]=openaireResults <claim-results [localStoragePrefix]="localStoragePrefix" [results]=openaireResults
[selectedResults]=selectedProjects [basketLimit]="basketLimit"></claim-results> [selectedResults]=selectedProjects [basketLimit]="basketLimit"></claim-results>
<div *ngIf="isNoProjectFunder && openaireResultsStatus != errorCodes.LOADING " class="uk-alert uk-alert-default">No projects for funder <span class=" uk-text-bold">{{selectedFunder.name}}</span>. </div>
<div *ngIf="openaireResultsNum != null && openaireResultsNum > 0 && openaireResultsStatus != errorCodes.LOADING " class="uk-flex uk-flex-center "> <div *ngIf="openaireResultsNum != null && openaireResultsNum > 0 && openaireResultsStatus != errorCodes.LOADING " class="uk-flex uk-flex-center ">
<paging-no-load [currentPage]="openaireResultsPage" <paging-no-load [currentPage]="openaireResultsPage"
[totalResults]="openaireResultsNum" [term]="keyword" [totalResults]="openaireResultsNum" [term]="keyword"

View File

@ -1,4 +1,4 @@
import {Component, ElementRef, EventEmitter, Input, Output, ViewChild} from '@angular/core'; import {Component, ElementRef, EventEmitter, Input, Output} from '@angular/core';
import {SearchProjectsService} from '../../services/searchProjects.service'; import {SearchProjectsService} from '../../services/searchProjects.service';
import {ProjectService} from '../../landingPages/project/project.service'; import {ProjectService} from '../../landingPages/project/project.service';
import {ClaimEntity, ClaimProject} from './claimHelper.class'; import {ClaimEntity, ClaimProject} from './claimHelper.class';
@ -10,7 +10,6 @@ import {RangeFilter} from "../../utils/rangeFilter/rangeFilterHelperClasses.clas
import {OpenaireEntities, SearchFields} from "../../utils/properties/searchFields"; import {OpenaireEntities, SearchFields} from "../../utils/properties/searchFields";
import {NewSearchPageComponent} from "../../searchPages/searchUtils/newSearchPage.component"; import {NewSearchPageComponent} from "../../searchPages/searchUtils/newSearchPage.component";
import {Subscriber} from "rxjs"; import {Subscriber} from "rxjs";
import { properties } from 'src/environments/environment';
declare var UIkit:any; declare var UIkit:any;
@ -27,16 +26,17 @@ export class ClaimProjectsSearchFormComponent {
public elementRef; public elementRef;
@Output() projectSelected = new EventEmitter(); @Output() projectSelected = new EventEmitter();
public properties:EnvProperties = properties; @Input() public properties:EnvProperties;
@Input() public inlineClaim:boolean=false; @Input() public inlineClaim:boolean=false;
@Input() localStoragePrefix:string = ""; @Input() localStoragePrefix:string = "";
@Input() basketLimit; @Input() basketLimit;
@Input() showOptions; @Input() showOptions;
public errorCodes:ErrorCodes = new ErrorCodes(); public errorCodes:ErrorCodes = new ErrorCodes();
public projects:string[]; public projects:string[];
public warningMessage = ""; public warningMessage = "";
openaireResults:ClaimEntity[] = []; openaireResults:ClaimEntity[] = [];
openaireResultsNum: number = -1; openaireResultsNum: number ;
openaireResultsPage : number = 1; openaireResultsPage : number = 1;
openaireResultsStatus:number = this.errorCodes.NONE; openaireResultsStatus:number = this.errorCodes.NONE;
page : number = 1; page : number = 1;
@ -53,86 +53,47 @@ export class ClaimProjectsSearchFormComponent {
public rangeFields:string[][] = this.searchFields.PROJECT_RANGE_FIELDS; public rangeFields:string[][] = this.searchFields.PROJECT_RANGE_FIELDS;
openaireEntities = OpenaireEntities; openaireEntities = OpenaireEntities;
sub; sub;
selectedFunder = null;
funderOptions = [];
isNoProjectFunder = false;
constructor(private _service: ProjectService, private _projectService: SearchProjectsService, myElement: ElementRef) { constructor(private _service: ProjectService, private _projectService: SearchProjectsService, myElement: ElementRef) {
this.elementRef = myElement; this.elementRef = myElement;
this.rangeFilters = RangeFilter.parse(this.rangeFields,"project"); this.rangeFilters = RangeFilter.parse(this.rangeFields,"project");
this.getFunders();
} }
ngOnDestroy() { ngOnDestroy() {
if (this.sub instanceof Subscriber) { if (this.sub instanceof Subscriber) {
this.sub.unsubscribe(); this.sub.unsubscribe();
} }
} }
getFunders(){
this.openaireResultsStatus = this.errorCodes.LOADING;
this.showResults = true;
this.sub = this._projectService.advancedSearchProjects("", 1, 0, this.properties,
this.refineFieldsQuery, this.refineFields, "&type=projects&sf=funder", false, false).subscribe(
data => {
let option = {value : null, label: "No funder selected"};
this.funderOptions.push(option);
for(let v of data[2][0].values){
let option = {value : v, label: v.name};
this.funderOptions.push(option);
}
this.openaireResultsStatus = this.errorCodes.DONE;
}, error =>{
this.openaireResultsStatus = this.errorCodes.ERROR;
})
}
funderChanged(value){
this.keyword = ""
this.selectedFunder = value;
this.isNoProjectFunder = this.selectedFunder && this.selectedFunder.number == 1;
this.openaireResults = [];
this.openaireResultsNum = -1;
if(this.isNoProjectFunder){
this.showResults = true;
this.search(1,1);
}else{
this.openaireResults = [];
}
}
search(page,size) { search(page,size) {
/* if (this.keyword.length == 0) { if(this.keyword.length == 0){
this.showResults = false; this.showResults =false;
return; return;
}*/ }
this.showResults = true; this.showResults =true;
this.openaireResults = []; this.openaireResults = [];
this.openaireResultsStatus = this.errorCodes.LOADING; this.openaireResultsStatus = this.errorCodes.LOADING;
this.prevFilters = this.filters; this.prevFilters = this.filters;
//searchProjects (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties ):any { //searchProjects (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties ):any {
this.sub = this._projectService.advancedSearchProjects(this.createOpenaireQueryParams(), page, size, this.properties, this.createOpenaireRefineQuery(), [], null, false, false).subscribe( this.sub = this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe(
// this.sub = this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe(
data => { data => {
if (data != null) { if(data != null) {
this.openaireResultsPage = page; this.openaireResultsPage=page;
this.openaireResultsNum = data[0]; this.openaireResultsNum = data[0];
this.openaireResults = ClaimProjectsSearchFormComponent.openaire2ClaimEntity(data[1], this.properties); this.openaireResults =ClaimProjectsSearchFormComponent.openaire2ClaimEntity(data[1], this.properties);
if (data[2] && data[2].length > 0) { if(data[2] && data[2].length > 0){
this.filters = this.checkSelectedFilters(data[2], this.prevFilters); this.filters = this.checkSelectedFilters( data[2], this.prevFilters);
} }
this.openaireResultsStatus = this.errorCodes.DONE; this.openaireResultsStatus = this.errorCodes.DONE;
if (this.openaireResultsNum == 0) { if(this.openaireResultsNum == 0){
this.openaireResultsStatus = this.errorCodes.NONE; this.openaireResultsStatus = this.errorCodes.NONE;
this.filters = this.checkSelectedFilters([], this.prevFilters); this.filters = this.checkSelectedFilters( [], this.prevFilters);
}
}else {
this.openaireResultsStatus = this.errorCodes.ERROR;
} }
/* if(this.isNoProjectFunder && this.claimResultsComponent){ },
this.claimResultsComponent.add(this.openaireResults[0])
}*/
} else {
this.openaireResultsStatus = this.errorCodes.ERROR;
}
},
err => { err => {
this.openaireResultsStatus = this.errorCodes.ERROR; this.openaireResultsStatus = this.errorCodes.ERROR;
//console.log(err.status); //console.log(err.status);
@ -140,23 +101,85 @@ export class ClaimProjectsSearchFormComponent {
} }
); );
} }
remove(item){ // select(entity){
// if(this.selectedProjects.length > 50){
// UIkit.notification({
// message : 'Your basket exceeds the number of allowed projects (50)',
// status : 'warning',
// timeout : 1500,
// pos : 'top-center'
// });
// return;
// }
// this.query = "";
// // this.searchTermStream.next(this.query); //clear
// entity = entity.value;
// // var project: ClaimProject = new ClaimProject();
// // project.funderId = entity.funderId;
// // project.funderName = entity.funderName;
// // project.id = entity.id;
// // project.projectName = entity.projectName;
// // project.projectAcronym = entity.projectAcronym;
// // project.startDate = entity.startDate;
// // project.endDate = entity.endDate;
// // project.code = entity.code;
// // project.jurisdiction = entity.jurisdiction;
// // project.fundingLevel0 = entity.fundingLevel0;
//
//
// var index:number =this.selectedProjects.indexOf(entity);
// var found:boolean = false;
// this.warningMessage = "";
//
// for (var _i = 0; _i < this.selectedProjects.length; _i++) {
// let project = this.selectedProjects[_i];
// if(entity.id == project.id){
// found=true;
// this.warningMessage = "Project already in your basket";
// }
// }
//
// if (!found) {
// this.selectedProjects.push(entity);
// if(this.selectedProjects != null){
// localStorage.setItem(this.localStoragePrefix + "projects", JSON.stringify(this.selectedProjects));
// }
// this.projectSelected.emit({
// value: true
// });
//
// }
// }
/* static showItem(item):string{
return ((item.field[1]['@value'])?item.field[1]['@value']+" - ":"" ) + item.field[3]['@value'];
}*/
remove(item){
let index:number =this.selectedProjects.indexOf(item); let index:number =this.selectedProjects.indexOf(item);
if (index > -1) { if (index > -1) {
this.selectedProjects.splice(index, 1); this.selectedProjects.splice(index, 1);
} }
} }
static openaire2ClaimEntity(items, properties:EnvProperties){ /* handleClick(event){
var clickedComponent = event.target;
var inside = false;
do {
if (clickedComponent === this.elementRef.nativeElement) {
inside = true;
}
clickedComponent = clickedComponent.parentNode;
} while (clickedComponent);
}*/
static openaire2ClaimEntity(items, properties:EnvProperties){
const projects: ClaimEntity[] = []; const projects: ClaimEntity[] = [];
for(const item of items){ for(const item of items){
const entity: ClaimEntity = new ClaimEntity(); const entity: ClaimEntity = new ClaimEntity();
entity.project = new ClaimProject(); entity.project = new ClaimProject();
entity.project.funderId = item.funderId; entity.project.funderId = item.funderId;
entity.project.funderShortname = item.funderShortname?item.funderShortname:(entity.project.funderId?entity.project.funderId.split("::")[1]:""); entity.project.funderName = item.funderShortname;
entity.project.funderName = item.funderName;
entity.id = item.id; entity.id = item.id;
entity.project.url = (item.code !="unidentified") ? properties.searchLinkToProject + entity.id : null; entity.project.url = properties.searchLinkToProject + entity.id;
entity.title = item.title.name; entity.title = item.title.name;
entity.project.acronym = item.acronym; entity.project.acronym = item.acronym;
entity.project.startDate = item.startYear; entity.project.startDate = item.startYear;
@ -179,47 +202,43 @@ export class ClaimProjectsSearchFormComponent {
} }
createOpenaireQueryParams(): string { createOpenaireQueryParams():string {
let query = ""; let query = "";
if (this.keyword.length > 0) { if(this.keyword.length > 0){
// query += "q=" + StringUtils.quote(StringUtils.URIEncode(this.keyword)); query += "q=" + StringUtils.quote(StringUtils.URIEncode(this.keyword));
query += StringUtils.quote(StringUtils.URIEncode(this.keyword));
} }
return query;
}
createOpenaireRefineQuery(): string { /*if(this.startYear.length > 0 ){
query+='&fq=projectstartyear exact \"'+this.startYear+'\"'
}
if(this.endYear.length > 0 ){
query+='&fq=projectendyear exact \"'+this.endYear+'\"'
}*/
let allFqs = ""; let allFqs = "";
for (let filter of this.filters) { for (let filter of this.filters){
if (filter.countSelectedValues > 0) { if(filter.countSelectedValues > 0){
let count_selected = 0; let count_selected=0;
let fq = ""; let fq = "";
for (let value of filter.values) { for (let value of filter.values){
if (value.selected == true) { if(value.selected == true){
count_selected++; count_selected++;
fq += (fq.length > 0 ? " " + filter.filterOperator + " " : "") + filter.filterId + " exact " + (StringUtils.quote(value.id)); fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + (StringUtils.quote(value.id));
} }
} }
if (count_selected > 0) { if(count_selected > 0){
fq = "&fq=" + StringUtils.URIEncode(fq); fq="&fq="+StringUtils.URIEncode(fq);
allFqs += fq; allFqs += fq;
} }
} }
} }
if(this.selectedFunder){ for (let i=0; i<this.rangeFilters.length; i++){
allFqs += "&fq=" + StringUtils.URIEncode( "funder exact " + (StringUtils.quote(this.selectedFunder.id)));
}
if(!this.isNoProjectFunder || !this.selectedFunder){
allFqs += '&fq=(projectcode<>"unidentified")'
}
for (let i = 0; i < this.rangeFilters.length; i++) {
let filter = this.rangeFilters[i]; let filter = this.rangeFilters[i];
//selectedFromValue, selectedToValue, equalityOp, equalityOpFrom, equalityOpTo, filterOp ){ //selectedFromValue, selectedToValue, equalityOp, equalityOpFrom, equalityOpTo, filterOp ){
allFqs += NewSearchPageComponent.createRangeFilterQuery(this.rangeFields[i], filter.selectedFromValue, filter.selectedToValue, " within ", ">=", "<=", "and") allFqs+= NewSearchPageComponent.createRangeFilterQuery(this.rangeFields[i],filter.selectedFromValue, filter.selectedToValue, " within ", ">=" ,"<=", "and" )
} }
return allFqs + "&type=projects"; return query+allFqs;
}
}
public yearChanged() { public yearChanged() {
this.search(this.page, this.size); this.search(this.page, this.size);
@ -254,21 +273,20 @@ export class ClaimProjectsSearchFormComponent {
} }
} }
filter.countAllValues = filter.values.length;
} }
if(filters.length == 0 ){ if(filters.length == 0 ){
for(let j=0; j< prevFilters.length ; j++) { for(let j=0; j< prevFilters.length ; j++){
let filter = Object.assign({}, prevFilters[j]); let filter = Object.assign({}, prevFilters[j]);
filter.values = []; filter.values = [];
for (let filterValue of prevFilters[j].values) { for(let filterValue of prevFilters[j].values) {
if (filterValue.selected) { if(filterValue.selected){
filterValue.number = 0; filterValue.number = 0;
filter.values.push(filterValue); filter.values.push(filterValue);
}
}
filters.push(filter)
} }
}
filter.countAllValues = filter.values.length;
filters.push(filter)
}
} }
return filters; return filters;
} }

View File

@ -17,15 +17,14 @@ import {RangeFilterModule} from "../../utils/rangeFilter/rangeFilter.module";
import {AdvancedSearchInputModule} from "../../sharedComponents/advanced-search-input/advanced-search-input.module"; import {AdvancedSearchInputModule} from "../../sharedComponents/advanced-search-input/advanced-search-input.module";
import {InputModule} from "../../sharedComponents/input/input.module"; import {InputModule} from "../../sharedComponents/input/input.module";
import {DropdownFilterModule} from "../../utils/dropdown-filter/dropdown-filter.module"; import {DropdownFilterModule} from "../../utils/dropdown-filter/dropdown-filter.module";
import {LoadingModule} from "../../utils/loading/loading.module";
@NgModule({ @NgModule({
imports: [ imports: [
SharedModule, CommonModule, SharedModule, CommonModule,
// LoadingModalModule, // LoadingModalModule,
ProjectServiceModule, ProjectsServiceModule, EntitiesAutocompleteModule, HelperModule, ProjectServiceModule, ProjectsServiceModule, EntitiesAutocompleteModule, HelperModule,
PagingModule, SearchFilterModule, ClaimResultsModule, RangeFilterModule, AdvancedSearchInputModule, InputModule, DropdownFilterModule, LoadingModule PagingModule, SearchFilterModule, ClaimResultsModule, RangeFilterModule, AdvancedSearchInputModule, InputModule, DropdownFilterModule
], ],
providers:[ providers:[
], ],
declarations: [ declarations: [

View File

@ -51,9 +51,7 @@
</div> </div>
</div> </div>
<div *ngIf="crossrefStatus === errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" <div *ngIf="crossrefStatus === errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1"
role="alert"> role="alert"><span class="loading-gif uk-align-center"></span></div>
<loading></loading>
</div>
<div> <div>
<claim-results [localStoragePrefix]=localStoragePrefix [results]=crossrefResults <claim-results [localStoragePrefix]=localStoragePrefix [results]=crossrefResults
@ -116,7 +114,7 @@
<div *ngIf="openaireResultsStatus === errorCodes.LOADING" <div *ngIf="openaireResultsStatus === errorCodes.LOADING"
class="uk-animation-fade uk-margin-top uk-width-1-1" class="uk-animation-fade uk-margin-top uk-width-1-1"
role="alert"><loading></loading></div> role="alert"><span class="loading-gif uk-align-center">Loading...</span></div>
<claim-results [localStoragePrefix]=localStoragePrefix <claim-results [localStoragePrefix]=localStoragePrefix
[results]=openaireResults [selectedResults]=selectedResults [basketLimit]="basketLimit"></claim-results> [results]=openaireResults [selectedResults]=selectedResults [basketLimit]="basketLimit"></claim-results>
<div class="uk-flex uk-flex-center" *ngIf=" openaireResultsStatus != errorCodes.LOADING && openaireResultsNum != null && openaireResultsNum > 0" > <div class="uk-flex uk-flex-center" *ngIf=" openaireResultsStatus != errorCodes.LOADING && openaireResultsNum != null && openaireResultsNum > 0" >
@ -179,7 +177,7 @@
</div> </div>
</div> </div>
<div *ngIf="orcidStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"> <div *ngIf="orcidStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
<loading></loading></div> <span class="loading-gif uk-align-center"></span></div>
</div> </div>
</div> </div>
<div *ngIf="activeTab == 'datacite'" id="datacite" class="uk-animation-fade"> <div *ngIf="activeTab == 'datacite'" id="datacite" class="uk-animation-fade">
@ -192,7 +190,7 @@
<div class="uk-margin-top"> <div class="uk-margin-top">
<div *ngIf="dataciteStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1" <div *ngIf="dataciteStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1"
role="alert"><loading></loading></div> role="alert"><span class="loading-gif uk-align-center"></span></div>
<div> <div>
<claim-results [localStoragePrefix]=localStoragePrefix *ngIf="dataciteResults.length > 0 " <claim-results [localStoragePrefix]=localStoragePrefix *ngIf="dataciteResults.length > 0 "
[results]=dataciteResults [selectedResults]=selectedResults [basketLimit]="basketLimit"></claim-results> [results]=dataciteResults [selectedResults]=selectedResults [basketLimit]="basketLimit"></claim-results>

View File

@ -22,11 +22,10 @@ import {AdvancedSearchInputModule} from "../../sharedComponents/advanced-search-
import {InputModule} from "../../sharedComponents/input/input.module"; import {InputModule} from "../../sharedComponents/input/input.module";
import {SearchInputModule} from "../../sharedComponents/search-input/search-input.module"; import {SearchInputModule} from "../../sharedComponents/search-input/search-input.module";
import {DropdownFilterModule} from "../../utils/dropdown-filter/dropdown-filter.module"; import {DropdownFilterModule} from "../../utils/dropdown-filter/dropdown-filter.module";
import {LoadingModule} from "../../utils/loading/loading.module";
@NgModule({ @NgModule({
imports: [SharedModule, CommonModule, SearchResearchResultsServiceModule, PagingModule, SearchCrossrefServiceModule, imports: [SharedModule, CommonModule, SearchResearchResultsServiceModule, PagingModule, SearchCrossrefServiceModule,
SearchDataciteServiceModule, HelperModule, SearchFilterModule, ClaimResultsModule, MatSelectModule, QuickSelectionsModule, RangeFilterModule, ClaimProjectsSearchFormModule, AdvancedSearchInputModule, InputModule, SearchInputModule, DropdownFilterModule, LoadingModule], SearchDataciteServiceModule, HelperModule, SearchFilterModule, ClaimResultsModule, MatSelectModule, QuickSelectionsModule, RangeFilterModule, ClaimProjectsSearchFormModule, AdvancedSearchInputModule, InputModule, SearchInputModule, DropdownFilterModule],
providers:[ providers:[
SearchOrcidService SearchOrcidService
], ],

View File

@ -1,23 +0,0 @@
export class ClaimsProperties{
ALLOW_ORGANIZATION_LINKING:boolean = false;
SELECT_ENTITIES = {
projects:"Funding"
}
INLINE_ENTITY = {
show: true,
guideText : null
}
BASKET ={
source_title: "Source",
target_title: "Link source to"
}
METADATA_PREVIEW ={
source_title: "Source",
target_title: "Link to",
edit_source_title: "Edit",
edit_target_title: "Edit",
edit_target_icon: "edit"
}
}

View File

@ -1,27 +1,25 @@
<schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other"></schema2jsonld> <schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other"></schema2jsonld>
<div class="uk-grid"> <div class="uk-grid">
<div class="uk-width-expand uk-position-relative uk-margin-small-top"> <div class="uk-width-expand uk-position-relative">
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" <helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
[texts]="pageContents['top']"></helper> [texts]="pageContents['top']"></helper>
<div *ngIf="filterForm" [id]="actions?'page_content_actions':null" [class.uk-blur-background]="actions" [attr.uk-sticky]="(actions)?'media: @m':null" [attr.offset]="offset"> <div *ngIf="filterForm" [id]="actions?'page_content_actions':null" [class.uk-blur-background]="actions" [attr.uk-sticky]="(actions)?'media: @m':null" [attr.offset]="offset">
<div [class.uk-padding-small]="actions" class="uk-padding-remove-vertical"> <div [class.uk-padding-small]="actions" class="uk-padding-remove-vertical">
<div class="uk-section-xsmall">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle"> <div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle">
<div search-input [disabled]="loading" [searchControl]="filterForm.controls.keyword" searchInputClass="outer" <div search-input [disabled]="loading" [searchControl]="filterForm.controls.keyword" searchInputClass="outer"
placeholder="Search links" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1" placeholder="Search links" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"
(searchEmitter)="changeKeyword()" [expandable]="true"></div> (searchEmitter)="changeKeyword()" [expandable]="true"></div>
</div> </div>
</div>
</div> </div>
</div> </div>
<div [class.uk-padding]="actions" class="uk-padding-remove-vertical"> <div [class.uk-padding]="actions" class="uk-padding-remove-vertical">
<div class="uk-margin-small-top"> <div class="uk-margin-medium-top">
<results-and-pages [type]="resultsNum !== 1?'Links':'Link'" [page]="page" [pageSize]="size" [hasSearch]="true" [searchTerm]="keyword" <results-and-pages [type]="resultsNum !== 1?'Links':'Link'" [page]="page" [pageSize]="size" [hasSearch]="true" [searchTerm]="keyword"
[totalResults]="resultsNum" customClasses="uk-margin-remove"></results-and-pages> [totalResults]="resultsNum" customClasses="uk-margin-remove"></results-and-pages>
</div> </div>
<div class="uk-grid uk-flex-middle uk-margin-small-top" uk-grid> <div class="uk-grid uk-flex-middle uk-margin-medium-top" uk-grid>
<div *ngIf="fetchBy != 'User' && properties.environment == 'development'" >
<input [(ngModel)]="mine" [checked]="mine" (ngModelChange)="goTo(1)" type="checkbox" class="uk-checkbox"> Mine
</div>
<div> <div>
<dropdown-filter #dropdownFilter dropdownClass="uk-width-medium uk-padding-small" <dropdown-filter #dropdownFilter dropdownClass="uk-width-medium uk-padding-small"
name="Type of Entity" [disabled]="loading" [count]="entities.length"> name="Type of Entity" [disabled]="loading" [count]="entities.length">
@ -45,7 +43,6 @@
type="select" [options]="sortOptions"> type="select" [options]="sortOptions">
</div> </div>
</div> </div>
<div class="uk-width-expand@l uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center"> <div class="uk-width-expand@l uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center">
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [size]="size" <paging-no-load [currentPage]="page" [totalResults]="resultsNum" [size]="size"
[loading]="false" (pageChange)="pageChange($event)"></paging-no-load> [loading]="false" (pageChange)="pageChange($event)"></paging-no-load>
@ -59,76 +56,57 @@
<div *ngIf="claims && claims.length == 0" class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold"> <div *ngIf="claims && claims.length == 0" class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No links found</div> <div>No links found</div>
</div> </div>
<ng-container *ngIf="claims && claims.length > 0"> <ul class="uk-margin-small-top uk-list uk-list-xlarge">
<li *ngFor="let claim of claims; let i=index" class="uk-card uk-card-default">
<div class="uk-flex uk-flex-middle uk-margin-top uk-margin-small-bottom uk-padding-small uk-padding-remove-horizontal"> <div class="uk-card-body">
<div class="uk-width-xsmall uk-flex uk-flex-center uk-flex-middle"> <div class="uk-grid uk-grid-small" uk-grid>
<label> <div class="uk-width-expand">
<input id="checkAll" type="checkbox" (click)="selectAll($event)" class="uk-checkbox" title="Select All" <div class="uk-margin-bottom">
[ngModel]="selected.length == claims.length"/> <claim-entity [entity]="claim.target" [type]="claim.targetType" [properties]=properties
</label> [externalPortalUrl]=externalPortalUrl [source]="true" [linkAvailable]="isClaimAvailable(claim)"></claim-entity>
</div>
<button class="uk-button uk-button-link" [class.uk-disabled]="selected.length == 0" [disabled]="selected.length == 0"
(click)="deleteOpen()">
<span>Delete ({{selected.length}})</span>
</button>
</div>
<ul class="uk-margin-small-top uk-list uk-list-striped">
<li *ngFor="let claim of claims; let i=index" class="uk-flex uk-flex-middle uk-padding-small uk-padding-remove-horizontal">
<div class="uk-width-xsmall uk-flex uk-flex-center uk-flex-middle">
<input type="checkbox" class="uk-checkbox"
[id]="claim.id" (click)="selectClaim(claim, $event)" [ngModel]="isSelectedClaim(claim.id)">
</div>
<div class="uk-width-expand">
<div class="uk-grid uk-grid-small uk-flex-middle" uk-grid>
<div class="uk-width-expand">
<div class="uk-margin-small-bottom">
<claim-entity [entity]="claim.target" [type]="claim.targetType" [properties]=properties
[externalPortalUrl]=externalPortalUrl [source]="true" [linkAvailable]="isClaimAvailable(claim)"></claim-entity>
</div>
<div class="uk-margin-small-bottom">
<span *ngIf="isClaimAvailable(claim) else notAvailable" class="uk-label uk-label-small uk-label-success"
[attr.uk-tooltip]="'title: The link information is available in the portal and the APIs.'">available</span>
<ng-template #notAvailable>
<span class="uk-label uk-label-small uk-label-danger"
[attr.uk-tooltip]="'title:The link information will be added in the portal and the APIs in the next content provision workflow.'">pending</span>
</ng-template>
</div>
<div class="uk-text-small">
<div *ngIf="showUserEmail" class="uk-margin-xsmall-bottom">
<span class="uk-text-meta">Claimed by:</span>
<span class="uk-margin-xsmall-left">{{claim.userMail}}</span>
</div>
<div>
<span class="uk-text-meta">Claimed date:</span>
<span class="uk-margin-xsmall-left">{{claim.date}}</span>
</div>
</div>
</div> </div>
<div class="uk-visible@m"> <div class="uk-margin-bottom">
<div class="claim-divider"> <span *ngIf="isClaimAvailable(claim) else notAvailable" class="uk-label uk-label-success"
<icon class="uk-position-center" name="link" customClass="uk-text-primary" ratio="2" [flex]="true"></icon> [attr.uk-tooltip]="'title: The link information is available in the portal and the APIs.'">available</span>
</div> <ng-template #notAvailable>
<span class="uk-label uk-label-danger"
[attr.uk-tooltip]="'title:The link information will be added in the portal and the APIs in the next content provision workflow.'">pending</span>
</ng-template>
</div> </div>
<div class="uk-width-1-2@m uk-width-1-1"> <div class="uk-text-small">
<claim-entity [entity]="claim.source" [type]="claim.sourceType" [source]="false" [properties]=properties <div *ngIf="showUserEmail" class="uk-margin-small-bottom">
[externalPortalUrl]=externalPortalUrl></claim-entity> <span class="uk-text-meta">Claimed by:</span>
<span class="uk-margin-xsmall-left">{{claim.userMail}}</span>
</div>
<div>
<span class="uk-text-meta">Claimed date:</span>
<span class="uk-margin-xsmall-left">{{claim.date}}</span>
</div>
</div> </div>
</div> </div>
<div class="uk-visible@m">
<div class="claim-divider">
<icon class="uk-position-center" name="link" customClass="uk-text-primary" ratio="2" [flex]="true"></icon>
</div>
</div>
<div class="uk-width-1-2@m uk-width-1-1 uk-flex uk-flex-column uk-flex-center">
<claim-entity [entity]="claim.source" [type]="claim.sourceType" [source]="false" [properties]=properties
[externalPortalUrl]=externalPortalUrl></claim-entity>
</div>
</div> </div>
<div class="uk-width-xsmall uk-flex uk-flex-center uk-flex-middle"> </div>
<button class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="deleteOpen(i)"> <div class="uk-card-footer uk-flex uk-flex-right">
<icon name="delete" [flex]="true"></icon> <button class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="deleteOpen(i)">
</button> <icon name="delete" [flex]="true"></icon>
</div> <span class="uk-margin-xsmall-left">Delete</span>
</li> </button>
</ul> </div>
<div class="uk-margin-medium-top uk-flex uk-flex-center uk-flex-right@m"> </li>
<paging-no-load *ngIf="resultsNum" [currentPage]="page" [totalResults]="resultsNum" [size]="size" </ul>
(pageChange)="pageChange($event)"></paging-no-load> <div class="uk-margin-medium-top uk-flex uk-flex-center uk-flex-right@m">
</div> <paging-no-load *ngIf="resultsNum" [currentPage]="page" [totalResults]="resultsNum" [size]="size"
</ng-container> (pageChange)="pageChange($event)"></paging-no-load>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -4,4 +4,14 @@
position: relative; position: relative;
padding: 0 20px; padding: 0 20px;
height: 100%; height: 100%;
&::before {
content: '';
position: absolute;
top: 0;
left: 50%;
right: 0;
bottom: 0;
border-left: @global-border-width solid @global-border;
}
} }

View File

@ -28,7 +28,7 @@ import {DropdownFilterComponent} from "../../../utils/dropdown-filter/dropdown-f
}) })
export class DisplayClaimsComponent implements OnInit, OnDestroy { export class DisplayClaimsComponent implements OnInit, OnDestroy {
@Input() pageTitle: string = ""; @Input() pageTitle: string = "";
properties: EnvProperties = properties; properties: EnvProperties;
public searchTermStream = new Subject<string>(); public searchTermStream = new Subject<string>();
subscriptions: any = []; subscriptions: any = [];
public subResults: any; public subResults: any;
@ -40,7 +40,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
page: number = 1; page: number = 1;
size: number = 50; size: number = 50;
keyword: string; // the keyword string to give to the request as parameter keyword: string; // the keyword string to give to the request as parameter
types = ["All", "Project", "Context", "Result", "User", "Organization"]; types = ["All", "Project", "Context", "Result", "User"];
loading: boolean = false; loading: boolean = false;
@Input() fetchBy: string; @Input() fetchBy: string;
@Input() fetchId: string; @Input() fetchId: string;
@ -52,8 +52,6 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
lastIndexDate = null; lastIndexDate = null;
public filterForm: FormGroup; public filterForm: FormGroup;
public entities: string[] = []; public entities: string[] = [];
selected = [];
mine = false;
allOptions: Option[] = [ allOptions: Option[] = [
{label: OpenaireEntities.PUBLICATIONS, value: "publication"}, {label: OpenaireEntities.PUBLICATIONS, value: "publication"},
@ -101,6 +99,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
sort: this._fb.control(this.sortOptions[0].value) sort: this._fb.control(this.sortOptions[0].value)
}); });
this.properties = properties;
this.url = properties.domain + properties.baseLink + this._router.url; this.url = properties.domain + properties.baseLink + this._router.url;
if (!this.myClaims) { if (!this.myClaims) {
this.sortOptions.push({label: "User (desc) ", value: {sort: "user", descending: true}}); this.sortOptions.push({label: "User (desc) ", value: {sort: "user", descending: true}});
@ -133,7 +132,6 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
this.fetchId = this.fetchId ? this.fetchId : ''; this.fetchId = this.fetchId ? this.fetchId : '';
} }
let page = (params['page'] === undefined) ? 1 : +params['page']; let page = (params['page'] === undefined) ? 1 : +params['page'];
this.mine = (params['mine'] == 'true' ? true:false);
this.keyword = (params['keyword'] ? params['keyword'] : ""); this.keyword = (params['keyword'] ? params['keyword'] : "");
this.filterForm.get('keyword').setValue(this.keyword); this.filterForm.get('keyword').setValue(this.keyword);
this.page = (page <= 0) ? 1 : page; this.page = (page <= 0) ? 1 : page;
@ -187,16 +185,6 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
this.handleErrors(err, "Error getting claims for project with id: " + this.fetchId); this.handleErrors(err, "Error getting claims for project with id: " + this.fetchId);
} }
); );
} else if (this.fetchBy == "Organization") {
this.subResults = this._claimService.getClaimsByOrganization(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL, this.mine).subscribe(
data => {
this.manageAPIData(data);
this.loading = false;
},
err => {
this.handleErrors(err, "Error getting claims for project with id: " + this.fetchId);
}
);
} else if (this.fetchBy == "User") { } else if (this.fetchBy == "User") {
this.subResults = this._claimService.getClaimsByUser(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( this.subResults = this._claimService.getClaimsByUser(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe(
data => { data => {
@ -220,7 +208,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
} }
); );
} else if (this.fetchBy == "Context") { } else if (this.fetchBy == "Context") {
this.subResults = this._claimService.getClaimsBycontext(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL, this.mine).subscribe( this.subResults = this._claimService.getClaimsBycontext(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe(
data => { data => {
this.manageAPIData(data); this.manageAPIData(data);
this.loading = false; this.loading = false;
@ -231,7 +219,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
} }
); );
} else { } else {
this.subResults = this._claimService.getClaims(this.size, this.page, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL, this.mine).subscribe( this.subResults = this._claimService.getClaims(this.size, this.page, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe(
data => { data => {
this.manageAPIData(data); this.manageAPIData(data);
this.loading = false; this.loading = false;
@ -270,8 +258,15 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
types += (types.length > 0 ? ',' : '') + type; types += (types.length > 0 ? ',' : '') + type;
} }
params += (this.entities.length > 0) ? (params.length > 0 ? '&' : '') + "types=" + types : ""; params += (this.entities.length > 0) ? (params.length > 0 ? '&' : '') + "types=" + types : "";
if (this.isAdmin) {
params += (this.fetchBy == 'All' ? "" : (params.length > 0 ? '&' : '') + "fetchBy=" + this.fetchBy);
params += (this.fetchId == '' ? "" : (params.length > 0 ? '&' : '') + "fetchId=" + this.fetchId);
}
params += (this.filterForm.get("sort").value.sort == 'date' && this.filterForm.get("sort").value.descending ? "" : (params.length > 0 ? '&' : '') + "sort=" + this.filterForm.get("sort").value.sort + "-" + this.filterForm.get("sort").value.descending); params += (this.filterForm.get("sort").value.sort == 'date' && this.filterForm.get("sort").value.descending ? "" : (params.length > 0 ? '&' : '') + "sort=" + this.filterForm.get("sort").value.sort + "-" + this.filterForm.get("sort").value.descending);
params += (this.keyword == '' ? "" : (params.length > 0 ? '&' : '') + "keyword=" + this.keyword); params += (this.keyword == '' ? "" : (params.length > 0 ? '&' : '') + "keyword=" + this.keyword);
if (this.communityId != null) {
params += "&communityId=" + this.communityId;
}
return params; return params;
} }
@ -315,34 +310,23 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
} }
isSelected(value: string) { isSelected(value: string) {
return this.filterForm && this.filterForm.get('entities').value.find(entity => entity === value); return this.filterForm && this.filterForm.get('entities').value.find(entity => entity === value)
} }
deleteOpen(index: number = null) { deleteOpen(index: number) {
this.index = index; this.index = index;
this.deleteModal.alertTitle = 'Delete Confirmation'; this.deleteModal.alertTitle = 'Delete Confirmation';
this.deleteModal.message = 'Are you sure you want to delete ' + (this.index != null ? '1' : this.selected.length) + ' link(s)?'; this.deleteModal.message = 'Are you sure you want to delete this link?';
this.deleteModal.okButtonText = 'Yes'; this.deleteModal.okButtonText = 'Yes';
this.deleteModal.open(); this.deleteModal.open();
} }
delete() { delete() {
let claimsToBeDeleted = ((this.index != null) ? [this.claims[this.index].id] : this.selected.map(claim => claim.id)); this.subscriptions.push(this._claimService.deleteBulk([this.claims[this.index].id], this.properties.claimsAPIURL).subscribe(
// console.log(claimsToBeDeleted);
this.subscriptions.push(this._claimService.deleteBulk(claimsToBeDeleted, this.properties.claimsAPIURL).subscribe(
res => { res => {
if (this.index != null) { this.claims.splice(this.index, 1);
this.claims.splice(this.index, 1); this.resultsNum = this.resultsNum - 1;
this.resultsNum = this.resultsNum - 1; NotificationHandler.rise('Link has been deleted successfully');
NotificationHandler.rise('Link has been deleted successfully');
} else {
claimsToBeDeleted.forEach(claimId => {
this.claims.splice(this.claims.findIndex((id) => id == claimId), 1);
});
this.resultsNum = this.resultsNum - claimsToBeDeleted.length;
NotificationHandler.rise(claimsToBeDeleted.length + ' links have been deleted successfully');
}
this.selected = [];
let goToPage = this.page; let goToPage = this.page;
if (this.totalPages(this.resultsNum) < this.page && this.page > 0) { if (this.totalPages(this.resultsNum) < this.page && this.page > 0) {
goToPage = this.page - 1; goToPage = this.page - 1;
@ -350,8 +334,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
this.goTo(goToPage); this.goTo(goToPage);
}, err => { }, err => {
this.handleErrors(err, "Error deleting claim with id: " + this.claims[this.index].id); this.handleErrors(err, "Error deleting claim with id: " + this.claims[this.index].id);
} }));
));
} }
pageChange($event) { pageChange($event) {
@ -365,15 +348,10 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
let lastUpdateDateStr = Dates.getDateToString(lastUpdateDate); let lastUpdateDateStr = Dates.getDateToString(lastUpdateDate);
let claimDate = new Date(claim.date); let claimDate = new Date(claim.date);
let claimDateStr = Dates.getDateToString(claimDate); let claimDateStr = Dates.getDateToString(claimDate);
//TODO remove when organization links are integrated in Graph ------>
if(claim.sourceType == 'organization'){
return false;
}
// remove until here <-------
if (claimDateStr < lastUpdateDateStr) { if (claimDateStr < lastUpdateDateStr) {
return true; return true;
} else { } else {
return claim.target.collectedFrom != "infrastruct_::openaire"; return claim.target.collectedFrom != "infrastruct_::openaire" && claim.indexed;
} }
} }
@ -385,43 +363,6 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
return totalPages; return totalPages;
} }
selectClaim(item: any, event) {
let value = event.currentTarget.checked;
if (value) {
this.selected.push(item);
} else {
for (var _i = 0; _i < this.selected.length; _i++) {
let claim = this.selected[_i];
if (claim['id'] == item.id) {
this.selected.splice(_i, 1);
}
}
}
}
selectAll(event) {
let value = event.currentTarget.checked;
if (value) {
this.selected = [];
for (let _i = 0; _i < this.claims.length; _i++) {
let claim = this.claims[_i];
this.selected.push(claim);
}
} else {
this.selected = [];
}
}
isSelectedClaim(id: string) {
for (let _i = 0; _i < this.selected.length; _i++) {
let claim = this.selected[_i];
if (claim['id'] == id) {
return true;
}
}
return false;
}
private updateDescription(description: string) { private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'"); this._meta.updateTag({content: description}, "property='og:description'");

View File

@ -17,6 +17,7 @@ import {HelperModule} from '../../../utils/helper/helper.module';
import {Schema2jsonldModule} from '../../../sharedComponents/schema2jsonld/schema2jsonld.module'; import {Schema2jsonldModule} from '../../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../../sharedComponents/SEO/SEOService.module'; import { SEOServiceModule } from '../../../sharedComponents/SEO/SEOService.module';
import {IndexInfoServiceModule} from "../../../utils/indexInfoService.module"; import {IndexInfoServiceModule} from "../../../utils/indexInfoService.module";
import {PiwikServiceModule} from "../../../utils/piwik/piwikService.module";
import {SearchInputModule} from '../../../sharedComponents/search-input/search-input.module'; import {SearchInputModule} from '../../../sharedComponents/search-input/search-input.module';
import {InputModule} from '../../../sharedComponents/input/input.module'; import {InputModule} from '../../../sharedComponents/input/input.module';
import {LoadingModule} from '../../../utils/loading/loading.module'; import {LoadingModule} from '../../../utils/loading/loading.module';
@ -29,7 +30,7 @@ import {link} from "../../../utils/icons/icons";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, RouterModule, ClaimServiceModule, LoadingModalModule, AlertModalModule, CommonModule, FormsModule, RouterModule, ClaimServiceModule, LoadingModalModule, AlertModalModule,
ClaimEntityFormatterModule, PagingModule, HelperModule, Schema2jsonldModule, SEOServiceModule, ClaimEntityFormatterModule, PagingModule, HelperModule, Schema2jsonldModule, SEOServiceModule, PiwikServiceModule,
IndexInfoServiceModule, MatSelectModule, SearchInputModule, MatAutocompleteModule, MatChipsModule, MatFormFieldModule, MatSlideToggleModule, InputModule, LoadingModule, NoLoadPaging, IconsModule, DropdownFilterModule IndexInfoServiceModule, MatSelectModule, SearchInputModule, MatAutocompleteModule, MatChipsModule, MatFormFieldModule, MatSlideToggleModule, InputModule, LoadingModule, NoLoadPaging, IconsModule, DropdownFilterModule
], ],

View File

@ -1,6 +1,6 @@
import {Component, Input} from '@angular/core'; import {Component, Input} from '@angular/core';
import {EnvProperties} from '../../../utils/properties/env-properties'; import {EnvProperties} from '../../../utils/properties/env-properties';
import {ClaimDBContext, ClaimDBOrganization, ClaimDBProject, ClaimDBResult} from "../claimHelper.class"; import {ClaimDBContext, ClaimDBProject, ClaimDBResult} from "../claimHelper.class";
import {OpenaireEntities} from "../../../utils/properties/searchFields"; import {OpenaireEntities} from "../../../utils/properties/searchFields";
import {StringUtils} from "../../../utils/string-utils.class"; import {StringUtils} from "../../../utils/string-utils.class";
@ -15,32 +15,27 @@ import {StringUtils} from "../../../utils/string-utils.class";
<div *ngIf="source" class="uk-text-small"> <div *ngIf="source" class="uk-text-small">
{{getEntityName(type)}} {{getEntityName(type)}}
</div> </div>
<div> <div class="uk-flex">
<span *ngIf="!source" class="uk-text-meta uk-text-small uk-margin-small-right uk-text-nowrap">Link to:</span> <span *ngIf="!source" class="uk-text-meta uk-margin-small-right uk-text-large uk-text-nowrap">Link to:</span>
<publication-title [entity]="entity" param="id" <publication-title [entity]="entity" param="id"
path="/search/result" [externalPortalUrl]=externalPortalUrl [linkAvailable]="linkAvailable"></publication-title> path="/search/result" [externalPortalUrl]=externalPortalUrl [linkAvailable]="linkAvailable"></publication-title>
</div> </div>
</div> </div>
<div *ngIf="type == 'project'" [attr.uk-tooptip]="getEntityName(type)"> <div *ngIf="type == 'project'" [attr.uk-tooptip]="getEntityName(type)"
<span class="uk-text-meta uk-text-small uk-margin-small-right uk-text-nowrap">Link to:</span> class="uk-flex">
<span class="uk-text-meta uk-margin-small-right uk-text-large uk-text-nowrap">Link to:</span>
<project-title [project]="entity" [searchLink]=properties.searchLinkToProject <project-title [project]="entity" [searchLink]=properties.searchLinkToProject
[externalPortalUrl]=externalPortalUrl></project-title> [externalPortalUrl]=externalPortalUrl></project-title>
</div> </div>
<div *ngIf="type == 'organization'" [attr.uk-tooptip]="getEntityName(type)"> <div *ngIf="type == 'context'" class="uk-flex uk-text-large">
<span class="uk-text-meta uk-text-small uk-margin-small-right uk-text-nowrap">Link to:</span> <span class="uk-text-meta uk-margin-small-right uk-text-nowrap">Link to:</span>
<organization-title [organization]="entity"></organization-title> <span class="uk-text-truncate" uk-tooltip="Concept">{{entity.title}}</span>
</div>
<div *ngIf="type == 'context'">
<span class="uk-text-meta uk-text-small uk-margin-small-right uk-text-nowrap">Link to:</span>
<h6 class="uk-h6 uk-margin-remove">
<span class="uk-text-truncate" uk-tooltip="Concept">{{entity.title}}</span>
</h6>
</div> </div>
` `
}) })
export class ClaimEntityFormatter { export class ClaimEntityFormatter {
@Input() entity: ClaimDBResult | ClaimDBContext | ClaimDBProject | ClaimDBOrganization; @Input() entity: ClaimDBResult | ClaimDBContext | ClaimDBProject;
@Input() type: string; @Input() type: string;
@Input() properties: EnvProperties; @Input() properties: EnvProperties;
@Input() externalPortalUrl: string = null; @Input() externalPortalUrl: string = null;

View File

@ -5,19 +5,18 @@ import { RouterModule } from '@angular/router';
import {ProjectTitleFormatter} from './projectTitleFormatter.component'; import {ProjectTitleFormatter} from './projectTitleFormatter.component';
import {PublicationTitleFormatter} from './publicationTitleFormatter.component'; import {PublicationTitleFormatter} from './publicationTitleFormatter.component';
import {ClaimEntityFormatter} from './claimEntityFormatter.component'; import {ClaimEntityFormatter} from './claimEntityFormatter.component';
import {OrganizationTitleFormatterComponent} from "./organizationTitleFormatter.component";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, RouterModule CommonModule, RouterModule
], ],
declarations: [ declarations: [
ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter, OrganizationTitleFormatterComponent ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter
], ],
providers: [ ], providers: [ ],
exports: [ exports: [
ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter, OrganizationTitleFormatterComponent ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter
] ]
}) })

View File

@ -1,18 +0,0 @@
import {Component, Input} from '@angular/core';
@Component({
selector: 'organization-title',
template: `
<h6 *ngIf="organization" class="uk-margin-remove multi-line-ellipsis lines-2">
<p class="uk-margin-remove">
{{(organization.shortName ? ('[' + organization.shortName + '] ') : '')}}{{organization.name}}
</p>
</h6>
`
})
export class OrganizationTitleFormatterComponent {
@Input() organization: any;
public url: string;
}

View File

@ -10,19 +10,17 @@ import {properties} from "../../../../../environments/environment";
<ng-container> <ng-container>
<h6 class="uk-margin-remove multi-line-ellipsis lines-2"> <h6 class="uk-margin-remove multi-line-ellipsis lines-2">
<p class="uk-margin-remove"> <p class="uk-margin-remove">
<a *ngIf="externalPortalUrl" [href]="externalPortalUrl + projectUrl + '?projectId='+project['openaireId']" class="uk-link uk-link-heading" [class.uk-disabled]="project.name == 'unidentified'"> <a *ngIf="externalPortalUrl" [href]="externalPortalUrl + projectUrl + '?projectId='+project['openaireId']" class="uk-link uk-link-heading">
<span *ngIf="project['code'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span> {{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}
<span *ngIf="project['code'] == 'unidentified'">{{project['funderName']}}</span>
</a> </a>
<a *ngIf="!externalPortalUrl" [routerLink]="projectUrl" [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])" class="uk-link uk-link-heading" [class.uk-disabled]="project.name == 'unidentified'"> <a *ngIf="!externalPortalUrl" [routerLink]="projectUrl" [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])" class="uk-link uk-link-heading">
<span *ngIf="project['code'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span> {{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}
<span *ngIf="project['code'] == 'unidentified'">{{project['funderName']}} </span>
</a> </a>
</p> </p>
</h6> </h6>
</ng-container> </ng-container>
<span *ngIf="project['funderName'] && project['code'] != 'unidentified'" class="uk-margin-small-top"> <span *ngIf="project['funderName']" class="uk-margin-small-top">
<span class="uk-text-meta">Funder: </span>{{project['funderName']}} <span class="uk-text-muted">Funder: </span>{{project['funderName']}}
</span> </span>
` `
}) })

View File

@ -12,8 +12,8 @@ export class ClaimsService {
private getClaimRequest(size : number, page : number, url :string, fromCache:boolean):any { private getClaimRequest(size : number, page : number, url :string, fromCache:boolean):any {
return this.http.get(url, CustomOptions.getAuthOptionsWithBody()); return this.http.get(url, CustomOptions.getAuthOptionsWithBody());
} }
getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string, mine:boolean):any { getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string):any {
let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types) + (mine?"&mine=true":"") + (mine?"&mine=true":""); let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types);
return this.getClaimRequest(size,page,url,true); return this.getClaimRequest(size,page,url,true);
} }
@ -23,7 +23,7 @@ export class ClaimsService {
return this.getClaimRequest(size,page,url,false); return this.getClaimRequest(size,page,url,false);
} }
getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string , apiUrl:string, mine:boolean):any { getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string , apiUrl:string):any {
//console.info('ClaimsService: getClaims for context : '+contextId); //console.info('ClaimsService: getClaims for context : '+contextId);
let url = apiUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types); let url = apiUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types);
return this.getClaimRequest(size,page,url,true); return this.getClaimRequest(size,page,url,true);
@ -40,10 +40,6 @@ export class ClaimsService {
let url = apiUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types); let url = apiUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types);
return this.getClaimRequest(size,page,url,true); return this.getClaimRequest(size,page,url,true);
} }
getClaimsByOrganization( size : number, page : number, organizationId:string, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string, mine:boolean):any {
let url = apiUrl +"organizations/"+organizationId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types) + (mine?"&mine=true":"");
return this.getClaimRequest(size,page,url,true);
}
deleteClaimById(claimId:string , apiUrl:string):any{ deleteClaimById(claimId:string , apiUrl:string):any{
//console.warn('Trying to delete claim with id : '+claimId); //console.warn('Trying to delete claim with id : '+claimId);

View File

@ -58,20 +58,22 @@ export class SearchDataciteService {
entity.result.journal = null; entity.result.journal = null;
entity.result.DOI = item.attributes.doi; entity.result.DOI = item.attributes.doi;
entity.id = item.attributes.doi; entity.id = item.attributes.doi;
entity.title = Array.isArray(item.attributes.titles) && item.attributes.titles[0].title?item.attributes.titles[0].title:null; entity.title = item.attributes.title;
entity.result.url = properties.doiURL + item.attributes.doi; entity.result.url = properties.doiURL + item.attributes.doi;
entity.result.source = 'datacite'; entity.result.source = 'datacite';
entity.type = 'dataset'; entity.type = 'dataset';
entity.result.date = item.attributes.publicationYear; entity.result.date = item.attributes.published;
entity.result.accessRights = "OPEN"; entity.result.accessRights = "OPEN";
entity.result.publisher = item.attributes['publisher']; entity.result.publisher = item.attributes['container-title'];
entity.result.journal = null; entity.result.journal = null;
entity.result.record = item; entity.result.record = item;
if (item.attributes.creators) { if (item.attributes.author) {
entity.result.authors = []; entity.result.authors = [];
for (let j = 0; j < item.attributes.creators.length; j++) { for (let j = 0; j < item.attributes.author.length; j++) {
const author = item.attributes.creators[j].name; const author = item.attributes.author[j];
entity.result.authors.push(author); if(author.family || author.literal) {
entity.result.authors.push((author.family) ? author.family + (author.given ? ', ' + author.given : '') : author.literal);
}
} }
} }
results.push(entity); results.push(entity);

View File

@ -108,6 +108,7 @@ export class SearchOrcidService {
static parseOrcidAuthor(data: any, authorIds: string[], authors, addId): any { static parseOrcidAuthor(data: any, authorIds: string[], authors, addId): any {
console.log(data)
if (data[2] != null) { if (data[2] != null) {
if (addId) { if (addId) {
authorIds.push(data[2].path); authorIds.push(data[2].path);
@ -127,7 +128,9 @@ export class SearchOrcidService {
if (data[3] != null) { if (data[3] != null) {
author['institution'] = data[3]; author['institution'] = data[3];
} }
console.log(author['institution'])
authors.push(author); authors.push(author);
return true; return true;
} }
return false; return false;

View File

@ -3,6 +3,9 @@ import { NgModule } from '@angular/core';
import { SharedModule } from '../../../openaireLibrary/shared/shared.module'; import { SharedModule } from '../../../openaireLibrary/shared/shared.module';
import { ClaimsAdminComponent } from './claimsAdmin.component'; import { ClaimsAdminComponent } from './claimsAdmin.component';
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module'; import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
import { AdminLoginGuard} from'../../login/adminLoginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({ @NgModule({
imports: [ imports: [
@ -10,7 +13,7 @@ import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.mo
DisplayClaimsModule DisplayClaimsModule
], ],
providers:[], providers:[AdminLoginGuard, PreviousRouteRecorder,IsRouteEnabled],
declarations: [ declarations: [
ClaimsAdminComponent ClaimsAdminComponent
], ],

View File

@ -1,7 +1,6 @@
<loading *ngIf="validInput === null" [full]="true" class="uk-position-center"></loading>
<linking-generic *ngIf="validInput" [localStoragePrefix]="localStoragePrefix" [results]="results" [sources]="sources" <linking-generic *ngIf="validInput" [localStoragePrefix]="localStoragePrefix" [results]="results" [sources]="sources"
[communityId]="communityId" [inlineEntity]="inlineEntity" [showOptions]="showOptions" [communityId]="communityId" [inlineEntity]="inlineEntity" [showOptions]="showOptions"
pageTitle="Direct Linking" [claimsProperties]="claimsProperties"> pageTitle="Direct Linking">
</linking-generic> </linking-generic>
<div *ngIf="validInput== false" id="tm-main" class=" uk-section uk-padding-remove-top tm-middle"> <div *ngIf="validInput== false" id="tm-main" class=" uk-section uk-padding-remove-top tm-middle">

View File

@ -1,7 +1,7 @@
import {Component, Input, ViewChild} from '@angular/core'; import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {EnvProperties} from '../../utils/properties/env-properties'; import {EnvProperties} from '../../utils/properties/env-properties';
import {ClaimEntity, ClaimOrganization, ClaimProject, ShowOptions} from '../claim-utils/claimHelper.class'; import {ClaimEntity, ClaimProject, ShowOptions} from '../claim-utils/claimHelper.class';
import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service'; import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service';
import {SearchResearchResultsService} from '../../services/searchResearchResults.service'; import {SearchResearchResultsService} from '../../services/searchResearchResults.service';
import {LinkingGenericComponent} from "../linking/linkingGeneric.component"; import {LinkingGenericComponent} from "../linking/linkingGeneric.component";
@ -11,7 +11,6 @@ import {properties} from "../../../../environments/environment";
import {OpenaireEntities} from "../../utils/properties/searchFields"; import {OpenaireEntities} from "../../utils/properties/searchFields";
import {StringUtils} from "../../utils/string-utils.class"; import {StringUtils} from "../../utils/string-utils.class";
import {ClaimProjectsSearchFormComponent} from "../claim-utils/claimProjectSearchForm.component"; import {ClaimProjectsSearchFormComponent} from "../claim-utils/claimProjectSearchForm.component";
import {ClaimsProperties} from "../claim-utils/claims.properties";
@Component({ @Component({
@ -25,20 +24,18 @@ export class DirectLinkingComponent {
// linkType: string = "project"; // link type (selected in home page) : project, context, software, etc // linkType: string = "project"; // link type (selected in home page) : project, context, software, etc
/* url Parameters for inline linking */ /* url Parameters for inline linking */
@Input() id: string = null; //entity id id: string = null; //entity id
type: string = null; // entity type (publication or dataset) type: string = null; // entity type (publication or dataset)
// linkTo: string = null; // entity type (project or context or entity) // linkTo: string = null; // entity type (project or context or entity)
// linkToEntities: string[] = []; // linkToEntities: string[] = [];
showOptions:ShowOptions = new ShowOptions(); showOptions:ShowOptions = new ShowOptions();
validEntityTypes = ["dataset", "publication", "software", "other", "project", "context", "organization"]; validEntityTypes = ["dataset", "publication", "software", "other", "project", "context"];
sources: ClaimEntity[] = []; sources: ClaimEntity[] = [];
inlineEntity: ClaimEntity = null; inlineEntity: ClaimEntity = null;
validInput: boolean = null;//'true; validInput: boolean = null;//'true;
properties: EnvProperties = properties; properties: EnvProperties;
@Input() communityId: string = null; @Input() communityId: string = null;
localStoragePrefix: string = ""; localStoragePrefix: string = "";
@Input() organizationClaim: boolean = false;
@Input() claimsProperties:ClaimsProperties = new ClaimsProperties();
constructor(private _router: Router, private route: ActivatedRoute,private entitySearch:EntitiesSearchService, constructor(private _router: Router, private route: ActivatedRoute,private entitySearch:EntitiesSearchService,
private _searchResearchResultsService: SearchResearchResultsService) {} private _searchResearchResultsService: SearchResearchResultsService) {}
subscriptions = []; subscriptions = [];
@ -50,18 +47,12 @@ export class DirectLinkingComponent {
}); });
} }
ngOnInit() { ngOnInit() {
/* if(!this.claimsProperties){ this.properties = properties;
this.claimsProperties = new ClaimsProperties();
}*/
this.subscriptions.push(this.route.queryParams.subscribe(params => { this.subscriptions.push(this.route.queryParams.subscribe(params => {
if(this.organizationClaim){ this.id = params['id'];
this.type = "organization"; this.type = params['type'];
this.showOptions.linkTo = "result"; this.showOptions.linkTo = params['linkTo'];
}else {
this.id = params['id'];
this.type = params['type'];
this.showOptions.linkTo = params['linkTo'];
}
if (this.type != null && this.showOptions.linkTo != null) { if (this.type != null && this.showOptions.linkTo != null) {
this.type = (this.validEntityTypes.indexOf(this.type) != -1) ? this.type : 'publication'; this.type = (this.validEntityTypes.indexOf(this.type) != -1) ? this.type : 'publication';
this.showOptions.linkTo = (this.validEntityTypes.indexOf(this.showOptions.linkTo) != -1 || this.showOptions.linkTo == "result") ? this.showOptions.linkTo : 'project'; this.showOptions.linkTo = (this.validEntityTypes.indexOf(this.showOptions.linkTo) != -1 || this.showOptions.linkTo == "result") ? this.showOptions.linkTo : 'project';
@ -77,8 +68,6 @@ export class DirectLinkingComponent {
if (this.type == "project") { if (this.type == "project") {
// this.linkType = "project"; // this.linkType = "project";
this.getProjectById(this.id); this.getProjectById(this.id);
} else if (this.type == "organization") {
this.getOrganizationById(this.id);
} else if (this.type == "publication") { } else if (this.type == "publication") {
this.getResearchResultById("publication", this.id); this.getResearchResultById("publication", this.id);
} else if (this.type == "dataset") { } else if (this.type == "dataset") {
@ -92,7 +81,7 @@ export class DirectLinkingComponent {
} }
//set which entities it is allowed to link to. //set which entities it is allowed to link to.
// add first the // add first the
if(this.type == "project" || this.type == "organization"){ if(this.type == "project"){
this.showOptions.linkToEntities = ["result"]; this.showOptions.linkToEntities = ["result"];
this.showOptions.linkTo = "result"; this.showOptions.linkTo = "result";
}else{ }else{
@ -106,27 +95,24 @@ export class DirectLinkingComponent {
this.showOptions.linkToEntities = ["result","project","context" ]; this.showOptions.linkToEntities = ["result","project","context" ];
} }
}
} else {
this.validInput = this.isValidInput(null);
} }
})); } else {
this.validInput = this.isValidInput(null);
}
}));
} }
isValidInput(result: ClaimEntity) { isValidInput(result: ClaimEntity) {
if (result == null) { if (result == null) {
return false; return false;
} else if (this.type == "organization" && !this.claimsProperties.ALLOW_ORGANIZATION_LINKING) { } else if (this.type == "project" && this.showOptions.linkTo != "result") {
return false;
} else if ((this.type == "project" || this.type == "organization") && this.showOptions.linkTo != "result") {
return false; return false;
} else if (["dataset", "publication", "software", "other"].indexOf(this.type) != -1 && (["project", "context", "result"].indexOf(this.showOptions.linkTo) == -1)) { } else if (["dataset", "publication", "software", "other"].indexOf(this.type) != -1 && (["project", "context", "result"].indexOf(this.showOptions.linkTo) == -1)) {
return false; return false;
} else if (["project", "dataset", "publication", "software", "other", "organization"].indexOf(this.type) == -1) { } else if (["project", "dataset", "publication", "software", "other"].indexOf(this.type) == -1) {
return false; return false;
} else { } else {
return true; return true;
@ -144,17 +130,6 @@ export class DirectLinkingComponent {
this.handleError("Error getting project by id: " + id, err); this.handleError("Error getting project by id: " + id, err);
})); }));
} }
getOrganizationById(id: string) {
this.subscriptions.push(this.entitySearch.fetchByType(id,"organization", this.properties).subscribe(
data => {
this.createClaimEntity(data, "organization");
},
err => {
this.validInput = this.isValidInput(null);
//console.log("An error occured")
this.handleError("Error getting project by id: " + id, err);
}));
}
getResearchResultById(resultType: string, id: string) { getResearchResultById(resultType: string, id: string) {
this.subscriptions.push(this._searchResearchResultsService.searchById(resultType, id, this.properties).subscribe(data => { this.subscriptions.push(this._searchResearchResultsService.searchById(resultType, id, this.properties).subscribe(data => {
@ -181,23 +156,12 @@ export class DirectLinkingComponent {
entity.project.code = project.code; entity.project.code = project.code;
entity.project.endDate = project.endDate; entity.project.endDate = project.endDate;
entity.project.funderId = project.funderId; entity.project.funderId = project.funderId;
entity.project.funderShortname = project.funderShortName?project.funderShortName:(entity.project.funderId.split("::")[1]);
entity.project.funderName = project.funderName; entity.project.funderName = project.funderName;
entity.project.fundingLevel0 = project.fundingLevel0; entity.project.fundingLevel0 = project.fundingLevel0;
entity.project.jurisdiction = project.jurisdiction; entity.project.jurisdiction = project.jurisdiction;
entity.project.startDate = project.startDate; entity.project.startDate = project.startDate;
this.inlineEntity = entity; this.inlineEntity = entity;
}else if(type =="organization"){ }else{
let organization = data[0];
let entity:ClaimEntity = new ClaimEntity();
entity.id = organization.id;
entity.type = "organization";
entity.title = organization.label;
entity.organization = new ClaimOrganization();
// entity.organization.url = properties.searchLinkToOrganization + entity.id;
entity.organization.name = organization.label;
this.inlineEntity = entity;
}else{
results = ClaimResultSearchFormComponent.openaire2ClaimResults(data, this.properties); results = ClaimResultSearchFormComponent.openaire2ClaimResults(data, this.properties);
} }

View File

@ -5,18 +5,20 @@ import { DirectLinkingComponent } from './directLinking.component';
import {EntitySearchServiceModule} from '../../utils/entitiesAutoComplete/entitySearchService.module'; import {EntitySearchServiceModule} from '../../utils/entitiesAutoComplete/entitySearchService.module';
import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module'; import {SearchResearchResultsServiceModule} from '../../services/searchResearchResultsService.module';
import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import {LinkingGenericModule} from '../linking/linkingGeneric.module'; import {LinkingGenericModule} from '../linking/linkingGeneric.module';
import {LoadingModule} from "../../utils/loading/loading.module";
@NgModule({ @NgModule({
imports: [ imports: [
SharedModule, SharedModule,
EntitySearchServiceModule, SearchResearchResultsServiceModule, EntitySearchServiceModule, SearchResearchResultsServiceModule,
Schema2jsonldModule, SEOServiceModule, LinkingGenericModule, LoadingModule Schema2jsonldModule, SEOServiceModule, LinkingGenericModule
], ],
providers:[], providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
declarations: [ declarations: [
DirectLinkingComponent DirectLinkingComponent
], exports:[DirectLinkingComponent] ], exports:[DirectLinkingComponent]

View File

@ -133,11 +133,11 @@ export class BulkClaimComponent {
} }
}); });
} }
upload() { upload() {
this.enableUpload = false; this.enableUpload = false;
this.showReport = false; this.showReport = false;
this.errorMessage = ""; this.errorMessage = "";
console.log(this.filesToUpload);
if (this.filesToUpload.length == 0) { if (this.filesToUpload.length == 0) {
this.errorMessage = "There is no selected file to upload."; this.errorMessage = "There is no selected file to upload.";
return; return;
@ -150,7 +150,7 @@ export class BulkClaimComponent {
} }
this.loading.open(); this.loading.open();
this.makeFileRequest(this.properties.utilsService + '/upload', [], this.filesToUpload).then(async (result) => { this.makeFileRequest(this.properties.utilsService + '/upload', [], this.filesToUpload).then((result) => {
const rows = (result as any).split('\n'); // I have used space, you can use any thing. const rows = (result as any).split('\n'); // I have used space, you can use any thing.
this.exceedsLimit = false; this.exceedsLimit = false;
let invalid_rows = 0; let invalid_rows = 0;
@ -179,7 +179,6 @@ export class BulkClaimComponent {
this.allIds.push(id); this.allIds.push(id);
if (currentLength < this.basketLimit){ if (currentLength < this.basketLimit){
currentLength++; currentLength++;
await new Promise((resolve) => setTimeout(resolve, 100));
this.fetchResult(id, accessMode, Dates.getDateToString(embargoDate), i + 1); this.fetchResult(id, accessMode, Dates.getDateToString(embargoDate), i + 1);
}else{ }else{
this.exceedsLimit = true; this.exceedsLimit = true;
@ -270,16 +269,11 @@ export class BulkClaimComponent {
} }
}, },
err => { err => {
// console.log(err); //console.log(err);
BulkClaimComponent.handleError("Error getting crossref by DOIs: " + id, err); BulkClaimComponent.handleError("Error getting crossref by DOIs: " + id, err);
this.notFoundIds.push(id);
if(err.status == 404) { this.notFoundIdsRow.push(row);
this.searchInDatacite(id, accessMode, date, row); this.endOfFetching();
} else {
this.notFoundIds.push(id);
this.notFoundIdsRow.push(row);
this.endOfFetching();
}
} }
)); ));
} }

View File

@ -1,5 +1,5 @@
import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core'; import {Component, Input, Output, EventEmitter, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {Router, ActivatedRoute} from '@angular/router';
import {ClaimsService} from '../../claim-utils/service/claims.service'; import {ClaimsService} from '../../claim-utils/service/claims.service';
import {ModalLoading} from '../../../utils/modal/loading.component'; import {ModalLoading} from '../../../utils/modal/loading.component';
import {AlertModal} from '../../../utils/modal/alert'; import {AlertModal} from '../../../utils/modal/alert';
@ -63,7 +63,6 @@ export class ClaimInsertComponent {
private userManagementService: UserManagementService, private _logService: LogService) { private userManagementService: UserManagementService, private _logService: LogService) {
} }
subscriptions = []; subscriptions = [];
timerSubscription;
ngOnDestroy() { ngOnDestroy() {
this.subscriptions.forEach(subscription => { this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) { if (subscription instanceof Subscriber) {
@ -89,12 +88,13 @@ export class ClaimInsertComponent {
}) })
).subscribe(); ).subscribe();
this.subscriptions.push(loadingTimerSubscription); this.subscriptions.push(loadingTimerSubscription);
this.timerSubscription = timer(0, 10000).pipe(
let timerSubscription = timer(0, 10000).pipe(
map(() => { map(() => {
this.getStatus(); // load data contains the http request this.getStatus(); // load data contains the http request
}) })
).subscribe(); ).subscribe();
this.subscriptions.push(this.timerSubscription); this.subscriptions.push(timerSubscription);
}else{ }else{
this.claimsJob = null; this.claimsJob = null;
} }
@ -156,14 +156,13 @@ export class ClaimInsertComponent {
this.loading.open(); this.loading.open();
let claims: ClaimRecord2Insert[] = []; let claims: ClaimRecord2Insert[] = [];
let directclaims: DirectIndexRecord[] = []; let directclaims: DirectIndexRecord[] = [];
let idSuffix = (new Date()).getTime() + "";
let dashboard = this.properties.environment+"_"+this.properties.dashboard + (this.communityId?("_"+this.communityId):''); let dashboard = this.properties.environment+"_"+this.properties.dashboard + (this.communityId?("_"+this.communityId):'');
for (let j = 0; j < this.sources.length; j++) { // if an external result -> direct insert in the index for (let j = 0; j < this.sources.length; j++) { // if an external result -> direct insert in the index
const result: ClaimEntity = this.sources[j]; const result: ClaimEntity = this.sources[j];
if (result.result && ["crossref", "datacite", "orcid"].indexOf(result.result.source) != -1) { if (result.result && ["crossref", "datacite", "orcid"].indexOf(result.result.source) != -1) {
directclaims.push({ directclaims.push({
"id": result.id, "id": result.id,
"record": ClaimInsertComponent.createDirectClaim(result, this.results, idSuffix) "record": ClaimInsertComponent.createDirectClaim(result, this.results)
}); });
} }
} }
@ -174,12 +173,12 @@ export class ClaimInsertComponent {
if (this.sources.length > 0) { if (this.sources.length > 0) {
directclaims.push({ directclaims.push({
"id": entity.id, "id": entity.id,
"record": ClaimInsertComponent.createDirectClaim(entity, this.sources, idSuffix) "record": ClaimInsertComponent.createDirectClaim(entity, this.sources)
}); });
} else if (this.inlineEntity && this.inlineEntity.type != "organization") { } else if (this.inlineEntity) {
directclaims.push({ directclaims.push({
"id": entity.id, "id": entity.id,
"record": ClaimInsertComponent.createDirectClaim(entity, [this.inlineEntity], idSuffix) "record": ClaimInsertComponent.createDirectClaim(entity, [this.inlineEntity])
}); });
} }
@ -188,13 +187,11 @@ export class ClaimInsertComponent {
for (let j = 0; j < this.sources.length; j++) { for (let j = 0; j < this.sources.length; j++) {
const result: ClaimEntity = this.sources[j]; // this is a research result const result: ClaimEntity = this.sources[j]; // this is a research result
if (entity.result) { if (entity.result) {
claims.push(ClaimInsertComponent.createResultClaim(result, entity, user.email, dashboard, idSuffix)); claims.push(ClaimInsertComponent.createResultClaim(result, entity, user.email, dashboard));
} else if (entity.context) { } else if (entity.context) {
claims.push(ClaimInsertComponent.createContextClaim(result, entity, user.email, dashboard, idSuffix)); claims.push(ClaimInsertComponent.createContextClaim(result, entity, user.email, dashboard));
} else if (entity.project) { } else if (entity.project) {
claims.push(ClaimInsertComponent.createProjectClaim(result, entity, user.email, dashboard, idSuffix)); claims.push(ClaimInsertComponent.createProjectClaim(result, entity, user.email, dashboard));
/* } else if (entity.organization) {
claims.push(ClaimInsertComponent.createOrganizationClaim(result, entity, user.email, dashboard, idSuffix));*/
} }
this.infoToLog.push([ result.title?result.title: result.id, entity.title?entity.title:entity.id]); this.infoToLog.push([ result.title?result.title: result.id, entity.title?entity.title:entity.id]);
@ -204,19 +201,15 @@ export class ClaimInsertComponent {
if (this.inlineEntity.result) { if (this.inlineEntity.result) {
if (entity.result) { if (entity.result) {
claims.push(ClaimInsertComponent.createResultClaim(this.inlineEntity, entity, user.email, dashboard, idSuffix)); claims.push(ClaimInsertComponent.createResultClaim(this.inlineEntity, entity, user.email, dashboard));
} else if (entity.context) { } else if (entity.context) {
claims.push(ClaimInsertComponent.createContextClaim(this.inlineEntity, entity, user.email, dashboard, idSuffix)); claims.push(ClaimInsertComponent.createContextClaim(this.inlineEntity, entity, user.email, dashboard));
} else if (entity.project) { } else if (entity.project) {
claims.push(ClaimInsertComponent.createProjectClaim(this.inlineEntity, entity, user.email, dashboard, idSuffix)); claims.push(ClaimInsertComponent.createProjectClaim(this.inlineEntity, entity, user.email, dashboard));
} }
} else if (this.inlineEntity.project) { } else if (this.inlineEntity.project) {
if (entity.result) { if (entity.result) {
claims.push(ClaimInsertComponent.createProjectClaim(entity, this.inlineEntity, user.email, dashboard, idSuffix)); claims.push(ClaimInsertComponent.createProjectClaim(entity, this.inlineEntity, user.email, dashboard));
}
} else if (this.inlineEntity.organization) {
if (entity.result) {
claims.push(ClaimInsertComponent.createOrganizationClaim(entity, this.inlineEntity, user.email, dashboard, idSuffix));
} }
} }
} }
@ -232,7 +225,7 @@ export class ClaimInsertComponent {
data => { data => {
this.feedRecordsJob = data.data; this.feedRecordsJob = data.data;
this.records2Insert = directclaims.length; this.records2Insert = directclaims.length;
// console.log(data); console.log(data);
// this.insertedRecords = data.insertedIds; // this.insertedRecords = data.insertedIds;
// //
// this.errorInRecords = data.errorInClaims; // this.errorInRecords = data.errorInClaims;
@ -274,12 +267,12 @@ export class ClaimInsertComponent {
} }
} }
this.saveLocalStorage(); this.saveLocalStorage();
this.timerSubscription = timer(0, 10000).pipe( let timerSubscription = timer(0, 10000).pipe(
map(() => { map(() => {
this.getStatus(); // load data contains the http request this.getStatus(); // load data contains the http request
}) })
).subscribe(); ).subscribe();
this.subscriptions.push(this.timerSubscription); this.subscriptions.push(timerSubscription);
}, },
err => { err => {
err = err && err.error?err.error:err; err = err && err.error?err.error:err;
@ -391,18 +384,13 @@ export class ClaimInsertComponent {
localStorage.removeItem(this.localStoragePrefix + "results"); localStorage.removeItem(this.localStoragePrefix + "results");
localStorage.removeItem(this.localStoragePrefix + "claimsJob"); localStorage.removeItem(this.localStoragePrefix + "claimsJob");
localStorage.removeItem(this.localStoragePrefix + "feedRecordsJob"); localStorage.removeItem(this.localStoragePrefix + "feedRecordsJob");
if(this.properties.myClaimsLink && this.properties.myClaimsLink.indexOf(".") == -1) {
this._router.navigate([this.properties.myClaimsLink], {queryParams: this.params}); this._router.navigate([this.properties.myClaimsLink], {queryParams: this.params});
}else if(this.properties.myClaimsLink && this.properties.myClaimsLink.indexOf(".") != -1) {
this._router.navigate([this.properties.myClaimsLink], {relativeTo: this.route});
}else{
this._router.navigate(["/"]);
}
} }
} }
private static createContextClaim(resultEntity: ClaimEntity, contextEntity: ClaimEntity, user: any, dashboard:string, idSuffix:string): ClaimRecord2Insert { private static createContextClaim(resultEntity: ClaimEntity, contextEntity: ClaimEntity, user: any, dashboard:string): ClaimRecord2Insert {
return { return {
claimedBy: user, claimedBy: user,
sourceId: contextEntity.context.concept.id, sourceId: contextEntity.context.concept.id,
@ -415,12 +403,11 @@ export class ClaimInsertComponent {
targetCollectedFrom: resultEntity.result.source, targetCollectedFrom: resultEntity.result.source,
targetAccessRights: resultEntity.result.accessRights, targetAccessRights: resultEntity.result.accessRights,
targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(resultEntity), targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(resultEntity),
claimedInDashboard : dashboard, claimedInDashboard : dashboard
idSuffix : idSuffix
}; };
} }
private static createProjectClaim(resultEntity: ClaimEntity, projectEntity: ClaimEntity, user: any, dashboard:string, idSuffix:string): ClaimRecord2Insert { private static createProjectClaim(resultEntity: ClaimEntity, projectEntity: ClaimEntity, user: any, dashboard:string): ClaimRecord2Insert {
return { return {
claimedBy: user, claimedBy: user,
sourceId: projectEntity.id, sourceId: projectEntity.id,
@ -433,29 +420,11 @@ export class ClaimInsertComponent {
targetCollectedFrom: resultEntity.result.source, targetCollectedFrom: resultEntity.result.source,
targetAccessRights: resultEntity.result.accessRights, targetAccessRights: resultEntity.result.accessRights,
targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(resultEntity), targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(resultEntity),
claimedInDashboard : dashboard, claimedInDashboard : dashboard
idSuffix : idSuffix
};
}
private static createOrganizationClaim(resultEntity: ClaimEntity, organizationEntity: ClaimEntity, user: any, dashboard:string, idSuffix:string): ClaimRecord2Insert {
return {
claimedBy: user,
sourceId: organizationEntity.id,
sourceType: "organization",
sourceCollectedFrom: "openaire",
sourceAccessRights: "OPEN",
sourceEmbargoEndDate: "",
targetId: resultEntity.id,
targetType: resultEntity.type,
targetCollectedFrom: resultEntity.result.source,
targetAccessRights: resultEntity.result.accessRights,
targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(resultEntity),
claimedInDashboard : dashboard,
idSuffix : idSuffix
}; };
} }
private static createResultClaim(inlineResult: ClaimEntity, resultEntity: ClaimEntity, user: string, dashboard:string, idSuffix:string): ClaimRecord2Insert { private static createResultClaim(inlineResult: ClaimEntity, resultEntity: ClaimEntity, user: string, dashboard:string): ClaimRecord2Insert {
return { return {
claimedBy: user, claimedBy: user,
@ -469,9 +438,7 @@ export class ClaimInsertComponent {
targetCollectedFrom: inlineResult.result.source, targetCollectedFrom: inlineResult.result.source,
targetAccessRights: inlineResult.result.accessRights, targetAccessRights: inlineResult.result.accessRights,
targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(inlineResult), targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(inlineResult),
claimedInDashboard : dashboard, claimedInDashboard : dashboard
idSuffix : idSuffix
}; };
} }
@ -481,13 +448,12 @@ export class ClaimInsertComponent {
} }
return "" return ""
} }
static createOpenAIREId(id, idSuffix:string):string {
return id.indexOf( "::" ) == -1 ? ("userclaim___::" + Md5.hashStr(id + idSuffix)):id; static createDirectClaim(resultEntity: ClaimEntity, results: ClaimEntity[]) {
}
static createDirectClaim(resultEntity: ClaimEntity, results: ClaimEntity[], idSuffix:string) {
let entity = {}; let entity = {};
entity["originalId"] = this.createOpenAIREId(resultEntity.id, idSuffix); const md5_id = Md5.hashStr(resultEntity.id);
entity["openaireId"] = this.createOpenAIREId(resultEntity.id, idSuffix); entity["originalId"] = "userclaim___::" + md5_id;
entity["openaireId"] = "userclaim___::" + md5_id;
entity["title"] = resultEntity.title; entity["title"] = resultEntity.title;
entity["title"] = (Array.isArray(resultEntity.title) && resultEntity.title.length > 0) ? resultEntity.title[0] : resultEntity.title; entity["title"] = (Array.isArray(resultEntity.title) && resultEntity.title.length > 0) ? resultEntity.title[0] : resultEntity.title;
@ -536,7 +502,7 @@ export class ClaimInsertComponent {
entity["linksToProjects"] = []; entity["linksToProjects"] = [];
} }
let project: ClaimEntity = results[i]; let project: ClaimEntity = results[i];
entity["linksToProjects"].push("info:eu-repo/grantAgreement/" + project.project.funderShortname + "/" + project.project.fundingLevel0 + "/" + project.project.code + "/" + project.project.jurisdiction + "/" + project.title + "/" + project.project.acronym); entity["linksToProjects"].push("info:eu-repo/grantAgreement/" + project.project.funderName + "/" + project.project.fundingLevel0 + "/" + project.project.code + "/" + project.project.jurisdiction + "/" + project.title + "/" + project.project.acronym);
} else if (results[i].context) { } else if (results[i].context) {
@ -599,10 +565,11 @@ export class ClaimInsertComponent {
} }
getStatus(){ getStatus(){
if(this.feedRecordsJob && ! (this.feedRecordsJob.status == "COMPLETE" || this.feedRecordsJob.status == "FAILED") ) { if(this.feedRecordsJob && ! (this.feedRecordsJob.status == "COMPLETE" || this.feedRecordsJob.status == "ERROR") ) {
this.subscriptions.push(this.claimService.getStatus(this.feedRecordsJob.id, this.properties.claimsAPIURL).subscribe(data => { this.subscriptions.push(this.claimService.getStatus(this.feedRecordsJob.id, this.properties.claimsAPIURL).subscribe(data => {
this.feedRecordsJob = data.data; this.feedRecordsJob = data.data;
if (this.feedRecordsJob.status == "COMPLETE" || this.feedRecordsJob.status == "FAILED") { // console.log("feed", this.feedRecordsJob.status);
if (this.feedRecordsJob.status == "COMPLETE" || data.data.status == "ERROR") {
this.insertedRecords = this.feedRecordsJob.insertedIds; this.insertedRecords = this.feedRecordsJob.insertedIds;
this.errorInRecords = this.feedRecordsJob.errorInClaims; this.errorInRecords = this.feedRecordsJob.errorInClaims;
} }
@ -621,8 +588,8 @@ export class ClaimInsertComponent {
if(this.claimsJob) { if(this.claimsJob) {
this.subscriptions.push(this.claimService.getStatus(this.claimsJob.id, this.properties.claimsAPIURL).subscribe(data => { this.subscriptions.push(this.claimService.getStatus(this.claimsJob.id, this.properties.claimsAPIURL).subscribe(data => {
this.claimsJob = data.data; this.claimsJob = data.data;
if ((this.claimsJob.status == "COMPLETE" || this.claimsJob.status == "FAILED") && // console.log("claim: ", this.claimsJob.status, this.feedRecordsJob.status?this.feedRecordsJob.status:" no feed job");
( !this.feedRecordsJob || (this.feedRecordsJob.status == "COMPLETE" || data.data.status == "FAILED"))) { if ((this.claimsJob.status == "COMPLETE" || data.data.status == "ERROR") && ( !this.feedRecordsJob || (this.feedRecordsJob.status == "COMPLETE" || data.data.status == "ERROR")) ) {
this.insertedClaims = this.claimsJob.insertedIds; this.insertedClaims = this.claimsJob.insertedIds;
this.errorInClaims = this.claimsJob.errorInClaims; this.errorInClaims = this.claimsJob.errorInClaims;
@ -635,7 +602,7 @@ export class ClaimInsertComponent {
this.errors.push(error); this.errors.push(error);
} }
this.afterclaimsInsertion(); this.afterclaimsInsertion();
this.timerSubscription.unsubscribe();
} }
}, err => { }, err => {

View File

@ -67,19 +67,18 @@
[results]="results" [sources]="sources" [results]="results" [sources]="sources"
[localStoragePrefix]="localStoragePrefix" [inlineEntity]="inlineEntity" [localStoragePrefix]="localStoragePrefix" [inlineEntity]="inlineEntity"
[showOptions]="showOptions" [properties]=properties [pageContents]="pageContents" [showOptions]="showOptions" [properties]=properties [pageContents]="pageContents"
[defaultColors]="!communityId" [communityId]="communityId" [claimsProperties]="claimsProperties" [defaultColors]="!communityId" [communityId]="communityId"
> >
</metadata-preview> </metadata-preview>
<div id="tm-main" class="uk-section uk-padding-remove-top" *ngIf="showOptions.show != 'claim'"> <div id="tm-main" class="uk-section uk-padding-remove-top" *ngIf="showOptions.show != 'claim'">
<div> <div>
<schema2jsonld *ngIf="url" [URL]="url" name="Link your {{openaireEntities.RESULTS}}" type="other"></schema2jsonld> <schema2jsonld *ngIf="url" [URL]="url" name="Link your {{openaireEntities.RESULTS}}" type="other"></schema2jsonld>
<div class="uk-container uk-container-large"> <div class="uk-container uk-container-large">
<div *ngIf="properties && claimsProperties" class="uk-section uk-padding-remove-top"> <div *ngIf="properties" class="uk-section uk-padding-remove-top">
<div class="uk-container uk-container-large"> <div class="uk-container uk-container-large">
<div class="uk-grid basketContainer" *ngIf="showOptions.show!='claim'" uk-grid> <div class="uk-grid basketContainer" *ngIf="showOptions.show!='claim'" uk-grid>
<div class="uk-width-2-3@m uk-position-z-index uk-flex-first@m uk-flex-last uk-margin-medium-top"> <div class="uk-width-2-3@m uk-position-z-index uk-flex-first@m uk-flex-last uk-margin-medium-top">
<h2 *ngIf="inlineEntity && claimsProperties.INLINE_ENTITY.show" class="uk-text-center">Link source to</h2> <h2 *ngIf="inlineEntity" class="uk-text-center">Link source to</h2>
<div *ngIf="inlineEntity && claimsProperties.INLINE_ENTITY.guideText" class="uk-text-center">{{claimsProperties.INLINE_ENTITY.guideText}}</div>
<div *ngIf="showOptions.show=='source'"> <div *ngIf="showOptions.show=='source'">
<claim-result-search-form [selectedResults]="sources" [properties]=properties <claim-result-search-form [selectedResults]="sources" [properties]=properties
[localStoragePrefix]="localStoragePrefix+'sources'" [localStoragePrefix]="localStoragePrefix+'sources'"
@ -116,16 +115,16 @@
<div class="uk-card-body uk-padding-small"> <div class="uk-card-body uk-padding-small">
<div> <div>
<ng-container *ngIf="inlineEntity"> <ng-container *ngIf="inlineEntity">
<div *ngIf="claimsProperties.INLINE_ENTITY.show" class="uk-margin-small-bottom"> <div class="uk-margin-small-bottom">
<div class="uk-text-emphasis uk-text-bolder">{{claimsProperties.BASKET.source_title}}</div> <div class="uk-text-emphasis uk-text-bolder">Source</div>
<claim-selected-results [results]="[inlineEntity]" <claim-selected-results [results]="[inlineEntity]"
[localStoragePrefix]="localStoragePrefix+'sources'" class="" [localStoragePrefix]="localStoragePrefix+'sources'" class=""
[enableRemove]="false" type="source"> [enableRemove]="false" type="source">
</claim-selected-results> </claim-selected-results>
</div> </div>
<div *ngIf="claimsProperties.INLINE_ENTITY.show" class="uk-padding-small uk-padding-remove-horizontal"><hr class="uk-margin-remove"/></div> <div class="uk-padding-small uk-padding-remove-horizontal"><hr class="uk-margin-remove"/></div>
<div class="uk-margin-small-top"> <div class="uk-margin-small-top">
<div class="uk-text-emphasis uk-text-bolder">{{claimsProperties.BASKET.target_title}} <span *ngIf="results.length> 0">({{(results.length) | number}})</span></div> <div class="uk-text-emphasis uk-text-bolder">Link source to <span *ngIf="results.length> 0">({{(results.length) | number}})</span></div>
<ng-container *ngTemplateOutlet="destinations_basket"></ng-container> <ng-container *ngTemplateOutlet="destinations_basket"></ng-container>
</div> </div>
</ng-container> </ng-container>

View File

@ -18,7 +18,6 @@ import {RouterHelper} from "../../utils/routerHelper.class";
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import {LoginErrorCodes} from "../../login/utils/guardHelper.class"; import {LoginErrorCodes} from "../../login/utils/guardHelper.class";
import {UserManagementService} from "../../services/user-management.service"; import {UserManagementService} from "../../services/user-management.service";
import {ClaimsProperties} from "../claim-utils/claims.properties";
@Component({ @Component({
selector: 'linking-generic', selector: 'linking-generic',
@ -42,7 +41,7 @@ export class LinkingGenericComponent {
// show linkToEntities /values: result, project, context // show linkToEntities /values: result, project, context
@Input() sources:ClaimEntity[] =[]; @Input() sources:ClaimEntity[] =[];
properties:EnvProperties = properties; properties:EnvProperties;
public openaireEntities = OpenaireEntities; public openaireEntities = OpenaireEntities;
@Input() localStoragePrefix:string = "linking_"; @Input() localStoragePrefix:string = "linking_";
url=null; url=null;
@ -50,7 +49,7 @@ export class LinkingGenericComponent {
public pageContents = null; public pageContents = null;
@Input() breadcrumbs: Breadcrumb[] = []; @Input() breadcrumbs: Breadcrumb[] = [];
public routerHelper: RouterHelper = new RouterHelper(); public routerHelper: RouterHelper = new RouterHelper();
@Input() claimsProperties:ClaimsProperties = new ClaimsProperties();
constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService,
private _meta: Meta, private _title: Title, private _piwikService:PiwikService, private _meta: Meta, private _title: Title, private _piwikService:PiwikService,
private seoService: SEOService, private helper: HelperService, private cdr: ChangeDetectorRef, private seoService: SEOService, private helper: HelperService, private cdr: ChangeDetectorRef,
@ -59,9 +58,6 @@ export class LinkingGenericComponent {
subscriptions = []; subscriptions = [];
ngOnInit() { ngOnInit() {
/* if(!this.claimsProperties){
this.claimsProperties = new ClaimsProperties();
}*/
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
if (!user) { if (!user) {
this.saveStateAndRedirectLogin(); this.saveStateAndRedirectLogin();
@ -72,13 +68,14 @@ export class LinkingGenericComponent {
this.breadcrumbs.push({name: "Link", route: null}); this.breadcrumbs.push({name: "Link", route: null});
} }
this.showOptions.show = 'source'; this.showOptions.show = 'source';
this.showOptions.initSelectOptions(this.claimsProperties); this.showOptions.initSelectOptions();
if(this.inlineEntity){ if(this.inlineEntity){
this.showOptions.showLinkTo(); this.showOptions.showLinkTo();
// this.showOptions.basketShowLinksTo = true; // this.showOptions.basketShowLinksTo = true;
this.showOptions.show = this.showOptions.linkTo; this.showOptions.show = this.showOptions.linkTo;
} }
this.properties = properties;
this.url = this.properties.domain + this.properties.baseLink+this._router.url; this.url = this.properties.domain + this.properties.baseLink+this._router.url;
var description = "Linking is a functionality provided by OpenAIRE, in order to link research results with a project, a research community or other research results."; var description = "Linking is a functionality provided by OpenAIRE, in order to link research results with a project, a research community or other research results.";

View File

@ -7,16 +7,20 @@ import {SelectedContextsModule} from './selected/selectedContexts.module';
import {SelectedPublicationsModule} from './selected/selectedResults.module'; import {SelectedPublicationsModule} from './selected/selectedResults.module';
import {LinkingGenericComponent} from './linkingGeneric.component'; import {LinkingGenericComponent} from './linkingGeneric.component';
import {StartOverModule} from '../claim-utils/startOver.module'; import {StartOverModule} from '../claim-utils/startOver.module';
import {LoginGuard} from '../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {ClaimContextSearchFormModule} from '../claim-utils/claimContextSearchForm.module'; import {ClaimContextSearchFormModule} from '../claim-utils/claimContextSearchForm.module';
import {ClaimProjectsSearchFormModule} from '../claim-utils/claimProjectSearchForm.module'; import {ClaimProjectsSearchFormModule} from '../claim-utils/claimProjectSearchForm.module';
import {BulkClaimModule} from './bulkClaim/bulkClaim.module'; import {BulkClaimModule} from './bulkClaim/bulkClaim.module';
import {ClaimResultSearchFormModule} from '../claim-utils/claimResultSearchForm.module'; import {ClaimResultSearchFormModule} from '../claim-utils/claimResultSearchForm.module';
import {HelperModule} from '../../utils/helper/helper.module'; import {HelperModule} from '../../utils/helper/helper.module';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import {SEOServiceModule} from '../../sharedComponents/SEO/SEOService.module'; import {SEOServiceModule} from '../../sharedComponents/SEO/SEOService.module';
import {MetadataPreviewModule} from './selected/metadataPreview.module'; import {MetadataPreviewModule} from './selected/metadataPreview.module';
import {ClaimEntitiesMetadataModule} from "./selected/ClaimEntitiesMetadata.module"; import {ClaimEntitiesMetadataModule} from "./selected/ClaimEntitiesMetadata.module";
import {AlertModalModule} from '../../utils/modal/alertModal.module'; import {AlertModalModule} from '../../utils/modal/alertModal.module';
import {PiwikServiceModule} from "../../utils/piwik/piwikService.module";
import {BreadcrumbsModule} from "../../utils/breadcrumbs/breadcrumbs.module"; import {BreadcrumbsModule} from "../../utils/breadcrumbs/breadcrumbs.module";
import {StepperModule} from "../../sharedComponents/stepper/stepper.module"; import {StepperModule} from "../../sharedComponents/stepper/stepper.module";
import {IconsModule} from "../../utils/icons/icons.module"; import {IconsModule} from "../../utils/icons/icons.module";
@ -30,9 +34,10 @@ import {link} from "../../utils/icons/icons";
StartOverModule, StartOverModule,
ClaimContextSearchFormModule, ClaimProjectsSearchFormModule, BulkClaimModule, ClaimResultSearchFormModule, ClaimContextSearchFormModule, ClaimProjectsSearchFormModule, BulkClaimModule, ClaimResultSearchFormModule,
HelperModule, Schema2jsonldModule, SEOServiceModule, MetadataPreviewModule, ClaimEntitiesMetadataModule, AlertModalModule, HelperModule, Schema2jsonldModule, SEOServiceModule, MetadataPreviewModule, ClaimEntitiesMetadataModule, AlertModalModule,
PiwikServiceModule,
MatSelectModule, BreadcrumbsModule, StepperModule, IconsModule MatSelectModule, BreadcrumbsModule, StepperModule, IconsModule
], ],
providers: [], providers: [LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
declarations: [ declarations: [
LinkingGenericComponent LinkingGenericComponent
], exports: [ ], exports: [

View File

@ -3,21 +3,13 @@ import {SharedModule} from '../../../../openaireLibrary/shared/shared.module';
import {ClaimEntityTitleComponent} from "./ClaimEntityTitle.component"; import {ClaimEntityTitleComponent} from "./ClaimEntityTitle.component";
import {ClaimEntityResultMetadataComponent} from "./ClaimEntityResultMetadata.component"; import {ClaimEntityResultMetadataComponent} from "./ClaimEntityResultMetadata.component";
import {ClaimEntityProjectMetadataComponent} from "./ClaimEntityProjectMetadata.component"; import {ClaimEntityProjectMetadataComponent} from "./ClaimEntityProjectMetadata.component";
import {IconsService} from "../../../utils/icons/icons.service";
import {coins} from "../../../utils/icons/icons";
import {IconsModule} from "../../../utils/icons/icons.module";
@NgModule({ @NgModule({
imports: [ imports: [
SharedModule, SharedModule
IconsModule
], ],
declarations: [ declarations: [
ClaimEntityTitleComponent, ClaimEntityResultMetadataComponent, ClaimEntityProjectMetadataComponent ClaimEntityTitleComponent, ClaimEntityResultMetadataComponent, ClaimEntityProjectMetadataComponent
], exports:[ ClaimEntityTitleComponent, ClaimEntityResultMetadataComponent, ClaimEntityProjectMetadataComponent] ], exports:[ ClaimEntityTitleComponent, ClaimEntityResultMetadataComponent, ClaimEntityProjectMetadataComponent]
}) })
export class ClaimEntitiesMetadataModule { export class ClaimEntitiesMetadataModule { }
constructor(private _iconsService:IconsService) {
this._iconsService.registerIcons([coins])
}
}

View File

@ -8,28 +8,20 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class';
<div *ngIf="!shortVersion" class="claim-entity-metadata uk-flex-inline uk-flex-wrap uk-text-xsmall uk-text-emphasis" <div *ngIf="!shortVersion" class="claim-entity-metadata uk-flex-inline uk-flex-wrap uk-text-xsmall uk-text-emphasis"
[class.uk-margin-xsmall-top]="!shortVersion"> [class.uk-margin-xsmall-top]="!shortVersion">
<span class="uk-text-capitalize"> <span class="uk-text-capitalize">
{{entity.type == 'project' && entity.project.code == 'unidentified'?'funder':entity.type}} {{entity.type}}
</span> </span>
<span *ngIf="entity.project.startDate || entity.project.endDate"> <span *ngIf="entity.project.startDate || entity.project.endDate">
{{(entity.project.startDate) ? entity.project.startDate : 'Unknown'}}{{'-' + ((entity.project.endDate) ? entity.project.endDate : 'Unknown')}} {{(entity.project.startDate) ? entity.project.startDate : 'Unknown'}}{{'-' + ((entity.project.endDate) ? entity.project.endDate : 'Unknown')}}
</span> </span>
</div> </div>
<div *ngIf="shortVersion && entity.type == 'project' && entity.project.code == 'unidentified'" class="claim-entity-metadata uk-flex-inline uk-flex-wrap uk-text-xsmall uk-text-emphasis" <div class="uk-text-small uk-flex uk-flex-wrap" [style.grid-gap]="shortVersion?'10px':'20px'"
[class.uk-margin-xsmall-top]="!shortVersion">
<span class="uk-text-capitalize">
funder
</span>
</div>
<div *ngIf="entity.project.code!='unidentified'" class="uk-text-small uk-flex uk-flex-wrap" [style.grid-gap]="shortVersion?'0px':'10px'"
[class.uk-margin-small-top]="!shortVersion"> [class.uk-margin-small-top]="!shortVersion">
<div *ngIf="entity.project.funderName">
<span class="uk-text-meta">Funder: </span>{{entity.project.funderName}}
</div>
<div *ngIf="entity.project.code"> <div *ngIf="entity.project.code">
<span class="uk-text-meta">Project Code: </span>{{entity.project.code}} <span class="uk-text-meta">Project Code: </span>{{entity.project.code}}
</div> </div>
<div *ngIf="entity.project.funderName || entity.project.funderShortname">
<span class="uk-text-meta">Funding: </span>{{entity.project.funderName?entity.project.funderName:entity.project.funderShortname}}
</div>
</div> </div>
</ng-container> </ng-container>
`, `,

View File

@ -5,18 +5,16 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class';
selector: 'claim-title', selector: 'claim-title',
template: ` template: `
<div class="uk-grid uk-flex uk-flex-middle"> <div class="uk-grid uk-flex uk-flex-middle">
<span *ngIf="showIcon" class="uk-flex uk-margin-xsmall-right"> <span *ngIf="showIcon" class="uk-flex">
<icon *ngIf="entity.result" class=" uk-text-small uk-text-meta" name="insert_drive_file"> <span *ngIf="entity.result" class="material-icons uk-text-small uk-text-meta">
insert_drive_file
</icon> </span>
<icon *ngIf="entity.project && entity.project.code !='unidentified'" class=" uk-text-small uk-text-meta" name="assignment_turned_in"> <span *ngIf="entity.project" class="material-icons uk-text-small uk-text-meta">
</icon> assignment_turned_in
<icon *ngIf="entity.project && entity.project.code =='unidentified'" class="uk-text-small uk-text-meta" name="coins" [ratio]="1.4"> </span>
</icon> <span *ngIf="entity.type=='community'" class="material-icons uk-text-small uk-text-meta" style="margin-right: 2px;">
<icon *ngIf="entity.organization" class=" uk-text-small uk-text-meta" name="account_balance"> people
</icon> </span>
<icon *ngIf="entity.type=='community'" class=" uk-text-small uk-text-meta" style="margin-right: 2px;" name="people">
</icon>
</span> </span>
<div class="uk-width-expand multi-line-ellipsis lines-3" style="word-break: break-word;" <div class="uk-width-expand multi-line-ellipsis lines-3" style="word-break: break-word;"
[class.uk-padding-remove-left]="showIcon" [class.uk-text-truncate]="shortVersion"> [class.uk-padding-remove-left]="showIcon" [class.uk-text-truncate]="shortVersion">
@ -29,15 +27,7 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class';
<span *ngIf="(entity.result && !entity.result.url)"> <span *ngIf="(entity.result && !entity.result.url)">
{{entity.title ? sliceString(entity.title) : '[No title available]'}} {{entity.title ? sliceString(entity.title) : '[No title available]'}}
</span> </span>
<span *ngIf="entity.type=='project' && entity.project && entity.project.code =='unidentified'"> <span *ngIf="entity.type=='project' && entity.project">
<span *ngIf="!shortVersion">
{{(entity.project.funderShortname ? '[' + entity.project.funderShortname + '] ' : '') + entity.project.funderName}}
</span>
<span *ngIf="shortVersion">
{{sliceString(entity.project.funderName)}}
</span>
</span>
<span *ngIf="entity.type=='project' && entity.project && entity.project.code!='unidentified'">
<a *ngIf="entity.project && entity.project.url" target="_blank" [href]="entity.project.url" <a *ngIf="entity.project && entity.project.url" target="_blank" [href]="entity.project.url"
class="uk-link uk-text-decoration-none uk-width-expand"> class="uk-link uk-text-decoration-none uk-width-expand">
<span *ngIf="!shortVersion"> <span *ngIf="!shortVersion">
@ -56,9 +46,6 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class';
</span> </span>
</span> </span>
</span> </span>
<span *ngIf="entity.type=='organization' && entity.organization">
{{sliceString(entity.title)}}
</span>
<span *ngIf="entity.type=='community' && entity.context"> <span *ngIf="entity.type=='community' && entity.context">
<span *ngIf=" entity.context.community != entity.context.concept.label"> <span *ngIf=" entity.context.community != entity.context.concept.label">
{{entity.context.community }} > {{entity.context.category}} > {{entity.context.community }} > {{entity.context.category}} >

View File

@ -6,14 +6,15 @@
<div class="uk-width-expand"> <div class="uk-width-expand">
<div class="uk-card uk-card-default"> <div class="uk-card uk-card-default">
<div class="uk-card-body"> <div class="uk-card-body">
<div class="uk-grid uk-grid-divider uk-child-width-1-1@s" uk-grid [class.uk-child-width-1-2@m] = "claimsProperties.INLINE_ENTITY.show" > <div class="uk-grid uk-grid-divider uk-child-width-1-2@m uk-child-width-1-1@s" uk-grid>
<!-- Sources--> <!-- Sources-->
<div *ngIf="claimsProperties.INLINE_ENTITY.show"> <div>
<div class=" uk-margin uk-animation-toggle"> <div class=" uk-margin uk-animation-toggle">
<span class="uk-h6 "> {{claimsProperties.METADATA_PREVIEW.source_title}} ({{sources.length + (inlineEntity ? 1 : 0) | number}}) <span class="uk-h6 "> SOURCES ({{sources.length + (inlineEntity ? 1 : 0) | number}})
</span> </span>
<a *ngIf="!inlineEntity" class="uk-float-right uk-text-small" (click)="showOptions.showSource() "> <span <a *ngIf="!inlineEntity" class="uk-float-right uk-text-small" (click)="showOptions.showSource() "> <span
uk-icon="pencil" class="uk-margin-xsmall-right"></span>{{claimsProperties.METADATA_PREVIEW.edit_source_title}}</a> uk-icon="pencil" class="uk-margin-xsmall-right"></span>Edit
sources</a>
</div> </div>
<ul *ngIf="inlineEntity" class="uk-list uk-animation-fade uk-list-divider"> <ul *ngIf="inlineEntity" class="uk-list uk-animation-fade uk-list-divider">
<li> <li>
@ -152,15 +153,13 @@
</div> </div>
<!-- Results--> <!-- Results-->
<div class=" "> <div class=" ">
<div class=" uk-margin uk-grid"> <div class=" uk-margin ">
<span class=" uk-h6 uk-width-expand"> {{claimsProperties.METADATA_PREVIEW.target_title}} ({{results.length | number}})</span> <span class=" uk-h6 "> LINK TO ({{results.length | number}})</span>
<div class="uk-width-auto uk-flex">
<icon [name]="claimsProperties.METADATA_PREVIEW.edit_target_icon" [flex]="true"></icon> <a class="uk-float-right uk-text-small" (click)="showOptions.showLinkTo()"> <span
<a class=" uk-margin-left-xsmall uk-text-small" (click)="showOptions.showLinkTo()"> uk-icon="pencil" class="uk-margin-xsmall-right"></span>Edit
{{claimsProperties.METADATA_PREVIEW.edit_target_title}}</a> entities</a>
</div>
</div> </div>
<div *ngIf="results.length == 0"> <div *ngIf="results.length == 0">
<div class="uk-alert dangerBorder no-selected-message uk-text-center"> <div class="uk-alert dangerBorder no-selected-message uk-text-center">

View File

@ -4,7 +4,6 @@ import {ClaimEntity, ClaimsErrorMessage, Message, ShowOptions} from '../../claim
import {EnvProperties} from "../../../utils/properties/env-properties"; import {EnvProperties} from "../../../utils/properties/env-properties";
import {Dates} from "../../../utils/string-utils.class"; import {Dates} from "../../../utils/string-utils.class";
import {HelperFunctions} from "../../../utils/HelperFunctions.class"; import {HelperFunctions} from "../../../utils/HelperFunctions.class";
import {ClaimsProperties} from "../../claim-utils/claims.properties";
@Component({ @Component({
selector: 'metadata-preview', selector: 'metadata-preview',
@ -29,7 +28,6 @@ export class MetadataPreviewComponent {
@ViewChild(AlertModal) alertApplyAll; @ViewChild(AlertModal) alertApplyAll;
@Input() localStoragePrefix: string = ""; @Input() localStoragePrefix: string = "";
@Input() communityId:string= null; @Input() communityId:string= null;
@Input() claimsProperties:ClaimsProperties;
errors:ClaimsErrorMessage[] = []; errors:ClaimsErrorMessage[] = [];
warnings:Message[] = []; warnings:Message[] = [];
public commonAccessRights = "OPEN"; // for access rights- changes when user apply a change to every entity public commonAccessRights = "OPEN"; // for access rights- changes when user apply a change to every entity

View File

@ -11,17 +11,16 @@ import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select'; import { MatSelectModule } from '@angular/material/select';
import {HelperModule} from "../../../utils/helper/helper.module"; import {HelperModule} from "../../../utils/helper/helper.module";
import {SelectedPublicationsModule} from "./selectedResults.module"; import {SelectedPublicationsModule} from "./selectedResults.module";
import {IconsModule} from "../../../utils/icons/icons.module";
@NgModule({ @NgModule({
imports: [ imports: [
SharedModule, SharedModule,
AlertModalModule, AlertModalModule,
ClaimEntitiesMetadataModule, ClaimEntitiesMetadataModule,
InsertClaimsModule, InsertClaimsModule,
MatDatepickerModule, MatNativeDateModule, MatFormFieldModule, MatInputModule, MatSelectModule, MatDatepickerModule, MatNativeDateModule, MatFormFieldModule, MatInputModule, MatSelectModule,
HelperModule, SelectedPublicationsModule, IconsModule HelperModule, SelectedPublicationsModule
], ],
declarations: [MetadataPreviewComponent], declarations: [MetadataPreviewComponent],
exports:[MetadataPreviewComponent] exports:[MetadataPreviewComponent]
}) })

View File

@ -3,6 +3,9 @@ import { NgModule } from '@angular/core';
import { SharedModule } from '../../../openaireLibrary/shared/shared.module'; import { SharedModule } from '../../../openaireLibrary/shared/shared.module';
import { MyClaimsComponent } from './myClaims.component'; import { MyClaimsComponent } from './myClaims.component';
import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module'; import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.module';
import {LoginGuard} from'../../login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({ @NgModule({
imports: [ imports: [
@ -10,7 +13,7 @@ import {DisplayClaimsModule} from '../claim-utils/displayClaims/displayClaims.mo
DisplayClaimsModule DisplayClaimsModule
], ],
providers:[], providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled],
declarations: [ declarations: [
MyClaimsComponent MyClaimsComponent
], exports: [MyClaimsComponent] ], exports: [MyClaimsComponent]

View File

@ -1,69 +0,0 @@
<ng-template #card let-organization="organization" let-fullView="fullView">
<div [class]="fullView?'uk-card-body uk-height-1-1 uk-flex uk-flex-column uk-flex-around':''">
<div class="affiliation-logo">
<img *ngIf="organization.logo_url"
[src]="organization.logo_url | urlPrefix"
alt="{{(organization.name)?organization.name:''}} logo"
class="uk-blend-multiply uk-height-max-xsmall" loading="lazy">
</div>
<div class="affiliation-name multi-line-ellipsis lines-3" *ngIf="organization.name && fullView">
<p class="uk-text-emphasis uk-text-bold uk-margin-remove">
{{organization.name}}
</p>
</div>
</div>
</ng-template>
<ng-container *ngIf="affiliations.length > 0">
<div *ngIf="showLoading" class="uk-animation-fade uk-width-1-1" role="alert">
<span class="loading-gif uk-align-center"></span>
</div>
<div *ngIf="longView"
class="uk-child-width-1-5@xl uk-child-width-1-4@l uk-child-width-1-3@m uk-child-width-1-2@s uk-text-center uk-grid"
uk-height-match="target: .affiliation-logo, .affiliation-name"
uk-scrollspy="cls: uk-animation-fade; target: .uk-card; repeat: false"
uk-grid>
<div *ngFor="let affiliation of affiliations;">
<div>
<div class="uk-card uk-card-default uk-card-hover affiliationCard">
<a *ngIf="affiliation.website_url" target="_blank" [href]="affiliation.website_url | urlPrefix" class="uk-link-reset">
<ng-container *ngTemplateOutlet="card; context: { organization: affiliation, fullView: true}"></ng-container>
</a>
<span *ngIf="!affiliation.website_url" class="uk-link-reset">
<ng-container *ngTemplateOutlet="card; context: { organization: affiliation, fullView: true}"></ng-container>
</span>
</div>
</div>
</div>
</div>
<div *ngIf="affiliations.length > 0 && communityFirstPage && !longView" class="uk-grid uk-grid-large" uk-grid>
<div class="uk-width-auto@m uk-width-1-1@s">
<h2 class="uk-h1">
Supporting <br> Organizations
</h2>
<a class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default uk-margin-top"
routerLinkActive="router-link-active" routerLink="/organizations">
<span class="uk-flex uk-flex-middle">
<span>Browse all</span>
</span>
</a>
</div>
<div class="uk-width-expand@m uk-width-1-1@s">
<div class="uk-grid uk-grid-large uk-child-width-1-3@m uk-child-width-1-2@s supportingOrganizations" uk-grid>
<div *ngFor="let affiliation of affiliations.slice(0,9);">
<a *ngIf="affiliation.website_url" target="_blank" [href]="affiliation.website_url | urlPrefix" class="uk-link-reset">
<ng-container *ngTemplateOutlet="card; context: {organization: affiliation, fullView: false}"></ng-container>
</a>
<span *ngIf="!affiliation.website_url" class="uk-link-reset">
<ng-container *ngTemplateOutlet="card; context: {organization: affiliation, fullView: false}"></ng-container>
</span>
</div>
</div>
</div>
</div>
</ng-container>
<!--<div *ngIf="affiliations.length == 0 && longView" class="uk-animation-fade uk-alert uk-alert-primary" role="alert">-->
<!-- No affiliations available-->
<!--</div>-->

View File

@ -1,18 +0,0 @@
.affiliationCard {
width: 260px !important;
height: 260px !important;
}
.supportingOrganizations a {
img, svg {
-webkit-filter: grayscale(1);
filter: grayscale(1);
transition-duration: 0.3s;
}
&:hover img, svg {
-webkit-filter: grayscale(0);
filter: grayscale(0);
transition-duration: 0.3s;
}
}

View File

@ -1,68 +0,0 @@
import {Component, Input} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {EnvProperties} from '../../utils/properties/env-properties';
import {AffiliationService} from "./affiliation.service";
import {Affiliation} from "../../utils/entities/CuratorInfo";
import {ConnectHelper} from "../connectHelper";
import {Subscriber} from "rxjs";
import {properties} from "../../../../environments/environment";
import {ConfigurationService} from "../../utils/configuration/configuration.service";
import {CommunityService} from "../community/community.service";
@Component({
selector: 'affiliations',
templateUrl: './affiliations.component.html',
styleUrls: ['./affiliations.component.less']
})
export class AffiliationsComponent {
@Input() getAffiliationsFromAPI: boolean = false;
@Input() longView: boolean = false;
@Input() communityFirstPage: boolean = false;
@Input() affiliationsInSlider: number = 5;
@Input() affiliations: Affiliation[] = [];
@Input() sliderOptions = '';
@Input() arrows = true;
public showLoading: boolean = false;
public communityId: string;
public properties: EnvProperties = properties;
private subscriptions = [];
constructor(private route: ActivatedRoute, private affiliationService: AffiliationService, private config: ConfigurationService) {
}
public ngOnInit() {
this.subscriptions.push(this.config.portalAsObservable.subscribe(
res => {
// this.portal = res;
this.communityId = res.pid
},
error => {
console.log(error);
}
));
if (this.getAffiliationsFromAPI) {
this.showLoading = true;
this.affiliationService.initAffiliations(this.communityId);
this.subscriptions.push(this.affiliationService.affiliations.subscribe(
affiliations => {
this.affiliations = affiliations.filter((affiliation) => this.longView || !!affiliation['logo_url']);
this.showLoading = false;
},
error => {
console.error("Affiliations Component: Error getting affiliations for community with id: " + this.communityId, error);
this.showLoading = false;
}
));
}
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscriber) {
subscription.unsubscribe();
}
});
this.affiliationService.clearSubscriptions();
}
}

View File

@ -1,26 +0,0 @@
import {NgModule} from '@angular/core';
import {PreviousRouteRecorder} from '../../utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard'
import {RouterModule} from '@angular/router';
import {AffiliationsComponent} from './affiliations.component';
import {CommonModule} from "@angular/common";
import {UrlPrefixModule} from "../../utils/pipes/url-prefix.module";
import {AffiliationService} from "./affiliation.service";
@NgModule({
imports: [
CommonModule, RouterModule, UrlPrefixModule
],
declarations: [
AffiliationsComponent
],
providers:[PreviousRouteRecorder, IsRouteEnabled, AffiliationService],
exports: [
AffiliationsComponent
]
})
export class AffiliationsModule{}

View File

@ -21,12 +21,13 @@ export class ApprovedByCommunityComponent {
public approved:boolean = false; public approved:boolean = false;
private communityContentProviders = []; private communityContentProviders = [];
properties:EnvProperties = properties; properties:EnvProperties;
public openaireEntities = OpenaireEntities; public openaireEntities = OpenaireEntities;
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchCommunityDataprovidersService) {} constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchCommunityDataprovidersService) {}
public ngOnInit() { public ngOnInit() {
this.properties =properties;
this.route.queryParams.subscribe( this.route.queryParams.subscribe(
communityId => { communityId => {
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain); this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);

View File

@ -91,7 +91,6 @@ export class CustomizationOptions {
identity: { identity: {
mainColor: string; mainColor: string;
secondaryColor: string; secondaryColor: string;
customCss: string;
}; };
identityIsCustom: boolean; identityIsCustom: boolean;
backgroundsIsCustom: boolean; backgroundsIsCustom: boolean;
@ -120,7 +119,6 @@ export class CustomizationOptions {
this.identity = { this.identity = {
mainColor: mainColor ? mainColor : CustomizationOptions.getIdentity().mainColor, mainColor: mainColor ? mainColor : CustomizationOptions.getIdentity().mainColor,
secondaryColor: secondaryColor ? secondaryColor : CustomizationOptions.getIdentity().secondaryColor, secondaryColor: secondaryColor ? secondaryColor : CustomizationOptions.getIdentity().secondaryColor,
customCss: ""
}; };
this.identityIsCustom = false; this.identityIsCustom = false;
this.backgroundsIsCustom = false; this.backgroundsIsCustom = false;
@ -187,9 +185,6 @@ export class CustomizationOptions {
if (current.identity && current.identity.mainColor && current.identity.secondaryColor) { if (current.identity && current.identity.mainColor && current.identity.secondaryColor) {
updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor); updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor);
} }
if(current.identity && !current.identity.customCss){
current.identity.customCss = defaultCO.identity.customCss;
}
if (!current.backgrounds) { if (!current.backgrounds) {
current.backgrounds = Object.assign({}, updated.backgrounds); current.backgrounds = Object.assign({}, updated.backgrounds);
} }

View File

@ -92,8 +92,6 @@ export class CommunityService {
const community: CommunityInfo = new CommunityInfo(); const community: CommunityInfo = new CommunityInfo();
community.title = resData.name; community.title = resData.name;
community.shortTitle = resData.shortName; community.shortTitle = resData.shortName;
community.displayTitle = resData.displayName?resData.displayName:resData.name;
community.displayShortTitle = resData.displayShortName?resData.displayShortName:resData.shortName;
community.communityId = resData.id; community.communityId = resData.id;
community.queryId = resData.queryId; community.queryId = resData.queryId;
community.logoUrl = resData.logoUrl; community.logoUrl = resData.logoUrl;
@ -104,7 +102,6 @@ export class CommunityService {
community.claim = resData.claim; community.claim = resData.claim;
community.membership = resData.membership; community.membership = resData.membership;
community.type = resData.type; community.type = resData.type;
community.plan = resData.plan?resData.plan:"Default";
community.otherZenodoCommunities = resData.otherZenodoCommunities; community.otherZenodoCommunities = resData.otherZenodoCommunities;
if (resData.hasOwnProperty('status')) { if (resData.hasOwnProperty('status')) {
community.status = resData.status; community.status = resData.status;

View File

@ -4,8 +4,6 @@ import {SelectionCriteria} from "../../utils/entities/contentProvider";
export class CommunityInfo { export class CommunityInfo {
title: string; title: string;
shortTitle:string; shortTitle:string;
displayTitle: string;
displayShortTitle:string;
communityId: string; communityId: string;
queryId: string; queryId: string;
type: string; type: string;
@ -26,7 +24,6 @@ export class CommunityInfo {
fos: string[] = []; fos: string[] = [];
sdg: string[] = [] sdg: string[] = []
selectionCriteria: SelectionCriteria; selectionCriteria: SelectionCriteria;
plan: "Standard" | "Advanced" | "Premium" | "National" | "Default" ;
public static checkIsUpload(response: CommunityInfo | CommunityInfo[]): any | any[] { public static checkIsUpload(response: CommunityInfo | CommunityInfo[]): any | any[] {
if (Array.isArray(response)) { if (Array.isArray(response)) {

View File

@ -1,15 +0,0 @@
import { NgModule} from '@angular/core';
import { RouterModule } from '@angular/router';
import {CuratorsComponent} from "./curators.component";
import {IsRouteEnabled} from "../../../error/isRouteEnabled.guard";
import {PreviousRouteRecorder} from "../../../utils/piwik/previousRouteRecorder.guard";
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: CuratorsComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder]}
])
]
})
export class CuratorsRoutingModule {
}

View File

@ -1,152 +0,0 @@
<schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other"></schema2jsonld>
<ng-container *ngIf="longView else shortView">
<div style="min-height: 650px;">
<div class="uk-container uk-container-large uk-section uk-section-small uk-padding-remove-bottom">
<div class="uk-padding-small uk-padding-remove-horizontal">
<breadcrumbs [breadcrumbs]="breadcrumbs"></breadcrumbs>
</div>
</div>
<div class="uk-container uk-container-large uk-section uk-section-small">
<div *ngIf="showLoading" class="uk-margin-large uk-padding-large uk-padding-remove-horizontal">
<loading></loading>
</div>
<div *ngIf="!showLoading">
<h1 class="uk-margin-top">
Curators
</h1>
<div *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" class="uk-margin-medium">
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
[texts]="pageContents['top']">
</helper>
</div>
<div *ngIf="curators" class="uk-margin-large-top">
<div *ngFor="let curator of curators let i=index;" class="uk-card uk-card-default uk-padding uk-margin-medium-bottom">
<div class="uk-grid" uk-grid>
<div class="uk-width-2-3@m uk-flex uk-flex-middle">
<div class="uk-width-small">
<img *ngIf="curator.photo && curator.photo !== ''" class="uk-border-circle" style="width: 150px; height: 150px;"
src="{{downloadUrl + curator.photo}}" alt="Curator Photo">
<img *ngIf="!curator.photo || curator.photo == ''" class="uk-border-circle" style="width: 150px; height: 150px;"
src="../../assets/common-assets/curator-default.png" alt="Curator Photo">
</div>
<div class="uk-width-expand">
<div class="uk-padding">
<h4 class="uk-margin-remove">{{curator.name}}</h4>
<div *ngIf="curator.bio" class="uk-margin-top uk-height-max-large uk-overflow-auto">
<div class="uk-text-muted uk-margin-small-bottom">
Biography
</div>
<div>
<div *ngIf="!viewingMore">{{format(curator.bio)}}</div>
<div *ngIf="viewingMore">{{curator.bio}}</div>
<div *ngIf="curator.bio.length >= maxCharacters" class="uk-text-right uk-margin-small-top">
<a *ngIf="curator.bio.length >= maxCharacters"
(click)="openFsModal(curator)">
View details
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div *ngIf="curator.affiliations && curator.affiliations.length > 0" class="uk-width-1-3@m uk-padding" style="border-left: 1px solid #eaeaea">
<div class="uk-text-muted uk-margin-bottom">
Affiliations
</div>
<div class="uk-grid uk-flex-middle uk-child-width-1-2" uk-grid>
<div *ngFor="let affiliation of curator.affiliations">
<span *ngIf="!affiliation.website_url">
<img [src]="affiliation.logo_url | urlPrefix" [alt]="affiliation.name">
</span>
<a *ngIf="affiliation.website_url"
target="_blank" [href]="affiliation.website_url | urlPrefix">
<img [src]="affiliation.logo_url | urlPrefix" [alt]="affiliation.name">
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="uk-margin-medium">
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0"
[texts]="pageContents['bottom']">
</helper>
</div>
</div>
</div>
</ng-container>
<!-- Short view for community's homepage -->
<ng-template #shortView>
<div *ngIf="curators && curators.length > 0" class="uk-grid" uk-grid>
<span class="uk-width-auto">
Curated by:
</span>
<div class="uk-width-expand uk-padding-remove uk-overflow-auto">
<div class="uk-height-max-medium uk-margin-xsmall-left">
<a routerLink="/curators">
<span *ngFor="let curator of curators.slice(0,curatorsLimit) let i=index;">
{{curator.name}}
<span *ngIf="i < curators.length-1 && i < curatorsLimit-1">, </span>
</span>
<span *ngIf="curators.length > curatorsLimit">
+{{curators.length-curatorsLimit}} more
</span>
</a>
</div>
</div>
</div>
</ng-template>
<fs-modal #fsModal classTitle="">
<div *ngIf="curatorInModal" class="uk-width-1-1 uk-height-1-1">
<div class="uk-container uk-container-large uk-section">
<div class="uk-margin-large-top uk-grid uk-grid-large" uk-grid>
<div class="uk-width-1-3@m">
<h2>
{{curatorInModal.name}}
</h2>
<img *ngIf="curatorInModal.photo && curatorInModal.photo !== ''" class="uk-width-2-3 uk-border-circle uk-margin-top uk-margin-bottom"
src="{{downloadUrl + curatorInModal.photo}}" alt="Curator Photo">
<img *ngIf="!curatorInModal.photo || curatorInModal.photo == ''" class="uk-width-2-3 uk-border-circle uk-margin-top uk-margin-bottom"
src="../../assets/common-assets/curator-default.png" alt="Curator Photo">
</div>
<div class="uk-width-2-3@m">
<ul class="uk-tab" uk-tab>
<li>
<a>Biography</a>
</li>
<li *ngIf="curatorInModal.affiliations && curatorInModal.affiliations.length > 0">
<a>Affiliations</a>
</li>
</ul>
<ul class="uk-switcher">
<li class="uk-padding uk-padding-remove-left">
<h5>
Biography
</h5>
<div>
{{curatorInModal.bio}}
</div>
</li>
<li *ngIf="curatorInModal.affiliations && curatorInModal.affiliations.length > 0" class="uk-padding uk-padding-remove-left">
<div class="uk-grid uk-flex-middle uk-child-width-1-3" uk-grid>
<div *ngFor="let affiliation of curatorInModal.affiliations">
<span *ngIf="!affiliation.website_url">
<img [src]="affiliation.logo_url | urlPrefix" [alt]="affiliation.name">
</span>
<a *ngIf="affiliation.website_url"
target="_blank" [href]="affiliation.website_url | urlPrefix">
<img [src]="affiliation.logo_url | urlPrefix" [alt]="affiliation.name">
</a>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</fs-modal>

View File

@ -1,154 +0,0 @@
import {Component, Input, ViewChild} from '@angular/core';
import {EnvProperties} from '../../../utils/properties/env-properties';
import {CuratorService} from "../../curators/curator.service";
import {Curator} from "../../../utils/entities/CuratorInfo";
import {ActivatedRoute, Router} from "@angular/router";
import {CommunityService} from "../../community/community.service";
import {HelperService} from "../../../utils/helper/helper.service";
import {Meta, Title} from "@angular/platform-browser";
import {SEOService} from "../../../sharedComponents/SEO/SEO.service";
import {PiwikService} from "../../../utils/piwik/piwik.service";
import {Breadcrumb} from "../../../utils/breadcrumbs/breadcrumbs.component";
import {Subscription} from "rxjs";
import {properties} from "../../../../../environments/environment";
import {UserRegistryService} from "../../../services/user-registry.service";
import {FullScreenModalComponent} from '../../../utils/modal/full-screen-modal/full-screen-modal.component';
import {CommunityInfo} from "../../community/communityInfo";
@Component({
selector: 'curators',
templateUrl: './curators.component.html'
})
export class CuratorsComponent {
@Input() longView = true;
community: CommunityInfo;
public downloadUrl = null;
public showLoading = true;
public curators: Curator[] = [];
public curatorsLimit: number = 5;
public numberOfCurators: number = 5;
public showMore = [];
public maxCharacters = 450;
public viewingMore: boolean = false;
public curatorInModal;
public properties: EnvProperties = properties;
public pageContents = null;
public divContents = null;
public url: string = null;
public pageTitle: string = "Curators";
public breadcrumbs: Breadcrumb[] = [{name: 'Home', route: '/'}, {name: 'About - Curators'}];
subs: Subscription[] = [];
@ViewChild('fsModal', { static: true }) fsModal: FullScreenModalComponent;
constructor(private route: ActivatedRoute,
private curatorsService: CuratorService,
private communityService: CommunityService,
private userRegistryService: UserRegistryService,
private _router: Router,
private helper: HelperService,
private _meta: Meta,
private _title: Title,
private seoService: SEOService,
private _piwikService: PiwikService) {
}
ngOnInit() {
this.showLoading = true;
this.downloadUrl = this.properties.utilsService + '/download/';
//if (properties.environment !== 'development') {
if (!this.longView) {
this.subs.push(this.communityService.getCommunityAsObservable().subscribe(community => {
if (community) {
this.community = community;
this.getCurators();
}
}));
} else {
this.subs.push(this.communityService.getCommunityAsObservable().subscribe(community => {
if (community) {
this.community = community;
this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
this.url = this.properties.domain + this._router.url;
this.seoService.createLinkForCanonicalURL(this.url);
this.updateUrl(this.url);
this.updateTitle(this.pageTitle);
this.updateDescription("OpenAIRE - Connect, Community Gateway, research community");
//this.getDivContents();
this.getPageContents();
this.getCurators();
}
}));
}
}
ngOnDestroy() {
for (let sub of this.subs) {
sub.unsubscribe();
}
}
private getCurators() {
this.subs.push(this.curatorsService.getCurators(this.community.communityId).subscribe(curators => {
this.curators = curators;
this.showLoading = false;
}, error => {
console.error(error);
this.curators = [];
this.showLoading = false;
}));
}
private getPageContents() {
this.subs.push(this.helper.getPageHelpContents(this.properties, this.community.communityId, this._router.url).subscribe(contents => {
this.pageContents = contents;
}));
}
private getDivContents() {
this.subs.push(this.helper.getDivHelpContents(this.properties, this.community.communityId, this._router.url).subscribe(contents => {
this.divContents = contents;
}));
}
format(name: string) {
if (name) {
return (((name).length > this.maxCharacters) ? (name.substring(0, (this.maxCharacters - ('...').length)) + '...') : name);
} else {
return null;
}
}
public viewMore() {
this.viewingMore = !this.viewingMore;
}
public openFsModal(curator) {
this.curatorInModal = curator;
this.fsModal.title = this.community.shortTitle + ' Curator';
this.fsModal.open();
}
private updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'");
}
private updateTitle(title: string) {
var _title = ((title.length > 50) ? title.substring(0, 50) : title);
this._title.setTitle(_title);
this._meta.updateTag({content: _title}, "property='og:title'");
}
private updateUrl(url: string) {
this._meta.updateTag({content: url}, "property='og:url'");
}
}

View File

@ -1,35 +0,0 @@
import { NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import {CuratorsComponent} from './curators.component';
import {CuratorService} from "../../curators/curator.service";
import {CuratorsRoutingModule} from "./curators-routing.module";
import {HelperModule} from "../../../utils/helper/helper.module";
import {Schema2jsonldModule} from "../../../sharedComponents/schema2jsonld/schema2jsonld.module";
import {SEOServiceModule} from "../../../sharedComponents/SEO/SEOService.module";
import {PiwikServiceModule} from "../../../utils/piwik/piwikService.module";
import {BreadcrumbsModule} from "../../../utils/breadcrumbs/breadcrumbs.module";
import {UrlPrefixModule} from "../../../utils/pipes/url-prefix.module";
import {LoadingModule} from '../../../utils/loading/loading.module';
import {FullScreenModalModule} from '../../../utils/modal/full-screen-modal/full-screen-modal.module';
import {AffiliationsModule} from "../../affiliations/affiliations.module";
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule,
CuratorsRoutingModule, AffiliationsModule, HelperModule,
Schema2jsonldModule, SEOServiceModule, PiwikServiceModule,
BreadcrumbsModule, UrlPrefixModule, LoadingModule,
FullScreenModalModule
],
declarations: [
CuratorsComponent
],
providers: [CuratorService],
exports: [
CuratorsComponent
]
})
export class CuratorsModule {}

View File

@ -12,10 +12,10 @@ export class ConnectHelper {
if(properties.environment == "development" && if(properties.environment == "development" &&
(properties.adminToolsPortalType == "connect" || properties.adminToolsPortalType == "community" (properties.adminToolsPortalType == "connect" || properties.adminToolsPortalType == "community"
|| properties.adminToolsPortalType == "aggregator" || properties.adminToolsPortalType == "eosc")) { || properties.adminToolsPortalType == "aggregator" || properties.adminToolsPortalType == "eosc")) {
// domain = "covid-19.openaire.eu"; //for testing domain = "covid-19.openaire.eu"; //for testing
} }
domain = domain.indexOf("//") != -1? domain.split("//")[1]:domain; //remove https:// prefix domain = domain.indexOf("//") != -1? domain.split("//")[1]:domain; //remove https:// prefix
if (domain.indexOf('eosc-portal.eu') != -1 || domain.indexOf('eosc-beyond.eu') != -1) { if (domain.indexOf('eosc-portal.eu') != -1) {
return "eosc"; return "eosc";
} }
if (domain.indexOf('openaire.eu') === -1) { if (domain.indexOf('openaire.eu') === -1) {

View File

@ -6,13 +6,13 @@ import {map} from "rxjs/operators";
@Injectable() @Injectable()
export class SearchCommunityDataprovidersService { export class SearchCommunityDataprovidersService {
constructor(private http: HttpClient ) {} constructor(private http: HttpClient ) {}
searchDataproviders (properties:EnvProperties, pid: string, deposit = false):any { searchDataproviders (properties:EnvProperties, pid: string):any {
let url = properties.communityAPI+pid+"/datasources" + (deposit?'?deposit=true':''); let url = properties.communityAPI+pid+"/contentproviders";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url); return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
} }
countTotalDataproviders(properties:EnvProperties,pid:string) { countTotalDataproviders(properties:EnvProperties,pid:string) {
let url = properties.communityAPI+pid+"/datasources"; let url = properties.communityAPI+pid+"/contentproviders";
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
.pipe(map(res => res['length'])); .pipe(map(res => res['length']));
} }

View File

@ -4,7 +4,6 @@ import {Observable} from 'rxjs';
import {Curator} from '../../utils/entities/CuratorInfo'; import {Curator} from '../../utils/entities/CuratorInfo';
import {EnvProperties} from '../../utils/properties/env-properties'; import {EnvProperties} from '../../utils/properties/env-properties';
import {CustomOptions} from "../../services/servicesUtils/customOptions.class"; import {CustomOptions} from "../../services/servicesUtils/customOptions.class";
import {properties} from '../../../../environments/environment';
@Injectable() @Injectable()
export class CuratorService { export class CuratorService {
@ -12,17 +11,17 @@ export class CuratorService {
constructor(private http: HttpClient) { constructor(private http: HttpClient) {
} }
public getCurators(communityId: string): Observable<Curator[]> { public getCurators(properties: EnvProperties, communityId: string): Observable<Curator[]> {
let url: string = properties.adminToolsAPIURL + communityId + '/curator'; let url: string = properties.adminToolsAPIURL + '/' + communityId + '/curator';
return this.http.get<Curator[]>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url); return this.http.get<Curator[]>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url);
} }
public updateCurator(curator: Curator) { public updateCurator(properties: EnvProperties, curator: Curator) {
let url: string = properties.adminToolsAPIURL + "curator"; let url: string = properties.adminToolsAPIURL + "curator";
return this.http.post<Curator>(url, curator, CustomOptions.registryOptions()); return this.http.post<Curator>(url, curator, CustomOptions.registryOptions());
} }
public getCurator(): Observable<Curator> { public getCurator(properties: EnvProperties): Observable<Curator> {
let url: string = properties.adminToolsAPIURL + 'curator'; let url: string = properties.adminToolsAPIURL + 'curator';
return this.http.get<Curator>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url, CustomOptions.registryOptions()); return this.http.get<Curator>((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url, CustomOptions.registryOptions());
} }

View File

@ -42,7 +42,7 @@ export class ZenodoCommunitiesService {
var result: ZenodoCommunityInfo = new ZenodoCommunityInfo(); var result: ZenodoCommunityInfo = new ZenodoCommunityInfo();
let metadata = resData["metadata"]; let metadata = resData["metadata"];
result['title'] = metadata.title; result['title'] = metadata.title;
result['id'] = resData.slug; result['id'] = resData.id;
result['description'] = metadata.description; result['description'] = metadata.description;
result['link'] = resData.links.self_html; result['link'] = resData.links.self_html;
result['logoUrl'] = resData.links.logo; result['logoUrl'] = resData.links.logo;

View File

@ -6,5 +6,4 @@ export class ZenodoCommunityInfo {
logoUrl: string; logoUrl: string;
date: Date; date: Date;
page: string; page: string;
master:boolean = false;
} }

View File

@ -80,7 +80,7 @@ export class DivIdsComponent implements OnInit {
getDivIds() { getDivIds() {
this.showLoading = true; this.showLoading = true;
this.subscriptions.push(this._helpContentService.getAllDivIdsFull().subscribe( this.subscriptions.push(this._helpContentService.getAllDivIdsFull(this.properties.adminToolsAPIURL).subscribe(
divIds => { divIds => {
this.divIds = divIds; this.divIds = divIds;
this.checkboxes = []; this.checkboxes = [];
@ -138,12 +138,12 @@ export class DivIdsComponent implements OnInit {
public confirmedDeleteDivIds(data: any) { public confirmedDeleteDivIds(data: any) {
this.showLoading = true; this.showLoading = true;
this.subscriptions.push(this._helpContentService.deleteDivIds(this.selectedDivIds).subscribe( this.subscriptions.push(this._helpContentService.deleteDivIds(this.selectedDivIds, this.properties.adminToolsAPIURL).subscribe(
_ => { _ => {
this.deleteDivIdsFromArray(this.selectedDivIds); this.deleteDivIdsFromArray(this.selectedDivIds);
NotificationHandler.rise('Classes have been <b>successfully deleted</b>'); NotificationHandler.rise('Classes have been <b>successfully deleted</b>');
this.showLoading = false; this.showLoading = false;
//this._clearCacheService.clearCache("Class ids deleted"); this._clearCacheService.clearCache("Class ids deleted");
}, },
error => this.handleUpdateError('System error deleting the selected classes', error) error => this.handleUpdateError('System error deleting the selected classes', error)
)); ));
@ -191,20 +191,20 @@ export class DivIdsComponent implements OnInit {
public divIdSaveConfirmed(data: any) { public divIdSaveConfirmed(data: any) {
this.showLoading = true; this.showLoading = true;
if (!this.classForm.getRawValue()._id) { if (!this.classForm.getRawValue()._id) {
this.subscriptions.push(this._helpContentService.saveDivId(<DivId>this.classForm.getRawValue()).subscribe( this.subscriptions.push(this._helpContentService.saveDivId(<DivId>this.classForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
divId => { divId => {
this.divIdSavedSuccessfully(divId); this.divIdSavedSuccessfully(divId);
NotificationHandler.rise('Class <b>' + divId.name + '</b> has been <b>successfully created</b>'); NotificationHandler.rise('Class <b>' + divId.name + '</b> has been <b>successfully created</b>');
//this._clearCacheService.clearCache("Class id saved"); this._clearCacheService.clearCache("Class id saved");
}, },
error => this.handleUpdateError("System error creating class", error) error => this.handleUpdateError("System error creating class", error)
)); ));
} else { } else {
this.subscriptions.push(this._helpContentService.updateDivId(<DivId>this.classForm.getRawValue()).subscribe( this.subscriptions.push(this._helpContentService.updateDivId(<DivId>this.classForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
divId => { divId => {
this.divIdUpdatedSuccessfully(divId); this.divIdUpdatedSuccessfully(divId);
NotificationHandler.rise('Class <b>' + divId.name + '</b> has been <b>successfully updated</b>'); NotificationHandler.rise('Class <b>' + divId.name + '</b> has been <b>successfully updated</b>');
//this._clearCacheService.clearCache("Class id updated"); this._clearCacheService.clearCache("Class id updated");
}, },
error => this.handleUpdateError("System error updating class", error) error => this.handleUpdateError("System error updating class", error)
)); ));
@ -261,7 +261,7 @@ export class DivIdsComponent implements OnInit {
getPages() { getPages() {
this.showLoading = true; this.showLoading = true;
this.subscriptions.push(this._helpContentService.getAllPages().subscribe( this.subscriptions.push(this._helpContentService.getAllPages(this.properties.adminToolsAPIURL).subscribe(
pages => { pages => {
this.allPages = []; this.allPages = [];
pages.forEach(page => { pages.forEach(page => {

View File

@ -15,10 +15,9 @@ import {LoadingModule} from "../../utils/loading/loading.module";
@NgModule({ @NgModule({
imports: [ imports: [
ClassesRoutingModule,
CommonModule, RouterModule, FormsModule, CommonModule, RouterModule, FormsModule,
AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule,
AdminTabsModule, PageContentModule, SearchInputModule, IconsModule, LoadingModule AdminTabsModule, PageContentModule, ClassesRoutingModule, SearchInputModule, IconsModule, LoadingModule
], ],
declarations: [DivIdsComponent], declarations: [DivIdsComponent],
exports: [DivIdsComponent] exports: [DivIdsComponent]

View File

@ -59,8 +59,8 @@ export class ClassContentFormComponent implements OnInit {
getInfo(pageId: string) { getInfo(pageId: string) {
this.showLoading = true; this.showLoading = true;
let obs = zip(this._helpContentService.getPageByPortal(pageId, this.portal), let obs = zip(this._helpContentService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal),
this._helpContentService.getDivIdsFullByPortal(pageId, this.portal)); this._helpContentService.getDivIdsFullByPortal(pageId, this.properties.adminToolsAPIURL, this.portal));
this.subs.push(obs.subscribe( this.subs.push(obs.subscribe(
results => { results => {
this.page = results[0]; this.page = results[0];
@ -73,7 +73,7 @@ export class ClassContentFormComponent implements OnInit {
this.showLoading = false; this.showLoading = false;
this.initCKEditor(); this.initCKEditor();
} else { } else {
this.subs.push(this._helpContentService.getDivHelpContent(this.pageContentId, this.portal).subscribe(pageHelpContent => { this.subs.push(this._helpContentService.getDivHelpContent(this.pageContentId, this.properties.adminToolsAPIURL, this.portal).subscribe(pageHelpContent => {
this.pageHelpContent = pageHelpContent; this.pageHelpContent = pageHelpContent;
if (this.properties.adminToolsPortalType != this.page.portalType) { if (this.properties.adminToolsPortalType != this.page.portalType) {
this._router.navigate(['../'], {relativeTo: this.route}); this._router.navigate(['../'], {relativeTo: this.route});
@ -161,12 +161,12 @@ export class ClassContentFormComponent implements OnInit {
if (this.myForm.valid) { if (this.myForm.valid) {
this.showLoading = true; this.showLoading = true;
let pageHelpContent: DivHelpContent = this.myForm.getRawValue(); let pageHelpContent: DivHelpContent = this.myForm.getRawValue();
this.subs.push(this._helpContentService.insertOrUpdateDivHelpContent(pageHelpContent, this.portal).subscribe( this.subs.push(this._helpContentService.insertOrUpdateDivHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.portal).subscribe(
_ => { _ => {
this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route}); this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route});
NotificationHandler.rise('Page content has been <b>successfully updated</b>'); NotificationHandler.rise('Page content has been <b>successfully updated</b>');
this.showLoading = false; this.showLoading = false;
this._clearCacheService.purgeBrowserCache("Class help text saved or updated",this.portal); this._clearCacheService.clearCache("Class help text saved or updated");
}, },
err => this.handleUpdateError('System error saving page content', err) err => this.handleUpdateError('System error saving page content', err)
)); ));

View File

@ -16,10 +16,9 @@ import {PageContentModule} from '../sharedComponents/page-content/page-content.m
@NgModule({ @NgModule({
imports: [ imports: [
ClassHelpContentFormRoutingModule,
CommonModule, FormsModule, RouterModule, CommonModule, FormsModule, RouterModule,
SafeHtmlPipeModule, CKEditorModule, SafeHtmlPipeModule, CKEditorModule,
AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, MatSlideToggleModule, IconsModule, LoadingModule, PageContentModule AlertModalModule, ReactiveFormsModule, ClassHelpContentFormRoutingModule, AdminToolServiceModule, InputModule, MatSlideToggleModule, IconsModule, LoadingModule, PageContentModule
], ],
declarations: [ declarations: [
ClassContentFormComponent ClassContentFormComponent

View File

@ -79,7 +79,7 @@ export class ClassHelpContentsComponent implements OnInit {
getPage(pageId: string) { getPage(pageId: string) {
this.showLoading = true; this.showLoading = true;
this.subscriptions.push(this._helpService.getPageByPortal(pageId, this.portal).subscribe( this.subscriptions.push(this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal).subscribe(
page => { page => {
if (this.properties.adminToolsPortalType != page.portalType) { if (this.properties.adminToolsPortalType != page.portalType) {
this.router.navigate(['./pageContents'], {queryParams: {'communityId': this.portal}}); this.router.navigate(['./pageContents'], {queryParams: {'communityId': this.portal}});
@ -109,7 +109,7 @@ export class ClassHelpContentsComponent implements OnInit {
} }
getPageHelpContents(community_pid: string) { getPageHelpContents(community_pid: string) {
this.subscriptions.push(this._helpService.getCommunityDivHelpContents(community_pid, this.selectedPageId).subscribe( this.subscriptions.push(this._helpService.getCommunityDivHelpContents(community_pid, this.properties.adminToolsAPIURL, this.selectedPageId).subscribe(
pageHelpContents => { pageHelpContents => {
this.divHelpContents = pageHelpContents as Array<DivHelpContent>; this.divHelpContents = pageHelpContents as Array<DivHelpContent>;
this.counter.all = this.divHelpContents.length; this.counter.all = this.divHelpContents.length;
@ -150,12 +150,12 @@ export class ClassHelpContentsComponent implements OnInit {
public confirmedDeletePageHelpContents(data: any) { public confirmedDeletePageHelpContents(data: any) {
this.showLoading = true; this.showLoading = true;
this.subscriptions.push(this._helpService.deleteDivHelpContents(this.selectedPageContents, this.portal).subscribe( this.subscriptions.push(this._helpService.deleteDivHelpContents(this.selectedPageContents, this.properties.adminToolsAPIURL, this.portal).subscribe(
_ => { _ => {
this.deletePageHelpContentsFromArray(this.selectedPageContents); this.deletePageHelpContentsFromArray(this.selectedPageContents);
NotificationHandler.rise('Page content(s) has been <b>successfully deleted</b>'); NotificationHandler.rise('Page content(s) has been <b>successfully deleted</b>');
this.showLoading = false; this.showLoading = false;
this._clearCacheService.purgeBrowserCache("Class text texts deleted",this.portal); this._clearCacheService.clearCache("Class text texts deleted");
}, },
error => this.handleUpdateError('System error deleting the selected page content(s)', error) error => this.handleUpdateError('System error deleting the selected page content(s)', error)
)); ));
@ -189,7 +189,7 @@ export class ClassHelpContentsComponent implements OnInit {
} }
public togglePageHelpContents(status: boolean, ids: string[]) { public togglePageHelpContents(status: boolean, ids: string[]) {
this.subscriptions.push(this._helpService.toggleDivHelpContents(ids, status, this.portal).subscribe( this.subscriptions.push(this._helpService.toggleDivHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe(
() => { () => {
for (let id of ids) { for (let id of ids) {
let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id); let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id);
@ -198,7 +198,7 @@ export class ClassHelpContentsComponent implements OnInit {
this.countClassHelpContents(); this.countClassHelpContents();
this.applyCheck(false); this.applyCheck(false);
NotificationHandler.rise('Page content(s) has been <b>successfully updated</b>'); NotificationHandler.rise('Page content(s) has been <b>successfully updated</b>');
this._clearCacheService.purgeBrowserCache("class help text's status changed",this.portal); this._clearCacheService.clearCache("class help text's status changed");
}, },
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error) error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
)); ));

View File

@ -19,9 +19,8 @@ import {PageContentModule} from '../sharedComponents/page-content/page-content.m
@NgModule({ @NgModule({
imports: [ imports: [
ClassHelpContentsRoutingModule,
CommonModule, RouterModule, FormsModule, SafeHtmlPipeModule, CommonModule, RouterModule, FormsModule, SafeHtmlPipeModule,
AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule, AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule, ClassHelpContentsRoutingModule,
SearchInputModule, IconsModule, LoadingModule, HTMLToStringPipeModule, PageContentModule SearchInputModule, IconsModule, LoadingModule, HTMLToStringPipeModule, PageContentModule
], ],
declarations: [ declarations: [

View File

@ -125,7 +125,7 @@ export class EntitiesComponent implements OnInit {
getEntities(portal: string) { getEntities(portal: string) {
this.showLoading = true; this.showLoading = true;
if (portal) { if (portal) {
this._helpContentService.getCommunityEntities(portal).subscribe( this._helpContentService.getCommunityEntities(portal, this.properties.adminToolsAPIURL).subscribe(
entities => { entities => {
this.entities = entities; this.entities = entities;
this.checkboxes = []; this.checkboxes = [];
@ -139,7 +139,7 @@ export class EntitiesComponent implements OnInit {
}, },
error => this.handleError('System error retrieving entities', error)); error => this.handleError('System error retrieving entities', error));
} else { } else {
this._helpContentService.getEntities().subscribe( this._helpContentService.getEntities(this.properties.adminToolsAPIURL).subscribe(
entities => { entities => {
this.entities = entities; this.entities = entities;
this.checkboxes = []; this.checkboxes = [];
@ -197,13 +197,13 @@ export class EntitiesComponent implements OnInit {
public confirmedDeleteEntities(data: any) { public confirmedDeleteEntities(data: any) {
this.showLoading = true; this.showLoading = true;
this._helpContentService.deleteEntities(this.selectedEntities).subscribe( this._helpContentService.deleteEntities(this.selectedEntities, this.properties.adminToolsAPIURL).subscribe(
_ => { _ => {
this.deleteEntitiesFromArray(this.selectedEntities); this.deleteEntitiesFromArray(this.selectedEntities);
NotificationHandler.rise('Entities have been <b>successfully deleted</b>'); NotificationHandler.rise('Entities have been <b>successfully deleted</b>');
this.showLoading = false; this.showLoading = false;
// this._clearCacheService.clearCache("entities deleted"); this._clearCacheService.clearCache("entities deleted");
// this._clearCacheService.purgeBrowserCache("entities deleted", this.portal); this._clearCacheService.purgeBrowserCache("entities deleted", this.portal);
}, },
error => this.handleUpdateError('System error deleting the selected entities', error) error => this.handleUpdateError('System error deleting the selected entities', error)
); );
@ -240,22 +240,22 @@ export class EntitiesComponent implements OnInit {
this.showLoading = true; this.showLoading = true;
if (this.entityForm.getRawValue()._id) { if (this.entityForm.getRawValue()._id) {
this._helpContentService.updateEntity( this._helpContentService.updateEntity(
<Entity>this.entityForm.getRawValue()).subscribe( <Entity>this.entityForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
entity => { entity => {
this.entityUpdatedSuccessfully(entity); this.entityUpdatedSuccessfully(entity);
NotificationHandler.rise('Entity <b>' + entity.name + '</b> has been <b>successfully updated</b>'); NotificationHandler.rise('Entity <b>' + entity.name + '</b> has been <b>successfully updated</b>');
// this._clearCacheService.clearCache("entity updated"); this._clearCacheService.clearCache("entity updated");
// this._clearCacheService.purgeBrowserCache("entity updated", this.portal); this._clearCacheService.purgeBrowserCache("entity updated", this.portal);
}, },
error => this.handleUpdateError('System error updating entity', error) error => this.handleUpdateError('System error updating entity', error)
); );
} else { } else {
this._helpContentService.saveEntity(<Entity>this.entityForm.getRawValue()).subscribe( this._helpContentService.saveEntity(<Entity>this.entityForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
entity => { entity => {
this.entitySavedSuccessfully(entity); this.entitySavedSuccessfully(entity);
NotificationHandler.rise('Entity <b>' + entity.name + '</b> has been <b>successfully created</b>'); NotificationHandler.rise('Entity <b>' + entity.name + '</b> has been <b>successfully created</b>');
// this._clearCacheService.clearCache("entity saved"); this._clearCacheService.clearCache("entity saved");
// this._clearCacheService.purgeBrowserCache("entity saved", this.portal) this._clearCacheService.purgeBrowserCache("entity saved", this.portal)
}, },
error => this.handleUpdateError('System error creating entity', error) error => this.handleUpdateError('System error creating entity', error)
); );
@ -338,14 +338,14 @@ export class EntitiesComponent implements OnInit {
public continueToggling(event: any) { public continueToggling(event: any) {
this._helpContentService.toggleEntities( this._helpContentService.toggleEntities(
this.portal, this.toggleIds, this.toggleStatus).subscribe( this.portal, this.toggleIds, this.toggleStatus, this.properties.adminToolsAPIURL).subscribe(
() => { () => {
for (let id of this.toggleIds) { for (let id of this.toggleIds) {
const i = this.checkboxes.findIndex(_ => _.entity._id === id); const i = this.checkboxes.findIndex(_ => _.entity._id === id);
this.checkboxes[i].entity.isEnabled = this.toggleStatus; this.checkboxes[i].entity.isEnabled = this.toggleStatus;
} }
this.applyCheck(false); this.applyCheck(false);
this._clearCacheService.purgeBrowserCache("entity's status changed", this.portal); this._clearCacheService.clearCache("entity's status changed");
this._clearCacheService.purgeBrowserCache("entity's status changed", this.portal); this._clearCacheService.purgeBrowserCache("entity's status changed", this.portal);
}, },
error => this.handleUpdateError('System error changing the status of the selected entity(-ies)', error) error => this.handleUpdateError('System error changing the status of the selected entity(-ies)', error)

View File

@ -17,9 +17,8 @@ import {LogoUrlPipeModule} from "../../utils/pipes/logoUrlPipe.module";
@NgModule({ @NgModule({
imports: [ imports: [
EntitiesRoutingModule,
CommonModule, RouterModule, FormsModule, AdminToolServiceModule, CommonModule, RouterModule, FormsModule, AdminToolServiceModule,
AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, InputModule, PageContentModule, AdminTabsModule, SearchInputModule, IconsModule, LoadingModule, LogoUrlPipeModule AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, InputModule, PageContentModule, AdminTabsModule, EntitiesRoutingModule, SearchInputModule, IconsModule, LoadingModule, LogoUrlPipeModule
], ],
declarations: [EntitiesComponent], declarations: [EntitiesComponent],
exports: [EntitiesComponent] exports: [EntitiesComponent]

View File

@ -34,9 +34,9 @@
</div> </div>
<form *ngIf="!showLoading" [formGroup]="myForm"> <form *ngIf="!showLoading" [formGroup]="myForm">
<div class="uk-grid uk-child-width-1-2"> <div class="uk-grid uk-child-width-1-2">
<div *ngIf="placementsOptions.length > 1" input [formInput]="myForm.get('placement')" <div *ngIf="placementsOptions.length > 0" input [formInput]="myForm.get('placement')"
placeholder="Select placement" [options]="placementsOptions" type="select"></div> placeholder="Select placement" [options]="placementsOptions" type="select"></div>
<div *ngIf="orderOptions.length > 1 " input [formInput]="myForm.get('order')" placeholder="Select order" [options]="orderOptions" type="select"></div> <div input [formInput]="myForm.get('order')" placeholder="Select order" [options]="orderOptions" type="select"></div>
</div> </div>
<div class="form-group uk-margin-medium-top"> <div class="form-group uk-margin-medium-top">
<span class="uk-text-bold uk-margin-small-right">Select Status (Enable/ disable)</span> <span class="uk-text-bold uk-margin-small-right">Select Status (Enable/ disable)</span>

View File

@ -62,7 +62,7 @@ export class PageContentFormComponent implements OnInit {
getInfo(pageId: string) { getInfo(pageId: string) {
this.showLoading = true; this.showLoading = true;
let obs = zip(this._helpContentService.getPageByPortal(pageId, this.portal), this._helpContentService.getCommunityPageHelpContents(this.portal, pageId)); let obs = zip(this._helpContentService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal), this._helpContentService.getCommunityPageHelpContents(this.portal, this.properties.adminToolsAPIURL, pageId));
this.subs.push(obs.subscribe( this.subs.push(obs.subscribe(
results => { results => {
this.page = results[0]; this.page = results[0];
@ -149,9 +149,6 @@ export class PageContentFormComponent implements OnInit {
if (page.left) { if (page.left) {
this.placementsOptions.push({label: "left", value: "left"}); this.placementsOptions.push({label: "left", value: "left"});
} }
if (page.right) {
this.placementsOptions.push({label: "right", value: "right"});
}
this.orderOptions = []; this.orderOptions = [];
for (let i = 1; i < countContents + 1; i++) { for (let i = 1; i < countContents + 1; i++) {
this.orderOptions.push({label: "" + i, value: i}); this.orderOptions.push({label: "" + i, value: i});
@ -197,12 +194,12 @@ export class PageContentFormComponent implements OnInit {
if (this.myForm.valid) { if (this.myForm.valid) {
this.showLoading = true; this.showLoading = true;
let pageHelpContent: PageHelpContent = this.myForm.getRawValue(); let pageHelpContent: PageHelpContent = this.myForm.getRawValue();
this.subs.push(this._helpContentService.savePageHelpContent(pageHelpContent, this.portal).subscribe( this.subs.push(this._helpContentService.savePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.portal).subscribe(
_ => { _ => {
NotificationHandler.rise('Page content has been <b>successfully ' + (this.pageContentId ? 'updated' : 'created') + '</b>'); NotificationHandler.rise('Page content has been <b>successfully ' + (this.pageContentId ? 'updated' : 'created') + '</b>');
this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route}); this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route});
this.showLoading = false; this.showLoading = false;
this._clearCacheService.purgeBrowserCache("page help content saved",this.portal); this._clearCacheService.clearCache("page help content saved");
}, },
err => this.handleUpdateError('System error saving page content', err) err => this.handleUpdateError('System error saving page content', err)
)); ));

View File

@ -16,10 +16,9 @@ import {MatSlideToggleModule} from "@angular/material/slide-toggle";
@NgModule({ @NgModule({
imports: [ imports: [
PageHelpContentFormRoutingModule,
CommonModule, FormsModule, RouterModule, CommonModule, FormsModule, RouterModule,
SafeHtmlPipeModule, CKEditorModule, SafeHtmlPipeModule, CKEditorModule,
AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, IconsModule, PageContentModule, LoadingModule, MatSlideToggleModule AlertModalModule, ReactiveFormsModule, PageHelpContentFormRoutingModule, AdminToolServiceModule, InputModule, IconsModule, PageContentModule, LoadingModule, MatSlideToggleModule
], ],
declarations: [PageContentFormComponent], declarations: [PageContentFormComponent],
exports: [PageContentFormComponent] exports: [PageContentFormComponent]

View File

@ -82,7 +82,7 @@ export class PageHelpContentsComponent implements OnInit {
getPage(pageId: string) { getPage(pageId: string) {
this.showLoading = true; this.showLoading = true;
this.subscriptions.push(this._helpService.getPageByPortal(pageId, this.portal).subscribe( this.subscriptions.push(this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal).subscribe(
page => { page => {
if (this.properties.adminToolsPortalType != page.portalType) { if (this.properties.adminToolsPortalType != page.portalType) {
this.router.navigate(['./pageContents']); this.router.navigate(['./pageContents']);
@ -111,7 +111,7 @@ export class PageHelpContentsComponent implements OnInit {
} }
getPageHelpContents(community_pid: string) { getPageHelpContents(community_pid: string) {
this.subscriptions.push(this._helpService.getCommunityPageHelpContents(community_pid, this.selectedPageId).subscribe( this.subscriptions.push(this._helpService.getCommunityPageHelpContents(community_pid, this.properties.adminToolsAPIURL, this.selectedPageId).subscribe(
pageHelpContents => { pageHelpContents => {
this.pageHelpContents = pageHelpContents as Array<PageHelpContent>; this.pageHelpContents = pageHelpContents as Array<PageHelpContent>;
this.counter.all = this.pageHelpContents.length; this.counter.all = this.pageHelpContents.length;
@ -160,12 +160,12 @@ export class PageHelpContentsComponent implements OnInit {
public confirmedDeletePageHelpContents(data: any) { public confirmedDeletePageHelpContents(data: any) {
this.showLoading = true; this.showLoading = true;
this.subscriptions.push(this._helpService.deletePageHelpContents(this.selectedPageContents, this.portal).subscribe( this.subscriptions.push(this._helpService.deletePageHelpContents(this.selectedPageContents, this.properties.adminToolsAPIURL, this.portal).subscribe(
_ => { _ => {
this.deletePageHelpContentsFromArray(this.selectedPageContents); this.deletePageHelpContentsFromArray(this.selectedPageContents);
NotificationHandler.rise('Page content(s) has been <b>successfully deleted</b>'); NotificationHandler.rise('Page content(s) has been <b>successfully deleted</b>');
this.showLoading = false; this.showLoading = false;
this._clearCacheService.purgeBrowserCache("Help texts deleted",this.portal); this._clearCacheService.clearCache("Help texts deleted");
}, },
error => this.handleUpdateError('System error deleting the selected page content(s)', error) error => this.handleUpdateError('System error deleting the selected page content(s)', error)
)); ));
@ -201,7 +201,7 @@ export class PageHelpContentsComponent implements OnInit {
} }
public togglePageHelpContents(status: boolean, ids: string[]) { public togglePageHelpContents(status: boolean, ids: string[]) {
this.subscriptions.push(this._helpService.togglePageHelpContents(ids, status, this.portal).subscribe( this.subscriptions.push(this._helpService.togglePageHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe(
() => { () => {
for (let id of ids) { for (let id of ids) {
let i = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id); let i = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id);
@ -210,7 +210,7 @@ export class PageHelpContentsComponent implements OnInit {
NotificationHandler.rise('Page content(s) has been <b>successfully updated</b>'); NotificationHandler.rise('Page content(s) has been <b>successfully updated</b>');
this.countPageHelpContents(); this.countPageHelpContents();
this.applyCheck(false); this.applyCheck(false);
this._clearCacheService.purgeBrowserCache("Help text's status changed",this.portal); this._clearCacheService.clearCache("Help text's status changed");
}, },
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error) error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
)); ));

View File

@ -17,9 +17,8 @@ import {HTMLToStringPipeModule} from '../../utils/pipes/HTMLToStringPipe.module'
@NgModule({ @NgModule({
imports: [ imports: [
PageHelpContentsRoutingModule,
CommonModule, RouterModule, FormsModule, SafeHtmlPipeModule, CommonModule, RouterModule, FormsModule, SafeHtmlPipeModule,
AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule, PageContentModule, AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule, PageHelpContentsRoutingModule, PageContentModule,
SearchInputModule, IconsModule, LoadingModule, HTMLToStringPipeModule SearchInputModule, IconsModule, LoadingModule, HTMLToStringPipeModule
], ],
declarations: [ declarations: [

View File

@ -7,13 +7,8 @@
<div class="uk-flex uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid <div class="uk-flex uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid
[class]="isPortalAdministrator ? 'uk-flex-between@m':'uk-flex-right@m'"> [class]="isPortalAdministrator ? 'uk-flex-between@m':'uk-flex-right@m'">
<div> <div>
<!--<div input inputClass="border-bottom" type="select" [options]="menuTypes" [(value)]="selectedMenuType" (valueChange)="valueChange()" <div input inputClass="border-bottom" type="select" [options]="menuTypes" [(value)]="selectedMenuType" (valueChange)="valueChange()"
*ngIf="isPortalAdministrator"></div>--> *ngIf="isPortalAdministrator"></div>
<ul *ngIf="isPortalAdministrator" class="uk-subnav uk-subnav-pill uk-margin-medium-top">
<li *ngFor="let type of menuTypes; let i=index"
[class.uk-active]="selectedMenuType === type.value"><a
(click)="selectedMenuType = type.value"><span>{{type.label}}</span></a></li>
</ul>
</div> </div>
<div> <div>
<button class="uk-button uk-button-default uk-flex uk-flex-middle" <button class="uk-button uk-button-default uk-flex uk-flex-middle"
@ -168,9 +163,9 @@
<span class="uk-margin-small-left">Hidden</span> <span class="uk-margin-small-left">Hidden</span>
</label> </label>
</div> </div>
<ng-container *ngIf="selectedMenuType == 'customMenu'">
<h6 class="uk-margin-medium-top">Menu alignment</h6> <h6 class="uk-margin-medium-top">Menu alignment</h6>
<div > <div *ngIf="selectedMenuType == 'customMenu'">
<div> <div>
<label (click)="alignMenu('LEFT')"> <label (click)="alignMenu('LEFT')">
<input class="uk-radio" type="radio" name="menuAlign" [checked]="(featuredAlignment == 'LEFT')"> <input class="uk-radio" type="radio" name="menuAlign" [checked]="(featuredAlignment == 'LEFT')">
@ -190,7 +185,6 @@
</label> </label>
</div> </div>
</div> </div>
</ng-container>
</div> </div>
</div> </div>
<div *ngIf="displayMenuItems && displayMenuItems.length == 0" <div *ngIf="displayMenuItems && displayMenuItems.length == 0"

View File

@ -46,9 +46,8 @@ export class MenuComponent implements OnInit {
public menuItemForm: FormGroup; public menuItemForm: FormGroup;
public pageForm: FormGroup; public pageForm: FormGroup;
public menuTypes = [ public menuTypes = [
{label: 'Custom', value: 'customMenu'}, {label: 'Normal Menu', value: 'normalMenu'},
{label: 'Main', value: 'normalMenu'} {label: 'Custom Menu', value: 'customMenu'}
]; ];
public selectedMenuType = this.menuTypes[0].value; public selectedMenuType = this.menuTypes[0].value;
public normalMenuItems: MenuItemExtended[] = []; public normalMenuItems: MenuItemExtended[] = [];
@ -127,8 +126,8 @@ export class MenuComponent implements OnInit {
} else { } else {
this.title.setTitle('Administrator Dashboard | Menu'); this.title.setTitle('Administrator Dashboard | Menu');
} }
this.isPortalAdministrator = false;//Session.isPortalAdministrator(user); this.isPortalAdministrator = Session.isPortalAdministrator(user);
this.selectedMenuType = this.menuTypes[0].value this.selectedMenuType = this.isPortalAdministrator ? this.menuTypes[0].value : this.menuTypes[1].value;
}); });
} }
@ -181,7 +180,7 @@ export class MenuComponent implements OnInit {
getPages() { getPages() {
this.subscriptions.push( this.subscriptions.push(
this._helpContentService.getCommunityPagesByType(this.portal, '').subscribe( this._helpContentService.getCommunityPagesByType(this.portal, '', this.properties.adminToolsAPIURL).subscribe(
data => { data => {
let pages = data; let pages = data;
this.pageStatus = new Map(); this.pageStatus = new Map();
@ -272,8 +271,8 @@ export class MenuComponent implements OnInit {
this.deleteMenuItemFromArray(this.selectedMenuItem, this.isChild); this.deleteMenuItemFromArray(this.selectedMenuItem, this.isChild);
NotificationHandler.rise("Menu item have been <b>successfully deleted</b>"); NotificationHandler.rise("Menu item have been <b>successfully deleted</b>");
this.showLoading = false; this.showLoading = false;
this._clearCacheService.purgeBrowserCache("Menu item deleted",this.portal); this._clearCacheService.clearCache("Menu item deleted");
this._clearCacheService.purgeBrowserCache("Menu item deleted", this.portal);
}, },
error => this.handleError("Server error deleting menu item", error) error => this.handleError("Server error deleting menu item", error)
) )
@ -314,7 +313,8 @@ export class MenuComponent implements OnInit {
menuItem => { menuItem => {
this.menuItemSavedSuccessfully(menuItem, true); this.menuItemSavedSuccessfully(menuItem, true);
NotificationHandler.rise('Menu item <b>' + menuItem.title + '</b> has been <b>successfully created</b>'); NotificationHandler.rise('Menu item <b>' + menuItem.title + '</b> has been <b>successfully created</b>');
this._clearCacheService.purgeBrowserCache("Menu item saved",this.portal); this._clearCacheService.clearCache("Menu item saved");
this._clearCacheService.purgeBrowserCache("Menu item saved", this.portal);
}, },
error => this.handleError("System error creating menu item", error) error => this.handleError("System error creating menu item", error)
) )
@ -325,7 +325,8 @@ export class MenuComponent implements OnInit {
menuItem => { menuItem => {
this.menuItemSavedSuccessfully(menuItem, false); this.menuItemSavedSuccessfully(menuItem, false);
NotificationHandler.rise('Menu item <b>' + menuItem.title + '</b> has been <b>successfully updated</b>'); NotificationHandler.rise('Menu item <b>' + menuItem.title + '</b> has been <b>successfully updated</b>');
this._clearCacheService.purgeBrowserCache("Menu item updated",this.portal); this._clearCacheService.clearCache("Menu item updated");
this._clearCacheService.purgeBrowserCache("Menu item updated", this.portal);
}, },
error => this.handleError("System error updating menu item", error) error => this.handleError("System error updating menu item", error)
) )
@ -391,7 +392,8 @@ export class MenuComponent implements OnInit {
HelperFunctions.swap(temp, index, newIndex); HelperFunctions.swap(temp, index, newIndex);
this._helpContentService.reorderMenuItems(temp, this.portal).subscribe(() => { this._helpContentService.reorderMenuItems(temp, this.portal).subscribe(() => {
HelperFunctions.swap(this.featuredMenuItems, index, newIndex); HelperFunctions.swap(this.featuredMenuItems, index, newIndex);
this._clearCacheService.purgeBrowserCache("Menu items reordered",this.portal); this._clearCacheService.clearCache("Menu items reordered");
this._clearCacheService.purgeBrowserCache("Menu items reordered", this.portal);
}, error => { }, error => {
this.handleError("System error reordering menu items", error); this.handleError("System error reordering menu items", error);
}); });
@ -403,7 +405,8 @@ export class MenuComponent implements OnInit {
HelperFunctions.swap(temp, index, newIndex); HelperFunctions.swap(temp, index, newIndex);
this._helpContentService.reorderMenuItems(temp, this.portal).subscribe(() => { this._helpContentService.reorderMenuItems(temp, this.portal).subscribe(() => {
HelperFunctions.swap(children && children.length ? children : this.normalMenuItems, index, newIndex); HelperFunctions.swap(children && children.length ? children : this.normalMenuItems, index, newIndex);
this._clearCacheService.purgeBrowserCache("Menu items reordered",this.portal); this._clearCacheService.clearCache("Menu items reordered");
this._clearCacheService.purgeBrowserCache("Menu items reordered", this.portal);
}, error => { }, error => {
this.handleError("System error reordering menu items", error); this.handleError("System error reordering menu items", error);
}); });
@ -418,7 +421,8 @@ export class MenuComponent implements OnInit {
} else { } else {
this.showNormalMenu = status; this.showNormalMenu = status;
} }
this._clearCacheService.purgeBrowserCache("Menu toggled",this.portal); this._clearCacheService.clearCache("Menu toggled");
this._clearCacheService.purgeBrowserCache("Menu toggled", this.portal);
NotificationHandler.rise("Menu has been <b>successfully toggled to be "+(status?"visible":"hidden")+"</b>"); NotificationHandler.rise("Menu has been <b>successfully toggled to be "+(status?"visible":"hidden")+"</b>");
}, error => { }, error => {
this.handleError("System error toggling menu", error); this.handleError("System error toggling menu", error);
@ -430,7 +434,8 @@ export class MenuComponent implements OnInit {
this.subscriptions.push( this.subscriptions.push(
this._helpContentService.alignMenu(MenuAlignment[alignment], this.portal).subscribe(() => { this._helpContentService.alignMenu(MenuAlignment[alignment], this.portal).subscribe(() => {
this.featuredAlignment = alignment; this.featuredAlignment = alignment;
this._clearCacheService.purgeBrowserCache("Menu aligned",this.portal); this._clearCacheService.clearCache("Menu aligned");
this._clearCacheService.purgeBrowserCache("Menu aligned", this.portal);
NotificationHandler.rise("Menu has been <b>successfully "+alignment.toLowerCase()+" aligned</b>"); NotificationHandler.rise("Menu has been <b>successfully "+alignment.toLowerCase()+" aligned</b>");
}, error => { }, error => {
this.handleError("System error aligning menu to the "+alignment.toLowerCase(), error); this.handleError("System error aligning menu to the "+alignment.toLowerCase(), error);

View File

@ -18,9 +18,8 @@ import {LogoUrlPipeModule} from '../../utils/pipes/logoUrlPipe.module';
@NgModule({ @NgModule({
imports: [ imports: [
MenuRoutingModule,
CommonModule, RouterModule, FormsModule, AdminToolServiceModule, CommonModule, RouterModule, FormsModule, AdminToolServiceModule,
AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, InputModule, PageContentModule, AdminTabsModule, SearchInputModule, IconsModule, LoadingModule, AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, InputModule, PageContentModule, AdminTabsModule, MenuRoutingModule, SearchInputModule, IconsModule, LoadingModule,
TransitionGroupModule, LogoUrlPipeModule TransitionGroupModule, LogoUrlPipeModule
], ],
declarations: [MenuComponent], declarations: [MenuComponent],

View File

@ -88,23 +88,14 @@
<div class="uk-card-footer uk-padding-remove-vertical"> <div class="uk-card-footer uk-padding-remove-vertical">
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid> <div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
<ng-container *ngIf="!isPortalAdministrator"> <ng-container *ngIf="!isPortalAdministrator">
<div *ngIf="pagePluginTemplatesCount[check.page._id]>0" >
<div class="uk-padding-small uk-padding-remove-horizontal">
<a class="uk-button uk-button-link uk-text-truncate"
[queryParams]="{pageId: check.page._id}"
routerLink="../plugins">
Manage plugins
<span *ngIf="pagePluginTemplatesCount[check.page._id]">({{pagePluginTemplatesCount[check.page._id]}})</span>
</a>
</div>
</div>
<div *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right"> <div *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right">
<div class="uk-padding-small uk-padding-remove-horizontal"> <div class="uk-padding-small uk-padding-remove-horizontal">
<a class="uk-button uk-button-link uk-text-truncate" <a class="uk-button uk-button-link uk-text-truncate"
[queryParams]="{pageId: check.page._id}" [queryParams]="{pageId: check.page._id}"
routerLink="../helptexts"> routerLink="../helptexts">
Manage page help texts Manage page help texts
<span *ngIf="pageHelpContentsCount[check.page._id]">({{pageHelpContentsCount[check.page._id]}})</span> <span *ngIf="pageHelpContentsCount[check.page._id]">({{pageHelpContentsCount[check.page._id]}}
)</span>
</a> </a>
</div> </div>
</div> </div>
@ -114,7 +105,8 @@
[queryParams]="{ pageId: check.page._id}" [queryParams]="{ pageId: check.page._id}"
routerLink="../classContents">Manage class help texts routerLink="../classContents">Manage class help texts
<span <span
*ngIf="pageClassContentsCount[check.page._id]">({{pageClassContentsCount[check.page._id]}})</span> *ngIf="pageClassContentsCount[check.page._id]">({{pageClassContentsCount[check.page._id]}}
)</span>
</a> </a>
</div> </div>
</div> </div>
@ -130,16 +122,6 @@
</ng-container> </ng-container>
<ng-container <ng-container
*ngIf="isPortalAdministrator || (check.page.portalType == properties.adminToolsPortalType && check.page.portalPid == portal)"> *ngIf="isPortalAdministrator || (check.page.portalType == properties.adminToolsPortalType && check.page.portalPid == portal)">
<div *ngIf="pagePluginTemplatesCount[check.page._id]>0" >
<div class="uk-padding-small uk-padding-remove-horizontal">
<a class="uk-button uk-button-link uk-text-truncate"
[queryParams]="{pageId: check.page._id}"
routerLink="../templates">
Manage plugin templates {{check.page.portalPid}}
<span *ngIf="pagePluginTemplatesCount[check.page._id]">({{pagePluginTemplatesCount[check.page._id]}})</span>
</a>
</div>
</div>
<div> <div>
<div class="uk-padding-small uk-padding-remove-horizontal"> <div class="uk-padding-small uk-padding-remove-horizontal">
<button [disabled]="!portal && check.page.portalPid" <button [disabled]="!portal && check.page.portalPid"

View File

@ -20,7 +20,6 @@ import {Stakeholder} from "../../monitor/entities/stakeholder";
import {CommunityService} from "../../connect/community/community.service"; import {CommunityService} from "../../connect/community/community.service";
import {ClearCacheService} from "../../services/clear-cache.service"; import {ClearCacheService} from "../../services/clear-cache.service";
import {NotificationHandler} from "../../utils/notification-handler"; import {NotificationHandler} from "../../utils/notification-handler";
import {PluginsService} from "../../services/plugins.service";
@Component({ @Component({
selector: 'pages', selector: 'pages',
@ -69,11 +68,10 @@ export class PagesComponent implements OnInit {
private index: number; private index: number;
pageHelpContentsCount = {}; pageHelpContentsCount = {};
pageClassContentsCount = {}; pageClassContentsCount = {};
pagePluginTemplatesCount = {};
constructor(private element: ElementRef, private route: ActivatedRoute, constructor(private element: ElementRef, private route: ActivatedRoute,
private title: Title, private title: Title,
private _router: Router, private _helpContentService: HelpContentService, private _router: Router, private _helpContentService: HelpContentService,
private _pluginsService: PluginsService,
private userManagementService: UserManagementService, private _fb: UntypedFormBuilder, private userManagementService: UserManagementService, private _fb: UntypedFormBuilder,
private communityService: CommunityService, private communityService: CommunityService,
private stakeholderService: StakeholderService, private stakeholderService: StakeholderService,
@ -131,7 +129,7 @@ export class PagesComponent implements OnInit {
this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.portal; this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.portal;
})); }));
})); }));
this.subscriptions.push(this._helpContentService.getEntities().subscribe( this.subscriptions.push(this._helpContentService.getEntities(this.properties.adminToolsAPIURL).subscribe(
entities => { entities => {
this.allEntities = []; this.allEntities = [];
entities.forEach(entity => { entities.forEach(entity => {
@ -143,9 +141,8 @@ export class PagesComponent implements OnInit {
}, },
error => this.handleError('System error retrieving pages', error))); error => this.handleError('System error retrieving pages', error)));
if (this.portal) { if (this.portal) {
this.getCountsPerPID(this.portal); this.getPageHelpContentsCounts(this.portal);
} }
this.getPluginTemplatesContentsCounts()
} }
ngOnDestroy(): void { ngOnDestroy(): void {
@ -166,7 +163,7 @@ export class PagesComponent implements OnInit {
parameters = '?page_type=' + this.pagesType; parameters = '?page_type=' + this.pagesType;
} }
if (portal) { if (portal) {
this.subscriptions.push(this._helpContentService.getCommunityPagesByType(portal, parameters).subscribe( this.subscriptions.push(this._helpContentService.getCommunityPagesByType(portal, parameters, this.properties.adminToolsAPIURL).subscribe(
pages => { pages => {
this.pagesReturned(pages); this.pagesReturned(pages);
//if(!this.pagesType || this.pagesType == "link") { //if(!this.pagesType || this.pagesType == "link") {
@ -178,7 +175,7 @@ export class PagesComponent implements OnInit {
error => this.handleError('System error retrieving pages', error) error => this.handleError('System error retrieving pages', error)
)); ));
} else { } else {
this.subscriptions.push(this._helpContentService.getAllPagesFull().subscribe( this.subscriptions.push(this._helpContentService.getAllPagesFull(this.properties.adminToolsAPIURL).subscribe(
pages => { pages => {
this.pagesReturned(pages); this.pagesReturned(pages);
this.showLoading = false; this.showLoading = false;
@ -189,7 +186,7 @@ export class PagesComponent implements OnInit {
} }
getPagesWithDivIds(portal: string) { getPagesWithDivIds(portal: string) {
this.subscriptions.push(this._helpContentService.getPageIdsFromDivIds(portal).subscribe( this.subscriptions.push(this._helpContentService.getPageIdsFromDivIds(portal, this.properties.adminToolsAPIURL).subscribe(
pages => { pages => {
this.pageWithDivIds = pages; this.pageWithDivIds = pages;
this.showLoading = false; this.showLoading = false;
@ -247,13 +244,13 @@ export class PagesComponent implements OnInit {
public confirmedDeletePages() { public confirmedDeletePages() {
this.showLoading = true; this.showLoading = true;
this.subscriptions.push(this._helpContentService.deletePages(this.selectedPages).subscribe( this.subscriptions.push(this._helpContentService.deletePages(this.selectedPages, this.properties.adminToolsAPIURL).subscribe(
_ => { _ => {
this.deletePagesFromArray(this.selectedPages); this.deletePagesFromArray(this.selectedPages);
NotificationHandler.rise('Pages have been <b>successfully deleted</b>'); NotificationHandler.rise('Pages have been <b>successfully deleted</b>');
this.showLoading = false; this.showLoading = false;
// this._clearCacheService.clearCache("Pages deleted"); this._clearCacheService.clearCache("Pages deleted");
// this._clearCacheService.purgeBrowserCache("Pages deleted", this.portal); this._clearCacheService.purgeBrowserCache("Pages deleted", this.portal);
}, },
error => this.handleUpdateError('System error deleting the selected pages', error) error => this.handleUpdateError('System error deleting the selected pages', error)
)); ));
@ -316,22 +313,22 @@ export class PagesComponent implements OnInit {
public pageSaveConfirmed(data: any) { public pageSaveConfirmed(data: any) {
this.showLoading = true; this.showLoading = true;
if (!this.pageForm.getRawValue()._id) { if (!this.pageForm.getRawValue()._id) {
this.subscriptions.push(this._helpContentService.savePage(<Page>this.pageForm.getRawValue()).subscribe( this.subscriptions.push(this._helpContentService.savePage(<Page>this.pageForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
page => { page => {
this.pageSavedSuccessfully(page, true); this.pageSavedSuccessfully(page, true);
NotificationHandler.rise('Page <b>' + page.name + '</b> has been <b>successfully created</b>'); NotificationHandler.rise('Page <b>' + page.name + '</b> has been <b>successfully created</b>');
// this._clearCacheService.clearCache("Page saved"); this._clearCacheService.clearCache("Page saved");
// this._clearCacheService.purgeBrowserCache("Page saved", this.portal); this._clearCacheService.purgeBrowserCache("Page saved", this.portal);
}, },
error => this.handleUpdateError('System error creating page', error) error => this.handleUpdateError('System error creating page', error)
)); ));
} else { } else {
this.subscriptions.push(this._helpContentService.updatePage(<Page>this.pageForm.getRawValue()).subscribe( this.subscriptions.push(this._helpContentService.updatePage(<Page>this.pageForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
page => { page => {
this.pageSavedSuccessfully(page, false); this.pageSavedSuccessfully(page, false);
NotificationHandler.rise('Page <b>' + page.name + '</b> has been <b>successfully updated</b>'); NotificationHandler.rise('Page <b>' + page.name + '</b> has been <b>successfully updated</b>');
// this._clearCacheService.clearCache("Page updated"); this._clearCacheService.clearCache("Page updated");
// this._clearCacheService.purgeBrowserCache("Page updated", this.portal); this._clearCacheService.purgeBrowserCache("Page updated", this.portal);
}, },
error => this.handleUpdateError('System error updating page', error) error => this.handleUpdateError('System error updating page', error)
)); ));
@ -408,13 +405,14 @@ export class PagesComponent implements OnInit {
} }
public togglePages(status: boolean, ids: string[]) { public togglePages(status: boolean, ids: string[]) {
this.subscriptions.push(this._helpContentService.togglePages(this.portal, ids, status).subscribe( this.subscriptions.push(this._helpContentService.togglePages(this.portal, ids, status, this.properties.adminToolsAPIURL).subscribe(
() => { () => {
for (let id of ids) { for (let id of ids) {
let i = this.checkboxes.findIndex(_ => _.page._id == id); let i = this.checkboxes.findIndex(_ => _.page._id == id);
this.checkboxes[i].page.isEnabled = status; this.checkboxes[i].page.isEnabled = status;
} }
this.applyCheck(false); this.applyCheck(false);
this._clearCacheService.clearCache("Page's status changed");
this._clearCacheService.purgeBrowserCache("Page's status changed", this.portal); this._clearCacheService.purgeBrowserCache("Page's status changed", this.portal);
}, },
error => this.handleUpdateError('System error changing the status of the selected page(s)', error) error => this.handleUpdateError('System error changing the status of the selected page(s)', error)
@ -428,30 +426,16 @@ export class PagesComponent implements OnInit {
} }
} }
getCountsPerPID(community_pid: string) { getPageHelpContentsCounts(community_pid: string) {
this.subscriptions.push(this._helpContentService.countCommunityPageHelpContents(community_pid, false).subscribe( this.subscriptions.push(this._helpContentService.countCommunityPageHelpContents(community_pid, this.properties.adminToolsAPIURL, false).subscribe(
pageHelpContentsCount => { pageHelpContentsCount => {
this.pageHelpContentsCount = pageHelpContentsCount; this.pageHelpContentsCount = pageHelpContentsCount;
}, },
error => this.handleError('System error retrieving page contents', error))); error => this.handleError('System error retrieving page contents', error)));
this.subscriptions.push(this._helpContentService.countCommunityPageHelpContents(community_pid, true).subscribe( this.subscriptions.push(this._helpContentService.countCommunityPageHelpContents(community_pid, this.properties.adminToolsAPIURL, true).subscribe(
pageClassContentsCount => { pageClassContentsCount => {
this.pageClassContentsCount = pageClassContentsCount; this.pageClassContentsCount = pageClassContentsCount;
}, },
error => this.handleError('System error retrieving page contents', error))); error => this.handleError('System error retrieving page contents', error)));
this.subscriptions.push(this._pluginsService.countPluginTemplatePerPage(community_pid).subscribe(
countPlugins => {
this.pagePluginTemplatesCount = countPlugins;
},
error => this.handleError('System error retrieving page contents', error)));
} }
getPluginTemplatesContentsCounts() {
this.subscriptions.push(this._pluginsService.countPluginTemplatePerPageForAllPortals().subscribe(
countPlugins => {
this.pagePluginTemplatesCount = countPlugins;
},
error => this.handleError('System error retrieving page contents', error)));
}
} }

View File

@ -20,9 +20,8 @@ import {LogoUrlPipeModule} from "../../utils/pipes/logoUrlPipe.module";
@NgModule({ @NgModule({
imports: [ imports: [
PagesRoutingModule,
CommonModule, RouterModule, FormsModule, AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule, CommonModule, RouterModule, FormsModule, AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule,
MatAutocompleteModule, MatFormFieldModule, MatChipsModule, AdminTabsModule, PageContentModule, SearchInputModule, IconsModule, LoadingModule, LogoUrlPipeModule MatAutocompleteModule, MatFormFieldModule, MatChipsModule, AdminTabsModule, PageContentModule, PagesRoutingModule, SearchInputModule, IconsModule, LoadingModule, LogoUrlPipeModule
], ],
declarations: [PagesComponent], declarations: [PagesComponent],
exports: [PagesComponent] exports: [PagesComponent]

View File

@ -1,144 +0,0 @@
import {Component, Input, SimpleChanges} from '@angular/core';
import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.form.component";
import {PluginCardInfo} from "./plugin-card-info.component";
@Component({
selector: 'plugin-card-info-form',
template: `
<div *ngIf="pluginObject" class="uk-padding-xsmall">
<ng-container *ngIf="selectedIndex == -1">
<plugin-field-edit [value]=" pluginObject.title"
type="text" field="title" (changed)="valueChanged($event)"></plugin-field-edit>
<plugin-field-edit [value]=" pluginObject.description"
type="textarea" field="description" (changed)="valueChanged($event)"></plugin-field-edit>
<hr class="uk-margin-left">
<div class="uk-margin-top uk-text-muted">
Cards:
</div>
<ng-container *ngFor="let card of pluginObject.cardInfoArray; let i = index">
<div class="uk-grid uk-grid-small uk-margin-xsmall-top">
<div *ngIf="selectedIndex != i" class="uk-text-small uk-width-expand">
<plugin-field-edit [value]=" pluginObject.cardInfoArray[i].show" type="checkbox" field="cardInfoArray"
(editClicked)="pluginEditEvent = $event"
(changed)="cardShowChanged(i,$event)"></plugin-field-edit>
{{card.title}}
</div>
<div class="uk-padding-remove-left uk-margin-medium-right">
<button
class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="edit(i)">
<icon name="edit" [flex]="true"></icon>
</button>
</div>
</div>
</ng-container>
</ng-container>
<ng-container *ngIf="selectedIndex > -1">
<div *ngIf="editTemplate" class="back uk-margin-bottom">
<a (click)="close()" class="uk-flex uk-flex-middle uk-flex-center">
<div class="uk-width-auto">
<icon name="west" ratio="1.3"
[flex]="true"></icon>
</div>
<span class="uk-text-small">Plugin Options</span>
</a>
</div>
<!--<div class="uk-text-small">
Enable
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].show"
type="boolean" field="cardInfoArray" (editClicked)="pluginEditEvent = $event"
(changed)="cardShowChanged(selectedIndex,$event)">
</plugin-field-edit>
</div>-->
<div class="uk-margin-top">
<plugin-field-edit [value]="pluginObject.cardInfoArray[selectedIndex].title"
type="text" field="title"
(changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit>
</div>
<div class="uk-margin-top">
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].description"
type="textarea" field="description"
(changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit>
</div>
<hr class="uk-margin-left">
<div class="uk-margin-top" title="Use material icons to update the card icon">
<div class="uk-width-1-1 uk-text-right">
<a href="https://fonts.google.com/icons" target="_blank" class="uk-text-xsmall uk-text-right custom-external">More options</a>
</div>
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].icon"
type="text" field="icon" placeholder="Material icon"
(changed)="cardValueChanged(selectedIndex, $event)"></plugin-field-edit>
</div>
<ng-container *ngFor="let cardUrl of pluginObject.cardInfoArray[selectedIndex].urlsArray; let j = index ">
<div class=" uk-margin-top uk-text-meta uk-text-xsmall"> Link #{{j + 1}}</div>
<div class="uk-margin-small-top">
<plugin-field-edit [value]=" cardUrl.url"
type="text" field="url"
(changed)="cardUrlValueChanged(selectedIndex, j, $event)"></plugin-field-edit>
</div>
<div class="uk-margin-top">
<plugin-field-edit [value]=" cardUrl.linkText"
type="text" field="linkText" placeholder="Link text"
(changed)="cardUrlValueChanged(selectedIndex, j, $event)"></plugin-field-edit>
</div>
</ng-container>
</ng-container>
</div>
`,
})
export class PluginCardInfoFormComponent extends PluginBaseFormComponent<PluginCardInfo> {
selectedIndex = -1;
@Input() editSubmenuOpen;
constructor() {
super()
}
ngOnChanges(changes: SimpleChanges) {
if (this.editSubmenuOpen == false && this.selectedIndex > -1) {
this.close();
}
}
cardShowChanged(i, $event: PluginEditEvent) {
this.pluginObject.cardInfoArray[i].show = $event.value;
$event.value = this.pluginObject.cardInfoArray;
this.valuesChanged.emit({field: $event.field, value: $event.value, type: 'parent'})
}
cardValueChanged(i, $event: PluginEditEvent) {
this.pluginObject.cardInfoArray[i][$event.field] = $event.value;
$event.value = this.pluginObject.cardInfoArray
this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'})
}
cardUrlValueChanged(i, j, $event: PluginEditEvent) {
if (this.editTemplate) {
this.pluginObject.cardInfoArray[i].urlsArray[j][$event.field] = $event.value;
$event.value = this.pluginObject.cardInfoArray;
} else {
this.pluginObject.cardInfoArray[i].urlsArray[j][$event.field] = $event.value;
$event.value = this.pluginObject.cardInfoArray;
}
this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'})
}
edit(i) {
this.selectedIndex = i;
this.toggleSubMenu(true);
}
close() {
this.selectedIndex = -1;
this.toggleSubMenu(false);
}
}

View File

@ -1,31 +0,0 @@
<div *ngIf="pluginObject" class="plugin-how-to-use uk-container uk-container-large uk-section">
<h3 class="uk-h2 uk-margin-large-bottom">
{{pluginObject.title}}
</h3>
<p *ngIf="pluginObject.description && pluginObject.description.length > 0"> {{pluginObject.description}}</p>
<div class="uk-padding" uk-height-match=".title">
<div class="uk-padding uk-grid uk-child-width-1-3@m uk-child-width-1-1 uk-grid-large" uk-grid
uk-height-match=".description">
<ng-container *ngFor="let card of pluginObject.cardInfoArray">
<ng-container *ngIf="card.show">
<div class="uk-flex uk-flex-column uk-flex-middle">
<div *ngIf="card.icon" class="uk-card uk-card-default uk-card-body">
<icon [name]="card.icon" [type]="'outlined'" [ratio]="3" [flex]="true"></icon>
</div>
<h5 class="title">
{{card.title}}
</h5>
<div class="uk-text-center uk-margin-bottom description">
{{card.description}}
</div>
<a *ngFor="let url of card.urlsArray" [href]="card.url" [class.uk-hidden]="!(url.url && url.url.length > 0)"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default"
[target]="url.target" [routerLink]="url.route?url.url:null" [class.uk-disabled] =previewInAdmin>
{{url.linkText}}
</a>
</div>
</ng-container>
</ng-container>
</div>
</div>
</div>

View File

@ -1,24 +0,0 @@
import {Component} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component";
export class PluginCardInfo extends PluginBaseInfo{
title:string ="Lorem ipsum";
description:string = "Lorem ipsum";
cardInfoArray: PluginInfoCards[] = [
{title: "Card 1", description: "Lorem ipsum", icon:"description", urlsArray:[ new PluginURL("https://exapmle.com","View all")], show:true},
{title: "Card 2", description: "Lorem ipsum", icon:"description", urlsArray:[ new PluginURL("https://exapmle.com","")/*, new PluginURL("","Guide for the managers")*/], show:true},
{title: "Card 3", description: "Lorem ipsum", icon:"description", urlsArray:[ new PluginURL("https://exapmle.com","View all")], show:true}
];
compare(oldObject){
oldObject = super.compare(oldObject)
return oldObject;
}
}
@Component({
selector: 'plugin-card-info',
templateUrl: 'plugin-card-info.component.html'
})
export class PluginCardInfoComponent extends PluginBaseComponent<PluginCardInfo>{
constructor() {
super()
}
}

View File

@ -1,25 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {PluginsService} from "../../../../services/plugins.service";
import {IconsModule} from "../../../../utils/icons/icons.module";
import {NumberRoundModule} from "../../../../utils/pipes/number-round.module";
import {IconsService} from "../../../../utils/icons/icons.service";
import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module";
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
import {PluginCardInfoComponent} from "./plugin-card-info.component";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule
],
providers:[PluginsService],
declarations: [PluginCardInfoComponent],
exports: [PluginCardInfoComponent]
})
export class PluginCardInfoModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([])
}
}

View File

@ -1,18 +0,0 @@
<div class="plugin-discover-by-subcommunity uk-container uk-container-large uk-section">
<h3 class="uk-text-center uk-margin-large-bottom">
{{pluginObject.title}}
</h3>
<ul *ngIf="subcommunities" class="uk-subnav uk-subnav-pill uk-flex uk-flex-center">
<li *ngFor="let item of subcommunities.slice(0,15)" class="uk-margin-small-bottom">
<a [routerLink]="properties.searchLinkToAdvancedResults" [queryParams]="{f0:'conceptname', fv0:item.label}" [class.uk-disabled] =previewInAdmin>
<!--{{item.category}} : {{item.subCommunityId}} - --> {{item.label}}
</a>
</li>
</ul>
<div *ngIf="subcommunities && subcommunities.length == 0" class="uk-text-muted uk-text-center">
No subcommunities available
</div>
<div *ngIf="!community && !subcommunities" class="uk-text-muted uk-text-center">
No community info available
</div>
</div>

View File

@ -1,31 +0,0 @@
import {Component} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component";
import {HttpClient} from "@angular/common/http";
import {CommunityService} from "../../../../connect/community/community.service";
export class PluginDiscoverBySubcommunity extends PluginBaseInfo{
title:string ="Discover content by sub-community";
}
@Component({
selector: 'plugin-discover-by-subcommunity',
templateUrl: 'plugin-discover-by-subcommunity.component.html'
})
export class PluginDiscoverBySubcommunityComponent extends PluginBaseComponent<PluginDiscoverBySubcommunity>{
subcommunities = null;
community;
constructor(http:HttpClient, private communityService: CommunityService) {
super()
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(
community => {
this.community = community;
if(community) {
this.subscriptions.push(http.get(this.properties.communityAPI + community.communityId
+ "/subcommunities?all=false").subscribe(res => {
console.log(res)
this.subcommunities = res ? res : [] /* = res.splice(0,15)*/;
}));
}
}));
}
}

View File

@ -1,21 +0,0 @@
import {Component} from '@angular/core';
import {PluginDiscoverBySubcommunity} from "./plugin-discover-by-subcommunity.component";
import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component";
@Component({
selector: 'plugin-discover-by-subcommunity-form',
template: `
<div *ngIf="pluginObject" class="uk-padding-xsmall">
<plugin-field-edit [value]="pluginObject.title"
type="text" field="title" (changed)="valueChanged($event)" ></plugin-field-edit>
</div>
`,
})
export class PluginDiscoverBySubcommunityFormComponent extends PluginBaseFormComponent<PluginDiscoverBySubcommunity> {
constructor() {
super()
}
}

View File

@ -1,25 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {PluginsService} from "../../../../services/plugins.service";
import {IconsModule} from "../../../../utils/icons/icons.module";
import {NumberRoundModule} from "../../../../utils/pipes/number-round.module";
import {IconsService} from "../../../../utils/icons/icons.service";
import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module";
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
import {PluginDiscoverBySubcommunityComponent} from './plugin-discover-by-subcommunity.component';
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule
],
providers:[PluginsService],
declarations: [PluginDiscoverBySubcommunityComponent],
exports: [PluginDiscoverBySubcommunityComponent]
})
export class PluginDiscoverBySubcommunityModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([])
}
}

View File

@ -1,37 +0,0 @@
<div class="plugin-featured-datasets uk-container uk-container-large uk-section">
<div class="uk-flex uk-flex-middle uk-flex-between ">
<h3 class="uk-margin-remove">
{{pluginObject.title}}
</h3>
<!-- <a [routerLink]="properties.searchLinkToAdvancedResults"
[queryParams]="{f0:'categoryid', fv0: 'enermaps::selection'}"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default">
Browse all
</a>-->
</div>
<div>
<div class="uk-margin-top uk-margin-medium-bottom uk-text-meta">
<div>{{pluginObject.textLine1}}</div>
<div>
{{pluginObject.textLine2}}
</div>
</div>
<div *ngIf="results" class=" uk-card uk-card-default uk-padding-xsmall">
<div>
<paging-no-load [totalResults]="results.length" [currentPage]="page" (pageChange)="page = $event.value"
[size]="size"></paging-no-load>
</div>
<div class="uk-margin-top">
<ng-container *ngFor="let result of results.slice((page-1)*slideItems,(page)*slideItems)">
<result-preview [properties]="properties" [showOrganizations]="true"
[showSubjects]="true" [result]="result" [showEnermaps]="true"
[isCard]="true" [showEntityActions]="false" [class.uk-disabled] =previewInAdmin>
</result-preview>
</ng-container>
</div>
</div>
</div>
</div>

View File

@ -1,71 +0,0 @@
import {Component, SimpleChanges} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component";
import {FetchResearchResults} from "../../../../utils/fetchEntitiesClasses/fetchResearchResults.class";
import {SearchResearchResultsService} from "../../../../services/searchResearchResults.service";
import {properties} from "../../../../../../environments/environment";
import {ResultPreview} from "../../../../utils/result-preview/result-preview";
export class PluginFeaturedDatasets extends PluginBaseInfo{
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;
slides = 1;
slideItems = 3;
totalNum = null;
results: ResultPreview[] = null;
constructor(private _searchResearchResultsService: SearchResearchResultsService) {
super()
// this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService);
// this.fetchFeaturedDatasets.searchUtils.size = this.size;
// this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", "enermaps", 1, 50, this.properties, "enermaps::selection");
this.subscriptions.push(this._searchResearchResultsService.advancedSearchResults("dataset", null, 1, 50, null, properties, "&type=results&fq=communityid=enermaps&fq=categoryid=" + encodeURIComponent("enermaps::selection")).subscribe(
data => {
console.log(data);
this.totalNum = data[0];
this.results = data[1].map( res => {
let resultPreview = ResultPreview.searchResultConvert(res, 'dataset')
resultPreview.hostedBy_collectedFrom = null;
resultPreview.measure = null;
return resultPreview
}) ;
console.log(this.totalNum = data[0], this.results);
if(this.results && this.results.length>0) {
this.calculatePages();
}
},
err => {
}
));
}
/* ngOnChanges(changes: SimpleChanges) {
if(this.results) {
this.calculatePages();
}
}*/
calculatePages(){
this.slides = 1;
if (this.results.length > this.slideItems) {
this.slides = parseInt('' + (this.results.length / this.slideItems));
if(this.slides< (this.results.length / this.slideItems)){
this.slides++;
}
}
}
}

View File

@ -1,37 +0,0 @@
import {Component} from '@angular/core';
import {OpenaireEntities} from "../../../../utils/properties/searchFields";
import {PluginFeaturedDatasets} from "./plugin-featured-datasets.component";
import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component";
@Component({
selector: 'plugin-featured-datasets-form',
template: `
<div *ngIf="pluginObject" class="uk-padding-xsmall">
<div class="uk-margin-bottom">
<plugin-field-edit [value]="pluginObject.title"
type="text" field="title" (changed)="valueChanged($event)"></plugin-field-edit>
</div>
<div class="uk-margin-bottom">
<plugin-field-edit [value]="pluginObject.textLine1"
type="text" field="textLine1" (changed)="valueChanged($event)"></plugin-field-edit>
</div>
<div class="uk-margin-bottom">
<plugin-field-edit [value]="pluginObject.textLine2"
type="text" field="textLine2" (changed)="valueChanged($event)"></plugin-field-edit>
</div>
</div>
`,
})
export class PluginFeaturedDatasetsFormComponent extends PluginBaseFormComponent<PluginFeaturedDatasets> {
selectedIndex = null;
openaireEntities = OpenaireEntities;
constructor() {
super()
}
}

View File

@ -1,29 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {PluginsService} from "../../../../services/plugins.service";
import {IconsModule} from "../../../../utils/icons/icons.module";
import {NumberRoundModule} from "../../../../utils/pipes/number-round.module";
import {IconsService} from "../../../../utils/icons/icons.service";
import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module";
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
import {PluginFeaturedDatasetsComponent} from './plugin-featured-datasets.component';
import {NoLoadPaging} from "../../../../searchPages/searchUtils/no-load-paging.module";
import {SearchResultsModule} from "../../../../searchPages/searchUtils/searchResults.module";
import {ResultPreviewModule} from "../../../../utils/result-preview/result-preview.module";
import {PagingModule} from "../../../../utils/paging.module";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, ResultPreviewModule, PagingModule
],
providers:[PluginsService],
declarations: [PluginFeaturedDatasetsComponent],
exports: [PluginFeaturedDatasetsComponent]
})
export class PluginFeaturedDatasetsModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([])
}
}

View File

@ -1,229 +0,0 @@
<div *ngIf="!community " class="uk-text-meta uk-text-center">
No community info available
</div>
<div class="uk-section uk-container" *ngIf="community ">
<div class="uk-grid uk-child-width-1-2@m uk-child-width-1-1@s ">
<div *ngIf="portal && community" class="">
<div *ngIf="pluginObject.showShortTitle"
class="uk-text-primary">
{{community.displayShortTitle}}
</div>
<h1 *ngIf="pluginObject.showTitle" class=" uk-h2 uk-margin-remove">
{{community.displayTitle}}
</h1>
<div *ngIf="pluginObject.description" [innerHTML]="community.description"></div>
<div *ngIf="pluginObject.searchbar && isRouteEnabled(searchLinkToResults)" [class.uk-invisible]="disableSelect"
class="uk-margin-medium-top">
<advanced-search-input #advanced (searchEmitter)="goTo(true)">
<entities-selection class="uk-width-1-3" [simpleView]="true" currentEntity="result"
[selectedEntity]="selectedEntity"
(selectionChange)="entityChanged($event);advanced.focusNext(input, $event)"
(disableSelectEmitter)="disableSelectChange($event)"
[onChangeNavigate]="false"></entities-selection>
<div input #input class="uk-width-expand" placeholder="Scholarly works" [searchable]="true"
[hint]="'Search in OpenAIRE'" [(value)]="keyword"></div>
</advanced-search-input>
</div>
<div
*ngIf="(pluginObject.fos && isRouteEnabled('/fields-of-science')) || (pluginObject.sdgs && isRouteEnabled('/sdgs'))"
class="uk-padding-small uk-margin-small-top">
<div class="uk-text-meta">
Try browsing by:
</div>
<div class="link-actions uk-flex uk-flex-column uk-flex-top uk-margin-small-top">
<a *ngIf="pluginObject.sdgs && isRouteEnabled('/sdgs')" [class.uk-disabled] =previewInAdmin
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-margin-small-bottom"
routerLinkActive="router-link-active" routerLink="/sdgs">
<span class="uk-flex uk-flex-middle">
<img src="assets/common-assets/sdg/sdg-dot-img.svg" alt="SDGs logo" loading="lazy" width="17px"
height="17px">
<span class="uk-margin-small-left">Sustainable Development Goals (SDG<span
class="uk-text-lowercase">s</span>)</span>
</span>
</a>
<a *ngIf="pluginObject.fos&& isRouteEnabled('/fields-of-science') " [class.uk-disabled] =previewInAdmin
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
routerLinkActive="router-link-active" routerLink="/fields-of-science">
<span class="uk-flex uk-flex-middle">
<img src="assets/common-assets/fos/fos-icon.svg" alt="FOS logo" loading="lazy" width="17px"
height="8px">
<span class="uk-margin-small-left">Fields of Science (FoS)</span>
</span>
</a>
</div>
</div>
</div>
<div>
<div class="heroBackground generalSearchForm uk-border-rounded uk-padding uk-margin-medium-bottom"
[class.uk-light]="!this.fontsDarkMode"
[style]="style">
<div class="plugin-content">
<div class="uk-text-lead uk-text-large uk-text-bold uk-margin-bottom">
{{ pluginObject.title}}
</div>
<ng-container *ngIf="community">
<div *ngIf="isRouteEnabled('/curators') && isVisible('curators')"
class="uk-text-small uk-margin-xsmall-bottom" [class.uk-disabled] =previewInAdmin>
<curators [longView]="false"></curators>
</div>
<div *ngIf="community.date && isVisible('date')" class="uk-text-small">
<span>Created: </span> {{community.date | date:'dd-MMM-yyyy'}}
</div>
<div class="uk-grid uk-grid-large uk-grid-stack uk-margin-top" uk-grid uk-height-match=".info-number">
<div>
<div *ngIf="projectTotal && projectTotal > 0 && isEntityEnabled('project')
&& isRouteEnabled(searchLinkToProjects) && isVisible('projects')"
class="uk-flex uk-flex-column uk-margin-bottom info-number">
<a class="uk-h5 uk-margin-remove" [queryParams]=params
routerLinkActive="router-link-active"
[routerLink]="searchLinkToProjects" [class.uk-disabled] =previewInAdmin>
{{projectTotal|number}}
</a>
<span class="uk-flex uk-flex-middle uk-text-small">
Projects
<a *ngIf="projectsCalculated && (projectTotal && projectTotal > 0 && isEntityEnabled('project') && isRouteEnabled(searchLinkToProjects))"
[title]="buildProjectsTooltip()"
[attr.uk-tooltip]="'pos: bottom-right; delay: 10;'"
class="uk-link-reset uk-margin-xsmall-left" [class.uk-disabled] =previewInAdmin>
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true"
[customClass]="'uk-text-meta'"></icon>
</a>
</span>
</div>
<div *ngIf="contentProviderTotal && contentProviderTotal > 0 && isEntityEnabled('datasource') &&
isRouteEnabled(searchLinkToDataProviders) && isVisible('datasources')"
class="uk-flex uk-flex-column info-number">
<a class="uk-h5 uk-margin-remove" [queryParams]=params
routerLinkActive="router-link-active"
[routerLink]="searchLinkToDataProviders" [class.uk-disabled] =previewInAdmin>
{{contentProviderTotal|number}}
</a>
<span class="uk-flex uk-flex-middle uk-text-small">
{{openaireEntities.DATASOURCES}}
<a *ngIf="contentProvidersCalculated && (contentProviderTotal && contentProviderTotal > 0 && isEntityEnabled('datasource') && isRouteEnabled(searchLinkToDataProviders))"
[title]="buildContentProvidersTooltip()"
[attr.uk-tooltip]="'pos: bottom-right; delay: 10;'"
class="uk-link-reset uk-margin-xsmall-left" [class.uk-disabled] =previewInAdmin>
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true"
[customClass]="'uk-text-meta'"></icon>
</a>
</span>
</div>
</div>
<div>
<div *ngIf="(zenodoCommunityIdS.length + ((masterZenodoCommunity) ? 1 : 0) > 0) && isRouteEnabled(shareInZenodoPage)
&& isVisible('communities')"
class="uk-flex uk-flex-column uk-margin-bottom info-number">
<a class="uk-h5 uk-margin-remove" [queryParams]=params
routerLinkActive="router-link-active" [routerLink]="shareInZenodoPage" [class.uk-disabled] =previewInAdmin>
{{zenodoCommunityIdS.length + ((masterZenodoCommunity) ? 1 : 0)}}
</a>
<span class="uk-flex uk-flex-middle uk-text-small">
Linked Zenodo Communities
<a [title]="buildZenodoCommunitiesTooltip()"
[attr.uk-tooltip]="'pos: bottom-right; delay: 10;'"
class="uk-link-reset uk-margin-xsmall-left" [class.uk-disabled] =previewInAdmin>
<icon [name]="'help_outline'" [type]="'outlined'" [ratio]="0.8" [flex]="true"
[customClass]="'uk-text-meta'"></icon>
</a>
</span>
</div>
<div
*ngIf="isRouteEnabled('/subjects') && displayedAllSubjects && displayedAllSubjects.length > 0 && isVisible('subjects')"
class="uk-flex uk-flex-column uk-margin-bottom info-number">
<a class="uk-h5 uk-margin-remove"
routerLinkActive="router-link-active" [routerLink]="'/subjects'" [class.uk-disabled] =previewInAdmin>
{{displayedAllSubjects.length}}
</a>
<span class="uk-text-small">
Subjects
</span>
</div>
</div>
</div>
</ng-container>
</div>
</div>
<div *ngIf="community" class="plugin2 uk-flex uk-flex-middle uk-flex-wrap" style="grid-gap: 30px;">
<div class="uk-flex uk-flex-middle" *ngIf="resultCounts && resultCounts.publications > 0 && isEntityEnabled('publication')
&& isRouteEnabled(searchLinkToResults) &&
isVisible('publications')">
<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-disabled] =previewInAdmin
class="uk-link-reset uk-flex uk-flex-column">
<span class="uk-text-xsmall">
{{openaireEntities.PUBLICATIONS}}
</span>
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove uk-button-link"
[innerHTML]="resultCounts.publications | numberRound: 1:1">
</span>
</a>
</div>
<div class="uk-flex uk-flex-middle" *ngIf="resultCounts && resultCounts.datasets > 0 && isEntityEnabled('dataset')
&& isRouteEnabled(searchLinkToResults) &&
isVisible('datasets')">
<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" [class.uk-disabled] =previewInAdmin>
<span class="uk-text-xsmall">
{{openaireEntities.DATASETS}}
</span>
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove uk-button-link"
[innerHTML]="resultCounts.datasets | numberRound: 1:1">
</span>
</a>
</div>
<!--<div class="uk-flex uk-flex-middle" *ngIf="resultCounts && resultCounts.datasets > 0 && isEntityEnabled('dataset')
&& isRouteEnabled(searchLinkToResults) &&
isVisible('datasets')">
<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="resultCounts" class="uk-h6 uk-margin-remove uk-button-link" [innerHTML]="resultCounts.datasets | numberRound: 1:1">
</span>
</a>
</div>-->
<div class="uk-flex uk-flex-middle" *ngIf="resultCounts && resultCounts.software > 0 && isEntityEnabled('software')
&& isRouteEnabled(searchLinkToResults) &&
isVisible('software')">
<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" [class.uk-disabled] =previewInAdmin>
<span class="uk-text-xsmall">
{{openaireEntities.SOFTWARE}}
</span>
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove uk-button-link"
[innerHTML]="resultCounts.software | numberRound: 1:1">
</span>
</a>
</div>
<div class="uk-flex uk-flex-middle" *ngIf="resultCounts && resultCounts.other > 0 && isEntityEnabled('orp')
&& isRouteEnabled(searchLinkToResults) &&
isVisible('other')">
<icon [name]="'apps'" [type]="'outlined'" [ratio]="2" [flex]="true"
[customClass]="'uk-margin-small-right uk-text-secondary'"></icon>
<a [queryParams]="getParamsForSearchLink('other')" [routerLink]="properties.searchLinkToAdvancedResults"
class="uk-link-reset uk-flex uk-flex-column" [class.uk-disabled] =previewInAdmin>
<span class="uk-text-xsmall">
{{openaireEntities.OTHER}}
</span>
<span *ngIf="resultCounts" class="uk-h6 uk-margin-remove uk-button-link"
[innerHTML]="resultCounts.other | numberRound: 1:1">
</span>
</a>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,16 +0,0 @@
.plugin-gateway-information {
overflow: hidden;
position: relative;
.plugin-background {
object-fit: cover;
opacity: 0.3;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.plugin-content {
position: relative;
}
}

View File

@ -1,275 +0,0 @@
import {ChangeDetectorRef, Component} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component";
import {ConfigurationService} from '../../../../../openaireLibrary/utils/configuration/configuration.service';
import {CommunityService} from '../../../../../openaireLibrary/connect/community/community.service';
import {SearchCommunityProjectsService} from '../../../../../openaireLibrary/connect/projects/searchProjects.service';
import {SearchCommunityDataprovidersService} from '../../../../../openaireLibrary/connect/contentProviders/searchDataproviders.service';
import {ZenodoCommunitiesService} from '../../../../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
import {User} from '../../../../../openaireLibrary/login/utils/helper.class';
import {RouterHelper} from "../../../../utils/routerHelper.class";
import {OpenaireEntities} from "../../../../utils/properties/searchFields";
import {HttpClient} from "@angular/common/http";
import {Filter} from "../../../../searchPages/searchUtils/searchHelperClasses.class";
import {Router} from "@angular/router";
import {SearchResearchResultsService} from "../../../../services/searchResearchResults.service";
import {CustomizationService} from "../../../../services/customization.service";
export class PluginGatewayInformation extends PluginBaseInfo{
showTitle:boolean = true;
showShortTitle:boolean = false;
description:boolean = false;
sdgs:boolean = false;
fos:boolean = false;
searchbar:boolean = false;
title:string ="Gateway Information";
curators:boolean = true;
date:boolean = true;
communities:boolean = true;
projects:boolean = true;
organizations:boolean = true;
datasources:boolean = true;
subjects:boolean = true;
publications:boolean = true;
datasets:boolean = true;
software:boolean = true;
other:boolean = true;
compare(oldObject): any {
let newObj= super.compare(oldObject);
return newObj;
}
}
@Component({
selector: 'plugin-gateway-information',
templateUrl: 'plugin-gateway-information.component.html',
styleUrls: ['plugin-gateway-information.component.less']
})
export class PluginGatewayInformationComponent extends PluginBaseComponent<PluginGatewayInformation>{
default = new PluginGatewayInformation();
community = null;
portal = null;
params: any = {};
projectTotal = null;
contentProviderTotal = null;
projectsCalculated: boolean = false;
contentProvidersCalculated: boolean = false;
zenodoCommunityIdS = [];
masterZenodoCommunity = null;
searchLinkToProjects: string = null;
searchLinkToDataProviders: string = null;
shareInZenodoPage: string = null;
displayedAllSubjects = [];
displayedSubjects = [];
displayedSdg = [];
displayedFos = [];
resultCounts = null;
private user: User;
searchLinkToResults: string = null;
public routerHelper: RouterHelper = new RouterHelper();
openaireEntities= OpenaireEntities;
selectedEntity = 'result';
selectedEntitySimpleUrl;
selectedEntityAdvancedUrl;
resultTypes: Filter = {
values: [],
filterId: "type",
countSelectedValues: 0,
filterType: 'checkbox',
originalFilterId: "",
valueIsExact: true,
title: "Type",
filterOperator: "or"
};
keyword: string = "";
// customFilter;
placeholderText = "Search by title, author, abstract, DOI, orcid... ";
resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = {
filter: null,
selected: true,
filterId: "resultbestaccessright",
value: "Open Access"
};
disableSelect: boolean = true;
constructor(private http:HttpClient,
private config: ConfigurationService,
private communityService: CommunityService,
private searchCommunityProjectsService: SearchCommunityProjectsService,
private searchCommunityDataprovidersService: SearchCommunityDataprovidersService,
private zenodoCommunitiesService: ZenodoCommunitiesService, private _router: Router,
private _searchResearchResultsService: SearchResearchResultsService,
private cdr: ChangeDetectorRef, protected layoutService: CustomizationService) {
super();
this.searchLinkToResults = this.properties.searchLinkToResults;
this.searchLinkToProjects = this.properties.searchLinkToProjects;
this.searchLinkToDataProviders = this.properties.searchLinkToDataProviders;
this.shareInZenodoPage = this.properties.shareInZenodoPage;
this.subscriptions.push(this.config.portalAsObservable.subscribe(
res => {
this.portal = res;
},
error => {
console.log(error);
}
));
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(
community => {
this.community = community;
if (community) {
this.displayedSubjects = community.subjects;
this.displayedSdg = community.sdg;
this.displayedFos = community.fos;
this.displayedSubjects.forEach(element => {
this.displayedAllSubjects.push({value: element, type: 'resultsubject'});
});
this.displayedSdg.forEach(element => {
this.displayedAllSubjects.push({value: element, type: 'sdg'});
});
this.displayedFos.forEach(element => {
this.displayedAllSubjects.push({value: element, type: 'fos'});
});
if (this.properties.environment == "development") {
this.params = {communityId: community.communityId};
}
if (this.community.zenodoCommunity) {
this.subscriptions.push(this.zenodoCommunitiesService.getZenodoCommunityById(this.properties, this.community.zenodoCommunity).subscribe(
res => {
this.masterZenodoCommunity = res;
},
error => {
console.log(error);
}
));
}
this.zenodoCommunityIdS = this.community.otherZenodoCommunities;
// Double check below: is `this.community.communityId` correct? the other way was through @input communityID from ConnectHelper service - domain
this.subscriptions.push(this.searchCommunityProjectsService.countTotalProjects(this.properties, this.community.communityId).subscribe(
res => {
this.projectTotal = res;
},
error => {
console.log(error);
},
() => {
this.projectsCalculated = true;
}
));
// Double check below: is `this.community.communityId` correct? the other way was through @input communityID from ConnectHelper service - domain
this.subscriptions.push(this.searchCommunityDataprovidersService.countTotalDataproviders(this.properties, this.community.communityId).subscribe(
res => {
this.contentProviderTotal = res;
},
error => {
console.log(error);
},
() => {
this.contentProvidersCalculated = true;
}
));
this.subscriptions.push(this._searchResearchResultsService.countResults("communityid", this.community.communityId).subscribe(res => {
this.resultCounts = res;
}));
}
}
));
}
ngOnInit() {
if (this.community) {
this.getLayout(this.community.communityId);
}
}
isEntityEnabled(entity: string) {
return this.portal.entities.some(x => x['pid'] == entity && x['isEnabled'] === true);
}
isRouteEnabled(route: string) {
return this.portal && this.portal.pages.some(x => x['route'] == route && x['isEnabled'] === true);
}
buildProjectsTooltip(): string {
let tooltipContent: string = "<div>";
if (this.projectTotal != null && this.projectTotal > 0 && this.isEntityEnabled('project') && this.isRouteEnabled(this.searchLinkToProjects)) {
tooltipContent += "<span class='uk-text-bold'>Projects</span>";
}
tooltipContent += " have been selected as relevant for your community by the gateway curators.";
tooltipContent += "</div>";
return tooltipContent;
}
public buildContentProvidersTooltip(): string {
let tooltipContent: string = "<div>";
if (this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders)) {
tooltipContent += "<span class='uk-text-bold'>Data sources</span>";
}
tooltipContent += " have been selected as relevant for your community by the gateway curators.";
tooltipContent += "</div>";
return tooltipContent;
}
public buildZenodoCommunitiesTooltip(): string {
let tooltipContent: string = "<div>";
tooltipContent += "<span class='uk-text-bold'>Zenodo</span> is a catch-all repository for OpenAIRE.";
tooltipContent += "<div class='uk-margin-small-top'>A <span class='uk-text-bold'>Zenodo Community</span> is created and curated by Zenodo users.</div>";
tooltipContent += "</div>";
return tooltipContent;
}
public getParamsForSearchLink(type: string = "") {
if (type) {
return this.routerHelper.createQueryParams(['type', 'qf', 'sortBy'], [type, 'false', 'resultdateofacceptance,descending']);
} else {
return {};
}
}
entityChanged($event) {
this.selectedEntity = $event.entity;
this.selectedEntitySimpleUrl = $event.simpleUrl;
this.selectedEntityAdvancedUrl = $event.advancedUrl;
if (this.selectedEntity == 'result') {
this.placeholderText = "Search by title, author, abstract, DOI, orcid... ";
} else if (this.selectedEntity == 'project') {
this.placeholderText = "Search by project title, grant id, funder...";
} else if (this.selectedEntity == 'dataprovider') {
this.placeholderText = "Search by name...";
} else {
this.placeholderText = "Search community content";
}
}
goTo(simple: boolean) {
let url = (simple) ? this.selectedEntitySimpleUrl : this.selectedEntityAdvancedUrl;
let parameterNames = [];
let parameterValues = [];
if (this.keyword.length > 0) {
parameterNames.push("fv0");
parameterValues.push(this.keyword);
parameterNames.push("f0");
parameterValues.push("q");
}
this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)});
}
disableSelectChange(event: boolean) {
this.disableSelect = event;
this.cdr.detectChanges();
}
}

View File

@ -1,168 +0,0 @@
import {Component} from '@angular/core';
import {PluginGatewayInformation} from "./plugin-gateway-information.component";
import {OpenaireEntities} from "../../../../utils/properties/searchFields";
import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component";
@Component({
selector: 'plugin-gateway-information-form',
template: `
<div *ngIf="pluginObject" class="uk-padding-xsmall">
<plugin-field-edit [value]="pluginObject.title"
type="text" field="title" (changed)="valueChanged($event)"></plugin-field-edit>
<div class="uk-margin-top uk-text-meta uk-text-small uk-margin-small-bottom">
Show or hide the following information:
</div>
<div class="uk-margin-top uk-text-meta uk-text-xsmall ">
Community info
</div>
<div class="uk-grid uk-child-width-1-1 uk-text-small uk-hr ">
<div class="uk-margin-xsmall-bottom uk-margin-xsmall-top">
<plugin-field-edit [value]=" pluginObject.showTitle"
type="checkbox" field="showTitle" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit> Title
</div>
<div class="uk-margin-xsmall-bottom uk-margin-xsmall-top">
<plugin-field-edit [value]=" pluginObject.showShortTitle"
type="checkbox" field="showShortTitle" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit> Short title
</div>
<div class="uk-margin-xsmall-bottom uk-margin-xsmall-top">
<plugin-field-edit [value]=" pluginObject.description"
type="checkbox" field="description" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit> Description
</div>
<div class="uk-margin-xsmall-bottom uk-margin-xsmall-top">
<plugin-field-edit [value]=" pluginObject.curators"
type="checkbox" field="curators" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>Curated by
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.date"
type="checkbox" field="date" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit> Created
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.projects"
type="checkbox" field="projects" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
{{openaireEntities.PROJECTS}}
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.communities"
type="checkbox" field="communities" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
Linked Zenodo communities
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.datasources"
type="checkbox" field="datasources" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
{{openaireEntities.DATASOURCES}}
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.subjects"
type="checkbox" field="subjects" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
Subjects
</div>
<div class="uk-alert uk-alert-warning uk-text-small uk-padding-xsmall uk-margin-medium-left "> Manage community info <a routerLink="../../../info/profile" target="_blank">here</a>.</div>
<div class="uk-margin-top uk-text-meta uk-text-xsmall">
Pages & menus
</div>
<div class="uk-margin-xsmall-bottom uk-hr uk-margin-xsmall-top">
<plugin-field-edit [value]=" pluginObject.searchbar"
type="checkbox" field="searchbar" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
Search bar
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.fos"
type="checkbox" field="fos" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
Browse by FOS
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.sdgs"
type="checkbox" field="sdgs" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
Browse by SDGs
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.publications"
type="checkbox" field="publications" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
{{openaireEntities.PUBLICATIONS}}
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.datasets"
type="checkbox" field="datasets" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
{{openaireEntities.DATASETS}}
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.software"
type="checkbox" field="software" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
{{openaireEntities.SOFTWARE}}
</div>
<div class="uk-margin-xsmall-bottom">
<plugin-field-edit [value]=" pluginObject.other"
type="checkbox" field="other" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>
{{openaireEntities.OTHER}}
</div>
</div>
<div class="uk-alert uk-alert-warning uk-text-small uk-padding-xsmall"> If some information is enabled here,
but still not visible, please check related <a routerLink="../../entities" target="_blank">entity</a> or <a routerLink="../../pages" target="_blank">page</a>.
</div>
<div class="uk-alert uk-alert-warning uk-text-small uk-padding-xsmall">
Change the custom section background options <a routerLink="../../../customize-layout" target="_blank"> here.</a>
</div>
</div>
`,
})
export class PluginGatewayInformationFormComponent extends PluginBaseFormComponent<PluginGatewayInformation> {
openaireEntities= OpenaireEntities;
constructor() {
super()
}
}

View File

@ -1,37 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {PluginsService} from "../../../../services/plugins.service";
import {IconsModule} from "../../../../utils/icons/icons.module";
import {NumberRoundModule} from "../../../../utils/pipes/number-round.module";
import {IconsService} from "../../../../utils/icons/icons.service";
import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module";
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
import {PluginGatewayInformationComponent} from './plugin-gateway-information.component';
import {CuratorsModule} from '../../../../connect/components/curators/curators.module';
import {SearchCommunityProjectsService} from '../../../../../openaireLibrary/connect/projects/searchProjects.service';
import {SearchCommunityDataprovidersService} from '../../../../../openaireLibrary/connect/contentProviders/searchDataproviders.service';
import {ZenodoCommunitiesService} from '../../../../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
import {AdvancedSearchInputModule} from "../../../../sharedComponents/advanced-search-input/advanced-search-input.module";
import {EntitiesSelectionModule} from "../../../../searchPages/searchUtils/entitiesSelection.module";
import {QuickSelectionsModule} from "../../../../searchPages/searchUtils/quick-selections.module";
import {InputModule} from "../../../../sharedComponents/input/input.module";
import {CustomizationServiceModule} from "../../../../services/customizationService.module";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule,
CuratorsModule, AdvancedSearchInputModule, EntitiesSelectionModule, QuickSelectionsModule, InputModule, CustomizationServiceModule
],
providers: [
PluginsService, SearchCommunityProjectsService, SearchCommunityDataprovidersService, ZenodoCommunitiesService
],
declarations: [PluginGatewayInformationComponent],
exports: [PluginGatewayInformationComponent]
})
export class PluginGatewayInformationModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([])
}
}

View File

@ -1,28 +0,0 @@
import {Component} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo, PluginURL} from "../../utils/base-plugin.component";
export class HTMLSection extends PluginBaseInfo{
title:string ="Lorem ipsum"
html:string = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`;
fullWidth:boolean = true;
compare(oldObject): any {
let newObj= super.compare(oldObject);
return newObj;
}
}
@Component({
selector: 'plugin-html-section',
template: `
<div [class]="pluginObject.fullWidth?'':'uk-container uk-container-large'">
<h2>{{pluginObject.title}}</h2>
<div [innerHTML]="pluginObject.html">
</div>
</div>
`
})
export class PluginHtmlSectionComponent extends PluginBaseComponent<HTMLSection>{
constructor() {
super();
}
}

View File

@ -1,33 +0,0 @@
import {Component} from '@angular/core';
import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.form.component";
import {HTMLSection} from "./plugin-html-section.component";
@Component({
selector: 'plugin-html-section-form',
template: `
<div *ngIf="pluginObject" class="uk-padding-xsmall">
<plugin-field-edit [value]="pluginObject.title"
type="text" field="title" (changed)="valueChanged($event)"></plugin-field-edit>
<div class="uk-margin-top">
<plugin-field-edit [value]="pluginObject.html" [switchToHTMLEditor]="true"
type="textarea" field="html" (changed)="valueChanged($event)"></plugin-field-edit>
</div>
<div class="uk-margin-xsmall-bottom uk-margin-xsmall-top">
<plugin-field-edit [value]=" pluginObject.fullWidth"
type="checkbox" field="fullWidth" (editClicked)="pluginEditEvent = $event"
(changed)="valueChanged($event)">
</plugin-field-edit>Full width
</div>
</div>
`,
})
export class PluginHtmlSectionFormComponent extends PluginBaseFormComponent<HTMLSection> {
constructor() {
super()
}
}

View File

@ -1,22 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {PluginsService} from "../../../../services/plugins.service";
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
import {InputModule} from "../../../../sharedComponents/input/input.module";
import {PluginHtmlSectionComponent} from "./plugin-html-section.component";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, PluginFieldEditModule, InputModule
],
providers: [
PluginsService
],
declarations: [PluginHtmlSectionComponent],
exports: [PluginHtmlSectionComponent]
})
export class PluginHtmlSectionModule {
}

View File

@ -1,97 +0,0 @@
import {Component, SimpleChanges} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component";
import {HttpClient} from "@angular/common/http";
export class PluginOpenAIREProducts extends PluginBaseInfo{
title:string ="OpenAIRE services for your community";
serviceIdsArray = ["argos","zenodo","amnesia"];
compare(oldObject): any {
return super.compare(oldObject);
}
}
@Component({
selector: 'plugin-openaire-products',
template: `
<div *ngIf="pluginObject " class="uk-container uk-section">
<h3>{{pluginObject.title}} </h3>
<div *ngIf="services && servicesToShow" uk-slider class="uk-slider">
<ul *ngIf="slides" class="uk-slider-items" uk-height-match="target: .uk-card; row: false">
<li *ngFor="let slide of [].constructor(slides); let i=index" class="uk-width-1-1 uk-padding">
<div class="uk-grid uk-child-width-1-3@m uk-child-width-1-1" uk-grid uk-scrollspy="target: [uk-scrollspy-class]; cls: uk-animation-fade; repeat: true">
<div *ngFor="let service of servicesToShow.slice((i)*slideItems,(i+1)*slideItems)" uk-scrollspy-class>
<div class="uk-card uk-card-default ">
<div class="uk-card-media-top">
<img [src]="service.logo" width="100%" height="" alt="" class="uk-height-max-small">
</div>
<div class=" uk-height-max-large uk-padding-small">
<div class="uk-text-primary">{{service.name}}</div>
<div class="uk-h5 uk-margin-remove-vertical">{{service.tagline}}</div>
<div [innerHTML]="service.description" class="uk-text-truncate uk-text-small uk-text-meta"></div>
<a class="uk-link-text" [href]="service.webpage" target="_blank">Read more</a>
</div>
</div>
</div>
</div>
</li>
</ul>
<ul class="uk-slider-nav uk-dotnav uk-flex-center uk-margin-medium-top"></ul>
</div>
<div *ngIf="showErrorMessage" class="uk-text-muted uk-text-center">
No products info available
</div>
</div>
`,
})
export class PluginOpenaireProductsComponent extends PluginBaseComponent<PluginOpenAIREProducts>{
services = null;
excludedServiceIds = ["openaire_login","research_community_dashboard"]
servicesToShow = null;
slides = 1;
slideItems = 3;
api= "https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name";
showErrorMessage = false;
constructor(private http:HttpClient) {
super()
}
ngOnInit(): void {
super.ngOnInit();
if(!this.services) {
this.subscriptions.push(this.http.get( this.properties.cacheUrl + encodeURIComponent(this.api)).subscribe(res =>{
this.services = res["results"].map( x=> {
if(x.id.indexOf("openaire.")!=-1){
x.id = x.id.split("openaire.")[1]
}
return x;
});
this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1);
this.calculatePages();
}, error => {
this.showErrorMessage = true;
}))
}else{
this.calculatePages();
}
}
ngOnChanges(changes: SimpleChanges) {
if(this.services) {
this.calculatePages();
}
}
calculatePages(){
this.slides = 1;
this.servicesToShow = this.services.filter(x => this.pluginObject.serviceIdsArray.indexOf(x.id) != -1);
if (this.servicesToShow.length > this.slideItems) {
this.slides = parseInt('' + (this.servicesToShow.length / this.slideItems));
if(this.slides< (this.servicesToShow.length / this.slideItems)){
this.slides++;
}
}
}
}

View File

@ -1,70 +0,0 @@
import {Component} from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {PluginOpenAIREProducts} from "./plugin-openaire-products.component";
import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.form.component";
@Component({
selector: 'plugin-openaire-products-form',
template: `
<div *ngIf="pluginObject" class="uk-padding-xsmall">
<plugin-field-edit [value]="pluginObject.title"
type="text" field="title" (changed)="valueChanged($event)" ></plugin-field-edit>
<div class="uk-margin-medium-top uk-text-muted">
Select services:
</div>
<ng-container *ngFor="let service of services">
<div class=" uk-margin-xsmall-top">
<plugin-field-edit [value]="pluginObject.serviceIdsArray.indexOf(service.id)!=-1"
type="checkbox" field="sdgs" (editClicked)="pluginEditEvent = $event"
(changed)="serviceChanged(service.id,$event)">
</plugin-field-edit>
{{service.name}}
</div>
</ng-container>
<div *ngIf="showErrorMessage" class="uk-text-muted uk-text-center">
No products info available
</div>
</div>
`,
})
//TODO make it extend PluginOpenaireProductsComponent (to avoid call in constructor..)
export class PluginOpenaireProductsFormComponent extends PluginBaseFormComponent<PluginOpenAIREProducts>{
default = new PluginOpenAIREProducts();
services = [];
excludedServiceIds = ["openaire_login","research_community_dashboard"]
api= "https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name";
showErrorMessage = false;
constructor(http:HttpClient) {
super()
this.subscriptions.push(http.get( this.properties.cacheUrl + encodeURIComponent(this.api)).subscribe(res =>{
this.services = res["results"].map( x=> {
x.id = x.id.split("openaire.")[1]
return x;
});
this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1);
}, error => {
this.showErrorMessage = true;
}))
}
serviceChanged(id,$event:PluginEditEvent){
let index = this.pluginObject.serviceIdsArray.indexOf(id);
if(index !=-1){
this.pluginObject.serviceIdsArray.splice(index,1);
}else{
this.pluginObject.serviceIdsArray.push(id);
}
$event.value =this.pluginObject.serviceIdsArray;
this.valuesChanged.emit({field:$event.field, value: $event.value, type: 'parent'})
}
}

View File

@ -1,25 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {PluginsService} from "../../../../services/plugins.service";
import {IconsModule} from "../../../../utils/icons/icons.module";
import {NumberRoundModule} from "../../../../utils/pipes/number-round.module";
import {IconsService} from "../../../../utils/icons/icons.service";
import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module";
import {PluginOpenaireProductsComponent} from "./plugin-openaire-products.component";
import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule
],
providers:[PluginsService],
declarations: [PluginOpenaireProductsComponent],
exports: [PluginOpenaireProductsComponent]
})
export class PluginOpenaireProductsModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([])
}
}

View File

@ -1,7 +0,0 @@
<div *ngIf=" portal && isRouteEnabled('/organizations')" class="plugin-featured-datasets uk-container uk-container-large uk-section">
<affiliations [longView]="false" [getAffiliationsFromAPI]="true" [communityFirstPage]="true" [class.uk-disabled] =previewInAdmin></affiliations>
</div>
<div *ngIf="!portal " class="uk-text-muted uk-text-center">
No community info available
</div>

View File

@ -1,34 +0,0 @@
import {Component} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component";
import {ConfigurationService} from "../../../../utils/configuration/configuration.service";
export class PluginOrganizations extends PluginBaseInfo{
title: string = "Supporting Organizations";
}
@Component({
selector: 'plugin-organizations',
templateUrl: 'plugin-organizations.component.html'
})
export class PluginOrganizationsComponent extends PluginBaseComponent<PluginOrganizations> {
portal;
constructor(private config: ConfigurationService) {
super()
this.subscriptions.push(this.config.portalAsObservable.subscribe(
res => {
this.portal = res;
},
error => {
console.log(error);
}
));
}
isRouteEnabled(route: string) {
return this.portal && this.portal.pages.some(x => x['route'] == route && x['isEnabled'] === true);
}
}

View File

@ -1,24 +0,0 @@
import {Component} from '@angular/core';
import {PluginOrganizations} from "./plugin-organizations.component";
import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component";
@Component({
selector: 'plugin-organizations-form',
template: `
<div *ngIf="pluginObject" class="uk-padding-xsmall">
<plugin-field-edit [value]="pluginObject.title"
type="text" field="title" (changed)="valueChanged($event)"></plugin-field-edit>
<div class="uk-alert uk-alert-warning uk-text-small"> Manage community organizations <a routerLink="../../info/organizations" target="_blank">here</a>.</div>
</div>
`,
})
export class PluginOrganizationsFormComponent extends PluginBaseFormComponent<PluginOrganizations> {
constructor() {
super()
}
}

View File

@ -1,22 +0,0 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {PluginsService} from "../../../../services/plugins.service";
import {IconsService} from "../../../../utils/icons/icons.service";
import {PluginOrganizationsComponent} from './plugin-organizations.component';
import {AffiliationsModule} from "../../../../connect/affiliations/affiliations.module";
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule, AffiliationsModule,
],
providers:[PluginsService],
declarations: [PluginOrganizationsComponent],
exports: [PluginOrganizationsComponent]
})
export class PluginOrganizationsModule {
constructor(private iconsService: IconsService) {
this.iconsService.registerIcons([])
}
}

View File

@ -1,34 +0,0 @@
<div class="uk-background-muted">
<div class="uk-position-relative">
<div class="uk-section uk-section-large">
<div class="uk-container">
<div class="uk-grid uk-child-width-1-2@m" uk-grid>
<div>
<div style="max-width: 550px;">
<h2>{{pluginObject.title}}</h2>
<div class="" [innerHTML]="pluginObject.paragraph1">
</div>
</div>
</div>
<div></div>
<img class="uk-visible@m uk-height-1-1 uk-position-top-right"
[src]="pluginObject.image" alt="Graph nodes" loading="lazy">
</div>
</div>
</div>
</div>
<div class="uk-section uk-padding-remove-top">
<div class="uk-container">
<div class="uk-width-1-2@m uk-margin-auto uk-margin-small-top uk-text-center" style="max-width: 600px;">
<div [innerHTML]="pluginObject.paragraph2"></div>
<div class="uk-margin-top">
<a [href]="pluginObject.url.url" [target]="pluginObject.url.target"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
{{pluginObject.url.linkText}}
</a>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,24 +0,0 @@
import {Component} from '@angular/core';
import {PluginBaseComponent, PluginBaseInfo, PluginURL} from "../../utils/base-plugin.component";
export class ParagraphInfo extends PluginBaseInfo{
title:string ="Lorem ipsum"
paragraph1:string = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.`;
paragraph2:string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
url:PluginURL= new PluginURL("https://example.com","Lorem ipsum")
image:string = "https://admin.connect.openaire.eu/assets/common-assets/placeholder.png"
compare(oldObject): any {
let newObj= super.compare(oldObject);
return newObj;
}
}
@Component({
selector: 'plugin-graph-info',
templateUrl: 'plugin-graph-info.component.html'
})
export class PluginGraphInfoComponent extends PluginBaseComponent<ParagraphInfo>{
constructor() {
super();
}
}

Some files were not shown because too many files have changed in this diff Show More