Project

General

Profile

« Previous | Next » 

Revision 47540

Organization landing page: added Publications tab (+count for Projects tab since now it is the second one) & CSV download for the Publications based on affiliations

View differences:

fetchProjects.class.ts
90 90
    );
91 91
  }
92 92

  
93
  public getNumForEntity(entity: string, id:string) {
94
      var parameters="";
95

  
96
      if(entity == "organization") {
97
        parameters = "organizations/"+id+"/projects/count";
98
      }
99

  
100
      var errorCodes:ErrorCodes = new ErrorCodes();
101
      this.searchUtils.status = errorCodes.LOADING;
102

  
103
      if(parameters != "") {
104

  
105
          this._searchProjectsService.numOfProjects(parameters).subscribe(
106
              data => {
107
                  this.searchUtils.totalResults = data;
108

  
109
                  var errorCodes:ErrorCodes = new ErrorCodes();
110
                  this.searchUtils.status = errorCodes.DONE;
111
                  if(this.searchUtils.totalResults == 0 ){
112
                    this.searchUtils.status = errorCodes.NONE;
113
                  }
114
              },
115
              err => {
116
                  console.log(err);
117
                   //TODO check erros (service not available, bad request)
118
                  // if( ){
119
                  //   this.searchUtils.status = ErrorCodes.ERROR;
120
                  // }
121
                  var errorCodes:ErrorCodes = new ErrorCodes();
122
                  this.searchUtils.status = errorCodes.ERROR;
123
              }
124
          );
125
      }
126
  }
127

  
93 128
  public getResultsForOrganizations(organizationId:string, filterquery:string, page: number, size: number, refineFields:string[]){
94 129
      var errorCodes:ErrorCodes = new ErrorCodes();
95 130
      this.searchUtils.status = errorCodes.LOADING;
96
      
131

  
97 132
    this._searchProjectsService.getProjectsForOrganizations(organizationId,filterquery, page, size,refineFields).subscribe(
98 133
        data => {
99 134
            this.searchUtils.totalResults = data[0]; // the results can be filtered so this number can be no total results

Also available in: Unified diff