[IMP] Improved CrashManager

bzr revid: fme@openerp.com-20110621121002-bqcsuzdfncyb1v24
This commit is contained in:
Fabien Meghazi
2011-06-21 14:10:02 +02:00
parent 41716a1516
commit 8e20af0331
3 changed files with 44 additions and 21 deletions
+11
View File
@@ -1042,3 +1042,14 @@ background: linear-gradient(top, #ffffff 0%,#ebe9e9 100%); /* W3C */
.openerp .oe-m2o-disabled-cm {
color: grey;
}
.openerp .oe-dialog-warning {
font-size: 1.2em;
font-weight: bold;
}
.openerp .oe-dialog-warning img {
float: left;
position: relative;
top: -0.5em;
margin:0 7px 7px 0;
}
+24 -15
View File
@@ -819,24 +819,32 @@ openerp.base.Dialog = openerp.base.BaseWidget.extend({
}
});
openerp.base.CrashManager = openerp.base.Controller.extend({
init: function(session, element_id) {
this._super(session, element_id);
openerp.base.CrashManager = openerp.base.Dialog.extend({
identifier_prefix: 'dialog_crash',
init: function(session) {
this._super(session);
this.session.on_rpc_error.add(this.on_rpc_error);
},
on_rpc_error: function(error) {
var msg = error.message + "\n" + error.data.debug;
this.display_error(msg);
on_button_Ok: function() {
this.close();
},
display_error: function(message) {
$('<pre></pre>').text(message).dialog({
modal: true,
buttons: {
OK: function() {
$(this).dialog("close");
}
}
});
on_rpc_error: function(error) {
this.error = error;
if (error.code === 200) {
this.dialog_title = "OpenERP Warning";
this.template = 'DialogWarning';
this.open({
width: 'auto',
height: 'auto'
});
} else {
this.dialog_title = "OpenERP Error";
this.template = 'DialogTraceback';
this.open({
width: '80%',
height: '80%'
});
}
}
});
@@ -1066,6 +1074,7 @@ openerp.base.WebClient = openerp.base.Controller.extend({
this.session = new openerp.base.Session("oe_errors");
this.loading = new openerp.base.Loading(this.session, "oe_loading");
this.crashmanager = new openerp.base.CrashManager(this.session);
this.crashmanager.start(false);
// Do you autorize this ?
openerp.base.Controller.prototype.notification = new openerp.base.Notification("oe_notification");
+9 -6
View File
@@ -870,12 +870,15 @@
</div>
</t>
<t t-name="DialogWarning">
<div id="dialog-message" t-att-title="title">
<p>
<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
<t t-esc="message"/>
</p>
</div>
<p class="oe-dialog-warning">
<img src="/base/static/src/img/warning.png" class="oe-dialog-icon"/>
<t t-esc="error.data.fault_code.substr(18)"/>
</p>
</t>
<t t-name="DialogTraceback">
<pre><t t-esc="error.message"/></pre>
<hr/>
<pre><t t-esc="error.data.debug"/></pre>
</t>
<t t-name="SelectCreatePopup">
<div t-att-id="element_id">