Merge branch 'new-api' into develop

This commit is contained in:
argirok 2023-10-06 17:51:55 +03:00
commit 096d601d29
16 changed files with 112 additions and 173 deletions

View File

@ -458,7 +458,7 @@ export class AppComponent implements OnInit, OnDestroy {
this.communityId = (this.community && ConnectHelper.isPrivate(this.community, this.user))?this.community.communityId:null; this.communityId = (this.community && ConnectHelper.isPrivate(this.community, this.user))?this.community.communityId:null;
this.configurationService.initPortal(this.properties, "connect"); this.configurationService.initPortal(this.properties, "connect");
this.buildConnectMenu(true); this.buildConnectMenu(true);
if (this.community && this.community.status == "manager") { if (this.community && this.community.isRestricted()) {
if (!this.user) { if (!this.user) {
if (typeof location !== 'undefined' && location.pathname.indexOf("user-info") == -1) { if (typeof location !== 'undefined' && location.pathname.indexOf("user-info") == -1) {
this.router.navigate(['/user-info'], { this.router.navigate(['/user-info'], {
@ -473,7 +473,7 @@ export class AppComponent implements OnInit, OnDestroy {
this.router.navigate(['/'], {queryParamsHandling: "merge"}); this.router.navigate(['/'], {queryParamsHandling: "merge"});
} }
} }
} else if (this.community && this.community.status == "hidden") { } else if (this.community && (this.community.isPrivate())) {
this.router.navigate([this.properties.errorLink]); this.router.navigate([this.properties.errorLink]);
} else { } else {
this.router.navigate(['/'], this.community && this.community.status ? {queryParamsHandling: "merge"} : {}); this.router.navigate(['/'], this.community && this.community.status ? {queryParamsHandling: "merge"} : {});

View File

@ -12,12 +12,12 @@
class="uk-text-background uk-text-small uk-position-top-left uk-padding-small uk-text-uppercase uk-text-bold"> class="uk-text-background uk-text-small uk-position-top-left uk-padding-small uk-text-uppercase uk-text-bold">
Member Member
</div> </div>
<div *ngIf="community.status === 'manager'" <div *ngIf="community.isRestricted()"
class="uk-position-top-right uk-margin-small-top uk-margin-small-right uk-flex uk-flex-column uk-flex-middle"> class="uk-position-top-right uk-margin-small-top uk-margin-small-right uk-flex uk-flex-column uk-flex-middle">
<icon [name]="visibilityIcon.get('RESTRICTED')" ratio="1.2" [flex]="true"></icon> <icon [name]="visibilityIcon.get('RESTRICTED')" ratio="1.2" [flex]="true"></icon>
<span class="uk-text-small uk-text-capitalize">restricted</span> <span class="uk-text-small uk-text-capitalize">restricted</span>
</div> </div>
<div *ngIf="community.status === 'hidden'" <div *ngIf="community.isPrivate()"
class="uk-position-top-right uk-margin-small-top uk-margin-small-right uk-flex uk-flex-column uk-flex-middle"> class="uk-position-top-right uk-margin-small-top uk-margin-small-right uk-flex uk-flex-column uk-flex-middle">
<icon [name]="visibilityIcon.get('PRIVATE')" ratio="1.2" [flex]="true"></icon> <icon [name]="visibilityIcon.get('PRIVATE')" ratio="1.2" [flex]="true"></icon>
<span class="uk-text-small uk-text-capitalize">private</span> <span class="uk-text-small uk-text-capitalize">private</span>

View File

@ -175,7 +175,7 @@ export class CommunitiesComponent implements OnInit, OnDestroy, AfterViewInit {
let showCommunity: boolean = true; let showCommunity: boolean = true;
community.isSubscribed = Session.isSubscribedTo('community', community.communityId, this.user); community.isSubscribed = Session.isSubscribedTo('community', community.communityId, this.user);
if (community['status'] == "hidden" || community['status'] == "manager") { if (community.isPrivate() || community.isRestricted()) {
showCommunity = false; showCommunity = false;
} }
if (showCommunity) { if (showCommunity) {
@ -193,7 +193,7 @@ export class CommunitiesComponent implements OnInit, OnDestroy, AfterViewInit {
} }
hasPermission(communityInfo: CommunityInfo) { hasPermission(communityInfo: CommunityInfo) {
return communityInfo.status === "all" || (communityInfo.status === "manager" && communityInfo.isManager); return communityInfo.isPublic() || (communityInfo.isRestricted() && communityInfo.isManager);
} }
private sort(results: CommunityInfo[]) { private sort(results: CommunityInfo[]) {

View File

@ -6,7 +6,6 @@ import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'
import {CommunityService} from "../openaireLibrary/connect/community/community.service"; import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {SearchZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
import {ZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service'; import {ZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
import {Session, User} from '../openaireLibrary/login/utils/helper.class'; import {Session, User} from '../openaireLibrary/login/utils/helper.class';
import {StatisticsForDashboardComponent} from '../statistics/statistics.component'; import {StatisticsForDashboardComponent} from '../statistics/statistics.component';
@ -156,7 +155,6 @@ export class CommunityComponent {
private _searchCommunityDataprovidersService: SearchCommunityDataprovidersService, private _searchCommunityDataprovidersService: SearchCommunityDataprovidersService,
private _searchCommunityProjectsService: SearchCommunityProjectsService, private _searchCommunityProjectsService: SearchCommunityProjectsService,
private _searchResearchResultsService: SearchResearchResultsService, private _searchResearchResultsService: SearchResearchResultsService,
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService,
private _zenodoCommunitieService: ZenodoCommunitiesService, private _zenodoCommunitieService: ZenodoCommunitiesService,
private seoService: SEOService, private seoService: SEOService,
private userManagementService: UserManagementService, private userManagementService: UserManagementService,
@ -221,7 +219,7 @@ export class CommunityComponent {
this._title.setTitle(community.title); this._title.setTitle(community.title);
this.subs.push(this._piwikService.trackView(this.properties, community.title).subscribe()); this.subs.push(this._piwikService.trackView(this.properties, community.title).subscribe());
if (this.community.zenodoCommunity) { if (this.community.zenodoCommunity) {
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity, null).subscribe( this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity).subscribe(
result => { result => {
this.masterZenodoCommunity = result; this.masterZenodoCommunity = result;
}, },
@ -230,14 +228,7 @@ export class CommunityComponent {
} }
)); ));
} }
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe( this.zenodoCommunityIdS = this.community.otherZenodoCommunities;
result => {
this.zenodoCommunityIdS = result;
},
error => {
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
}
));
} }
})); }));

View File

@ -12,12 +12,10 @@ import {InviteModule} from '../utils/subscribe/invite/invite.module';
import {ManageModule} from '../openaireLibrary/utils/manage/manage.module'; import {ManageModule} from '../openaireLibrary/utils/manage/manage.module';
import {StatisticsModule} from "../statistics/statistics.module"; import {StatisticsModule} from "../statistics/statistics.module";
import {
SearchZenodoCommunitiesServiceModule
} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
import { import {
ZenodoCommunitiesServiceModule ZenodoCommunitiesServiceModule
} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module'; } from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
import {SearchFormModule} from '../openaireLibrary/searchPages/searchUtils/searchForm.module'; import {SearchFormModule} from '../openaireLibrary/searchPages/searchUtils/searchForm.module';
import { import {
SearchDataprovidersServiceModule SearchDataprovidersServiceModule
@ -47,7 +45,7 @@ import {NoLoadPaging} from '../openaireLibrary/searchPages/searchUtils/no-load-p
imports: [ imports: [
CommonModule, FormsModule, RouterModule, CommonModule, FormsModule, RouterModule,
SubscribeModule, StatisticsModule, ManageModule, InviteModule, SubscribeModule, StatisticsModule, ManageModule, InviteModule,
SearchZenodoCommunitiesServiceModule, ZenodoCommunitiesServiceModule, SearchFormModule, SearchDataprovidersServiceModule, SearchProjectsServiceModule, ZenodoCommunitiesServiceModule, SearchFormModule, SearchDataprovidersServiceModule, SearchProjectsServiceModule,
SearchResearchResultsServiceModule, SearchResultsModule, CuratorsModule, AffiliationsModule, SearchResearchResultsServiceModule, SearchResultsModule, CuratorsModule, AffiliationsModule,
SEOServiceModule, MatSelectModule, EntitiesSelectionModule, SEOServiceModule, MatSelectModule, EntitiesSelectionModule,
TabsModule, SearchTabModule, ErrorMessagesModule, SafeHtmlPipeModule, ErrorModule, TabsModule, SearchTabModule, ErrorMessagesModule, SafeHtmlPipeModule, ErrorModule,

View File

@ -6,9 +6,6 @@ import {ZenodoInformationClass} from "../openaireLibrary/deposit/utils/zenodoInf
import {FetchZenodoInformation} from "./utils/fetchZenodoInformation.class"; import {FetchZenodoInformation} from "./utils/fetchZenodoInformation.class";
import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service"; import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service";
import {CommunityService} from "../openaireLibrary/connect/community/community.service"; import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {
SearchZenodoCommunitiesService
} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service";
import {Subscriber, Subscription} from "rxjs"; import {Subscriber, Subscription} from "rxjs";
import {properties} from "../../environments/environment"; import {properties} from "../../environments/environment";
@ -33,9 +30,8 @@ export class OpenaireDepositComponent {
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private _zenodoCommunitieService: ZenodoCommunitiesService, private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService, private _communityService: CommunityService) {
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) { this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService);
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService);
} }
public ngOnInit() { public ngOnInit() {
@ -44,7 +40,7 @@ export class OpenaireDepositComponent {
if(community) { if(community) {
this.communityId = community.communityId this.communityId = community.communityId
let masterZenodoCommunityId = community.zenodoCommunity; let masterZenodoCommunityId = community.zenodoCommunity;
if (masterZenodoCommunityId) { if (masterZenodoCommunityId || (community.otherZenodoCommunities && community.otherZenodoCommunities.length > 0)) {
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage; this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
} else { } else {
this.zenodoInformation.url = this.properties.zenodo; this.zenodoInformation.url = this.properties.zenodo;

View File

@ -9,7 +9,6 @@ import {DepositRoutingModule} from "./deposit-routing.module";
import {DepositFirstPageModule} from "../openaireLibrary/deposit/depositFirstPage.module"; import {DepositFirstPageModule} from "../openaireLibrary/deposit/depositFirstPage.module";
import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service"; import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service";
import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service";
@NgModule({ @NgModule({
imports: [ imports: [
@ -23,6 +22,6 @@ import {SearchZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoC
OpenaireDepositComponent, OpenaireDepositComponent,
], ],
providers: [PreviousRouteRecorder, IsRouteEnabled, providers: [PreviousRouteRecorder, IsRouteEnabled,
ZenodoCommunitiesService, SearchZenodoCommunitiesService] ZenodoCommunitiesService]
}) })
export class LibDepositModule { } export class LibDepositModule { }

View File

@ -3,9 +3,6 @@ import {ActivatedRoute} from '@angular/router';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {ZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service'; import {ZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
import {
SearchZenodoCommunitiesService
} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
import {CommunityService} from '../openaireLibrary/connect/community/community.service'; import {CommunityService} from '../openaireLibrary/connect/community/community.service';
import {ZenodoInformationClass} from '../openaireLibrary/deposit/utils/zenodoInformation.class'; import {ZenodoInformationClass} from '../openaireLibrary/deposit/utils/zenodoInformation.class';
@ -31,8 +28,8 @@ export class OpenaireSearchDataprovidersToDepositComponent {
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private _zenodoCommunitieService: ZenodoCommunitiesService, private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService, private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) { private _communityService: CommunityService) {
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService); this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService);
} }
public ngOnInit() { public ngOnInit() {
@ -41,7 +38,7 @@ export class OpenaireSearchDataprovidersToDepositComponent {
if(community) { if(community) {
this.communityId = community.communityId; this.communityId = community.communityId;
let masterZenodoCommunityId = community.zenodoCommunity; let masterZenodoCommunityId = community.zenodoCommunity;
if (masterZenodoCommunityId) { if (masterZenodoCommunityId || (community.otherZenodoCommunities && community.otherZenodoCommunities.length > 0)) {
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage; this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage;
} else { } else {
this.zenodoInformation.url = this.properties.zenodo; this.zenodoInformation.url = this.properties.zenodo;

View File

@ -9,14 +9,13 @@ import {SearchDataprovidersToDepositModule} from '../openaireLibrary/deposit/sea
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard'; import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard';
import {ZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module'; import {ZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
import {SearchZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, CommonModule, FormsModule,
SearchDataprovidersToDepositModule, SearchDataprovidersToDepositModule,
SearchDataprovidersToDepositRoutingModule, SearchDataprovidersToDepositRoutingModule,
ZenodoCommunitiesServiceModule, SearchZenodoCommunitiesServiceModule ZenodoCommunitiesServiceModule
], ],
declarations: [ declarations: [
OpenaireSearchDataprovidersToDepositComponent OpenaireSearchDataprovidersToDepositComponent

View File

@ -1,6 +1,5 @@
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service'; import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class'; import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
import {Subscriber} from "rxjs"; import {Subscriber} from "rxjs";
@ -11,8 +10,7 @@ import {Injectable} from "@angular/core";
}) })
export class FetchZenodoInformation { export class FetchZenodoInformation {
private subscriptions = []; private subscriptions = [];
constructor ( private _zenodoCommunitieService: ZenodoCommunitiesService, constructor ( private _zenodoCommunitieService: ZenodoCommunitiesService ) { }
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) { }
public ngOnDestroy() { public ngOnDestroy() {
this.clearSubscriptions(); this.clearSubscriptions();
@ -26,7 +24,7 @@ export class FetchZenodoInformation {
}); });
} }
public getZenodoCommunityNameAndUrlById(masterZenodoCommunityId: string, properties:EnvProperties, zenodoInformation: ZenodoInformationClass){ public getZenodoCommunityNameAndUrlById(masterZenodoCommunityId: string, properties:EnvProperties, zenodoInformation: ZenodoInformationClass){
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(properties, properties.zenodoCommunities+masterZenodoCommunityId, null).subscribe( this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(properties, properties.zenodoCommunities+masterZenodoCommunityId).subscribe(
result => { result => {
console.info("getZenodoCommunityNameAndUrlById", result); console.info("getZenodoCommunityNameAndUrlById", result);
var masterZenodoCommunity = result; var masterZenodoCommunity = result;
@ -38,22 +36,4 @@ export class FetchZenodoInformation {
} }
)); ));
} }
public searchNumberOfZCommunities(communityId: string, properties: EnvProperties, zenodoInformation: ZenodoInformationClass) {
this.subscriptions.push(this._searchZenodoCommunitiesService.searchZCommunities(properties,communityId).subscribe (
result => {
console.info("searchNumberOfZCommunities", result);
var CommunityIds = result;
var totalResults = CommunityIds.length;
if(totalResults > 0) {
zenodoInformation.shareInZenodoUrl = properties.shareInZenodoPage;
console.info(zenodoInformation.shareInZenodoUrl);
}
},
error => {
console.error("list of zenodo communities couldn't be loaded");
}
));
}
} }

View File

@ -76,7 +76,6 @@
</div> </div>
</div> </div>
</div> </div>
<div *ngIf="zenodoSearchUtils.status == errorCodes.LOADING" <div *ngIf="zenodoSearchUtils.status == errorCodes.LOADING"
class="uk-animation-fade uk-margin-large uk-padding-large uk-padding-remove-horizontal" role="alert"> class="uk-animation-fade uk-margin-large uk-padding-large uk-padding-remove-horizontal" role="alert">
<loading></loading> <loading></loading>
@ -86,7 +85,13 @@
No zenodo communities found No zenodo communities found
</div> </div>
<div class="uk-section"> <div class="uk-section">
<h6 class="uk-margin-medium-bottom">Other related Zenodo communities</h6> <h6 *ngIf="masterZenodoCommunity" class="uk-margin-medium-bottom">Other related Zenodo communities</h6>
<h6 *ngIf="!masterZenodoCommunity" class="uk-margin-medium-bottom">Related Zenodo communities</h6>
<div *ngIf="!masterZenodoCommunity" class="uk-margin-top uk-text-center uk-margin-medium-bottom">
<a routerLink="/participate/deposit/search" target="_blank" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
OpenAIRE Compliant Repositories
</a>
</div>
<no-load-paging *ngIf="communityIds && communityIds.length > size" [type]="'Zenodo communities'" <no-load-paging *ngIf="communityIds && communityIds.length > size" [type]="'Zenodo communities'"
(pageChange)="getCommunities($event)" (pageChange)="getCommunities($event)"
[page]="page" [pageSize]="size" [page]="page" [pageSize]="size"
@ -95,36 +100,36 @@
<div *ngIf="communityIds && communityIds.length > 0" class="uk-grid uk-grid-medium uk-grid-match uk-child-width-1-2@m uk-margin-top" uk-grid <div *ngIf="communityIds && communityIds.length > 0" class="uk-grid uk-grid-medium uk-grid-match uk-child-width-1-2@m uk-margin-top" uk-grid
uk-height-match="target: .header, .body"> uk-height-match="target: .header, .body">
<ng-template ngFor let-item [ngForOf]="communityIds" let-i="index"> <ng-template ngFor let-item [ngForOf]="communityIds" let-i="index">
<div *ngIf="i>=((page-1)*size) && i < communityIds.length && i< this.page * this.size && communities[this.communityIds[i]['zenodoid']]" <div *ngIf="i>=((page-1)*size) && i < communityIds.length && i< this.page * this.size && communities[this.communityIds[i]]"
class="uk-animation-fade"> class="uk-animation-fade">
<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="header uk-grid uk-grid-medium uk-flex-middle" uk-grid> <div class="header uk-grid uk-grid-medium uk-flex-middle" uk-grid>
<div class="uk-width-auto" *ngIf="communities[this.communityIds[i]['zenodoid']].logoUrl"> <div class="uk-width-auto" *ngIf="communities[this.communityIds[i]].logoUrl">
<a target="_blank" [href]="communities[this.communityIds[i]['zenodoid']].link"> <a target="_blank" [href]="communities[this.communityIds[i]].link">
<img *ngIf="communities[this.communityIds[i]['zenodoid']].logoUrl" <img *ngIf="communities[this.communityIds[i]].logoUrl"
src="{{communities[this.communityIds[i]['zenodoid']].logoUrl}}" width="80" height="80" alt="{{communities[this.communityIds[i]['zenodoid']].title}}"> src="{{communities[this.communityIds[i]].logoUrl}}" width="80" height="80" alt="{{communities[this.communityIds[i]].title}}">
</a> </a>
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">
<h2 class="uk-margin-remove uk-text-break uk-inline-block uk-h6"> <h2 class="uk-margin-remove uk-text-break uk-inline-block uk-h6">
<a class="custom-external uk-link uk-link-heading uk-width-expand" target="_blank" <a class="custom-external uk-link uk-link-heading uk-width-expand" target="_blank"
href="{{communities[this.communityIds[i]['zenodoid']].link}}"> href="{{communities[this.communityIds[i]].link}}">
<span *ngIf="communities[this.communityIds[i]['zenodoid']].title">{{communities[this.communityIds[i]['zenodoid']].title}}</span> <span *ngIf="communities[this.communityIds[i]].title">{{communities[this.communityIds[i]].title}}</span>
<span *ngIf="!communities[this.communityIds[i]['zenodoid']].title">[no name available]</span> <span *ngIf="!communities[this.communityIds[i]].title">[no name available]</span>
</a> </a>
</h2> </h2>
<div class="uk-text-small uk-margin-small-top"> <div class="uk-text-small uk-margin-small-top">
<span class="uk-text-meta">Last update: </span>{{communities[this.communityIds[i]['zenodoid']].date | date:'yyyy/MM/dd'}} <span class="uk-text-meta">Last update: </span>{{communities[this.communityIds[i]].date | date:'yyyy/MM/dd'}}
</div> </div>
</div> </div>
</div> </div>
<div class="body uk-margin-top uk-margin-bottom uk-text-small multi-line-ellipsis lines-3"> <!-- uk-height-max-small uk-overflow-auto --> <div class="body uk-margin-top uk-margin-bottom uk-text-small multi-line-ellipsis lines-3"> <!-- uk-height-max-small uk-overflow-auto -->
<p *ngIf="communities[this.communityIds[i]['zenodoid']].description" class="uk-margin-remove" [innerHtml]="communities[this.communityIds[i]['zenodoid']].description"></p> <p *ngIf="communities[this.communityIds[i]].description" class="uk-margin-remove" [innerHtml]="communities[this.communityIds[i]].description"></p>
</div> </div>
<div> <div>
<span class="uk-width-expand uk-flex-right"> <span class="uk-width-expand uk-flex-right">
<a [href]="depositLink + communities[this.communityIds[i]['zenodoid']].id" target="_blank" type="submit" <a [href]="depositLink + communities[this.communityIds[i]].id" target="_blank" type="submit"
class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text"> class="uk-float-right uk-margin-small-left uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
<span class="uk-flex uk-flex-middle"> <span class="uk-flex uk-flex-middle">
<icon name="file_upload" type="outlined" [flex]="true" class="uk-margin-small-right"></icon> <icon name="file_upload" type="outlined" [flex]="true" class="uk-margin-small-right"></icon>

View File

@ -3,9 +3,6 @@ import {ActivatedRoute, Router} from '@angular/router';
import {Meta, Title} from '@angular/platform-browser'; import {Meta, Title} from '@angular/platform-browser';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service'; import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
import {
SearchZenodoCommunitiesService
} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service'; import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo'; import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class'; import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
@ -58,7 +55,6 @@ export class ShareInZenodoComponent {
private _title: Title, private _title: Title,
private _zenodoCommunitieService: ZenodoCommunitiesService, private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService, private _communityService: CommunityService,
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService,
private helper: HelperService, private helper: HelperService,
private _piwikService: PiwikService, private _piwikService: PiwikService,
private seoService: SEOService) { private seoService: SEOService) {
@ -86,7 +82,7 @@ export class ShareInZenodoComponent {
this.community = community; this.community = community;
this.masterZenodoCommunityId = this.community.zenodoCommunity; this.masterZenodoCommunityId = this.community.zenodoCommunity;
if (this.masterZenodoCommunityId) { if (this.masterZenodoCommunityId) {
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId, null).subscribe( this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.masterZenodoCommunityId).subscribe(
result => { result => {
this.masterZenodoCommunity = result; this.masterZenodoCommunity = result;
@ -98,22 +94,14 @@ export class ShareInZenodoComponent {
)); ));
} }
this.zenodoSearchUtils.status = this.errorCodes.LOADING; this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe( this.communityIds = this.community.otherZenodoCommunities;
result => {
this.communityIds = result;
this.zenodoSearchUtils.totalResults = this.communityIds.length; this.zenodoSearchUtils.totalResults = this.communityIds.length;
if (this.communityIds.length == 0) { if (this.communityIds.length == 0) {
this.zenodoSearchUtils.status = this.errorCodes.NONE; this.zenodoSearchUtils.status = this.errorCodes.NONE;
} }
this.getCommunities() this.getCommunities()
},
error => {
//console.error("list of zenodo communities couldn't be loaded");
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
} //this.handleError('System error retrieving community profile', error)
));
} }
})); }));
@ -154,8 +142,8 @@ export class ShareInZenodoComponent {
})); }));
} }
getZenodoCommunityById(zenodoid, openaireId) { getZenodoCommunityById(zenodoid) {
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe( this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid).subscribe(
result => { result => {
this.communities[zenodoid] = result; this.communities[zenodoid] = result;
this.zenodoCommunitiesLoadedCount++; this.zenodoCommunitiesLoadedCount++;
@ -176,7 +164,7 @@ export class ShareInZenodoComponent {
this.zenodoSearchUtils.status = this.errorCodes.DONE; this.zenodoSearchUtils.status = this.errorCodes.DONE;
} }
//console.error("Zenodo community'"+zenodoid+"' couldn't be loaded"); //console.error("Zenodo community'"+zenodoid+"' couldn't be loaded");
this.handleError("Error getting Zenodo community with id: " + zenodoid + " and openaire id: " + openaireId, error); this.handleError("Error getting Zenodo community with id: " + zenodoid, error);
} }
)); ));
@ -190,7 +178,7 @@ export class ShareInZenodoComponent {
this.page = $event.value; this.page = $event.value;
for (let i = (this.page - 1) * this.size; i < this.communityIds.length && i < this.page * this.size; i++) { for (let i = (this.page - 1) * this.size; i < this.communityIds.length && i < this.page * this.size; i++) {
if (!this.communities[this.communityIds[i]["zenodoid"]]) { if (!this.communities[this.communityIds[i]["zenodoid"]]) {
this.getZenodoCommunityById(this.communityIds[i]["zenodoid"], this.communityIds[i]["id"]); this.getZenodoCommunityById(this.communityIds[i]);
} }
} }
} }

View File

@ -7,7 +7,6 @@ import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'
import {ShareInZenodoComponent} from './shareInZenodo.component'; import {ShareInZenodoComponent} from './shareInZenodo.component';
import {ShareInZenodoRoutingModule} from './shareInZenodo-routing.module'; import {ShareInZenodoRoutingModule} from './shareInZenodo-routing.module';
import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module'; import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
import {RouterModule} from "@angular/router"; import {RouterModule} from "@angular/router";
import {HelperModule} from "../../openaireLibrary/utils/helper/helper.module"; import {HelperModule} from "../../openaireLibrary/utils/helper/helper.module";
@ -21,7 +20,7 @@ import {LoadingModule} from 'src/app/openaireLibrary/utils/loading/loading.modul
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, ShareInZenodoRoutingModule, ZenodoCommunitiesServiceModule, SearchZenodoCommunitiesServiceModule, CommonModule, ShareInZenodoRoutingModule, ZenodoCommunitiesServiceModule,
RouterModule, HelperModule, LoadingModule, RouterModule, HelperModule, LoadingModule,
PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, NoLoadPaging, IconsModule PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, NoLoadPaging, IconsModule
], ],

View File

@ -97,7 +97,7 @@ export class MyCommunitiesComponent {
} }
hasPermission(communityInfo: CommunityInfo) { hasPermission(communityInfo: CommunityInfo) {
return communityInfo.status === "all" || (communityInfo.status === "manager" && communityInfo.isManager); return communityInfo.isPublic() || (communityInfo.isRestricted() && communityInfo.isManager);
} }
public getCommunities() { public getCommunities() {
@ -122,10 +122,10 @@ export class MyCommunitiesComponent {
communitiesResults.forEach((community, index) => { communitiesResults.forEach((community, index) => {
let showCommunity: boolean = true; let showCommunity: boolean = true;
community.isManager = Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || Session.isManager('community', community.communityId, this.user); community.isManager = Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user) || Session.isManager('community', community.communityId, this.user);
if (community['status'] == "hidden") { if (community.isPrivate()) {
showCommunity = false; showCommunity = false;
} else { } else {
if(!community.isManager && community['status'] == "manager") { if(!community.isManager && community.isRestricted()) {
showCommunity = false; showCommunity = false;
} }
} }

View File

@ -175,9 +175,9 @@ export class SearchCommunitiesComponent {
private showCommunities() { private showCommunities() {
let ret: CommunityInfo[] = []; let ret: CommunityInfo[] = [];
for (let result of this.results) { for (let result of this.results) {
if (result.status == 'hidden' && result.isManager) { if (result.isPrivate() && result.isManager) {
ret.push(result); ret.push(result);
} else if (result.status == "manager" || result.status == "all") { } else if (result.isRestricted() || result.isPublic()) {
ret.push(result); ret.push(result);
} }
} }
@ -284,6 +284,7 @@ export class SearchCommunitiesComponent {
if (params[filterId]) { if (params[filterId]) {
values = (StringUtils.URIDecode(params[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1); values = (StringUtils.URIDecode(params[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1);
} }
console.log(filterId + ": " +values)
if (filterId == 'type') { if (filterId == 'type') {
for (let i = 0; i < this.results.length; i++) { for (let i = 0; i < this.results.length; i++) {
if (values.length == 0) { if (values.length == 0) {
@ -302,19 +303,20 @@ export class SearchCommunitiesComponent {
if (values.length == 0) { if (values.length == 0) {
results.push(this.results[i]); results.push(this.results[i]);
} else { } else {
// console.log(this.results[i].status, this.results[i].isPublic(),this.results[i].isRestricted(), this.results[i].isPrivate() )
for (let value of values) { for (let value of values) {
if (value.replace(/["']/g, "") == 'public') { if (value.replace(/["']/g, "") == 'public') {
if (this.results[i].status === 'all') { if (this.results[i].isPublic()) {
results.push(this.results[i]); results.push(this.results[i]);
break; break;
} }
} else if (value.replace(/["']/g, "") == 'restricted') { } else if (value.replace(/["']/g, "") == 'restricted') {
if (this.results[i].status === 'manager') { if (this.results[i].isRestricted()) {
results.push(this.results[i]); results.push(this.results[i]);
break; break;
} }
} else if (value.replace(/["']/g, "") == 'private') { } else if (value.replace(/["']/g, "") == 'private') {
if (this.results[i].status === 'hidden') { if (this.results[i].isPrivate()) {
results.push(this.results[i]); results.push(this.results[i]);
break; break;
} }
@ -381,9 +383,9 @@ export class SearchCommunitiesComponent {
} }
} }
} else if (this.filters[i].filterId == 'access') { } else if (this.filters[i].filterId == 'access') {
if (results[k].status === 'all') { if (results[k].isPublic()) {
this.filters[i].values[0].number++; this.filters[i].values[0].number++;
} else if (results[k].status === 'manager') { } else if (results[k].isRestricted()) {
this.filters[i].values[1].number++; this.filters[i].values[1].number++;
} else if (this.user) { } else if (this.user) {
this.filters[i].values[2].number++; this.filters[i].values[2].number++;

View File

@ -1,8 +1,6 @@
import {Component, ViewChild} from '@angular/core'; import {Component, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {AdvancedField, Filter, Value} from '../../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class'; import {AdvancedField, Filter, Value} from '../../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class';
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes'; import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
import {ErrorMessagesComponent} from '../../openaireLibrary/utils/errorMessages.component'; import {ErrorMessagesComponent} from '../../openaireLibrary/utils/errorMessages.component';
import {SearchFields} from '../../openaireLibrary/utils/properties/searchFields'; import {SearchFields} from '../../openaireLibrary/utils/properties/searchFields';
@ -14,6 +12,7 @@ import {CommunityService} from "../../openaireLibrary/connect/community/communit
import {Subscriber} from "rxjs"; import {Subscriber} from "rxjs";
import {NewSearchPageComponent} from "../../openaireLibrary/searchPages/searchUtils/newSearchPage.component"; import {NewSearchPageComponent} from "../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
import {SearchResult} from "../../openaireLibrary/utils/entities/searchResult"; import {SearchResult} from "../../openaireLibrary/utils/entities/searchResult";
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class";
@Component({ @Component({
selector: 'openaire-search-projects', selector: 'openaire-search-projects',
@ -50,8 +49,9 @@ export class OpenaireSearchProjectsComponent {
private errorMessages: ErrorMessagesComponent; private errorMessages: ErrorMessagesComponent;
public columnNames = ['Project', 'GrantId', 'Funder']; public columnNames = ['Project', 'GrantId', 'Funder'];
public results =[]; public results =[];
public originalFilters =[]; public originalFunders =[];
public filters =[]; public filters =[];
selectedFunder = null;
public searchUtils:SearchUtilsClass = new SearchUtilsClass(); public searchUtils:SearchUtilsClass = new SearchUtilsClass();
subscriptions = []; subscriptions = [];
public searchFields:SearchFields = new SearchFields(); public searchFields:SearchFields = new SearchFields();
@ -64,7 +64,6 @@ export class OpenaireSearchProjectsComponent {
private communityId: string = ''; private communityId: string = '';
customFilter: SearchCustomFilter = null; customFilter: SearchCustomFilter = null;
initialLoad = true; initialLoad = true;
public allResults =[];
@ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent; @ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent;
public fieldIds: string[] = this.searchFields.PROJECT_ADVANCED_FIELDS; public fieldIds: string[] = this.searchFields.PROJECT_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.PROJECT_FIELDS; public fieldIdsMap= this.searchFields.PROJECT_FIELDS;
@ -88,14 +87,14 @@ export class OpenaireSearchProjectsComponent {
this.subscriptions.push(this.route.queryParams.subscribe(params => { this.subscriptions.push(this.route.queryParams.subscribe(params => {
let page = (params['page'] === undefined) ? 1 : +params['page']; let page = (params['page'] === undefined) ? 1 : +params['page'];
this.searchUtils.page = (page <= 0) ? 1 : page; this.searchUtils.page = (page <= 0) ? 1 : page;
this.selectedFunder = params["funder"]?StringUtils.unquote(params["funder"]):null;
this.searchUtils.validateSize(params['size']); this.searchUtils.validateSize(params['size']);
this.keyword = decodeURIComponent(params['fv0']?params['fv0']:(params['keyword']?params['keyword']:'')); this.keyword = decodeURIComponent(params['fv0']?params['fv0']:(params['keyword']?params['keyword']:''));
this.selectedFields = []; this.selectedFields = [];
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap, this.customFilter, params, "project"); this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap, this.customFilter, params, "project");
if(this.initialLoad) { if(this.initialLoad) {
this.initialLoad = false; this.initialLoad = false;
this._getResults(); this._getCommunityFunders();
}else{ }else{
this._getResults(); this._getResults();
} }
@ -119,73 +118,60 @@ export class OpenaireSearchProjectsComponent {
this.disableForms = true; this.disableForms = true;
this.disableRefineForms = true; this.disableRefineForms = true;
this.enableSearchView = false; this.enableSearchView = false;
if(this.allResults) { this.subscriptions.push(this._searchProjectsService.searchProjectsWithPaging(this.properties, this.communityId, this.searchUtils.page, this.searchUtils.size, this.searchUtils.keyword, this.selectedFunder, "name" ).subscribe(
this.subscriptions.push(this._searchProjectsService.searchProjects(this.properties, this.communityId).subscribe( data => {
data => { this.searchUtils.totalResults = data['totalElements'];
this.originalFilters = this.createFilters(data).slice(); //copy array this.filters = this.selectedFunder?this.createFilters([this.selectedFunder]):this.createFilters(this.originalFunders);
this.allResults = this.parseResults(data); this.results = this.parseResults(data.content);
this.filters = this.searchPage.prepareFiltersToShow(this.originalFilters, this.allResults.length); this.oldTotalResults = data['totalElements'];
this.filterResults(); this.searchUtils.totalResults = data['totalElements'];
}, this.searchUtils.status = this.results.length == 0 ? this.errorCodes.NONE: this.errorCodes.DONE;
err => { this.disableForms = false;
this.handleError("Error getting projects for community with id: " + this.communityId, err); this.disableRefineForms = false;
this.searchUtils.status = this.errorMessages.getErrorCode(err.status); this.enableSearchView = true;
this.enableSearchView = true; this.searchUtils.refineStatus = this.errorCodes.DONE;
} },
)); err => {
}else{ this.handleError("Error getting projects for community with id: " + this.communityId, err);
this.filters = this.searchPage.prepareFiltersToShow(this.originalFilters, this.allResults.length); this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.filterResults(); this.enableSearchView = true;
} }
));
} }
private createFilters(data):Filter[] { private createFilters(data):Filter[] {
let length = Array.isArray(data) ? data.length : 1;
var filter_names=["Funder"];
var filter_ids=["funder"];
var filter_original_ids = ["funder"];
var value_names=[];
var value_original_ids=[];
var funders = new Set<String>(); var funders = new Set<String>();
var value_name = []; var value_name = [];
var value_original_id = []; var value_original_id = [];
let i; for(let funder of data) {
for(i=0; i<length; i++) { funders.add(funder);
let resData = Array.isArray(data) ? data[i] : data; value_name.push(funder);
if(resData.funder && !funders.has(resData.funder)) { value_original_id.push(funder);
funders.add(resData.funder);
value_name.push(resData.funder);
value_original_id.push(resData.funder.trim());
}
} }
value_names.push(value_name);
value_original_ids.push(value_original_id);
var filters: Filter[] =[]; var filters: Filter[] =[];
for(i =0 ; i < filter_names.length;i++){ if(value_name.length > 0) {
if(value_names[i].length > 0) {
var values: Value[] = []; var values: Value[] = [];
for (var j = 0; j < value_names[i].length; j++) { for (var j = 0; j < value_name.length; j++) {
var value: Value = {name: value_names[i][j], id: value_original_ids[i][j], number: j, selected: false} var value: Value = {name: value_name[j], id:value_name[j], number: 0, selected: this.selectedFunder == value_name[j] }
values.push(value); values.push(value);
} }
var filter: Filter = { var filter: Filter = {
title: filter_names[i], title: "Funder",
filterId: filter_ids[i], filterId: "funder",
originalFilterId: filter_original_ids[i], originalFilterId: "funder",
values: values, values: values,
countSelectedValues: 0, countSelectedValues: this.selectedFunder?1:0,
"filterOperator": 'or', "filterOperator": 'or',
valueIsExact: true, valueIsExact: true,
filterType: "checkbox" filterType: "checkbox"
}; };
filters.push(filter); filters.push(filter);
} }
}
return filters; return filters;
} }
@ -203,33 +189,32 @@ export class OpenaireSearchProjectsComponent {
} }
return results; return results;
} }
filterResults(){ getFunderFilterValue(){
let results = this.allResults.filter(value => { return value.title.name && value.title.name.toLowerCase().indexOf(this.keyword.toLowerCase()) !=-1 || value.acronym && value.acronym.toLowerCase().indexOf(this.keyword.toLowerCase()) !=-1});
let funderFilterValues = [];
for(let filter of this.filters){ for(let filter of this.filters){
if(filter.countSelectedValues > 0){ if(filter.countSelectedValues > 0){
for(let value of filter.values){ for(let value of filter.values){
if(value.selected) { if(value.selected) {
funderFilterValues.push(value.name); return value.name;
} }
} }
} }
} }
if(funderFilterValues.length > 0) { return null;
results = results.filter(value => {
return funderFilterValues.indexOf(value.funderShortname) != -1
});
}
this.oldTotalResults = results.length;
this.searchUtils.totalResults = results.length;
this.results = results.slice((this.searchUtils.page - 1) * this.searchUtils.size, this.searchUtils.page *this.searchUtils.size );
this.searchUtils.status = this.results.length == 0 ? this.errorCodes.NONE: this.errorCodes.DONE;
this.disableForms = false;
this.disableRefineForms = false;
this.enableSearchView = true;
this.searchUtils.refineStatus = this.errorCodes.DONE;
} }
private handleError(message: string, error) { private handleError(message: string, error) {
console.error("Projects simple Search Page: "+message, error); console.error("Projects simple Search Page: "+message, error);
} }
public _getCommunityFunders() {
this.subscriptions.push(this._searchProjectsService.getProjectFunders(this.properties, this.communityId).subscribe(
data => {
this.originalFunders = data
this._getResults();
},
err => {
}
));
}
} }