Project

General

Profile

« Previous | Next » 

Revision 57494

[Trunk | Library]:
1. landingPages/: When no id is specified or id is not found (search service returns 404), redirect to /error with more specific message.
2. error/errorPage.component.ts: When the error was caused by landing pages, add more specific message - suggest to search again.

View differences:

resultLanding.component.ts
12 12
import {HelperFunctions} from '../../utils/HelperFunctions.class';
13 13
import {HelperService} from '../../utils/helper/helper.service';
14 14
import {isPlatformBrowser} from "@angular/common";
15
import {LoginErrorCodes} from "../../login/utils/guardHelper.class";
15 16

  
16 17

  
17 18
@Component({
......
145 146
          } else {
146 147
            this.showLoading = false;
147 148

  
149
            this._router.navigate(['/error'], {queryParams: {"page": this.linkToSearchPage + this.id, "page_type": this.type}});
150
            /*
148 151
            this.warningMessage = "No valid ";
149 152
            if(this.type == "publication" || this.type == "software") {
150 153
              this.warningMessage += this.type + " ";
......
154 157
              this.warningMessage += "other research product ";
155 158
            }
156 159
            this.warningMessage += "id";
160
            */
157 161
          }
158 162

  
159 163
          this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false';
......
287 291
      err => {
288 292
        this.handleError("Error getting "+this.type+" for id: " + this.id, err);
289 293

  
294
        if(err.status == 404) {
295
          this._router.navigate(['/error'], {queryParams: {"page": this.linkToSearchPage + this.id, "page_type": this.type}});
296
        }
297

  
290 298
        if(this.type == "publication" || this.type == "software") {
291 299
          this.errorMessage = 'No '+this.type+' found';
292 300
        } else if(this.type == "dataset") {

Also available in: Unified diff