Project

General

Profile

« Previous | Next » 

Revision 48932

View differences:

MetricsForDatasourceWidget.java
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
import eu.dnetlib.repo.manager.client.AbstractRepositoryManagerWidget;
13 14
import eu.dnetlib.repo.manager.client.HelpCallback;
14 15
import eu.dnetlib.repo.manager.client.RepositoryManager;
15 16
import eu.dnetlib.repo.manager.client.RepositoryManagerWidget;
......
22 23
/**
23 24
 * Created by stefania on 12/15/16.
24 25
 */
25
public class MetricsForDatasourceWidget implements RepositoryManagerWidget {
26
public class MetricsForDatasourceWidget extends AbstractRepositoryManagerWidget implements RepositoryManagerWidget {
26 27

  
27 28
    private String parentToken = "";
28 29
    private String restToken = "";
29 30

  
30
    private FlowPanel metricsForDatasourcePanel = new FlowPanel();
31

  
32
    private FlowPanel metricsForDatasourceColPanel = new FlowPanel();
33
    private FlowPanel metricsForDatasourceInnerPanel = new FlowPanel();
34
    private FlowPanel metricsForDatasourceBox = new FlowPanel();
35 31
    private FlowPanel metricsForDatasourceBoxContent = new FlowPanel();
36 32

  
37 33
    private Alert errorAlert = new Alert();
38 34

  
39
    private FlowPanel helpPanel = new FlowPanel();
40

  
41 35
    private RepositoryServiceAsync repositoryService = GWT.create(RepositoryService.class);
42 36
    private static HelpServiceAsync helpService = GWT.create(HelpService.class);
43 37

  
44 38
    public MetricsForDatasourceWidget() {
45 39

  
46
        metricsForDatasourcePanel.addStyleName("row");
40
        super();
47 41

  
48
        metricsForDatasourceColPanel.addStyleName("col-lg-12");
49
        metricsForDatasourceColPanel.add(metricsForDatasourceInnerPanel);
42
        HTML title = new HTML("<h1 class=\"uk-article-title\">Metrics</h1>");
43
        title.addStyleName("uk-margin-medium-bottom");
44
        contentPanel.add(title);
50 45

  
51
        metricsForDatasourceInnerPanel.addStyleName("wrapper wrapper-content animated fadeInUp");
52
        metricsForDatasourceInnerPanel.add(metricsForDatasourceBox);
53

  
54
        metricsForDatasourceBox.addStyleName("ibox");
55
        metricsForDatasourceBox.add(metricsForDatasourceBoxContent);
56

  
57
        metricsForDatasourceBoxContent.addStyleName("ibox-content bigContent");
58

  
59 46
        errorAlert.setType(AlertType.DANGER);
60 47
        errorAlert.setDismissable(false);
61 48
        errorAlert.setVisible(false);
62 49
        metricsForDatasourceBoxContent.add(errorAlert);
63 50

  
64
        metricsForDatasourcePanel.add(metricsForDatasourceColPanel);
51
        contentPanel.add(metricsForDatasourceBoxContent);
65 52
    }
66 53

  
67 54
    @Override
......
69 56

  
70 57
        metricsForDatasourceBoxContent.clear();
71 58
        errorAlert.setVisible(false);
72
        metricsForDatasourcePanel.remove(helpPanel);
59
        gridPanel.remove(helpPanel);
73 60
    }
74 61

  
75 62
    @Override
76 63
    public void reload() {
77 64

  
78
        Document.get().getElementById("page-wrapper").removeClassName("sidebar-content");
65
        Document.get().getElementById("headerNoTransparent").removeClassName("tm-header-transparent");
79 66
        metricsForDatasourceBoxContent.add(errorAlert);
80 67

  
81
        helpService.getHelpById(parentToken + "_forDatasource", new HelpCallback(metricsForDatasourceColPanel, helpPanel, metricsForDatasourcePanel));
68
        helpService.getHelpById(parentToken + "_forDatasource", new HelpCallback(helpPanel, gridPanel));
82 69

  
83 70
        final HTML loadingWheel = new HTML("<div class=\"loader-big\" style=\"text-align: center; padding-top: 170px; " +
84 71
                "color: rgb(47, 64, 80); font-weight: bold;\">Retrieving repository information...</div>" +
......
101 88
            @Override
102 89
            public void onSuccess(final Repository repository) {
103 90

  
104
                RepositoryManager.pageHeader.clear();
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>"));
105 104

  
106
                String logoURLSource = "";
107
                if(repository.getLogoUrl()==null || repository.getLogoUrl().isEmpty())
108
                    logoURLSource = "img/yourLogoHere.jpg";
109
                else
110
                    logoURLSource = repository.getLogoUrl();
111

  
112
                RepositoryManager.pageHeader.add(new HTML("<div class=\"col-sm-9\"><h2><img src=\"" + logoURLSource + "\" alt=[Repo Logo]" +
113
                        "width=\"35px\" height=\"35px\" style=\"margin-right: 15px; margin-top:-2px\">" + repository.getOfficialName() + "</h2>" +
114
                        "<ol class=\"breadcrumb\"><li><a href=\"#dashboard\">Home</a></li><li><a href=\"#" + parentToken +
115
                        "\">Metrics</a></li><li class=\"active\"><strong>" + repository.getOfficialName() +
116
                        "</strong></li></ol></div><div class=\"col-sm-3\"></div>"));
117

  
118 105
                repositoryService.getPiwikSiteForRepository(repository.getId(), new AsyncCallback<PiwikInfo>() {
119 106

  
120 107
                    @Override
......
124 111
                        metricsForDatasourceBoxContent.remove(loadingWheel);
125 112

  
126 113
                        //TODO change text
127
                        errorAlert.setText("System error retrieving repository info 2");
114
                        errorAlert.setText("System error retrieving piwik site info");
128 115
                        errorAlert.setVisible(true);
129 116
                    }
130 117

  
......
171 158

  
172 159
    }
173 160

  
174
    @Override
175
    public Widget asWidget() {
176
        return metricsForDatasourcePanel;
177
    }
178

  
179 161
    private FlowPanel createMetricsPanel(Repository repository) {
180 162

  
181 163
        FlowPanel metricsPanel = new FlowPanel();
......
200 182

  
201 183
        Frame datasourcesMonthlyViews = new Frame(datasourcesMonthlyViewsURL);
202 184
        datasourcesMonthlyViews.setStyleName("statsFrame");
203
        metricsPanel.add(datasourcesMonthlyViews);
204 185

  
186
        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");
188
        monthlyViewsPanel.add(datasourcesMonthlyViews);
189
        metricsPanel.add(monthlyViewsPanel);
190

  
205 191
        String datasourcesMonthlyDownloadsURL = "http://vatopedi.di.uoa.gr/stats2/merge.php?com=query&data=[{\"query\":" +
206 192
                "\"dtsrcDownloadsTimeline\",\"dtsrcName\":\"" + repository.getId() + "\",\"table\":\"\",\"fields\":[{\"fld\":\"sum\"," +
207 193
                "\"agg\":\"sum\",\"type\":\"chart\",\"yaxis\":1,\"c\":false}],\"xaxis\":{\"name\":\"month\",\"agg\":\"sum\"}," +
......
217 203

  
218 204
        Frame datasourcesMonthlyDownloads = new Frame(datasourcesMonthlyDownloadsURL);
219 205
        datasourcesMonthlyDownloads.setStyleName("statsFrame");
220
        metricsPanel.add(datasourcesMonthlyDownloads);
221 206

  
207
        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");
209
        monthlyDownloadsPanel.add(datasourcesMonthlyDownloads);
210
        metricsPanel.add(monthlyDownloadsPanel);
211

  
222 212
        return metricsPanel;
223 213
    }
224 214

  

Also available in: Unified diff