Project

General

Profile

« Previous | Next » 

Revision 55902

[angular7|library]

Merging Trunk into branch 55729:55901

View differences:

searchDatasets.service.ts
39 39
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
40 40
                    //.map(res => <any> res.json())
41 41
                    //.do(res => console.info(res))
42
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]));
42
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]));
43

  
43 44
    }
44 45
    searchDatasetById (id: string , properties:EnvProperties):any {
45 46

  
46 47
        let url = properties.searchAPIURLLAst+"datasets/"+id+"?format=json";
47 48
         return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
48 49
                    //.map(res => <any> res.json())
49
                    .pipe(map(res => this.parseResults(res)));
50
                    .pipe(map(res => this.parseResults(res, properties)));
50 51
    }
51 52

  
52 53
    searchAggregators (id: string, params: string, refineParams:string, page: number, size: number, properties:EnvProperties ):any {
......
90 91
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
91 92
                    //.map(res => <any> res.json())
92 93
                    //.do(res => console.info(res))
93
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]));
94
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'], properties),RefineResultsUtils.parse(res['refineResults'],refineFields, "dataset")]));
95

  
94 96
    }
95 97
    advancedSearchDatasets (params: string, page: number, size: number, sortBy: string, properties:EnvProperties ):any {
96 98
      let url = properties.searchResourcesAPIURL;
......
113 115
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
114 116
      //.map(res => <any> res.json())
115 117
      //.do(res => console.info(res))
116
      .pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
118
      .pipe(map(res => [res['meta'].total, this.parseResults(res['results'], properties)]));
119

  
117 120
    }
118 121
    searchDatasetsForEntity (params: string, page: number, size: number, properties:EnvProperties):any {
119 122
        let link = properties.searchAPIURLLAst;
......
121 124

  
122 125
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
123 126
                    //.map(res => <any> res.json())
124
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
127
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'], properties)]));
128

  
125 129
    }
126 130

  
127 131
    searchDatasetsForDataproviders(params: string, page: number, size: number, properties:EnvProperties):any {
......
129 133
        let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json";
130 134
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
131 135
                    //.map(res => <any> res.json())
132
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
136
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'], properties)]));
137

  
133 138
    }
134 139

  
135
    parseResults(data: any): SearchResult[] {
140
    parseResults(data: any, properties: EnvProperties): SearchResult[] {
136 141
        let results: SearchResult[] = [];
137 142

  
138 143
        let length = Array.isArray(data) ? data.length : 1;
......
221 226

  
222 227
            if(resData.hasOwnProperty("creator") && resData['creator'] != null) {
223 228
              if(result['authors'] == undefined) {
224
                result['authors'] = new Array<string>();
229
                result['authors'] = new Array<{"fullName": string, "orcid": string}>();
225 230
              }
226 231

  
227 232
              let authors = resData['creator'];
......
229 234

  
230 235
              for(let i=0; i<length; i++) {
231 236
                let author = Array.isArray(authors) ? authors[i] : authors;
232
                result.authors[author.rank] = author.content;
237
                if(author) {
238
                  /*if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
239
                    author.ORCID = author.ORCID.substr(properties.orcidURL.length);
240
                  }*/
241
                  result['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
242
                }
233 243
              }
234 244
              result.authors = result.authors.filter(function (item) {
235
                return (item != undefined);
245
                return (item != undefined && item.fullName != undefined);
236 246
              });
237 247
            }
238 248

  

Also available in: Unified diff