Skip to content

Commit ed7fe34

Browse files
committed
Tweak openhandler
Make the URL the primary action to load a dataset, add button for filtering. Give the rows fixed width, except the url, for consistent layout.
1 parent f0b9f1a commit ed7fe34

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

src/DebugBar/Resources/openhandler.js

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (typeof(PhpDebugBar) == 'undefined') {
2525
this.$closebtn = $('<a href="javascript:"><i class="fa fa-times"></i></a>');
2626
this.$table = $('<tbody />');
2727
$('<div>PHP DebugBar | Open</div>').addClass(csscls('header')).append(this.$closebtn).appendTo(this.$el);
28-
$('<table><thead><tr><th>Load</th><th>Method</th><th>URL</th><th>Date</th><th>IP</th></tr></thead></table>').append(this.$table).appendTo(this.$el);
28+
$('<table><thead><tr><th width="150">Date</th><th width="55">Method</th><th>URL</th><th width="100">IP</th><th width="100">Filter data</th></tr></thead></table>').append(this.$table).appendTo(this.$el);
2929
this.$actions = $('<div />').addClass(csscls('actions')).appendTo(this.$el);
3030

3131
this.$closebtn.on('click', function() {
@@ -106,11 +106,11 @@ if (typeof(PhpDebugBar) == 'undefined') {
106106
var a = $('<a href="javascript:" />')
107107
.text('Load dataset')
108108
.on('click', function(e) {
109-
self.hide();
110-
self.load(meta['id'], function(data) {
111-
self.callback(meta['id'], data);
112-
});
113-
e.preventDefault();
109+
self.hide();
110+
self.load(meta['id'], function(data) {
111+
self.callback(meta['id'], data);
112+
});
113+
e.preventDefault();
114114
});
115115

116116
var method = $('<a href="javascript:" />')
@@ -124,8 +124,10 @@ if (typeof(PhpDebugBar) == 'undefined') {
124124
var uri = $('<a href="javascript:" />')
125125
.text(meta['uri'])
126126
.on('click', function(e) {
127-
self.$table.empty();
128-
self.find({uri: meta['uri']}, 0, self.handleFind.bind(self));
127+
self.hide();
128+
self.load(meta['id'], function(data) {
129+
self.callback(meta['id'], data);
130+
});
129131
e.preventDefault();
130132
});
131133

@@ -136,13 +138,21 @@ if (typeof(PhpDebugBar) == 'undefined') {
136138
self.find({ip: meta['ip']}, 0, self.handleFind.bind(self));
137139
e.preventDefault();
138140
});
141+
142+
var search = $('<a href="javascript:" />')
143+
.text('Show URL')
144+
.on('click', function(e) {
145+
self.$table.empty();
146+
self.find({uri: meta['uri']}, 0, self.handleFind.bind(self));
147+
e.preventDefault();
148+
});
139149

140150
$('<tr />')
141-
.append($('<td />').append(a))
142-
.append($('<td />').append(method))
143-
.append($('<td />').append(uri))
144151
.append('<td>' + meta['datetime'] + '</td>')
152+
.append('<td>' + meta['method'] + '</td>')
153+
.append($('<td />').append(uri))
145154
.append($('<td />').append(ip))
155+
.append($('<td />').append(search))
146156
.appendTo(self.$table);
147157
});
148158
if (data.length < this.get('items_per_page')) {

0 commit comments

Comments
 (0)