[Trunk | Library]: Bug fix in deposit pages: Get information for zenodo communities in connect components.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56570 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
32e2077319
commit
f8f821c393
|
@ -1,19 +1,7 @@
|
||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
import {Router, ActivatedRoute} from '@angular/router';
|
|
||||||
import {ErrorCodes} from '../utils/properties/errorCodes';
|
|
||||||
|
|
||||||
import{EnvProperties} from '../utils/properties/env-properties';
|
|
||||||
|
|
||||||
import {RouterHelper} from '../utils/routerHelper.class';
|
|
||||||
|
|
||||||
import {ZenodoInformationClass} from './utils/zenodoInformation.class';
|
import {ZenodoInformationClass} from './utils/zenodoInformation.class';
|
||||||
import {ZenodoCommunitiesService} from "../connect/zenodoCommunities/zenodo-communities.service";
|
import {EnvProperties} from "../utils/properties/env-properties";
|
||||||
import {CommunityService} from "../connect/community/community.service";
|
import {ActivatedRoute} from "@angular/router";
|
||||||
import {SearchZenodoCommunitiesService} from "../connect/zenodoCommunities/searchZenodoCommunities.service";
|
|
||||||
import {FetchZenodoInformation} from "../../deposit/utils/fetchZenodoInformation.class";
|
|
||||||
import {ConnectHelper} from "../connect/connectHelper";
|
|
||||||
import {StringUtils} from "../utils/string-utils.class";
|
|
||||||
import {SearchFields} from "../utils/properties/searchFields";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'deposit-first-page',
|
selector: 'deposit-first-page',
|
||||||
|
@ -153,81 +141,23 @@ import {SearchFields} from "../utils/properties/searchFields";
|
||||||
})
|
})
|
||||||
|
|
||||||
export class DepositFirstPageComponent {
|
export class DepositFirstPageComponent {
|
||||||
public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
|
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
|
||||||
fetchZenodoInformation: FetchZenodoInformation;
|
|
||||||
|
|
||||||
@Input() compatibility: string = '';
|
|
||||||
@Input() piwikSiteId = null;
|
@Input() piwikSiteId = null;
|
||||||
// Type of entity: Publication or Research Data
|
|
||||||
@Input() requestFor: string = "Publications";
|
|
||||||
|
|
||||||
public organization: {"name": string, "url": string};
|
|
||||||
public organizationId: string = "";
|
|
||||||
|
|
||||||
// Id of the new selected organization to be searched
|
|
||||||
public selectedId: string = "";
|
|
||||||
|
|
||||||
@Input() subjectResults: boolean = false;
|
|
||||||
@Input() subject: string = "";
|
|
||||||
|
|
||||||
public status: number;
|
|
||||||
public warningMessage: string = "";
|
|
||||||
|
|
||||||
public parameterNames:string[] =[];
|
|
||||||
public parameterValues:string[] =[];
|
|
||||||
|
|
||||||
public routerHelper:RouterHelper = new RouterHelper();
|
|
||||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
|
||||||
|
|
||||||
sub: any; piwiksub: any;
|
|
||||||
properties:EnvProperties;
|
|
||||||
url=null;
|
|
||||||
|
|
||||||
public keyword: string;
|
public keyword: string;
|
||||||
public depositRoute = "/search-deposit";
|
public depositRoute = "/search-deposit";
|
||||||
public searchPlaceHolder = "Search for repositories by title, country, organization, subject...";
|
public searchPlaceHolder = "Search for repositories by title, country, organization, subject...";
|
||||||
|
properties:EnvProperties;
|
||||||
|
|
||||||
constructor (private _router: Router,
|
constructor (private route: ActivatedRoute) {}
|
||||||
private route: ActivatedRoute,
|
|
||||||
private _zenodoCommunitieService: ZenodoCommunitiesService,
|
|
||||||
private _communityService: CommunityService,
|
|
||||||
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
|
|
||||||
this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService, this._searchZenodoCommunitiesService);
|
|
||||||
}
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.data
|
this.route.data
|
||||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||||
this.properties = data.envSpecific;
|
this.properties = data.envSpecific;
|
||||||
|
|
||||||
this.route.queryParams.subscribe(params => {
|
if (!this.zenodoInformation) {
|
||||||
let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
this.zenodoInformation = new ZenodoInformationClass();
|
||||||
if (!communityId) {
|
|
||||||
communityId = params['communityId'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (communityId) {
|
|
||||||
|
|
||||||
if (communityId != null && communityId != '') {
|
|
||||||
|
|
||||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI + communityId).subscribe(
|
|
||||||
community => {
|
|
||||||
let masterZenodoCommunityId = community.zenodoCommunity;
|
|
||||||
if (masterZenodoCommunityId) {
|
|
||||||
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage+communityId;
|
|
||||||
//this.fetchZenodoInformation.getZenodoCommunityNameAndUrlById(masterZenodoCommunityId, this.properties, this.zenodoInformation);
|
|
||||||
} else {
|
|
||||||
this.zenodoInformation.url = this.properties.zenodo;
|
|
||||||
this.zenodoInformation.name = "Zenodo";
|
|
||||||
}
|
|
||||||
//this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
this.handleError("Error getting community with id: " + communityId, error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.zenodoInformation.shareInZenodoUrl) {
|
if (!this.zenodoInformation.shareInZenodoUrl) {
|
||||||
this.zenodoInformation.url = this.properties.zenodo;
|
this.zenodoInformation.url = this.properties.zenodo;
|
||||||
}
|
}
|
||||||
|
@ -235,13 +165,6 @@ export class DepositFirstPageComponent {
|
||||||
this.zenodoInformation.name = "Zenodo";
|
this.zenodoInformation.name = "Zenodo";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {}
|
ngOnDestroy() {}
|
||||||
|
|
||||||
private handleError(message: string, error) {
|
|
||||||
console.error("Deposit Result Page: "+message, error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,9 @@ import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
import {PiwikServiceModule} from '../utils/piwik/piwikService.module';
|
import {PiwikServiceModule} from '../utils/piwik/piwikService.module';
|
||||||
import {HelperModule} from '../utils/helper/helper.module';
|
import {HelperModule} from '../utils/helper/helper.module';
|
||||||
import {IFrameModule} from '../utils/iframe.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 {DepositFirstPageComponent} from "./depositFirstPage.component";
|
import {DepositFirstPageComponent} from "./depositFirstPage.component";
|
||||||
import {ZenodoCommunitiesService} from "../connect/zenodoCommunities/zenodo-communities.service";
|
|
||||||
import {CommunityService} from "../connect/community/community.service";
|
|
||||||
import {SearchZenodoCommunitiesService} from "../connect/zenodoCommunities/searchZenodoCommunities.service";
|
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -22,7 +17,7 @@ import {SearchZenodoCommunitiesService} from "../connect/zenodoCommunities/searc
|
||||||
RouterModule,
|
RouterModule,
|
||||||
PiwikServiceModule,
|
PiwikServiceModule,
|
||||||
HelperModule,
|
HelperModule,
|
||||||
IFrameModule, Schema2jsonldModule, SEOServiceModule
|
Schema2jsonldModule, SEOServiceModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
DepositFirstPageComponent
|
DepositFirstPageComponent
|
||||||
|
@ -30,8 +25,6 @@ import {SearchZenodoCommunitiesService} from "../connect/zenodoCommunities/searc
|
||||||
exports: [
|
exports: [
|
||||||
DepositFirstPageComponent
|
DepositFirstPageComponent
|
||||||
],
|
],
|
||||||
providers: [
|
providers: []
|
||||||
ZenodoCommunitiesService, CommunityService, SearchZenodoCommunitiesService
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
export class DepositFirstPageModule { }
|
export class DepositFirstPageModule { }
|
||||||
|
|
|
@ -8,14 +8,8 @@ import {SearchFields} from '../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from '../searchPages/searchUtils/searchPage.component';
|
import {SearchPageComponent } from '../searchPages/searchUtils/searchPage.component';
|
||||||
import {SearchCustomFilter, SearchUtilsClass} from '../searchPages/searchUtils/searchUtils.class';
|
import {SearchCustomFilter, SearchUtilsClass} from '../searchPages/searchUtils/searchUtils.class';
|
||||||
import {EnvProperties} from '../utils/properties/env-properties';
|
import {EnvProperties} from '../utils/properties/env-properties';
|
||||||
import {ZenodoInformationClass} from "./utils/zenodoInformation.class";
|
|
||||||
import {ConnectHelper} from "../connect/connectHelper";
|
|
||||||
import {PiwikHelper} from "../../utils/piwikHelper";
|
|
||||||
import {CommunityService} from "../connect/community/community.service";
|
|
||||||
import {SearchZenodoCommunitiesService} from "../connect/zenodoCommunities/searchZenodoCommunities.service";
|
|
||||||
import {FetchZenodoInformation} from "../../deposit/utils/fetchZenodoInformation.class";
|
|
||||||
import {ZenodoCommunitiesService} from "../connect/zenodoCommunities/zenodo-communities.service";
|
|
||||||
import {StringUtils} from "../utils/string-utils.class";
|
import {StringUtils} from "../utils/string-utils.class";
|
||||||
|
import {ZenodoInformationClass} from "./utils/zenodoInformation.class";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-dataproviders',
|
selector: 'search-dataproviders',
|
||||||
|
@ -44,7 +38,8 @@ import {StringUtils} from "../utils/string-utils.class";
|
||||||
[usedBy]="'deposit'"
|
[usedBy]="'deposit'"
|
||||||
[showMoreFilterValuesInline]=true
|
[showMoreFilterValuesInline]=true
|
||||||
[filterValuesNum]=4
|
[filterValuesNum]=4
|
||||||
[lastIndex]=false>
|
[lastIndex]=false
|
||||||
|
[zenodoInformation]="zenodoInformation">
|
||||||
</search-page>
|
</search-page>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
@ -75,6 +70,8 @@ export class SearchDataprovidersToDepositComponent {
|
||||||
|
|
||||||
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
||||||
|
|
||||||
|
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService) {
|
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService) {
|
||||||
this.errorCodes = new ErrorCodes();
|
this.errorCodes = new ErrorCodes();
|
||||||
this.errorMessages = new ErrorMessagesComponent();
|
this.errorMessages = new ErrorMessagesComponent();
|
||||||
|
|
|
@ -2,15 +2,10 @@ import {Component, Input} from '@angular/core';
|
||||||
import {SearchResult} from '../utils/entities/searchResult';
|
import {SearchResult} from '../utils/entities/searchResult';
|
||||||
import {ErrorCodes} from '../utils/properties/errorCodes';
|
import {ErrorCodes} from '../utils/properties/errorCodes';
|
||||||
import {RouterHelper} from '../utils/routerHelper.class';
|
import {RouterHelper} from '../utils/routerHelper.class';
|
||||||
import{EnvProperties} from '../utils/properties/env-properties';
|
import {EnvProperties} from '../utils/properties/env-properties';
|
||||||
import {ZenodoCommunitiesService} from "../connect/zenodoCommunities/zenodo-communities.service";
|
|
||||||
import {CommunityService} from "../connect/community/community.service";
|
|
||||||
import {SearchZenodoCommunitiesService} from "../connect/zenodoCommunities/searchZenodoCommunities.service";
|
|
||||||
import {ZenodoInformationClass} from "./utils/zenodoInformation.class";
|
import {ZenodoInformationClass} from "./utils/zenodoInformation.class";
|
||||||
import {FetchZenodoInformation} from "../../deposit/utils/fetchZenodoInformation.class";
|
|
||||||
import {ConnectHelper} from "../connect/connectHelper";
|
|
||||||
import {PiwikHelper} from "../../utils/piwikHelper";
|
|
||||||
import {ActivatedRoute} from "@angular/router";
|
import {ActivatedRoute} from "@angular/router";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'deposit-result',
|
selector: 'deposit-result',
|
||||||
templateUrl:'searchResultsInDeposit.component.html'
|
templateUrl:'searchResultsInDeposit.component.html'
|
||||||
|
@ -20,10 +15,6 @@ export class SearchResultsInDepositComponent {
|
||||||
@Input() results: SearchResult[];
|
@Input() results: SearchResult[];
|
||||||
@Input() status: number;
|
@Input() status: number;
|
||||||
@Input() type: string;
|
@Input() type: string;
|
||||||
@Input() showLoading: boolean = false;
|
|
||||||
@Input() showSubjects: boolean = false;
|
|
||||||
@Input() showOrganizations: boolean = true;
|
|
||||||
@Input() custom_class: string = "search-results";
|
|
||||||
@Input() properties:EnvProperties;
|
@Input() properties:EnvProperties;
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,18 +24,11 @@ export class SearchResultsInDepositComponent {
|
||||||
public routerHelper:RouterHelper = new RouterHelper();
|
public routerHelper:RouterHelper = new RouterHelper();
|
||||||
public errorMessage: string = "No results found";
|
public errorMessage: string = "No results found";
|
||||||
|
|
||||||
public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
|
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
|
||||||
fetchZenodoInformation: FetchZenodoInformation;
|
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute,
|
constructor (private route: ActivatedRoute) {}
|
||||||
private _ΖenodoCommunitieService: ZenodoCommunitiesService,
|
|
||||||
private _communityService: CommunityService,
|
|
||||||
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
|
|
||||||
this.fetchZenodoInformation = new FetchZenodoInformation(this._ΖenodoCommunitieService, this._searchZenodoCommunitiesService);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
if(this.type == "publication") {
|
if(this.type == "publication") {
|
||||||
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedPublications;
|
this.linkToAdvancedSearchPage = this.properties.searchLinkToAdvancedPublications;
|
||||||
this.urlParam = "articleId";
|
this.urlParam = "articleId";
|
||||||
|
@ -68,36 +52,13 @@ export class SearchResultsInDepositComponent {
|
||||||
this.urlParam = "datasourceId";
|
this.urlParam = "datasourceId";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.data
|
||||||
let communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||||
if (!communityId) {
|
this.properties = data.envSpecific;
|
||||||
communityId = params['communityId'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (communityId) {
|
if (!this.zenodoInformation) {
|
||||||
|
this.zenodoInformation = new ZenodoInformationClass();
|
||||||
if (communityId != null && communityId != '') {
|
|
||||||
|
|
||||||
this._communityService.getCommunity(this.properties, this.properties.communityAPI + communityId).subscribe(
|
|
||||||
community => {
|
|
||||||
var community = community;
|
|
||||||
var masterZenodoCommunityId = community.zenodoCommunity;
|
|
||||||
if (masterZenodoCommunityId) {
|
|
||||||
this.zenodoInformation.shareInZenodoUrl = this.properties.shareInZenodoPage+communityId;
|
|
||||||
//this.fetchZenodoInformation.getZenodoCommunityNameAndUrlById(masterZenodoCommunityId, this.properties, this.zenodoInformation);
|
|
||||||
} else {
|
|
||||||
this.zenodoInformation.url = this.properties.zenodo;
|
|
||||||
this.zenodoInformation.name = "Zenodo";
|
|
||||||
}
|
}
|
||||||
//this.fetchZenodoInformation.searchNumberOfZCommunities(communityId, this.properties, this.zenodoInformation);
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
this.handleError("Error getting community with id: " + communityId, error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.zenodoInformation.shareInZenodoUrl) {
|
if (!this.zenodoInformation.shareInZenodoUrl) {
|
||||||
this.zenodoInformation.url = this.properties.zenodo;
|
this.zenodoInformation.url = this.properties.zenodo;
|
||||||
}
|
}
|
||||||
|
@ -105,15 +66,9 @@ export class SearchResultsInDepositComponent {
|
||||||
this.zenodoInformation.name = "Zenodo";
|
this.zenodoInformation.name = "Zenodo";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public quote(params: string):string {
|
public quote(params: string):string {
|
||||||
return '"'+params+'"';
|
return '"'+params+'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError(message: string, error) {
|
|
||||||
console.error("search Results in Deposit page: "+message, error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,19 +170,20 @@
|
||||||
[results]="results"
|
[results]="results"
|
||||||
[status]="searchUtils.status"
|
[status]="searchUtils.status"
|
||||||
[type]="entityType"
|
[type]="entityType"
|
||||||
[showLoading]="true" [(properties)]=properties>
|
[showLoading]="true" [properties]=properties>
|
||||||
</search-result>
|
</search-result>
|
||||||
<deposit-result *ngIf="usedBy == 'deposit'"
|
<deposit-result *ngIf="usedBy == 'deposit'"
|
||||||
[results]="results"
|
[results]="results"
|
||||||
[status]="searchUtils.status"
|
[status]="searchUtils.status"
|
||||||
[type]="entityType"
|
[type]="entityType"
|
||||||
[showLoading]="true" [(properties)]=properties>
|
[zenodoInformation]="zenodoInformation"
|
||||||
|
[properties]=properties>
|
||||||
</deposit-result>
|
</deposit-result>
|
||||||
<community-search-result *ngIf="entityType == 'community' && !tableView && usedBy == 'search'"
|
<community-search-result *ngIf="entityType == 'community' && !tableView && usedBy == 'search'"
|
||||||
[results]="results"
|
[results]="results"
|
||||||
[status]="searchUtils.status"
|
[status]="searchUtils.status"
|
||||||
[type]="entityType"
|
[type]="entityType"
|
||||||
[showLoading]="true" [(properties)]=properties>
|
[showLoading]="true" [properties]=properties>
|
||||||
</community-search-result>
|
</community-search-result>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import {PiwikService} from '../../utils/piwik/piwik.service';
|
||||||
import {EnvProperties} from '../../utils/properties/env-properties';
|
import {EnvProperties} from '../../utils/properties/env-properties';
|
||||||
import { SEOService } from '../../sharedComponents/SEO/SEO.service';
|
import { SEOService } from '../../sharedComponents/SEO/SEO.service';
|
||||||
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
||||||
|
import {ZenodoInformationClass} from "../../deposit/utils/zenodoInformation.class";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-page',
|
selector: 'search-page',
|
||||||
|
@ -33,6 +34,7 @@ export class SearchPageComponent {
|
||||||
@Input() usedBy: string = "search";
|
@Input() usedBy: string = "search";
|
||||||
@Input() showMoreFilterValuesInline: boolean = false;
|
@Input() showMoreFilterValuesInline: boolean = false;
|
||||||
@Input() filterValuesNum: number = 5;
|
@Input() filterValuesNum: number = 5;
|
||||||
|
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
|
||||||
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
@Input() searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
||||||
@Output() queryChange = new EventEmitter();
|
@Output() queryChange = new EventEmitter();
|
||||||
@Input() baseUrl:string = '';
|
@Input() baseUrl:string = '';
|
||||||
|
|
Loading…
Reference in New Issue