apply changes to projects and zenodo communities pages and queries

This commit is contained in:
argirok 2023-07-14 14:54:58 +03:00
parent a03d41be9c
commit f53af36929
11 changed files with 32 additions and 84 deletions

View File

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

View File

@ -12,7 +12,6 @@ import {InviteModule} from '../utils/subscribe/invite/invite.module';
import {ManageModule} from '../openaireLibrary/utils/manage/manage.module';
import {StatisticsModule} from "../statistics/statistics.module";
import {SearchZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
import {ZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
import {SearchFormModule} from '../openaireLibrary/searchPages/searchUtils/searchForm.module';
import {SearchDataprovidersServiceModule} from "../openaireLibrary/connect/contentProviders/searchDataprovidersService.module";
@ -39,7 +38,7 @@ import {NoLoadPaging} from '../openaireLibrary/searchPages/searchUtils/no-load-p
imports: [
CommonModule, FormsModule, RouterModule,
SubscribeModule, StatisticsModule, ManageModule, InviteModule,
SearchZenodoCommunitiesServiceModule, ZenodoCommunitiesServiceModule, SearchFormModule, SearchDataprovidersServiceModule, SearchProjectsServiceModule,
ZenodoCommunitiesServiceModule, SearchFormModule, SearchDataprovidersServiceModule, SearchProjectsServiceModule,
SearchResearchResultsServiceModule, SearchResultsModule, CuratorsModule, AffiliationsModule,
SEOServiceModule, MatSelectModule, EntitiesSelectionModule,
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 {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service";
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {
SearchZenodoCommunitiesService
} from "../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service";
import {Subscriber, Subscription} from "rxjs";
import {properties} from "../../environments/environment";
@ -33,9 +30,8 @@ export class OpenaireDepositComponent {
constructor(private route: ActivatedRoute,
private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService,
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService);
private _communityService: CommunityService) {
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService);
}
public ngOnInit() {

View File

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

View File

@ -3,9 +3,6 @@ import {ActivatedRoute} from '@angular/router';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
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 {ZenodoInformationClass} from '../openaireLibrary/deposit/utils/zenodoInformation.class';
@ -31,8 +28,8 @@ export class OpenaireSearchDataprovidersToDepositComponent {
constructor(private route: ActivatedRoute,
private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService, private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService);
private _communityService: CommunityService) {
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService);
}
public ngOnInit() {

View File

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

View File

@ -1,6 +1,5 @@
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
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 {Subscriber} from "rxjs";
@ -11,8 +10,7 @@ import {Injectable} from "@angular/core";
})
export class FetchZenodoInformation {
private subscriptions = [];
constructor ( private _zenodoCommunitieService: ZenodoCommunitiesService,
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService ) { }
constructor ( private _zenodoCommunitieService: ZenodoCommunitiesService ) { }
public ngOnDestroy() {
this.clearSubscriptions();
@ -26,7 +24,7 @@ export class FetchZenodoInformation {
});
}
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 => {
console.info("getZenodoCommunityNameAndUrlById", 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

@ -95,36 +95,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
uk-height-match="target: .header, .body">
<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">
<div class="uk-card uk-card-default">
<div class="uk-card-body">
<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">
<a target="_blank" [href]="communities[this.communityIds[i]['zenodoid']].link">
<img *ngIf="communities[this.communityIds[i]['zenodoid']].logoUrl"
src="{{communities[this.communityIds[i]['zenodoid']].logoUrl}}" width="80" height="80" alt="{{communities[this.communityIds[i]['zenodoid']].title}}">
<div class="uk-width-auto" *ngIf="communities[this.communityIds[i]].logoUrl">
<a target="_blank" [href]="communities[this.communityIds[i]].link">
<img *ngIf="communities[this.communityIds[i]].logoUrl"
src="{{communities[this.communityIds[i]].logoUrl}}" width="80" height="80" alt="{{communities[this.communityIds[i]].title}}">
</a>
</div>
<div class="uk-width-expand">
<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"
href="{{communities[this.communityIds[i]['zenodoid']].link}}">
<span *ngIf="communities[this.communityIds[i]['zenodoid']].title">{{communities[this.communityIds[i]['zenodoid']].title}}</span>
<span *ngIf="!communities[this.communityIds[i]['zenodoid']].title">[no name available]</span>
href="{{communities[this.communityIds[i]].link}}">
<span *ngIf="communities[this.communityIds[i]].title">{{communities[this.communityIds[i]].title}}</span>
<span *ngIf="!communities[this.communityIds[i]].title">[no name available]</span>
</a>
</h2>
<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 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>
<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">
<span class="uk-flex uk-flex-middle">
<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 {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
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 {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
@ -58,7 +55,6 @@ export class ShareInZenodoComponent {
private _title: Title,
private _zenodoCommunitieService: ZenodoCommunitiesService,
private _communityService: CommunityService,
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService,
private helper: HelperService,
private _piwikService: PiwikService,
private seoService: SEOService) {
@ -86,7 +82,7 @@ export class ShareInZenodoComponent {
this.community = community;
this.masterZenodoCommunityId = this.community.zenodoCommunity;
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 => {
this.masterZenodoCommunity = result;
@ -98,22 +94,14 @@ export class ShareInZenodoComponent {
));
}
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
result => {
this.communityIds = result;
this.communityIds = this.community.otherZenodoCommunities;
this.zenodoSearchUtils.totalResults = this.communityIds.length;
if (this.communityIds.length == 0) {
this.zenodoSearchUtils.status = this.errorCodes.NONE;
}
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) {
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe(
getZenodoCommunityById(zenodoid) {
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid).subscribe(
result => {
this.communities[zenodoid] = result;
this.zenodoCommunitiesLoadedCount++;
@ -176,7 +164,7 @@ export class ShareInZenodoComponent {
this.zenodoSearchUtils.status = this.errorCodes.DONE;
}
//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;
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"]]) {
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 {ShareInZenodoRoutingModule} from './shareInZenodo-routing.module';
import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
import {RouterModule} from "@angular/router";
import {HelperModule} from "../../openaireLibrary/utils/helper/helper.module";
@ -21,7 +20,7 @@ import {LoadingModule} from 'src/app/openaireLibrary/utils/loading/loading.modul
@NgModule({
imports: [
CommonModule, ShareInZenodoRoutingModule, ZenodoCommunitiesServiceModule, SearchZenodoCommunitiesServiceModule,
CommonModule, ShareInZenodoRoutingModule, ZenodoCommunitiesServiceModule,
RouterModule, HelperModule, LoadingModule,
PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, NoLoadPaging, IconsModule
],

View File

@ -122,8 +122,8 @@ export class OpenaireSearchProjectsComponent {
if(this.allResults) {
this.subscriptions.push(this._searchProjectsService.searchProjects(this.properties, this.communityId).subscribe(
data => {
this.originalFilters = this.createFilters(data).slice(); //copy array
this.allResults = this.parseResults(data);
this.originalFilters = this.createFilters(data.content).slice(); //copy array
this.allResults = this.parseResults(data.content);
this.filters = this.searchPage.prepareFiltersToShow(this.originalFilters, this.allResults.length);
this.filterResults();
},