Project

General

Profile

« Previous | Next » 

Revision 47541

Functions for count results of an entity better structured in search services

View differences:

fetchDataproviders.class.ts
64 64
  }
65 65

  
66 66
  public getNumForEntity(entity: string, id:string) {
67
      var parameters="";
68

  
69
      if(entity == "organization") {
70
        parameters = "organizations/"+id+"/datasources/count";
71
      }
72

  
73 67
      var errorCodes:ErrorCodes = new ErrorCodes();
74 68
      this.searchUtils.status = errorCodes.LOADING;
75 69

  
76
      if(parameters != "") {
70
      if(id != "" && entity != "") {
77 71

  
78
          this._searchDataprovidersService.numOfDataproviders(parameters).subscribe(
72
          this._searchDataprovidersService.numOfEntityDataproviders(id, entity).subscribe(
79 73
              data => {
80 74
                  this.searchUtils.totalResults = data;
81 75

  
......
101 95
  public getNumForSearch(keyword: string) {
102 96
      var errorCodes:ErrorCodes = new ErrorCodes();
103 97
      this.searchUtils.status = errorCodes.LOADING;
104
      var parameters="datasources/count";
105
      if(keyword != "") {
106
          parameters += "?q=" +keyword ;
107
      }
108
      this._searchDataprovidersService.numOfDataproviders(parameters).subscribe(
98

  
99
      this._searchDataprovidersService.numOfDataproviders(keyword).subscribe(
109 100
          data => {
110 101
              this.searchUtils.totalResults = data;
111 102
              this.searchUtils.status = errorCodes.DONE;

Also available in: Unified diff