add details dialog to logs dialog

This commit is contained in:
rolux 2011-11-03 01:52:15 +00:00
parent 6bb51eabdb
commit c01ca5f0d8
3 changed files with 47 additions and 16 deletions

View file

@ -1,7 +1,6 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript // vim: et:ts=4:sw=4:sts=4:ft=javascript
/***
Pandora // FIXME: this should be named pandora.js
***/
/* /*
---- UI Tree ---- ---- UI Tree ----
@ -20,18 +19,18 @@ appPanel
statusbar statusbar
*/ */
window.onerror = function(error, url, line) {
try {
pandora.api.log({
text: error,
url: url,
line: line
});
} catch(e) {}
};
(function() { (function() {
window.onerror = function(error, url, line) {
try {
pandora.api.log({
text: error,
url: url,
line: line
});
} catch(e) {}
};
var debug = localStorage && localStorage.debug, var debug = localStorage && localStorage.debug,
theme = localStorage && localStorage.theme || 'modern'; theme = localStorage && localStorage.theme || 'modern';

View file

@ -77,7 +77,7 @@ pandora.ui.logsDialog = function() {
id: 'url', id: 'url',
title: 'URL', title: 'URL',
format: function(value, data) { format: function(value, data) {
return value.split('?')[0] + ':' + data.line; return formatURL(value, data.line);
}, },
operator: '+', operator: '+',
visible: true, visible: true,
@ -116,6 +116,33 @@ pandora.ui.logsDialog = function() {
$list.reloadList(); $list.reloadList();
Ox.Request.clearCache('findLogs'); Ox.Request.clearCache('findLogs');
}); });
},
open: function(data) {
var value = $list.value(Ox.last(data.ids)),
$dialog;
if (/^Traceback/.test(value.text)) {
$dialog = Ox.Dialog({
buttons: [
Ox.Button({
id: 'close',
title: 'Close'
})
.bindEvent({
click: function() {
$dialog.close();
}
})
],
closeButton: true,
content: $('<code>').append($('<pre>').css({margin: '16px'}).html(value.text)),
height: height - 48,
keys: {enter: 'close', escape: 'close'},
maximizeButton: true,
title: formatURL(value.url, value.line),
width: width - 48
})
.open();
}
} }
}), }),
@ -171,6 +198,9 @@ pandora.ui.logsDialog = function() {
}) })
.appendTo(that.$element.find('.OxButtonsbar')); .appendTo(that.$element.find('.OxButtonsbar'));
function formatURL(url, line) {
return url.split('?')[0] + ':' + line;
}
function renderLog(logData) { function renderLog(logData) {
var $checkbox; var $checkbox;

View file

@ -143,7 +143,8 @@ pandora.ui.mainMenu = function() {
{ id: 'clearcache', title: 'Clear Cache'}, { id: 'clearcache', title: 'Clear Cache'},
{ id: 'reloadapplication', title: 'Reload Application'}, { id: 'reloadapplication', title: 'Reload Application'},
{ id: 'resetui', title: 'Reset UI Settings'}, { id: 'resetui', title: 'Reset UI Settings'},
{ id: 'debug', title: (localStorage.debug?'Disable':'Enable')+' Debug Mode'} { id: 'debug', title: (localStorage.debug?'Disable':'Enable')+' Debug Mode'},
{ id: 'triggererror', title: 'Trigger JavaScript Error'},
] } ] }
] ]
: [] : []
@ -277,8 +278,9 @@ pandora.ui.mainMenu = function() {
} else { } else {
localStorage.debug = 1; localStorage.debug = 1;
} }
that.setItemTitle('debug', (localStorage.debug ? 'Disable' : 'Enable') + ' Debug Mode'); that.setItemTitle('debug', (localStorage.debug ? 'Disable' : 'Enable') + ' Debug Mode');
} else if (data.id == 'triggererror') {
var e = error;
} }
}, },
key_control_f: function() { key_control_f: function() {