1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 13:28:35 +01:00

Add filter form for OpenHandler

Provide a form to search for method/uri/ip.
Doesn't seem to handle multiple filters at once, but that seems a server-side problem.
Also, improvement could be to fill the form when clicking on a link, but it works :)
This commit is contained in:
Barry vd. Heuvel 2014-01-13 22:13:26 +01:00
parent 7fb14da75b
commit ef41586ae0

View File

@ -59,6 +59,8 @@ if (typeof(PhpDebugBar) == 'undefined') {
});
});
this.addSearch();
this.$overlay = $('<div />').addClass(csscls('overlay')).hide().appendTo('body');
this.$overlay.on('click', function() {
self.hide();
@ -71,6 +73,33 @@ if (typeof(PhpDebugBar) == 'undefined') {
this.find({}, 0, this.handleFind.bind(this));
},
addSearch: function(){
var self = this;
var searchBtn = $('<button />')
.text('Search')
.on('click', function(e) {
self.$table.empty();
var search = {};
var a = $(this).parent().serializeArray();
$.each(a, function() {
if(this.value){
search[this.name] = this.value;
}
});
self.find(search, 0, self.handleFind.bind(self));
e.preventDefault();
});
$('<form />')
.append('<br/><b>Filter results</b><br/>')
.append('Method: <select name="method"><option></option><option>GET</option><option>POST</option><option>PUT</option><option>DELETE</option></select><br/>')
.append('Uri: <input type="text" name="uri"><br/>')
.append('IP: <input type="text" name="ip"><br/>')
.append(searchBtn)
.appendTo(this.$actions);
},
handleFind: function(data) {
var self = this;
$.each(data, function(i, meta) {