Revision 0b416fc7
b/snf-cyclades-app/synnefo/ui/static/snf/css/main.css | ||
---|---|---|
4938 | 4938 |
font-size: 0.8em; |
4939 | 4939 |
} |
4940 | 4940 |
|
4941 |
.overlay-error .message p .api-message { |
|
4942 |
color: #444; |
|
4943 |
font-size: 0.9em; |
|
4944 |
} |
|
4945 |
|
|
4941 | 4946 |
.overlay-error span.value, .overlay-error div.value { |
4942 | 4947 |
padding: 0.4em; |
4943 | 4948 |
display: block; |
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_error_view.js | ||
---|---|---|
121 | 121 |
"Code: " + this.code + "\n" + |
122 | 122 |
"Type: " + this.type + "\n" + |
123 | 123 |
"Message: " + this.message + "\n" + |
124 |
"API Message: " + this.api_message + "\n" + |
|
124 | 125 |
"Module: " + this.ns + "\n" + |
125 | 126 |
"Details: " + this.details + "\n\n" + |
126 | 127 |
"Please describe the actions that triggered the error:\n" |
... | ... | |
128 | 129 |
return fdb_msg; |
129 | 130 |
}, |
130 | 131 |
|
131 |
show_error: function(ns, code, message, type, details, error_options) { |
|
132 |
show_error: function(ns, code, message, api_message, type, details, error_options) {
|
|
132 | 133 |
|
133 |
var error_entry = [ns, code, message, type, details, error_options]; |
|
134 |
var error_entry = [ns, code, message, api_message, type, details, error_options];
|
|
134 | 135 |
var last_error_key = this.update_errors_stack(error_entry); |
135 | 136 |
|
136 | 137 |
if (!this.is_visible && !this.displaying_error) { |
... | ... | |
196 | 197 |
|
197 | 198 |
display_error: function(stack_key) { |
198 | 199 |
var err = this.error_stack[stack_key]; |
199 |
var ns = err[0], code = err[1], message = err[2], type = err[3], details = err[4], error_options = err[5] |
|
200 |
var ns = err[0], code = err[1], message = err[2]; |
|
201 |
var api_message = err[3], type = err[4]; |
|
202 |
var details = err[5], error_options = err[6]; |
|
200 | 203 |
|
201 | 204 |
this.error_options = {'allow_report': true, 'allow_reload': true, |
202 | 205 |
'extra_details': {}, 'non_critical': false, |
... | ... | |
212 | 215 |
this.type = type; |
213 | 216 |
this.details = details ? (details.toString ? details.toString() : details) : undefined; |
214 | 217 |
this.message = message; |
215 |
this.title = error_options.title || undefined; |
|
218 |
this.api_message = api_message; |
|
219 |
this.title = _.escape(error_options.title) || undefined; |
|
216 | 220 |
|
217 | 221 |
this.update_details(); |
218 | 222 |
|
... | ... | |
244 | 248 |
this.$(".error-code").text(this.code || ""); |
245 | 249 |
this.$(".error-type").text(this.type || ""); |
246 | 250 |
this.$(".error-module").text(this.ns || ""); |
247 |
this.$(".message p").text(this.message || ""); |
|
251 |
if (this.api_message) { |
|
252 |
this.$(".message p").html($( |
|
253 |
"<span>{0}</span><br /><span class='api-message'>{1}</span>".format( |
|
254 |
_.escape(this.message), |
|
255 |
_.escape(this.api_message)))); |
|
256 |
} else { |
|
257 |
this.$(".message p").text(this.message || ""); |
|
258 |
} |
|
248 | 259 |
this.$(".error-more-details p").html($("<pre />", {text:this.details}) || "no info"); |
249 | 260 |
|
250 | 261 |
this.$(".extra-details").remove(); |
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_icon_view.js | ||
---|---|---|
108 | 108 |
// force logout if UNAUTHORIZED request arrives |
109 | 109 |
if (args.code == 401) { snf.ui.logout(); return }; |
110 | 110 |
|
111 |
var error_entry = [args.ns, args.code, args.message, args.type, args.details, args]; |
|
111 |
var error_entry = [args.ns, args.code, args.message, '', args.type, args.details, args];
|
|
112 | 112 |
ui.main.error_view.show_error.apply(ui.main.error_view, error_entry); |
113 | 113 |
}, |
114 | 114 |
|
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_main_view.js | ||
---|---|---|
678 | 678 |
// force logout if UNAUTHORIZED request arrives |
679 | 679 |
if (args.code == 401) { snf.auth_client.redirect_to_login(); return }; |
680 | 680 |
|
681 |
var error_entry = [args.ns, args.code, args.message, args.type, args.details, args]; |
|
681 |
var error_entry = [args.ns, args.code, args.message, |
|
682 |
args.api_message, args.type, |
|
683 |
args.details, args]; |
|
682 | 684 |
this.error_view.show_error.apply(this.error_view, error_entry); |
683 | 685 |
}, |
684 | 686 |
|
... | ... | |
688 | 690 |
params = { title: "UI error", extra_details: data.extra }; |
689 | 691 |
delete data.extra.allow_close; |
690 | 692 |
params.allow_close = data.extra.allow_close === undefined ? true : data.extra.allow_close; |
691 |
this.error_view.show_error("UI", -1, msg, "JS Exception", error, params); |
|
693 |
this.error_view.show_error("UI", -1, msg, undefined, |
|
694 |
"JS Exception", error, params); |
|
692 | 695 |
}, |
693 | 696 |
|
694 | 697 |
init_overlays: function() { |
b/snf-cyclades-app/synnefo/ui/static/snf/js/utils.js | ||
---|---|---|
575 | 575 |
options = _.extend(options, synnefo.i18n.API_ERROR_MESSAGES[error_message] || {}); |
576 | 576 |
options = _.extend(options, synnefo.i18n.API_ERROR_MESSAGES[code] || {}); |
577 | 577 |
|
578 |
options.api_message = options.message; |
|
579 |
|
|
578 | 580 |
if (window.ERROR_OVERRIDES && window.ERROR_OVERRIDES[options.message]) { |
579 | 581 |
options.message = window.ERROR_OVERRIDES[options.message]; |
580 | 582 |
} |
... | ... | |
582 | 584 |
if (code && window.ERROR_OVERRIDES && window.ERROR_OVERRIDES[code]) { |
583 | 585 |
options.message = window.ERROR_OVERRIDES[code]; |
584 | 586 |
} |
585 |
|
|
587 |
|
|
588 |
if (options.api_message == options.message) { |
|
589 |
options.api_message = ''; |
|
590 |
} |
|
586 | 591 |
options = _.extend(defaults, options); |
587 | 592 |
options.code = code; |
588 | 593 |
|
Also available in: Unified diff