[plugins-functionality | DONE | FIX] initialize properly view for master zenodo community
This commit is contained in:
parent
ed512f6f05
commit
b12ce55b20
|
@ -22,7 +22,6 @@
|
|||
<div *ngIf="searchUtils.status == errorCodes.LOADING" class="uk-position-center">
|
||||
<loading></loading>
|
||||
</div>
|
||||
{{selectedCommunities.length}} {{previewCommunities.length}}
|
||||
<div *ngIf="searchUtils.status !== errorCodes.LOADING">
|
||||
<div *ngIf="previewCommunities.length == 0"
|
||||
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
||||
|
|
|
@ -61,26 +61,13 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
|
|||
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Zenodo Communities');
|
||||
this.masterZenodoCommunityId = this.community.zenodoCommunity;
|
||||
this.selectedCommunities = [];
|
||||
if (this.masterZenodoCommunityId) {
|
||||
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties,
|
||||
this.masterZenodoCommunityId).subscribe(
|
||||
result => {
|
||||
this.masterZenodoCommunity = result;
|
||||
this.selectedCommunities.unshift(this.masterZenodoCommunity);
|
||||
},
|
||||
error => {
|
||||
const emptyCommunity: ZenodoCommunityInfo = new ZenodoCommunityInfo();
|
||||
emptyCommunity.id = this.masterZenodoCommunityId;
|
||||
emptyCommunity.title = this.masterZenodoCommunityId;
|
||||
this.masterZenodoCommunity = emptyCommunity;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
|
||||
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
|
||||
// this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.community.communityId).subscribe(
|
||||
// result => {
|
||||
|
||||
this.selectedCommunityIds = this.community.otherZenodoCommunities;
|
||||
if(this.masterZenodoCommunityId){
|
||||
this.selectedCommunityIds.unshift(this.masterZenodoCommunityId)
|
||||
}
|
||||
this.zenodoSearchUtils.totalResults = this.selectedCommunityIds.length;
|
||||
if (this.selectedCommunityIds.length === 0) {
|
||||
this.zenodoSearchUtils.status = this.errorCodes.NONE;
|
||||
|
@ -90,12 +77,6 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
|
|||
this.selectedCommunityIds[i]);
|
||||
}
|
||||
|
||||
// },
|
||||
// error => {
|
||||
// console.log('list of zenodo communities couldn\'t be loaded');
|
||||
// this.zenodoSearchUtils.status = this.errorCodes.DONE;
|
||||
// }
|
||||
// );
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -116,13 +97,18 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
|
|||
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties,
|
||||
zenodoid).subscribe(
|
||||
result => {
|
||||
if(zenodoid == this.masterZenodoCommunityId){
|
||||
this.masterZenodoCommunity = result;
|
||||
result.master = true;
|
||||
this.selectedCommunities.unshift(result);
|
||||
}else {
|
||||
this.selectedCommunities.push(result);
|
||||
}
|
||||
this.zenodocommunitiesloadedCount++;
|
||||
if (this.zenodocommunitiesloadedCount >= this.selectedCommunityIds.length) {
|
||||
this.zenodoSearchUtils.status = this.errorCodes.DONE;
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
error => {
|
||||
const emptyCommunity: ZenodoCommunityInfo = new ZenodoCommunityInfo();
|
||||
|
|
Loading…
Reference in New Issue