2024-01-31 10:05:46 +01:00
|
|
|
import {Component} from '@angular/core';
|
2024-02-28 12:07:31 +01:00
|
|
|
import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component";
|
2024-03-01 09:32:38 +01:00
|
|
|
import {SearchCommunityDataprovidersService} from "../../../../connect/contentProviders/searchDataproviders.service";
|
|
|
|
import {ConfigurationService} from "../../../../utils/configuration/configuration.service";
|
|
|
|
import {CommunityService} from "../../../../connect/community/community.service";
|
2024-02-28 12:07:31 +01:00
|
|
|
export class PluginSuggestedRepositories extends PluginBaseInfo{
|
2024-03-01 09:32:38 +01:00
|
|
|
title:string ="Suggested repositories & journals";
|
2024-03-06 14:26:14 +01:00
|
|
|
compare(oldObject): any {
|
|
|
|
console.log()
|
|
|
|
return super.compare(oldObject);
|
|
|
|
}
|
2024-02-22 10:09:20 +01:00
|
|
|
}
|
2024-01-31 10:05:46 +01:00
|
|
|
@Component({
|
|
|
|
selector: 'plugin-suggested-repositories',
|
|
|
|
templateUrl: 'plugin-suggested-repositories.component.html'
|
|
|
|
})
|
2024-02-22 10:09:20 +01:00
|
|
|
export class PluginSuggestedRepositoriesComponent extends PluginBaseComponent<PluginSuggestedRepositories>{
|
2024-03-01 09:32:38 +01:00
|
|
|
portal;
|
|
|
|
community;
|
|
|
|
contentProviders;
|
|
|
|
slides = 0;
|
|
|
|
constructor(private searchCommunityDataprovidersService: SearchCommunityDataprovidersService,
|
|
|
|
private config: ConfigurationService,
|
|
|
|
private communityService: CommunityService) {
|
2024-01-31 10:05:46 +01:00
|
|
|
super()
|
2024-03-01 09:32:38 +01:00
|
|
|
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.subscriptions.push(this.searchCommunityDataprovidersService.searchDataproviders(this.properties, this.community.communityId, true).subscribe(
|
|
|
|
res => {
|
|
|
|
this.slides =1;
|
|
|
|
this.contentProviders = res;
|
|
|
|
if(this.contentProviders.length > 2){
|
|
|
|
this.slides = parseInt('' + (this.contentProviders.length/2));
|
|
|
|
}
|
|
|
|
if(this.slides< (this.contentProviders.length / 2)){
|
|
|
|
this.slides++;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error => {
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
));
|
|
|
|
|
2024-01-31 10:05:46 +01:00
|
|
|
}
|
|
|
|
}
|