Revision 60288
Added by Argiro Kokogiannaki about 3 years ago
shareInZenodo.component.ts | ||
---|---|---|
45 | 45 |
|
46 | 46 |
communityIds = null; |
47 | 47 |
communities = []; |
48 |
|
|
48 |
page = 1; |
|
49 |
size = 5; |
|
49 | 50 |
zenodoCommunitiesLoadedCount = 0; |
50 | 51 |
zenodoSearchUtils: SearchUtilsClass = new SearchUtilsClass(); |
51 | 52 |
errorCodes: ErrorCodes = new ErrorCodes(); |
... | ... | |
125 | 126 |
if (this.communityIds.length == 0) { |
126 | 127 |
this.zenodoSearchUtils.status = this.errorCodes.NONE; |
127 | 128 |
} |
128 |
for (let i = 0; i < this.communityIds.length; i++) { |
|
129 |
this.getZenodoCommunityById(this.communityIds[i]["zenodoid"], this.communityIds[i]["id"]); |
|
130 |
} |
|
129 |
this.getCommunities() |
|
131 | 130 |
|
132 | 131 |
}, |
133 | 132 |
error => { |
... | ... | |
186 | 185 |
getZenodoCommunityById(zenodoid, openaireId) { |
187 | 186 |
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe( |
188 | 187 |
result => { |
189 |
this.communities.push(result);
|
|
188 |
this.communities[zenodoid] = result;
|
|
190 | 189 |
this.zenodoCommunitiesLoadedCount++; |
191 |
if (this.zenodoCommunitiesLoadedCount >= this.communityIds.length) { |
|
190 |
if (this.zenodoCommunitiesLoadedCount >= this.communityIds.length || this.page * this.size) {
|
|
192 | 191 |
this.zenodoSearchUtils.status = this.errorCodes.DONE; |
193 | 192 |
} |
194 | 193 |
|
... | ... | |
214 | 213 |
private handleError(message: string, error) { |
215 | 214 |
console.error("Share in Zenodo Page: " + message, error); |
216 | 215 |
} |
216 |
public getCommunities($event = {value:1}) { |
|
217 |
this.page = $event.value; |
|
218 |
for (let i = (this.page - 1 ) * this.size; i < this.communityIds.length && i< this.page * this.size; i++) { |
|
219 |
if(!this.communities[this.communityIds[i]["zenodoid"]]) { |
|
220 |
this.getZenodoCommunityById(this.communityIds[i]["zenodoid"], this.communityIds[i]["id"]); |
|
221 |
} |
|
222 |
} |
|
223 |
} |
|
224 |
|
|
217 | 225 |
} |
Also available in: Unified diff
[Connect|Trunk]
Zenodo communities: paging for zenodo communites