Revision 9ce969a7 ui/static/snf/js/ui/web/ui_error_view.js

b/ui/static/snf/js/ui/web/ui_error_view.js
81 81
        },
82 82
        
83 83
        show_error: function(ns, code, message, type, details, error_options) {
84
            if (!snf.api.error_state) { this.error_stack = {} };
84
            if (snf.api.error_state == snf.api.STATES.NORMAL) { this.error_stack = {} };
85 85
                
86
            if (error_options.fatal_error) {
87
                snf.api.error_state = true;
88
                snf.api.trigger("change:error_state", true);
89
            } else {
90
                snf.api.error_state = false;
91
                snf.api.trigger("change:error_state", false);
92
            }
93

  
94 86
            var error_entry = [ns, code, message, type, details, error_options];
95 87
            this.error_stack[new Date()] = error_entry;
96 88
            this.display_error.apply(this, error_entry);
......
98 90
        },
99 91

  
100 92
        display_error: function(ns, code, message, type, details, error_options) {
101
            this.error_options = {'allow_report': true, 'allow_reload': true, 'extra_details': {}, 'non_critical': false, 'allow_details': false };
102

  
93
            this.error_options = {'allow_report': true, 'allow_reload': true, 
94
                'extra_details': {}, 'non_critical': false, 
95
                'allow_details': false };
96
            
103 97
            if (error_options) {
104 98
                this.error_options = _.extend(this.error_options, error_options);
105 99
            }
......
109 103
            this.type = type;
110 104
            this.details = details ? (details.toString ? details.toString() : details) : undefined;
111 105
            this.message = message;
106
            this.title = error_options.title || undefined;
112 107

  
113 108
            this.update_details();
114 109
            
......
120 115
                this.error_options.allow_details = true;
121 116
            }
122 117
            
123
            //if (APP_DEBUG) {
124
                //this.error_options.allow_details = true;
125
            //}
126

  
118
            if (APP_DEBUG) {
119
                this.error_options.allow_details = true;
120
            }
121
            
127 122
            this.$(".actions .show-details").click();
128 123
            this.$(".key.details").click();
129 124
            this.$(".error-more-details").hide();
......
134 129
            if (this.ns && this.type) {
135 130
                title = this.title || this.type + " Error";
136 131
            }
132

  
137 133
            this.$(".header .title").text(title);
138 134
            this.$(".error-code").text(this.code || "");
139 135
            this.$(".error-type").text(this.type || "");
......
172 168
            } else {
173 169
                this.$(".reload-app").hide();
174 170
            }
171

  
172
        },
173

  
174
        onOpen: function() {
175
            var self = this;
176

  
177
            this.$(".closeme").unbind("click");
178
            this.$(".closeme").bind("click", function(){
179
                self.hide("reset")
180
            })
175 181
        },
176 182

  
177 183
        hide: function(reset_state) {
178
            if (reset_state === undefined) { reset_state = true };
179
            if (reset_state) {
180
                snf.api.error_state = false;
181
                snf.api.trigger("change:error_state", snf.api.error_state);
182
            }
184
            if (reset_state === "reset") { snf.api.trigger("reset") };
183 185
            views.ErrorView.__super__.hide.apply(this);
184 186
        },
185 187

  

Also available in: Unified diff