Commit 5a3330c7 authored by sand's avatar sand

do not hardcode the api search URL.

This change allow the web app to be served from a subdirectory (e.g.
/lens2).
parent 20d543b9
......@@ -64,6 +64,8 @@ lens.Lens = function(config) {
this.pagination_next_elem = $(_merge('pagination_next_id', '#log_pagination_next'));
this.pagination_prev_elem = $(_merge('pagination_prev_id', '#log_pagination_prev'));
this.search_endpoint = _merge('search_endpoint', '/search');
var lensobj = this;
this.pagination_next_elem.click(function() { lensobj.pageNext(); });
this.pagination_prev_elem.click(function() { lensobj.pagePrev(); });
......@@ -301,7 +303,7 @@ lens.Lens.prototype.refresh = function() {
? this.time_range.end
: lens.util.timestampNow()));
$.ajax({
url: '/search',
url: this.search_endpoint,
type: 'POST',
data: {q: this.cur_query,
start: this.offset,
......
......@@ -154,7 +154,9 @@ $(document).ready(function() {
replaceAttrsInMsg: lens.util.replaceAttrsInMsg,
});
lens_instance = new lens.Lens();
lens_instance = new lens.Lens({
search_endpoint: $('#searchForm').attr('action')
});
$('#query_field').focus();
$('#searchForm').submit(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment