Project

General

Profile

« Previous | Next » 

Revision 53188

fixed bug in usagestats

View differences:

modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-usagestats-report-results.component.ts
26 26
  selectedItemIndex: number;
27 27

  
28 28
  pageSizeSelect: FormGroup;
29
  chosenReport: string;
29 30

  
30 31
  constructor(private route: ActivatedRoute,
31 32
              private authService: AuthenticationService,
......
54 55
      this.params.append('Granularity', qparams['granularity']);
55 56
    });
56 57

  
58
    this.chosenReport = this.params.get('Report');
57 59
    this.getReportResponse();
58 60
  }
59 61

  
......
140 142
    }
141 143
  }
142 144

  
143
  transformItem(urls: string) {
145
  transformItem(itemIdentifiers: any[]) {
144 146
    /*const temp = urls.split(';');
145 147
    let output = '';
146 148
    for (let u of temp) {
......
149 151
      }
150 152
      output = output + u.replace(/\\/g,'').trim();
151 153
    }*/
152
    return urls.split(';');
154
    const i = itemIdentifiers.findIndex(x => x['Type'] === 'URL');
155
    if ( i > -1 ){
156
      const urls = itemIdentifiers[i]['Value'];
157
      return urls.split(';');
158
    }
159
    return '';
153 160
  }
154 161

  
155 162
  getBg(i: number) {
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-usagestats-report.component.ts
23 23
  repoId: string;
24 24
  shownRepoId: string;
25 25
  shownOpenaireId: string;
26
  useCurrentRepo: boolean;
26 27
  issnToShow: string = '';
27 28
  chosen_report: string;
28 29

  
......
50 51
    this.shownRepoId = this.convertToDisplayedFormat(this.repoId);
51 52
    console.log(`shownRepoId is ${this.repoId}`);
52 53
    this.title = `${this.chosen_report} report`;
54
    if (this.chosen_report !== 'RR1') {
55
      this.useCurrentRepo = true;
56
    }
53 57
  }
54 58

  
55 59
  convertToDisplayedFormat(input: string) {
......
75 79
        if (this.repo.piwikInfo) {
76 80
          this.shownOpenaireId = this.convertToDisplayedFormat(this.repo.piwikInfo.openaireId);
77 81
        }
78
        if (this.repo.issn){
79
          this.issnToShow = this.repo.issn.slice(0, 4)+ '-' + this.repo.issn.toString().slice(4);
82
        if (this.repo.issn && this.repo.issn !== 'null'){
83
          this.shownRepoId = this.repo.issn.slice(0, 4)+ '-' + this.repo.issn.toString().slice(4);
80 84
        }
81 85
        this.title = `${this.chosen_report} report for ${this.repo.officialName}`;
82 86
        if ( this.authService.activateFrontAuthorization && (this.authService.getUserEmail() !== this.repo.registeredBy) ) {
......
106 110
    this.granularity = event.target.value;
107 111
  }
108 112

  
113
  updateUseCurrentRepo(event: any) {
114
    this.useCurrentRepo = event.target.value;
115
  }
116

  
109 117
  goToReport() {
118
    if (!this.useCurrentRepo) { this.shownRepoId = ''; }
110 119
    this.router.navigate(['/getImpact/usagestats-report-results'], {
111 120
      queryParams: {
112 121
        report: this.chosen_report,
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-usagestats-report-results.component.html
116 116
                          <table class="uk-table uk-table-middle uk-table-striped" style="vertical-align: top !important;">
117 117
                            <thead>
118 118
                              <tr>
119
                                <th>Item Urls</th>
120
                                <th>Title</th>
121
                                <th>Publisher</th>
119
                                <th *ngIf="chosenReport !== 'RR1'">Title</th>
120
                                <th *ngIf="chosenReport !== 'RR1'">Publisher</th>
121
                                <th *ngIf="chosenReport === 'RR1'">Platform name</th>
122
                                <th>{{ (chosenReport !== 'RR1') ? 'Item Urls' : 'Url' }}</th>
122 123
                                <th>Type</th>
123 124
                                <th colspan="2">Downloads/Views</th>
124 125
                              </tr>
......
127 128
                            <tbody *ngFor="let item of repoResponse.Report.Report.Customer.ReportItems; let item_i = index"
128 129
                                   style="border-bottom: 1px solid whitesmoke;">
129 130
                              <tr>
131
                                <td *ngIf="chosenReport !== 'RR1'">{{ item.ItemName }}</td>
132
                                <td *ngIf="chosenReport !== 'RR1'">{{ item.ItemPublisher }}</td>
133
                                <td *ngIf="chosenReport === 'RR1'">{{ item.ItemPlatform }}</td>
130 134
                                <td>
131
                                <span *ngFor="let url of transformItem(item.ItemIdentifier[1].Value); let i = index">
132
                                  <br *ngIf="i>0">{{ url }}
133
                                </span>
135
                                  <span *ngFor="let url of transformItem(item.ItemIdentifier); let i = index">
136
                                    <br *ngIf="i>0">{{ url }}
137
                                  </span>
134 138
                                </td>
135
                                <td>{{ item.ItemName }}</td>
136
                                <td>{{ item.ItemPublisher }}</td>
137 139
                                <td>{{ item.ItemDataType }}</td>
138 140
                                <td class="uk-text-center"
139 141
                                    *ngIf="repoResponse.ReportDefinition.Filters.ReportAttribute[0].Value === 'Monthly'" colspan="2">
modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-usagestats-report.component.html
81 81
                    </div>
82 82
                  </div>
83 83
                  <h5><span *ngIf="chosen_report == 'RR1' || chosen_report == 'JR1'">Optional </span>Filters</h5>
84
                  <p>Provide either a Repository Identifier or an Item Identifier<br>
84
                  <p *ngIf="chosen_report != 'RR1' && chosen_report != 'JR1'">
85
                    For more specific results, provide an Item Identifier.<br>
85 86
                    Identifier format: <b>namespace:value</b><br>
86
                    Valid namespace for Repository Identifier: <b>openaire</b> or <b>opendoar</b>.<br>
87 87
                    Valid namespace for Item Identifier: <b>openaire</b>, <b>doi</b> or <b>oid</b>(for OAI-PMH).
88 88
                  </p>
89
            		  <p *ngIf="chosen_report =='RR1'">
90
                    By default results are returned for all repositories.<br>
91
		                To get just the results for the current repository, check the box.</p>
89 92
                  <div *ngIf="chosen_report != 'JR1'" class="uk-grid">
90 93
                    <div class=" uk-width-1-3 uk-text-right">
91 94
                      Repository Identifier:
......
93 96
                    <div class="uk-width-2-3">
94 97
                      {{ shownRepoId }}
95 98
                    </div>
99
                    <div *ngIf="chosen_report =='RR1'" class=" uk-width-1-3 uk-text-right">
100
                      Select current repository
101
                    </div>
102
                    <div *ngIf="chosen_report =='RR1'" class="uk-width-2-3 checkbox">
103
                      <input type="checkbox" value="useCurrentRepo"
104
                             (change)="updateUseCurrentRepo($event)">
105
                    </div>
96 106
                  </div>
97 107
                  <div *ngIf="repo.issn && chosen_report == 'JR1'" class="uk-grid">
98 108
                    <div class=" uk-width-1-3 uk-text-right">
99 109
                      Journal Identifier:
100 110
                    </div>
101 111
                    <div class="uk-width-2-3">
102
                      {{ issnToShow }}
112
                      {{ shownRepoId }}
103 113
                    </div>
104 114
                  </div>
105 115
                  <div *ngIf="chosen_report != 'JR1' && chosen_report != 'RR1'" class="uk-grid">

Also available in: Unified diff