1. src/app/utils/approvedByCommunity deleted by community and added in openaireLibrary/connect.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51579 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
886081d24d
commit
97fd1e4f05
|
@ -1,60 +0,0 @@
|
|||
import { Component, Input } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper';
|
||||
import {SearchCommunityDataprovidersService} from '../../services/searchDataproviders.service';
|
||||
|
||||
@Component({
|
||||
selector: 'approved-by-community',
|
||||
template: `
|
||||
<span *ngIf="approved" class="uk-align-right uk-label custom-label uk-label-success">Community Approved</span>
|
||||
`
|
||||
})
|
||||
|
||||
export class ApprovedByCommunityComponent {
|
||||
@Input() contentProviderId: string;
|
||||
|
||||
public communityId:string;
|
||||
public approved:boolean = false;
|
||||
private communityContentProviders = [];
|
||||
|
||||
properties:EnvProperties;
|
||||
|
||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchCommunityDataprovidersService) {}
|
||||
|
||||
public ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
|
||||
this.route.queryParams.subscribe(
|
||||
communityId => {
|
||||
this.communityId = communityId['communityId'];
|
||||
|
||||
if(!this.communityId){
|
||||
this.communityId = ConnectHelper.getCommunityFromDomain(document.location.hostname);
|
||||
}
|
||||
|
||||
if(this.communityId && this.communityId != "openaire") {
|
||||
this._searchDataprovidersService.searchDataproviders(this.properties, this.communityId).subscribe (
|
||||
contentproviders => {
|
||||
this.communityContentProviders = contentproviders;
|
||||
this.approved = this.checkApproval();
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private checkApproval(): boolean {
|
||||
let self = this;
|
||||
return this.communityContentProviders.map(contentprovider => contentprovider.openaireId).some(function(id) {
|
||||
return id == self.contentProviderId;
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { ApprovedByCommunityComponent } from './approved.component';
|
||||
import {SearchDataprovidersServiceModule} from '../../services/searchDataprovidersService.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, RouterModule, SearchDataprovidersServiceModule
|
||||
],
|
||||
declarations: [
|
||||
ApprovedByCommunityComponent
|
||||
],
|
||||
providers:[
|
||||
],
|
||||
exports: [
|
||||
ApprovedByCommunityComponent
|
||||
]
|
||||
})
|
||||
export class ApprovedByCommunityModule { }
|
Loading…
Reference in New Issue