diff --git a/src/app/pages/zenodo-communities/manage-zenodo-communities.component.html b/src/app/pages/zenodo-communities/manage-zenodo-communities.component.html
index 1f14450..5bf8d9d 100644
--- a/src/app/pages/zenodo-communities/manage-zenodo-communities.component.html
+++ b/src/app/pages/zenodo-communities/manage-zenodo-communities.component.html
@@ -22,7 +22,6 @@
diff --git a/src/app/pages/zenodo-communities/zenodo-communities.component.ts b/src/app/pages/zenodo-communities/zenodo-communities.component.ts
index 8a3de95..7486032 100644
--- a/src/app/pages/zenodo-communities/zenodo-communities.component.ts
+++ b/src/app/pages/zenodo-communities/zenodo-communities.component.ts
@@ -42,7 +42,7 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
zenodoSearchUtils: SearchUtilsClass = new SearchUtilsClass();
public errorCodes: ErrorCodes = new ErrorCodes();
subscriptions = [];
- @ViewChild('fsModal', { static: true }) fullscreen: FullScreenModalComponent;
+ @ViewChild('fsModal', {static: true}) fullscreen: FullScreenModalComponent;
@ViewChild(ManageZenodoCommunitiesComponent) manage: ManageZenodoCommunitiesComponent;
public showLoadingInRemove: boolean = true;
@@ -50,7 +50,7 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
private _zenodoCommunitieService: ZenodoCommunitiesService, private title: Title,
private _communityService: CommunityService) {
}
-
+
ngOnInit() {
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this.properties = properties;
@@ -61,41 +61,22 @@ 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;
- this.zenodoSearchUtils.totalResults = this.selectedCommunityIds.length;
- if (this.selectedCommunityIds.length === 0) {
- this.zenodoSearchUtils.status = this.errorCodes.NONE;
- }
- for (let i = 0; i < this.selectedCommunityIds.length; i++) {
- this.getZenodoCommunityById(
- this.selectedCommunityIds[i]);
- }
- // },
- // error => {
- // console.log('list of zenodo communities couldn\'t be loaded');
- // this.zenodoSearchUtils.status = this.errorCodes.DONE;
- // }
- // );
+ this.zenodoSearchUtils.status = this.errorCodes.LOADING;
+
+ 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;
+ }
+ for (let i = 0; i < this.selectedCommunityIds.length; i++) {
+ this.getZenodoCommunityById(
+ this.selectedCommunityIds[i]);
+ }
+
})
);
@@ -103,7 +84,7 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
this.fullscreen.okButtonText = "Done";
this.fullscreen.okButton = true;
}
-
+
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscription) {
@@ -111,18 +92,23 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
}
});
}
-
+
getZenodoCommunityById(zenodoid) {
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties,
- zenodoid).subscribe(
+ zenodoid).subscribe(
result => {
- this.selectedCommunities.push(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();