Project

General

Profile

« Previous | Next » 

Revision 53553

Linking:
1. When linking is from connect, add community in the basket if there is not
2. My links add separate section with the recent claims (24h)
3. In recent claims add tooltip with information about the link visiblility in the index
4. Add section on the right with the link to create more and a link to claims information article
5. Add link to claims information article to the properties

View differences:

displayClaims.component.ts
19 19
export class DisplayClaimsComponent {
20 20
  properties:EnvProperties;
21 21
  public searchTermStream = new Subject<string>();
22

  
22 23
  constructor (private _claimService: ClaimsService,  private route: ActivatedRoute, private _router:Router, private location: Location) {
23 24
   }
24 25

  
......
74 75
  @Input() showUserEmail: boolean = true;
75 76
  @Input() myClaims: boolean= false ;
76 77
  @Input() isAdmin:boolean = false;
78
  @Input() showLatestClaims:boolean = false;
79
  recentClaims = [];
77 80
  page : number;
78 81
  size:number;
79 82
  sizes = [10,20,30,50];
......
87 90
  navigateTo: string = "Claims";
88 91
  resultsNum: number ;
89 92
  claims: string[];
93
  @Input() moreClaimsURL:string;// ="/participate/claim";
94
  @Input() claimsInfoURL:string;// ="https://www.openaire.eu/linking";
90 95

  
91 96
  @ViewChild (ModalLoading) loading : ModalLoading ;
92 97

  
......
129 134
    if(this.fetchBy =="Project" ){
130 135
      this._claimService.getClaimsByProject(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe(
131 136
        data => {
132
          this.claims = data.data;
133
          this.resultsNum= data.total;
137
          this.manageAPIData(data);
134 138
          },
135 139
        err => {
136 140
          this.handleErrors(err);
......
139 143
    }else if(this.fetchBy =="User"){
140 144
      this._claimService.getClaimsByUser(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types,this.properties.claimsAPIURL).subscribe(
141 145
        data => {
142
          this.claims = data.data;
143
          this.resultsNum= data.total;
146
          this.manageAPIData(data);
144 147
          },
145 148
          err => {
146 149
            this.handleErrors(err);
......
149 152
    }else if(this.fetchBy =="Result"){
150 153
      this._claimService.getClaimsByResult(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe(
151 154
        data => {
152
          this.claims = data.data;
153
          this.resultsNum= data.total;
155
          this.manageAPIData(data);
154 156
          },
155 157
          err => {
156 158
            this.handleErrors(err);
......
159 161
    }else if(this.fetchBy =="Context"){
160 162
      this._claimService.getClaimsBycontext(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe(
161 163
        data => {
162
          this.claims = data.data;
163
          this.resultsNum= null;
164
          this.resultsNum= data.total;//data.length; //TODO get the total results num
164
          this.manageAPIData(data);
165 165
          },
166 166
          err => {
167 167
             this.handleErrors(err);
......
170 170
    }else{
171 171
      this._claimService.getClaims(this.size,this.page,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe(
172 172
        data => {
173
          this.claims = data.data;
174
          this.resultsNum = null;
175
          this.resultsNum= data.total;//data.length; //TODO get the total results num
173
          this.manageAPIData(data);
176 174
          },
177 175
          err => {
178 176
            this.handleErrors(err);
......
181 179
    }
182 180
  }
183 181
}
182
manageAPIData(data){
183
   var d = new Date();
184
  var dateTomillis = d.getTime();
185
  var millis24h:number = 24*3600000;
186
  console.log("Date is:"+dateTomillis);
187
  if(this.showLatestClaims && this.recentClaims.length == 0){
188
    this.recentClaims = [];
189
    for(var i=0;i<data.data.length;i++){
190
      var claimDate = new Date(data.data[i].date);
191
      var claimDateToMillis = claimDate.getTime()
192
      // console.log("Claim Date is:"+claimDateToMillis + " "+(dateTomillis - claimDateToMillis));
193
      if((dateTomillis - claimDateToMillis)<millis24h){
194
        // console.log("Claim in:"+  " "+(dateTomillis - claimDateToMillis)+" < " +(millis24h));
195
        this.recentClaims.push(data.data[i]);
196
      }
197
    }
198
  }
199
  this.claims = data.data;
200
  this.resultsNum= data.total;
201

  
202

  
203
}
184 204
handleErrors(err){
185 205

  
186 206
  this.showErrorMessage = true;
......
520 540
      var page:number = +$event.value
521 541
      this.goTo(page);
522 542
    }
543

  
544
    getclaimStatus(claim):string{
545
      if(claim.target.collectedFrom == "infrastruct_::openaire"){
546
         return "The link information will be visible in the portal and the APIs after the next content provision workflow.";
547
      }else{
548
        return "The link information is visible in the portal and the APIs.";
549
      }
550

  
551
    }
523 552
}

Also available in: Unified diff