Revision 49691
Added by Antonis Lempesis over 6 years ago
MetricsForDatasourceWidget.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import com.google.gwt.core.client.GWT; |
4 | 4 |
import com.google.gwt.dom.client.Document; |
5 |
import com.google.gwt.user.client.History; |
|
5 | 6 |
import com.google.gwt.user.client.rpc.AsyncCallback; |
6 | 7 |
import com.google.gwt.user.client.ui.FlowPanel; |
7 | 8 |
import com.google.gwt.user.client.ui.Frame; |
8 | 9 |
import com.google.gwt.user.client.ui.HTML; |
9 |
import com.google.gwt.user.client.ui.Widget; |
|
10 | 10 |
import eu.dnetlib.domain.data.Repository; |
11 | 11 |
import eu.dnetlib.gwt.client.help.HelpService; |
12 | 12 |
import eu.dnetlib.gwt.client.help.HelpServiceAsync; |
13 | 13 |
import eu.dnetlib.repo.manager.client.AbstractRepositoryManagerWidget; |
14 | 14 |
import eu.dnetlib.repo.manager.client.HelpCallback; |
15 |
import eu.dnetlib.repo.manager.client.RepositoryManager; |
|
16 | 15 |
import eu.dnetlib.repo.manager.client.RepositoryManagerWidget; |
17 | 16 |
import eu.dnetlib.repo.manager.client.services.RepositoryService; |
18 | 17 |
import eu.dnetlib.repo.manager.client.services.RepositoryServiceAsync; |
... | ... | |
88 | 87 |
@Override |
89 | 88 |
public void onSuccess(final Repository repository) { |
90 | 89 |
|
91 |
// RepositoryManager.pageHeader.clear(); |
|
92 |
// |
|
93 |
// String logoURLSource = ""; |
|
94 |
// if(repository.getLogoUrl()==null || repository.getLogoUrl().isEmpty()) |
|
95 |
// logoURLSource = "img/yourLogoHere.jpg"; |
|
96 |
// else |
|
97 |
// logoURLSource = repository.getLogoUrl(); |
|
98 |
// |
|
99 |
// RepositoryManager.pageHeader.add(new HTML("<div class=\"col-sm-9\"><h2><img src=\"" + logoURLSource + "\" alt=[Repo Logo]" + |
|
100 |
// "width=\"35px\" height=\"35px\" style=\"margin-right: 15px; margin-top:-2px\">" + repository.getOfficialName() + "</h2>" + |
|
101 |
// "<ol class=\"breadcrumb\"><li><a href=\"#dashboard\">Home</a></li><li><a href=\"#" + parentToken + |
|
102 |
// "\">Metrics</a></li><li class=\"active\"><strong>" + repository.getOfficialName() + |
|
103 |
// "</strong></li></ol></div><div class=\"col-sm-3\"></div>")); |
|
104 |
|
|
105 | 90 |
repositoryService.getPiwikSiteForRepository(repository.getId(), new AsyncCallback<PiwikInfo>() { |
106 | 91 |
|
107 | 92 |
@Override |
... | ... | |
126 | 111 |
EnableMetricsWidget enableMetricsWidget = new EnableMetricsWidget(repository); |
127 | 112 |
metricsForDatasourceBoxContent.add(enableMetricsWidget.asWidget()); |
128 | 113 |
|
129 |
} else { |
|
114 |
} else if(!piwikInfo.isApproved()) {
|
|
130 | 115 |
|
131 |
// HTML readInstructions = new HTML("<div><a href=\"#getImpact/instructions/" + repository.getId() + "\">" + |
|
132 |
// "<img src=\"https://maxcdn.icons8.com/Share/icon/Very_Basic//info1600.png\"></a></div>"); |
|
133 |
// metricsForDatasourceBoxContent.add(readInstructions); |
|
116 |
History.replaceItem("getImpact/instructions/" + repository.getId()); |
|
134 | 117 |
|
135 |
// Alert info = new Alert(); |
|
136 |
// info.setType(AlertType.INFO); |
|
137 |
// info.setDismissable(false); |
|
138 |
// info.setText("Piwik info found for this repository with siteid = " + piwikInfo.getSiteId()); |
|
139 |
// metricsForDatasourceBoxContent.add(info); |
|
140 |
// show metrics |
|
118 |
} else { |
|
141 | 119 |
|
142 |
metricsForDatasourceBoxContent.add(createMetricsPanel(repository));
|
|
120 |
metricsForDatasourceBoxContent.add(createMetricsPanel(piwikInfo));
|
|
143 | 121 |
} |
144 | 122 |
} |
145 | 123 |
}); |
... | ... | |
158 | 136 |
|
159 | 137 |
} |
160 | 138 |
|
161 |
private FlowPanel createMetricsPanel(Repository repository) {
|
|
139 |
private FlowPanel createMetricsPanel(PiwikInfo piwikInfo) {
|
|
162 | 140 |
|
163 | 141 |
FlowPanel metricsPanel = new FlowPanel(); |
164 | 142 |
|
165 |
String datasourcesMonthlyViewsURL = "http://vatopedi.di.uoa.gr/stats2/merge.php?com=query&data=[{\"query\":\"dtsrcOpenAIRETimeline\", " + |
|
166 |
"\"dtsrcName\":\"" + repository.getId() + "\", \"table\":\"\",\"fields\":[{\"fld\":\"sum\",\"agg\":\"sum\",\"type\":\"column\"," + |
|
167 |
"\"yaxis\":1,\"c\":false}],\"xaxis\":{\"name\":\"month\",\"agg\":\"sum\"},\"group\":\"\",\"color\":\"\",\"type\":\"chart\"," + |
|
168 |
"\"size\":30,\"sort\":\"xaxis\",\"xStyle\":{\"r\":0,\"s\":\"0\",\"l\":\"-\",\"ft\":\"-\",\"wt\":\"-\"},\"title\":\"\"," + |
|
169 |
"\"subtitle\":\"\",\"xaxistitle\":\"OpenAIRE\",\"yaxisheaders\":[\"Monthly views\"],\"generalxaxis\":\"\",\"theme\":0," + |
|
170 |
"\"in\":[],\"filters\":[{\"name\":\"\",\"values\":[\"\"],\"to\":\"-1\"}]},{\"query\":\"dtsrcRepoTimeline\", " + |
|
171 |
"\"dtsrcName\":\"" + repository.getId() + "\", \"table\":\"\",\"fields\":[{\"fld\":\"sum\"," + |
|
172 |
"\"agg\":\"sum\",\"type\":\"column\",\"yaxis\":1,\"c\":false}],\"xaxis\":{\"name\":\"month\",\"agg\":\"sum\"}," + |
|
173 |
"\"group\":\" \",\"color\":\"\",\"type\":\"chart\",\"size\":30,\"sort\":\"xaxis\",\"xStyle\":{\"r\":0,\"s\":\"0\"," + |
|
174 |
"\"l\":\"-\",\"ft\":\"-\",\"wt\":\"-\"},\"title\":\"\",\"subtitle\":\"\",\"xaxistitle\":\"Repository\",\"yaxisheaders\"" + |
|
175 |
":[\"\"],\"generalxaxis\":\"\",\"theme\":0,\"in\":[],\"filters\":[{\"name\":\"\",\"values\":[\"\"],\"to\":\"-1\"}]}]" + |
|
176 |
"&info_types=[\"column\",\"column\"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{\"color\":" + |
|
177 |
"\"rgba(0, 0, 0, 1)\",\"size\":\"18\"},{\"color\":\"rgba(0, 0, 0, 1)\",\"size\":\"18\"},{\"color\":\"000000\",\"size\":" + |
|
178 |
"\"\"},{\"color\":\"000000\",\"size\":\"\"}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=" + |
|
179 |
"rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)" + |
|
180 |
"&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba" + |
|
181 |
"(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false"; |
|
143 |
String datasourcesMonthlyViewsURL = "https://beta.openaire.eu/stats3/merge.php?com=query&data=[{\"query\":\"dtsrcRepoViews\"," + |
|
144 |
"\"dtsrcName\":\"" + piwikInfo.getOpenaireId() + "\",\"table\":\"\",\"fields\":[{\"fld\":\"sum\",\"agg\":\"sum\"," + |
|
145 |
"\"type\":\"chart\",\"yaxis\":1,\"c\":false}],\"xaxis\":{\"name\":\"month\",\"agg\":\"sum\"},\"group\":\"\",\"color\":\"\"," + |
|
146 |
"\"type\":\"chart\",\"size\":30,\"sort\":\"xaxis\",\"xStyle\":{\"r\":-30,\"s\":\"0\",\"l\":\"-\",\"ft\":\"-\",\"wt\":\"-\"}," + |
|
147 |
"\"title\":\"\",\"subtitle\":\"\",\"xaxistitle\":\"\",\"yaxisheaders\":[\"Monthly views\"],\"generalxaxis\":\"\"," + |
|
148 |
"\"theme\":0,\"in\":[]}]&info_types=[\"spline\"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&" + |
|
149 |
"style=[{\"color\":\"rgba(0, 0, 0, 1)\",\"size\":\"18\"},{\"color\":\"rgba(0, 0, 0, 1)\",\"size\":\"18\"}," + |
|
150 |
"{\"color\":\"000000\",\"size\":\"\"},{\"color\":\"000000\",\"size\":\"\"}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124,\n" + |
|
151 |
"181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125,\n" + |
|
152 |
"1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233,\n" + |
|
153 |
"1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84,\n" + |
|
154 |
"1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91,\n" + |
|
155 |
"1)&colors[]=rgba(145, 232, 225,\n" + |
|
156 |
"1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false"; |
|
182 | 157 |
|
183 | 158 |
Frame datasourcesMonthlyViews = new Frame(datasourcesMonthlyViewsURL); |
184 | 159 |
datasourcesMonthlyViews.setStyleName("statsFrame"); |
185 | 160 |
|
186 | 161 |
FlowPanel monthlyViewsPanel = new FlowPanel(); |
187 |
monthlyViewsPanel.addStyleName("uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium uk-margin-bottom"); |
|
162 |
monthlyViewsPanel.addStyleName("uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview " + |
|
163 |
"uk-animation-slide-top-medium uk-margin-bottom uk-padding"); |
|
188 | 164 |
monthlyViewsPanel.add(datasourcesMonthlyViews); |
189 | 165 |
metricsPanel.add(monthlyViewsPanel); |
190 | 166 |
|
191 |
String datasourcesMonthlyDownloadsURL = "http://vatopedi.di.uoa.gr/stats2/merge.php?com=query&data=[{\"query\":" +
|
|
192 |
"\"dtsrcDownloadsTimeline\",\"dtsrcName\":\"" + repository.getId() + "\",\"table\":\"\",\"fields\":[{\"fld\":\"sum\"," +
|
|
167 |
String datasourcesMonthlyDownloadsURL = "https://beta.openaire.eu/stats3/merge.php?com=query&data=[{\"query\":\"dtsrcRepoDownloads\"," +
|
|
168 |
"\"dtsrcName\":\"" + piwikInfo.getOpenaireId() + "\",\"table\":\"\",\"fields\":[{\"fld\":\"sum\"," +
|
|
193 | 169 |
"\"agg\":\"sum\",\"type\":\"chart\",\"yaxis\":1,\"c\":false}],\"xaxis\":{\"name\":\"month\",\"agg\":\"sum\"}," + |
194 |
"\"group\":\"\",\"color\":\"\",\"type\":\"chart\",\"size\":30,\"sort\":\"xaxis\",\"xStyle\":{\"r\":0,\"s\":\"0\"," + |
|
195 |
"\"l\":\"-\",\"ft\":\"-\",\"wt\":\"-\"},\"title\":\"\",\"subtitle\":\"\",\"xaxistitle\":\"\",\"yaxisheaders\":" + |
|
196 |
"[\"Monthly downloads\"],\"generalxaxis\":\"\",\"theme\":0,\"in\":[]}]&info_types=[\"spline\"]&stacking=&steps=false&" + |
|
197 |
"fontFamily=Courier&spacing=[5,0,0,0]&style=[{\"color\":\"rgba(0, 0, 0, 1)\",\"size\":\"18\"},{\"color\":\"" + |
|
198 |
"rgba(0, 0, 0, 1)\",\"size\":\"18\"},{\"color\":\"000000\",\"size\":\"\"},{\"color\":\"000000\",\"size\":\"\"}]" + |
|
199 |
"&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=" + |
|
200 |
"rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)" + |
|
201 |
"&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=" + |
|
202 |
"rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false"; |
|
170 |
"\"group\":\"\",\"color\":\"\",\"type\":\"chart\",\"size\":30,\"sort\":\"xaxis\",\"xStyle\":{\"r\":-30,\"s\":\"0\",\"l\":\"-\"," + |
|
171 |
"\"ft\":\"-\",\"wt\":\"-\"},\"title\":\"\",\"subtitle\":\"\",\"xaxistitle\":\"\",\"yaxisheaders\":[\"Monthly\n" + |
|
172 |
"downloads\"],\"generalxaxis\":\"\",\"theme\":0,\"in\":[]}]&info_types=[\"spline\"]&stacking=&steps=false&fontFamily=Courier&" + |
|
173 |
"spacing=[5,0,0,0]&style=[{\"color\":\"rgba(0, 0, 0, 1)\",\"size\":\"18\"},{\"color\":\"rgba(0, 0, 0,\n" + |
|
174 |
"1)\",\"size\":\"18\"},{\"color\":\"000000\",\"size\":\"\"},{\"color\":\"000000\",\"size\":\"\"}]&backgroundColor=" + |
|
175 |
"rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125,\n" + |
|
176 |
"1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233,\n" + |
|
177 |
"1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84,\n" + |
|
178 |
"1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91,\n" + |
|
179 |
"1)&colors[]=rgba(145, 232, 225,\n" + |
|
180 |
"1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false"; |
|
203 | 181 |
|
204 | 182 |
Frame datasourcesMonthlyDownloads = new Frame(datasourcesMonthlyDownloadsURL); |
205 | 183 |
datasourcesMonthlyDownloads.setStyleName("statsFrame"); |
206 | 184 |
|
207 | 185 |
FlowPanel monthlyDownloadsPanel = new FlowPanel(); |
208 |
monthlyDownloadsPanel.addStyleName("uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview uk-animation-slide-top-medium uk-margin-bottom"); |
|
186 |
monthlyDownloadsPanel.addStyleName("uk-text-center uk-card uk-card-default uk-card-hover uk-scrollspy-inview " + |
|
187 |
"uk-animation-slide-top-medium uk-margin-bottom uk-padding"); |
|
209 | 188 |
monthlyDownloadsPanel.add(datasourcesMonthlyDownloads); |
210 | 189 |
metricsPanel.add(monthlyDownloadsPanel); |
211 | 190 |
|
Also available in: Unified diff
svn merge -r49522:HEAD https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-repository-manager-gui/trunk .