Revision 96ff5f77 ui/templates/home.html

b/ui/templates/home.html
153 153
            'DEFAULT' : '{% trans "Could not contact the service. Please check your network connectivity and try again." %}',
154 154
            // bad request
155 155
            '400' : '{% trans "Malformed request." %}',
156
            // Unauthorized
157
            '401' : '{% trans "Unauthorized" %}',
156 158
            // not found
157 159
            '404' : '{% trans "Your request has failed. Resource not found." %}',
158 160
            // internal server error
......
172 174
            // error box title
173 175
            'GENERIC_POPUP_HEADER' : '{% trans "Something seems to have gone wrong :( Here is what happened:" %}',
174 176
            // no advanced details
175
            'NO_DETAILS' : '{% trans "Νο advanced details provided" %}'
177
            'NO_DETAILS' : '{% trans "Νο advanced details provided" %}',
178
            'TIMEOUT' : '{% trans "It seems that connection with the server takes to long to respond, please check your network connectivity" %}'
176 179
        };
177 180

  
178 181
        var SUGGESTED_FLAVORS = {{ suggested_flavors|safe }};
......
198 201

  
199 202
        // ajax error checking
200 203
        function ajax_error(status, serverID, action, responseText, ajax_settings) {
201
            
202
            // ugly way to identify the type of the request
203
            // that caused the timeout
204
            if (serverID == "timeout" && status < 0 && ajax_settings && ajax_settings.repeated) {
205
                // do not show error for the first timeout
206
                if (TIMEOUTS_OCCURED < SKIP_TIMEOUTS) {
207
                    TIMEOUTS_OCCURED += 1;
208
                    return;
209
                }
210
            }
211 204

  
205
            // flag to display or not error report link
206
            var allow_report = ajax_settings.disable_report ? false : true;
207
            var no_details = ajax_settings.no_details === undefined || ajax_settings.no_details === false ? false : true;
208
            
212 209
            var error_date = new Date();
213 210
            if (!ajax_settings) {
214 211
                ajax_settings = {};
......
254 251
                } else {
255 252
                    details = errors[0].details;
256 253
                }
254
                
255
                // fallback to predefined message
256
                if (ERRORS[status] !== undefined) {
257
                    errors[0].message = ERRORS[status];
258
                }
257 259

  
258 260
                $("#error-success .machine-now-building").html(ERRORS["GENERIC_POPUP_HEADER"]);
259 261
                $("#error-success .popup-header").addClass("popup-header-error");
......
396 398
                       location.reload();
397 399
                    }
398 400
                },
401
                onBeforeLoad: function() {
402
                    if (allow_report) {
403
                        $(".error-report .send-btn").show();
404
                    } else {
405
                        $(".error-report .send-btn").hide();
406
                    }
407

  
408
                    if (no_details) {
409
                        $(".expand-details").hide();
410
                    } else {
411
                        $(".expand-details").show();
412
                    }
413
                },
399 414
                onLoad: function() {
400
                    initialize_error_report($(this.getOverlay()), [status, serverID, action, responseText]);
415
                    if (allow_report) {
416
                        initialize_error_report($(this.getOverlay()), [status, serverID, action, responseText]);
417
                    } else {
418
                    }
401 419
                }
402 420

  
403 421
            });

Also available in: Unified diff