Revision 57323
Added by Konstantinos Triantafyllou over 4 years ago
home.component.ts | ||
---|---|---|
23 | 23 |
public piwiksub: any; |
24 | 24 |
|
25 | 25 |
public pageTitle = "OpenAIRE | Monitor"; |
26 |
public researchCommunities = []; |
|
27 |
public gifs: { "gif": string, "header": string, "text" }[] = []; |
|
28 | 26 |
public pageContents = null; |
29 | 27 |
public divContents = null; |
30 |
// Message variables |
|
31 | 28 |
public status: number; |
32 | 29 |
public loading: boolean = true; |
33 | 30 |
public subscriberErrorMessage: string = ""; |
... | ... | |
44 | 41 |
private _meta: Meta, |
45 | 42 |
private _title: Title, |
46 | 43 |
private _piwikService: PiwikService, |
47 |
private _communitiesService: CommunitiesService, |
|
48 |
private _subscribeService: SubscribeService, |
|
49 | 44 |
private helper: HelperService, |
50 | 45 |
private seoService: SEOService) { |
51 | 46 |
|
... | ... | |
72 | 67 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
73 | 68 |
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE Monitor", this.properties.piwikSiteId).subscribe(); |
74 | 69 |
} |
75 |
this.getCommunities(); |
|
76 |
this.createGifs(); |
|
77 | 70 |
//this.getDivContents(); |
78 | 71 |
this.getPageContents(); |
79 | 72 |
}); |
... | ... | |
91 | 84 |
}) |
92 | 85 |
} |
93 | 86 |
|
94 |
public getCommunities() { |
|
95 |
this.loading = true; |
|
96 |
this.status = this.errorCodes.LOADING; |
|
97 |
this.subscriberErrorMessage = ""; |
|
98 |
|
|
99 |
this.researchCommunities = []; |
|
100 |
|
|
101 |
this._communitiesService.getCommunitiesState().subscribe( |
|
102 |
communitiesResults => { |
|
103 |
if(!communitiesResults){ |
|
104 |
return; |
|
105 |
} |
|
106 |
if(communitiesResults.length == 0) { |
|
107 |
this.status = this.errorCodes.DONE; |
|
108 |
return; |
|
109 |
} |
|
110 |
this.sort(communitiesResults); |
|
111 |
communitiesResults.forEach((community, index) => { |
|
112 |
let showCommunity: boolean = true; |
|
113 |
if (community['status'] == "hidden" || community['status'] == "manager") { |
|
114 |
showCommunity = false; |
|
115 |
} |
|
116 |
if (showCommunity) { |
|
117 |
this.researchCommunities.push(community); |
|
118 |
} |
|
119 |
this.status = this.errorCodes.DONE; |
|
120 |
}); |
|
121 |
this.loading = false; |
|
122 |
}, |
|
123 |
error => { |
|
124 |
this.status = this.handleError("Error getting communities", error); |
|
125 |
this.loading = false; |
|
126 |
} |
|
127 |
); |
|
128 |
} |
|
129 |
|
|
130 |
private createGifs() { |
|
131 |
this.gifs.push({ |
|
132 |
gif: "assets/connect-assets/home/gifs/deposit.gif", |
|
133 |
header: "Find a repository to deposit your research outcome", |
|
134 |
text: "This is OpenAIRE’s key service for research communities, both established and emerging ones. Our service helps you reach out and engage all your researchers to practice open science out-of-the-box." |
|
135 |
}); |
|
136 |
this.gifs.push({ |
|
137 |
gif: "assets/connect-assets/home/gifs/link.gif", |
|
138 |
header: "Link your research output with your community, funding, and other research products", |
|
139 |
text: "This is OpenAIRE’s key service for research communities, both established and emerging ones. Our service helps you reach out and engage all your researchers to practice open science out-of-the-box." |
|
140 |
}); |
|
141 |
this.gifs.push({ |
|
142 |
gif: "assets/connect-assets/home/gifs/overview.gif", |
|
143 |
header: "View community's overview at a glance", |
|
144 |
text: "This is OpenAIRE’s key service for research communities, both established and emerging ones. Our service helps you reach out and engage all your researchers to practice open science out-of-the-box." |
|
145 |
}); |
|
146 |
this.gifs.push({ |
|
147 |
gif: "assets/connect-assets/home/gifs/results.gif", |
|
148 |
header: "Search & browse your community's research products. ", |
|
149 |
text: "This is OpenAIRE’s key service for research communities, both established and emerging ones. Our service helps you reach out and engage all your researchers to practice open science out-of-the-box." |
|
150 |
}); |
|
151 |
this.gifs.push({ |
|
152 |
gif: "assets/connect-assets/home/gifs/graph-analysis.gif", |
|
153 |
header: "View statistics for your community's research products.", |
|
154 |
text: "This is OpenAIRE’s key service for research communities, both established and emerging ones. Our service helps you reach out and engage all your researchers to practice open science out-of-the-box." |
|
155 |
}); |
|
156 |
} |
|
157 |
|
|
158 |
private sort(results: CommunityInfo[]) { |
|
159 |
results.sort((left, right): number => { |
|
160 |
if (!right.date || left.date > right.date) { |
|
161 |
return -1; |
|
162 |
} else if (!left.date || left.date < right.date) { |
|
163 |
return 1; |
|
164 |
} else { |
|
165 |
if (left.title > right.title) { |
|
166 |
return 1; |
|
167 |
} else if (left.title < right.title) { |
|
168 |
return -1; |
|
169 |
} else { |
|
170 |
return 0; |
|
171 |
} |
|
172 |
} |
|
173 |
}) |
|
174 |
} |
|
175 |
|
|
176 | 87 |
public quote(param: string): string { |
177 | 88 |
return StringUtils.quote(param); |
178 | 89 |
} |
Also available in: Unified diff
[Monitor]: Delete connect folders