Revision edd1d565 ui/static/snf/js/ui/web/ui_error_view.js
b/ui/static/snf/js/ui/web/ui_error_view.js | ||
---|---|---|
21 | 21 |
content_selector: "#error-overlay-content", |
22 | 22 |
css_class: 'overlay-error', |
23 | 23 |
overlay_id: "error-overlay", |
24 |
error_stack: {}, |
|
24 | 25 |
|
25 | 26 |
initialize: function() { |
26 | 27 |
views.ErrorView.__super__.initialize.apply(this, arguments); |
... | ... | |
60 | 61 |
|
61 | 62 |
report_error: function() { |
62 | 63 |
this.feedback_view = this.feedback_view || ui.main.feedback_view; |
63 |
this.feedback_view.show(this.get_report_message(), true, {error: this.error_object()}); |
|
64 |
this.hide(false); |
|
65 |
window.setTimeout(_.bind(function() { |
|
66 |
this.feedback_view.show(this.get_report_message(), true, {error: this.error_object()}); |
|
67 |
}, this), 400); |
|
64 | 68 |
}, |
65 | 69 |
|
66 | 70 |
get_report_message: function() { |
... | ... | |
75 | 79 |
|
76 | 80 |
return fdb_msg; |
77 | 81 |
}, |
78 |
|
|
82 |
|
|
79 | 83 |
show_error: function(ns, code, message, type, details, error_options) { |
84 |
if (!snf.api.error_state) { this.error_stack = {} }; |
|
85 |
|
|
86 |
snf.api.error_state = true; |
|
87 |
snf.api.trigger("change:error_state", true); |
|
88 |
|
|
89 |
var error_entry = [ns, code, message, type, details, error_options]; |
|
90 |
this.error_stack[new Date()] = error_entry; |
|
91 |
this.display_error.apply(this, error_entry); |
|
92 |
this.show(); |
|
93 |
}, |
|
94 |
|
|
95 |
display_error: function(ns, code, message, type, details, error_options) { |
|
80 | 96 |
this.error_options = {'allow_report': true, 'allow_reload': true, 'extra_details': {}, 'non_critical': false}; |
81 | 97 |
|
82 | 98 |
if (error_options) { |
83 | 99 |
this.error_options = _.extend(this.error_options, error_options); |
84 | 100 |
} |
85 | 101 |
|
86 |
this.hide(); |
|
87 |
|
|
88 | 102 |
this.code = code; |
89 | 103 |
this.ns = ns; |
90 | 104 |
this.type = type; |
... | ... | |
99 | 113 |
this.el.removeClass("non-critical"); |
100 | 114 |
} |
101 | 115 |
|
102 |
this.show(); |
|
103 |
|
|
104 | 116 |
this.$(".actions .show-details").click(); |
105 | 117 |
this.$(".key.details").click(); |
106 | 118 |
this.$(".error-more-details").hide(); |
... | ... | |
145 | 157 |
} |
146 | 158 |
}, |
147 | 159 |
|
148 |
onClose: function() { |
|
160 |
hide: function(reset_state) { |
|
161 |
if (reset_state === undefined) { reset_state = true }; |
|
162 |
if (reset_state) { |
|
163 |
snf.api.error_state = false; |
|
164 |
snf.api.trigger("change:error_state", snf.api.error_state); |
|
165 |
} |
|
166 |
views.ErrorView.__super__.hide.apply(this); |
|
167 |
}, |
|
168 |
|
|
169 |
onClose: function(reset_state) { |
|
149 | 170 |
this.trigger("close", this); |
150 | 171 |
} |
151 | 172 |
}); |
Also available in: Unified diff