Project

General

Profile

« Previous | Next » 

Revision 52995

almost ready for release

View differences:

modules/uoa-repository-dashboard-gui/trunk/app/pages/adminPg/adminPg.routing.ts
11 11
    component: AdminPgComponent,
12 12
    children: [
13 13
      {
14
        path: '',
15
        redirectTo: '/help-texts',
16
        pathMatch: 'full'
17
      },
18
      {
19
        path: 'help-texts',
20
        component: AdminPgHelpTextsComponent
21
      },
22
      {
23 14
        path: 'metrics',
24 15
        component: AdminPgMetricsComponent
25 16
      }
modules/uoa-repository-dashboard-gui/trunk/app/pages/sources/sources.routing.ts
24 24
        children: [
25 25
          {
26 26
            path: '',
27
            component: SourcesRegisterComponent,
28
            pathMatch: 'full'
27
            component: SourcesRegisterComponent
29 28
          },
30 29
          {
31 30
            path: 'literature',
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics.routing.ts
15 15
const metricsRoutes: Routes = [
16 16
    {
17 17
      path: '',
18
      component: MetricsComponent,
18
      component: MetricsComponent
19 19
    },
20 20
    {
21 21
      path: 'enable/:id',
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-usagestats-report-results.component.ts
11 11
})
12 12
export class MetricsUsagestatsReportResultsComponent implements OnInit {
13 13

  
14
  loadingMessage: string;
14 15
  errorMessage: string;
16
  infoMessage: string;
15 17

  
16
  repoResponse = ar1_report_results['ReportResponse'];
18
  repoResponse: ReportResponse;
17 19
  coveredPeriod: string;
20
  params: URLSearchParams;
21
  page:number;
22
  pageSize:number;
23
  totalPages:number;
24
  selectedItemIndex: number;
18 25

  
19 26
  constructor(private route: ActivatedRoute,
20 27
              private authService: AuthenticationService,
21 28
              private usageService: UsagestatsService) {}
22 29

  
23 30
  ngOnInit() {
24
    //this.getReportResponse();
25
    if (this.repoResponse.Report && this.repoResponse.ReportDefinition.Filters.UsageDateRange &&
26
      this.repoResponse.ReportDefinition.Filters.UsageDateRange.Begin && this.repoResponse.ReportDefinition.Filters.UsageDateRange.End) {
27
      this.coveredPeriod = this.repoResponse.ReportDefinition.Filters.UsageDateRange.Begin + ' to ' + this.repoResponse.ReportDefinition.Filters.UsageDateRange.End;
28
    } else {
29
      let defaultDatePeriod = this.repoResponse.Exception.filter(x => x['Message'] === 'Unspecified Date Arguments');
30
      this.coveredPeriod = defaultDatePeriod[0].Data.split(':')[1].trim() + ' to ' + defaultDatePeriod[1].Data.split(':')[1].trim() + ' (default)';
31
    }
31
    this.page = 0;
32
    this.pageSize = 10;
33
    this.readParams();
32 34
  }
33 35

  
34
  getReportResponse() {
35
    let params = new URLSearchParams();
36
  readParams() {
37
    this.params = new URLSearchParams();
36 38

  
37 39
    this.route.queryParams.subscribe( qparams => {
38
      params.append('Report', qparams['report']);
39
      params.append('Release', '4');
40
      params.append('RequestorID', this.authService.getUserEmail());
41
      params.append('BeginDate', qparams['beginDate']);
42
      params.append('EndDate', qparams['endDate']);
43
      params.append('RepositoryIdentifier', qparams['repoId']);
44
      if (qparams['itemIdentifier']) {
45
        params.append('ItemIdentifier', qparams['itemIdentifier']);
46
      }
47
      if (qparams['itemDataType']) {
48
        params.append('ItemDataType', qparams['itemIdentifier']);
49
      }
50
      params.append('Granularity', qparams['granularity']);
51
      if (qparams['pretty'] && qparams['pretty']==='true') {
52
        params.append('Pretty', 'Pretty');
53
      }
40
      this.params.append('Report', qparams['report']);
41
      this.params.append('Release', '4');
42
      this.params.append('RequestorID', this.authService.getUserEmail());
43
      this.params.append('BeginDate', qparams['beginDate']);
44
      this.params.append('EndDate', qparams['endDate']);
45
      this.params.append('RepositoryIdentifier', qparams['repoId']);
46
      this.params.append('ItemIdentifier', qparams['itemIdentifier']);
47
      this.params.append('ItemDataType', qparams['itemIdentifier']);
48
      this.params.append('Granularity', qparams['granularity']);
54 49
    });
55 50

  
56
    this.usageService.getReportResponse(params).subscribe(
51
    this.getReportResponse();
52
  }
53

  
54
  getReportResponse() {
55
    this.errorMessage = '';
56
    this.loadingMessage = 'Loading results...';
57
    this.infoMessage = '';
58
    this.selectedItemIndex = null;
59
    this.repoResponse = null;
60

  
61
    this.usageService.getReportResponse(this.page.toString(), this.pageSize.toString(), this.params).subscribe(
57 62
      responseWrapper => {
58
        this.repoResponse = responseWrapper.ReportResponse
63
        this.repoResponse = responseWrapper.ReportResponse;
59 64
      },
60 65
      error => {
61 66
        this.errorMessage = 'Failed to load the report results!';
67
        this.loadingMessage = '';
62 68
      },
63 69
      () => {
64
        if (this.repoResponse.Report && this.repoResponse.ReportDefinition.Filters.UsageDateRange &&
65
          this.repoResponse.ReportDefinition.Filters.UsageDateRange.Begin && this.repoResponse.ReportDefinition.Filters.UsageDateRange.End) {
66
          this.coveredPeriod = this.repoResponse.ReportDefinition.Filters.UsageDateRange.Begin + ' to ' + this.repoResponse.ReportDefinition.Filters.UsageDateRange.End;
70
        this.errorMessage = '';
71
        this.loadingMessage = '';
72

  
73
        this.totalPages = Math.ceil(
74
          +this.repoResponse.ReportDefinition.Filters
75
                  .ReportAttribute.filter(x => x['Name'] === 'ReportItemCount')[0].Value / this.pageSize);
76
        if ( this.totalPages === 0 ) {
77
          this.infoMessage = 'No results were found';
78
        }
79

  
80
        if (this.repoResponse.ReportDefinition && this.repoResponse.ReportDefinition.Filters &&
81
            this.repoResponse.ReportDefinition.Filters.ReportAttribute) {
82

  
83
          if (this.repoResponse.Report && this.repoResponse.ReportDefinition.Filters.UsageDateRange &&
84
            this.repoResponse.ReportDefinition.Filters.UsageDateRange.Begin &&
85
            this.repoResponse.ReportDefinition.Filters.UsageDateRange.End) {
86
            this.coveredPeriod = this.repoResponse.ReportDefinition.Filters.UsageDateRange.Begin + ' to ';
87
            this.coveredPeriod = this.coveredPeriod + this.repoResponse.ReportDefinition.Filters.UsageDateRange.End;
88
          } else {
89
            let defaultDatePeriod = this.repoResponse.Exception.filter(x => x['Message'] === 'Unspecified Date Arguments');
90

  
91
            this.coveredPeriod = defaultDatePeriod[0].Data.split(':')[1].trim() + ' to ';
92
            this.coveredPeriod = this.coveredPeriod + defaultDatePeriod[1].Data.split(':')[1].trim() + ' (default)';
93
          }
94

  
67 95
        } else {
68
          let defaultDatePeriod = this.repoResponse.Exception.filter(x => x['Message'] === 'Unspecified Date Arguments');
69
          this.coveredPeriod = defaultDatePeriod[0].Data.split(':')[1].trim() + ' to ' + defaultDatePeriod[1].Data.split(':')[1].trim() + ' (default)';
96
          this.repoResponse = null;
70 97
        }
71 98
      }
72 99
    );
73 100

  
74 101
  }
75 102

  
76
  transformItem(url: string) {
77
    const temp = url.split(';');
103

  
104
  getPageSize(num: string){
105
    this.pageSize = +num;
106
    this.page = 0;
107
    this.getReportResponse();
108
  }
109

  
110
  goToNextPage(){
111
    if( (this.page+1) < this.totalPages) {
112
      this.page++;
113
      console.log(`Get me page ${this.page}!`);
114
      this.getReportResponse();
115
    }
116
  }
117

  
118
  goToPreviousPage(){
119
    if(this.page > 0) {
120
      this.page--;
121
      console.log(`Get me page ${this.page}!`);
122
      this.getReportResponse();
123
    }
124
  }
125

  
126
  displayItemPerformance(i: number) {
127
    if (this.selectedItemIndex === i) {
128
      this.selectedItemIndex = null;
129
    } else {
130
      this.selectedItemIndex = i;
131
    }
132
  }
133

  
134
  transformItem(urls: string) {
135
    /*const temp = urls.split(';');
78 136
    let output = '';
79 137
    for (let u of temp) {
80
      if (output.length === 0) {
138
      if (output.length > 0) {
81 139
        output = output + '\n';
82 140
      }
83
      output = output + u.replace(/\\/g,'');
141
      output = output + u.replace(/\\/g,'').trim();
142
    }*/
143
    return urls.split(';');
144
  }
145

  
146
  getBg(i: number) {
147
    if (i % 2 === 0) {
148
      console.log('true!');
149
      return 'background-color:white;';
84 150
    }
85
    return output;
86 151
  }
87 152

  
88 153
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-usagestats-report.component.ts
10 10

  
11 11
@Component({
12 12
  selector: 'metrics-usagestats-report',
13
  templateUrl: 'metrics-usagestats-report.component.html'
13
  templateUrl: './metrics-usagestats-report.component.html'
14 14
})
15 15

  
16 16
export class MetricsUsagestatsReportComponent implements OnInit {
......
32 32
  itemIdentifier: string = '';
33 33
  itemDataType: string = '';
34 34
  granularity: string = 'Monthly';
35
  pretty: boolean = true;
36 35

  
37 36
  constructor(private repoService: RepositoryService,
38 37
              private route: ActivatedRoute,
......
80 79
          this.issnToShow = this.repo.issn.slice(0, 4)+ '-' + this.repo.issn.toString().slice(4);
81 80
        }
82 81
        this.title = `${this.chosen_report} report for ${this.repo.officialName}`;
83
        if ( this.authService.getUserEmail() !== this.repo.registeredBy ) {
82
        // TODO: UNCOMMENT
83
        /*if ( this.authService.getUserEmail() !== this.repo.registeredBy ) {
84 84
          this.router.navigateByUrl('/403-forbidden', { skipLocationChange: true });
85
        }
85
        }*/
86 86
      }
87 87
    );
88 88
  }
......
107 107
    this.granularity = event.target.value;
108 108
  }
109 109

  
110
  updatePretty(event: any) {
111
    this.pretty = !this.pretty;
112
  }
113

  
114 110
  goToReport() {
115
    /* additional field: */
116
    /*itemIdentifier: this.repo.piwikInfo.openaireId,*/
117
    /*this.router.navigate([`/getImpact/${this.repoId}/${this.chosen_report}/results'], {
111
    this.router.navigate(['/getImpact/usagestats-report-results'], {
118 112
      queryParams: {
119 113
        report: this.chosen_report,
120 114
        beginDate: this.beginDate,
......
122 116
        repoId: this.shownRepoId,
123 117
        itemDataType: this.itemDataType,
124 118
        itemIdentifier: this.itemIdentifier,
125
        granularity: this.granularity,
126
        pretty: this.pretty
119
        granularity: this.granularity
127 120
      }
128
    });*/
121
    });
129 122

  
130
    const params = new URLSearchParams();
123
    /*const params = new URLSearchParams();
131 124

  
132 125
    params.append('Report', this.chosen_report);
133 126
    params.append('Release', '4');
......
141 134
    if (this.itemDataType) {
142 135
      params.append('ItemDataType', this.itemDataType);
143 136
    }
144
    params.append('Granularity', this.granularity);
145
    if (this.pretty && this.pretty === true) {
146
      params.append('Pretty', 'Pretty');
147
    }
137
    params.append('Pretty', 'Pretty');
148 138

  
149 139
    let url = `http://beta.services.openaire.eu/usagestats/sushilite/GetReport/?${params}`;
150 140
    console.log(`going to: ${url}`);
151 141

  
152
    window.location.href = url;
142
    window.location.href = url;*/
153 143
  }
154 144

  
155 145
}
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-instructions.component.ts
33 33
      piwik => this.piwik = piwik,
34 34
      error => console.log(error),
35 35
      () => {
36
        // TODO: UNCOMMENT
36 37
        /*if ( this.authService.getUserEmail() !== this.piwik.requestorEmail ) {
37 38
          this.router.navigateByUrl('/403-forbidden', { skipLocationChange: true });
38 39
        }*/
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-usagestats-report-results.component.html
26 26
            <div class=" uk-width-expand@m" style="min-height:500px;">
27 27

  
28 28
              <div *ngIf="errorMessage" class="uk-alert uk-alert-warning">{{errorMessage}}</div>
29
              <div *ngIf="loadingMessage" class="loading-big">
30
                <div class="loader-big" style="text-align: center; padding-top: 170px; color: rgb(47, 64, 80); font-weight: bold;">
31
                  {{ loadingMessage }}
32
                </div>
33
                <div class="whiteFilm"></div>
34
              </div>
29 35
              <div *ngIf="repoResponse" class="uk-margin-top">
30 36
                <h3>{{ repoResponse.ReportDefinition['@Name'] }} Report Results
31 37
                  <span *ngIf="repoResponse.Report &&
......
34 40
                              repoResponse.Report.Report.Customer.ReportItems &&
35 41
                              repoResponse.Report.Report.Customer.ReportItems.length > 0">for {{ repoResponse.Report.Report.Customer.ReportItems[0].ItemPlatform }}</span>
36 42
                </h3>
37
                <table class="uk-table uk-align-left">
38
                  <tr>
39
                    <th>Period covered</th>
40
                    <td>{{ coveredPeriod }}</td>
41
                  </tr>
42
                  <tr>
43
                    <th>Filters</th>
44
                    <td>
45
                      <span *ngFor="let filter of repoResponse.ReportDefinition.Filters.Filter; let i = index">
46
                        <br *ngIf="i>0">
47
                        {{ filter.Name }}: {{ filter.Value }}
43
                <div class="uk-width-1-2">
44
                  <table class="uk-table">
45
                    <tr>
46
                      <th>Period covered</th>
47
                      <td>{{ coveredPeriod }}</td>
48
                    </tr>
49
                    <tr>
50
                      <th>Filters</th>
51
                      <td>
52
                        <span *ngFor="let filter of repoResponse.ReportDefinition.Filters.Filter; let i = index">
53
                          <br *ngIf="i>0">
54
                          {{ filter.Name }}: {{ filter.Value }}
55
                        </span>
56
                      </td>
57
                    </tr>
58
                    <tr>
59
                      <th>Date run</th>
60
                      <td>{{ repoResponse.Report.Report['@Created'] | date: "yyyy-MM-dd HH:mm:ss" }}</td>
61
                    </tr>
62
                    <tr>
63
                      <th>Number of results</th>
64
                      <td>{{ repoResponse.ReportDefinition.Filters.ReportAttribute[1].Value }}</td>
65
                    </tr>
66
                  </table>
67
                </div>
68
                <div *ngIf="repoResponse.Report.Report.Customer &&
69
                            repoResponse.Report.Report.Customer.ReportItems">
70
                  <div>
71
                    <div class="show-options uk-inline" style="float: right;">
72
                      <div class="filterLabel" style="display: inline;">Results per page:</div>
73
                      <div class="inlineBlock">
74
                        <select #itemsPerPage class="form-control" (change)="getPageSize(itemsPerPage.value)">
75
                          <option value="10" selected>10</option>
76
                          <option value="25">25</option>
77
                          <option value="50">50</option>
78
                          <option value="100">100</option>
79
                        </select>
80
                      </div>
81
                    </div>
82
                  </div><br>
83
                  <div class="contentAndPagerPanel">
84

  
85
                    <!-- TOP PAGINATION LINKS -->
86
                    <div>
87
                      <ul class="uk-pagination">
88
                        <li>
89
                          <a class="uk-link uk-link-muted" (click)="goToPreviousPage()">
90
                      <span class="uk-margin-small-right uk-pagination-previous uk-icon" uk-pagination-previous="">
91
                        <svg width="7" height="12" viewBox="0 0 7 12" xmlns="http://www.w3.org/2000/svg"
92
                             icon="pagination-previous" ratio="1"></svg>
48 93
                      </span>
49
                    </td>
50
                  </tr>
51
                  <tr>
52
                    <th>Date run</th>
53
                    <td>{{ repoResponse.Report.Report['@Created'] | date: "yyyy-MM-dd HH:mm:ss" }}</td>
54
                  </tr>
55
                  <tr>
56
                    <th>Number of results</th>
57
                    <td>{{ repoResponse.ReportDefinition.Filters.ReportAttribute[1].Value }}</td>
58
                  </tr>
59
                </table>
94
                            Previous
95
                          </a>
96
                        </li>
97
                        <li class="uk-margin-auto-left">
98
                          <a class="uk-link uk-link-muted" (click)="goToNextPage()">
99
                            Next
100
                            <span class="uk-margin-small-left uk-pagination-next uk-icon" uk-pagination-next="">
101
                        <svg width="7" height="12" viewBox="0 0 7 12" xmlns="http://www.w3.org/2000/svg"
102
                             icon="pagination-next" ratio="1"></svg>
103
                      </span>
104
                          </a>
105
                        </li>
106
                      </ul>
107
                      <div class="resultsPageLabel">page {{ (totalPages > 0) ? page+1 : 0 }} of {{ totalPages }}</div>
108
                    </div>
60 109

  
61
                <table class="uk-table uk-table-expand">
62
                  <thead>
63
                  <tr>
64
                    <th>ItemUrl</th>
65
                    <th>Title</th>
66
                    <th>Publisher</th>
67
                    <th>Item Type</th>
68
                    <th colspan="2">Apr 2018</th>
69
                  </tr>
70
                  </thead>
71
                  <tbody>
72
                  <tr *ngFor="let item of repoResponse.Report.Report.Customer.ReportItems">
73
                    <td>{{ transformItem(item.ItemIdentifier[1].Value) }}</td>
74
                    <td>{{ item.ItemName }}</td>
75
                    <td>{{ item.ItemPublisher }}</td>
76
                    <td>{{ item.ItemDataType }}</td>
77
                    <td>{{ item.ItemPerformance[0].Instance[0].Count }}</td>
78
                    <td>{{ item.ItemPerformance[0].Instance[1].Count }}</td>
79
                  </tr>
80
                  </tbody>
81
                </table>
110

  
111
                    <!-- RESULTS TABLE -->
112
                    <div>
113
                      <div>
114
                        <div class="uk-overflow-auto uk-scrollspy-inview uk-animation-slide-top-medium uk-margin-top uk-margin-bottom">
115

  
116
                          <table class="uk-table uk-table-middle uk-table-striped" style="vertical-align: top !important;">
117
                            <thead>
118
                              <tr>
119
                                <th>Item Urls</th>
120
                                <th>Title</th>
121
                                <th>Publisher</th>
122
                                <th>Type</th>
123
                                <th colspan="2">Downloads/Views</th>
124
                                <!--<th *ngIf="repoResponse.ReportDefinition.Filters.ReportAttribute[0].Value === 'Totals'">
125
                                  Total Downloads
126
                                </th>
127
                                <th *ngIf="repoResponse.ReportDefinition.Filters.ReportAttribute[0].Value === 'Totals'">
128
                                  Total Views
129
                                </th>-->
130
                              </tr>
131
                            </thead>
132
                            <td colspan="6" *ngIf="infoMessage" class="uk-alert">{{ infoMessage }}</td>
133
                            <!--<tbody *ngFor="let item of repoResponse.Report.Report.Customer.ReportItems; let item_i = index"
134
                                   style="{{ (item_i % 2) > 0 ? 'background-color:white; border-bottom: 1px solid gray;': 'border-bottom: 1px solid gray;'">-->
135
                            <tbody *ngFor="let item of repoResponse.Report.Report.Customer.ReportItems; let item_i = index"
136
                                   style="border-bottom: 1px solid whitesmoke;">
137
                              <tr>
138
                                <td>
139
                                <span *ngFor="let url of transformItem(item.ItemIdentifier[1].Value); let i = index">
140
                                  <br *ngIf="i>0">{{ url }}
141
                                </span>
142
                                </td>
143
                                <td>{{ item.ItemName }}</td>
144
                                <td>{{ item.ItemPublisher }}</td>
145
                                <td>{{ item.ItemDataType }}</td>
146
                                <td class="uk-text-center"
147
                                    *ngIf="repoResponse.ReportDefinition.Filters.ReportAttribute[0].Value === 'Monthly'" colspan="2">
148
                                  <a *ngIf="item.ItemPerformance && (item.ItemPerformance.length > 0)"
149
                                     (click)="displayItemPerformance(item_i)">See results</a>
150
                                </td>
151
                                <td class="uk-text-center"
152
                                    *ngIf="repoResponse.ReportDefinition.Filters.ReportAttribute[0].Value === 'Totals'">
153
                                  {{ item.ItemPerformance[0].Instance[0].Count }}
154
                                </td>
155
                                <td class="uk-text-center"
156
                                    *ngIf="repoResponse.ReportDefinition.Filters.ReportAttribute[0].Value === 'Totals'">
157
                                  {{ item.ItemPerformance[0].Instance[1].Count }}
158
                                </td>
159
                              </tr>
160
                              <tr *ngIf="(selectedItemIndex === item_i)">
161
                                <td colspan="6">
162
                                  <div class="uk-animation-slide-top-medium uk-margin-small-top">
163
                                    <!--<div class="uk-child-width-expand uk-grid" uk-grid>
164
                                      <div class="uk-h5">Month</div>
165
                                      <div class="uk-h5">Downloads</div>
166
                                      <div class="uk-h5">Views</div>
167
                                    </div>
168
                                    <div *ngFor="let month of item.ItemPerformance" class="uk-child-width-expand uk-grid" uk-grid>
169
                                      <div>{{ month.Period.Begin | date: "MMM yyyy" }}</div>
170
                                      <div>{{ month.Instance[0].Count }}</div>
171
                                      <div>{{ month.Instance[1].Count }}</div>
172
                                    </div>-->
173
                                    <table class="uk-table uk-table-middle uk-table-striped">
174
                                      <tr>
175
                                        <th>Month</th>
176
                                        <th>Downloads</th>
177
                                        <th>Views</th>
178
                                      </tr>
179
                                      <tr *ngFor="let month of item.ItemPerformance">
180
                                        <td>{{ month.Period.Begin | date: "MMM yyyy" }}</td>
181
                                        <td>{{ month.Instance[0].Count }}</td>
182
                                        <td>{{ month.Instance[1].Count }}</td>
183
                                      </tr>
184
                                    </table>
185
                                  </div>
186
                                </td>
187
                              </tr>
188
                            </tbody>
189
                          </table>
190

  
191
                        </div>
192
                      </div>
193
                    </div>
194

  
195
                    <!-- BOTTOM PAGINATION LINKS -->
196
                    <div>
197
                      <ul class="uk-pagination">
198
                        <li>
199
                          <a class="uk-link uk-link-muted" (click)="goToPreviousPage()">
200
                      <span class="uk-margin-small-right uk-pagination-previous uk-icon" uk-pagination-previous="">
201
                        <svg width="7" height="12" viewBox="0 0 7 12" xmlns="http://www.w3.org/2000/svg"
202
                             icon="pagination-previous" ratio="1"></svg>
203
                      </span>
204
                            Previous
205
                          </a>
206
                        </li>
207
                        <li class="uk-margin-auto-left">
208
                          <a class="uk-link uk-link-muted" (click)="goToNextPage()">
209
                            Next
210
                            <span class="uk-margin-small-left uk-pagination-next uk-icon" uk-pagination-next="">
211
                        <svg width="7" height="12" viewBox="0 0 7 12" xmlns="http://www.w3.org/2000/svg"
212
                             icon="pagination-next" ratio="1"></svg>
213
                      </span>
214
                          </a>
215
                        </li>
216
                      </ul>
217
                      <div class="resultsPageLabel">page {{ (totalPages > 0) ? page+1 : 0 }} of {{ totalPages }}</div>
218
                    </div>
219
                  </div>
220
                </div>
221

  
82 222
              </div>
83 223

  
84 224
            </div>
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-usagestats-report.component.html
168 168
                      </select>
169 169
                    </div>
170 170
                  </div>
171
                  <p>The Pretty attribute is just for humans playing with the API and looking at results in a browser.</p>
172
                  <p><input name="Pretty" value="Pretty" checked="checked" type="checkbox" (change)="updatePretty($event)">Pretty print json(p) for humans</p>
173
                  <a class="uk-button uk-button-primary" (click)="goToReport()">Get Report</a>
171
                  <!--<p>The Pretty attribute is just for humans playing with the API and looking at results in a browser.</p>
172
                  <p><input name="Pretty" value="Pretty" checked="checked" type="checkbox" (change)="updatePretty($event)">Pretty print json(p) for humans</p>-->
173
                  <a class="uk-button uk-button-primary uk-margin-top" (click)="goToReport()">Get Report</a>
174 174
                </div>
175 175

  
176 176
              </div>
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-show.component.ts
53 53
      () => {
54 54
        this.loadingMessage = '';
55 55
        this.errorMessage = '';
56
        // TODO: UNCOMMENT
56 57
        /*if ( this.authService.getUserEmail() !== this.piwik.requestorEmail ) {
57 58
          this.router.navigateByUrl('/403-forbidden', { skipLocationChange: true });
58 59
        } else {*/
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-usagestats.component.ts
41 41
        },
42 42
        () => {
43 43
          this.title = this.title + ' for ' + this.repo.officialName;
44
          if ( this.authService.getUserEmail() !== this.repo.registeredBy ) {
44
          // TODO: UNCOMMENT
45
          /*if ( this.authService.getUserEmail() !== this.repo.registeredBy ) {
45 46
            this.router.navigateByUrl('/403-forbidden', { skipLocationChange: true });
46
          }
47
          }*/
47 48
        }
48 49
      );
49 50
    }
modules/uoa-repository-dashboard-gui/trunk/app/pages/compatibility/compatibility.module.ts
1
import {NgModule} from "@angular/core";
2
import {CommonModule} from "@angular/common";
3
import {TabsModule} from "ngx-bootstrap";
1
import { NgModule } from "@angular/core";
2
import { CommonModule } from "@angular/common";
3
import { TabsModule } from "ngx-bootstrap";
4 4
import { ReactiveFormsModule } from '@angular/forms';
5
import {CompatibilityComponent} from "./compatibility.component";
6
import {CompatibilityValidateComponent} from "./compatibility-validate.component";
7
import {CompatibilityRouting} from "./compatibility.routing";
8
import {CompatibilityMonitorComponent} from "./compatibility-monitor.component";
5
import { CompatibilityComponent } from "./compatibility.component";
6
import { CompatibilityValidateComponent } from "./compatibility-validate.component";
7
import { CompatibilityRouting } from "./compatibility.routing";
8
import { CompatibilityMonitorComponent } from "./compatibility-monitor.component";
9 9
import { CompatibilityValidationHistoryComponent } from './compatibility-validation-history.component';
10 10
import { ReusableComponentsModule } from '../../shared/reusablecomponents/reusable-components.module';
11 11
import { CompatibilityMonitorRepoComponent } from './compatibility-monitor-repo.component';
......
15 15
import { CompatibilityValidateStep3Component } from './compatibility-validate-forms/compatibility-validate-step3.component';
16 16
import { CompatibilityValidationResultsComponent } from './compatibility-validation-results.component';
17 17
import { CompatibilityValidateStep3CrisComponent } from './compatibility-validate-forms/compatibility-validate-step3-cris.component';
18
import {CompatibilityMonitorFullHistoryRepoComponent} from "./compatibility-monitor-fullHistory-repo.component";
18
import { CompatibilityMonitorFullHistoryRepoComponent } from "./compatibility-monitor-fullHistory-repo.component";
19 19

  
20 20
@NgModule ({
21 21
  imports: [
modules/uoa-repository-dashboard-gui/trunk/app/pages/compatibility/compatibility.routing.ts
2 2
import { RouterModule, Routes } from "@angular/router";
3 3

  
4 4
import { CompatibilityComponent } from "./compatibility.component";
5
import { CompatibilityValidateComponent } from "./compatibility-validate.component";
6
import { CompatibilityMonitorComponent } from "./compatibility-monitor.component";
5
import { CompatibilityValidateTypeComponent } from './compatibility-validate-type.component';
7 6
import { CompatibilityValidationHistoryComponent } from './compatibility-validation-history.component';
7
import { CompatibilityValidationResultsComponent } from './compatibility-validation-results.component';
8
import { CompatibilityMonitorComponent } from './compatibility-monitor.component';
8 9
import { CompatibilityMonitorRepoComponent } from './compatibility-monitor-repo.component';
9
import { CompatibilityValidateTypeComponent } from './compatibility-validate-type.component';
10
import { CompatibilityValidationResultsComponent } from './compatibility-validation-results.component';
11
import {CompatibilityMonitorFullHistoryRepoComponent} from "./compatibility-monitor-fullHistory-repo.component";
10
import { CompatibilityMonitorFullHistoryRepoComponent } from './compatibility-monitor-fullHistory-repo.component';
11
import { CompatibilityValidateComponent } from './compatibility-validate.component';
12 12

  
13 13
const compatibilityRoutes: Routes = [
14 14
  {
modules/uoa-repository-dashboard-gui/trunk/app/pages/compatibility/compatibility-monitor-fullHistory-repo.component.html
29 29
          <div *ngIf="noAggregations">{{ noAggregations }}</div>
30 30
          <div *ngIf="aggregationsMap && years && (years.length > 0) && !noAggregations">
31 31
            <div *ngFor="let year of years" class="uk-width-1-1@m">
32
              <div>
32
              <ul class="uk-list uk-list-striped">
33 33
                <h4>{{ year }}</h4>
34
                <div *ngFor="let aggr of aggregationsMap[year]">
34
                <li *ngFor="let aggr of aggregationsMap[year]">
35 35
                  <div class="uk-grid uk-child-width-1-4">
36 36
                    <div><span *ngIf="aggr.date">{{ aggr.date | date : "yyyy-MM-dd" }}</span></div>
37 37
                    <div><span *ngIf="aggr.aggregationStage">Aggregation stage: {{ aggr.aggregationStage }}</span></div>
38 38
                    <div><span *ngIf="aggr.collectionMode">CollectionMode: {{ aggr.collectionMode }}</span></div>
39 39
                    <div><span *ngIf="aggr.numberOfRecords">Number of records: {{ aggr.numberOfRecords }}</span></div>
40 40
                  </div>
41
                </div>
42
              </div>
41
                </li>
42
              </ul>
43 43
              <!--<div class="section md-bg-blue-grey-700">
44 44
                <div class="uk-container uk-container-center">
45 45
                  <div class="al_timeline">
modules/uoa-repository-dashboard-gui/trunk/app/pages/compatibility/compatibility-monitor-fullHistory-repo.component.ts
1 1
import { Component, OnInit } from '@angular/core';
2
import { ActivatedRoute } from '@angular/router';
2
import { ActivatedRoute, Router } from '@angular/router';
3 3
import {AggregationDetails, Repository} from '../../domain/typeScriptClasses';
4 4
import { RepositoryService } from '../../services/repository.service';
5 5
import {
......
9 9
  loadingRepoMessage,
10 10
  noAggregationHistory
11 11
} from '../../domain/shared-messages';
12
import { AuthenticationService } from '../../services/authentication.service';
12 13

  
13 14
@Component ({
14 15
  selector: 'app-compatibility-fullHistory-monitor-repo',
......
28 29
  years: string[] = [];
29 30

  
30 31
  constructor(private route: ActivatedRoute,
31
              private repoService: RepositoryService) {}
32
              private router: Router,
33
              private repoService: RepositoryService,
34
              private authService: AuthenticationService) {}
32 35

  
33 36
  ngOnInit() {
34 37
    this.readRepoId();
......
56 59
          this.loadingMessage = '';
57 60
          if (this.repo) {
58 61
            this.repoName = this.repo.officialName;
59
            this.getAllAggregationHistory();
62
            if ( this.authService.getUserEmail() !== this.repo.registeredBy ) {
63
              this.router.navigateByUrl('/403-forbidden', { skipLocationChange: true });
64
            } else {
65
              this.getAllAggregationHistory();
66
            }
60 67
          } else {
61 68
            this.errorMessage = loadingRepoError;
62 69
          }
......
80 87
        }
81 88
        if ( this.years.length === 0 ) {
82 89
          this.noAggregations = noAggregationHistory;
90
        } else {
91
          this.years.sort( (a, b)  => ( a > b ? -1 : 1 ) );
83 92
        }
84 93
      }
85 94
    );
modules/uoa-repository-dashboard-gui/trunk/app/pages/content/content-events.component.ts
44 44
        this.loadingMessage = '';
45 45
        if (!this.datasourcesOfUser || !this.datasourcesOfUser.length) {
46 46
          this.noDatasourcesMessage = loadingUserRepoInfoEmpty;
47
        /*} else {
48
          this.datasourcesOfUser.forEach(
49
            d => {
50
              console.log( d['first']['value'],' -> ',d['first']['size'] );
47
        } else {
48
          this.datasourcesOfUser.sort( function(a,b) {
49
            if ( a['first']['value'] < b['first']['value'] ) {
50
              return -1;
51
            } else if (a['first']['value'] > b['first']['value']) {
52
              return 1;
53
            } else {
54
              return 0;
51 55
            }
52
          );*/
56
          });
53 57
        }
54 58
      }
55 59
    );
modules/uoa-repository-dashboard-gui/trunk/app/pages/landing/landing.component.html
108 108
          <div class="uk-margin uk-panel">
109 109
            <h3 class="el-title uk-margin uk-h3 uk-heading-bullet uk-text-primary">
110 110
              Our community    </h3>
111
            <div class="el-content uk-margin uk-text-lead">800 literature repositories<br>200 OA Journals<br>50 data repositories<br>4 aggregators</div>
111
            <div class="el-content uk-margin uk-text-lead">
112
              {{ statisticsNumbers ? (statisticsNumbers['literature'] | number) : 'N/A' }} literature repositories<br>
113
              {{ statisticsNumbers ? (statisticsNumbers['journal'] | number) : 'N/A' }} OA Journals<br>
114
              {{ statisticsNumbers ? (statisticsNumbers['dataRepositories'] | number) : 'N/A' }} data repositories<br>
115
              {{ statisticsNumbers ? (statisticsNumbers['aggregators'] | number) : 'N/A' }} aggregators</div>
112 116
          </div>
113 117
          <hr class="uk-divider-small uk-text-left">
114 118
          <div class="uk-margin">
115
            <div>22,3 mi publications<br>6,000 datasets<br>1000 software</div>
116
            <div>1,200,000 usage events (2017)<br>330,000 metadata exchange events (2017)&nbsp;&nbsp;</div></div>
119
            <div>
120
              {{ statisticsNumbers ? (statisticsNumbers['publications'] | number) : 'N/A' }} publications<br>
121
              {{ statisticsNumbers ? (statisticsNumbers['datasets'] | number) : 'N/A' }} datasets<br>
122
              {{ statisticsNumbers ? (statisticsNumbers['software'] | number) : 'N/A' }} software</div>
123
            <div>
124
              1,200,000 usage events (2017)<br>
125
              330,000 metadata exchange events (2017)&nbsp;&nbsp;
126
            </div></div>
117 127
        </div>
118 128
        <div class="uk-width-expand@m">
119 129
          <h3 class="uk-h3 uk-heading-bullet uk-text-primary">
......
182 192
              <h4 class="el-title uk-margin uk-h4">
183 193
                A Researcher?    </h4>
184 194
              <div class="el-content uk-margin uk-text-lead">Explore all OA research results. Link all your research. Build your profile</div>
185
              <p><a href="/www.cnn.com" class="el-link uk-button uk-button-default uk-button-small">OpenAIRE.EXPLORE</a></p>
195
              <p><a href="https://{{ inBeta ? 'beta.' : '' }}explore.openaire.eu" class="el-link uk-button uk-button-default uk-button-small">OpenAIRE.EXPLORE</a></p>
186 196
            </div>
187 197
          </div>
188 198
          <div class="uk-width-expand@m uk-width-1-2@s uk-dark uk-grid-item-match">
......
190 200
              <h4 class="el-title uk-margin uk-h4">
191 201
                A Research Administrator?    </h4>
192 202
              <div class="el-content uk-margin uk-text-lead">Use our monitoring services and easily track all relevant research results.</div>
193
              <p><a href="/www.cnn.com" class="el-link uk-button uk-button-default uk-button-small">OpenAIRE.MONITOR</a></p>
203
              <p><a href="https://monitor.openaire.eu" class="el-link uk-button uk-button-default uk-button-small">OpenAIRE.MONITOR</a></p>
194 204
            </div>
195 205
          </div>
196 206
          <div class="uk-width-expand@m uk-width-1-2@s uk-dark uk-grid-item-match">
......
198 208
              <h4 class="el-title uk-margin uk-h4">
199 209
                A Research community?    </h4>
200 210
              <div class="el-content uk-margin uk-text-lead">Use a trusted partner to share, link, disseminate and monitor your research.</div>
201
              <p><a href="/www.cnn.com" class="el-link uk-button uk-button-default uk-button-small">OpenAIRE.CONNECT</a></p>
211
              <p><a href="https://{{ inBeta ? 'beta.' : '' }}connect.openaire.eu" class="el-link uk-button uk-button-default uk-button-small">OpenAIRE.CONNECT</a></p>
202 212
            </div>
203 213
          </div>
204 214

  
......
207 217
              <h4 class="el-title uk-margin uk-h4">
208 218
                A Developer?    </h4>
209 219
              <div class="el-content uk-margin uk-text-lead">Get access to OpenAIRE data and capitalize on on Europe's open linked research</div>
210
              <p><a href="/www.cnn.com" class="el-link uk-button uk-button-default uk-button-small">OpenAIRE.DEVELOP</a></p>
220
              <p><a href="https://develop.openaire.eu" class="el-link uk-button uk-button-default uk-button-small">OpenAIRE.DEVELOP</a></p>
211 221
            </div>
212 222
          </div>
213 223
        </div>
modules/uoa-repository-dashboard-gui/trunk/app/pages/landing/landing.component.ts
1 1
import {AuthenticationService} from "../../services/authentication.service";
2 2
import {Component, OnInit} from "@angular/core";
3 3
import {Router} from "@angular/router";
4
import { StatisticsService } from '../../services/statistics.service';
4 5

  
5 6
@Component ({
6 7
  selector: 'landing',
......
9 10

  
10 11
export class LandingComponent implements OnInit {
11 12

  
12
  constructor(private authService: AuthenticationService, private router: Router) { }
13
  statisticsNumbers: Map<string,string>;
14
  inBeta: boolean;
13 15

  
16
  constructor(private authService: AuthenticationService,
17
              private statsService: StatisticsService,
18
              private router: Router) { }
19

  
14 20
  ngOnInit() {
21
    this.getStatisticsNumbers();
22

  
23
    const baseUrl = window.location.origin;
24
    this.inBeta = ( baseUrl.includes('beta') || baseUrl.includes('athenarc') );
15 25
  }
16 26

  
17 27

  
......
19 29
    this.authService.loginWithState();
20 30
  }
21 31

  
32
  getStatisticsNumbers() {
33
    this.statsService.getStatisticsNumbers().subscribe(
34
      res => this.statisticsNumbers = res,
35
      error => console.log(error),
36
      () => console.log(JSON.stringify(this.statisticsNumbers))
37
    );
38
  }
39

  
22 40
  onStartHerePush() {
23 41
    this.router.navigate(['/dashboard']);
24 42
  }
modules/uoa-repository-dashboard-gui/trunk/app/services/usagestats.service.ts
21 21

  
22 22
@Injectable ()
23 23
export class UsagestatsService {
24
  private apiUrl = process.env.API_ENDPOINT + '/piwik/';
24
  private apiUrl = process.env.API_ENDPOINT + '/sushilite/';
25 25

  
26
  constructor(private http: Http,
27
              private httpClient: HttpClient) { }
26
  constructor(private httpClient: HttpClient) { }
28 27

  
29 28

  
30
  getReportResponse(params: URLSearchParams): Observable<ReportResponseWrapper> {
31
    let url = `http://beta.services.openaire.eu/usagestats/sushilite/GetReport/?${params}`;
29
  getReportResponse(page: String, pageSize: String, params: URLSearchParams): Observable<ReportResponseWrapper> {
30
    let url = `${this.apiUrl}getReportResults/${page}/${pageSize}?${params}`;
32 31
    console.log(`knocking on: ${url}`);
33 32

  
34 33
    return this.httpClient.get<ReportResponseWrapper>(url, headerOptions);
modules/uoa-repository-dashboard-gui/trunk/app/services/statistics.service.ts
1
/*
2
* Created by myrto on 05/11/2018
3
*/
4

  
5

  
6
import { Injectable } from '@angular/core';
7
import { Observable } from 'rxjs/Observable';
8
import 'rxjs/add/operator/map';
9
import { ReportResponseWrapper } from '../domain/usageStatsClasses';
10
import {HttpClient, HttpHeaders} from "@angular/common/http";
11

  
12

  
13
const headerOptions = {
14
  headers : new HttpHeaders().set('Content-Type', 'application/json')
15
    .set('Accept', 'application/json'),
16
  withCredentials: true
17
};
18

  
19
@Injectable ()
20
export class StatisticsService {
21
  private apiUrl = process.env.API_ENDPOINT + '/stats/';
22

  
23
  constructor(private httpClient: HttpClient) { }
24

  
25

  
26
  getStatisticsNumbers(): Observable<Map<string,string>> {
27
    let url = `${this.apiUrl}getStatistics`;
28
    console.log(`knocking on: ${url}`);
29

  
30
    return this.httpClient.get<Map<string,string>>(url, headerOptions);
31
  }
32

  
33

  
34
}
modules/uoa-repository-dashboard-gui/trunk/app/shared/topmenu/topmenu.component.html
119 119
                  <!--class="uk-responsive-height"-->
120 120
                  <!--src="http://dl119.madgik.di.uoa.gr/images/site_images/Home-icon.png"-->
121 121
                  <!--alt="home"></a></li>-->
122
                  <li><a href="https://beta.explore.openaire.eu" title="Search in OA. Link your research">Explore</a></li>
123
                  <li class="active"><a href="http://beta.provide.openaire.eu/" title="Content Provider Dashboard">Provide</a></li>
124
                  <li><a href="https://beta.connect.openaire.eu" title="Research Community Dashboard">Connect</a></li>
122
                  <li><a href="https://{{ inBeta ? 'beta.' : '' }}explore.openaire.eu" title="Search in OA. Link your research">Explore</a></li>
123
                  <li class="active"><a href="http://{{ inBeta ? 'beta.' : '' }}provide.openaire.eu/" title="Content Provider Dashboard">Provide</a></li>
124
                  <li><a href="https://{{ inBeta ? 'beta.' : '' }}connect.openaire.eu" title="Research Community Dashboard">Connect</a></li>
125 125
                  <li><a href="https://monitor.openaire.eu" title="Monitoring Dashboard">Monitor</a></li>
126 126
                  <li><a href="https://develop.openaire.eu" title="APIs">Develop</a></li>
127 127
                </ul>
modules/uoa-repository-dashboard-gui/trunk/app/shared/topmenu/topmenu.component.ts
17 17
  isUserAdmin: boolean = false;
18 18
  adminHomePage = process.env.FAQ_HOMEPAGE;
19 19

  
20
  inBeta: boolean;
21

  
20 22
  constructor(public authService: AuthenticationService) { }
21 23

  
22 24
  ngOnInit() {
23 25
    this.getIsUserLoggedIn();
24 26
    this.getUserName();
25 27
    this.getIsUserAdmin();
28

  
29
    const baseUrl = window.location.origin;
30
    this.inBeta = ( baseUrl.includes('beta') || baseUrl.includes('athenarc') );
26 31
  }
27 32

  
28 33

  
modules/uoa-repository-dashboard-gui/trunk/app/shared/reusablecomponents/reusable-components.module.ts
66 66
    AsideHelpContentComponent,
67 67
    ConfirmationDialogComponent,
68 68
    RepositoryTilesComponent,
69
    ForbiddenPageComponent,
69 70
    ...myGroups
70 71
  ],
71 72
  providers: [
modules/uoa-repository-dashboard-gui/trunk/app/app.module.ts
31 31
import { HTTP_INTERCEPTORS, HttpClientModule } from "@angular/common/http";
32 32
import { CookieLawModule } from "./shared/reusablecomponents/cookie-law/cookie-law.module";
33 33
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
34
import { ReusableComponentsModule } from './shared/reusablecomponents/reusable-components.module';
35
import { StatisticsService } from './services/statistics.service';
34 36

  
35 37

  
36 38
@NgModule({
......
43 45
    HttpClientModule,
44 46
    JsonpModule,
45 47
    ModalModule.forRoot(),
46
//    routing,
48
    TabsModule,
49
    ReusableComponentsModule,
50
    CookieLawModule,
47 51
    AppRouting,
48
    TabsModule,
49
    MetricsModule,
50
    SourcesModule,
51
    CompatibilityModule,
52
    ContentModule,
53
    AdminPgModule,
54
    CookieLawModule
55 52
  ],
56 53
  declarations: [
57 54
    AppComponent,
......
72 69
    RepositoryService,
73 70
    ValidatorService,
74 71
    UsagestatsService,
72
    StatisticsService,
75 73
    AuthGuardService,
76 74
    AuthenticationService
77 75
  ],
modules/uoa-repository-dashboard-gui/trunk/webpack.config.js
77 77
    },
78 78
    proxy: {
79 79
      '/uoa-repository-manager-service': {
80
        target: 'http://koulis.athenarc.gr:8080',
80
        target: 'http://aleka.athenarc.gr:8480',
81 81
        secure: false
82 82
      }
83 83
    }
......
122 122
      }
123 123
    );
124 124
  } else {
125
    /*disabling console.log in production*/
126
    console.log = function () {};
127

  
125 128
    webpackConfig.plugins.push(
126 129
      new AotPlugin({
127 130
        tsConfigPath: 'tsconfig.json',

Also available in: Unified diff