Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding fix to avoid clearing the current log file selected when the a…

…ction is changed.
  • Loading branch information...
commit 068ec9b686284e42f75bac7596378d16a361d479 1 parent 9bb62ea
@fcanache fcanache authored
View
42 public/javascripts/app.js
@@ -11,25 +11,19 @@ var Search = {
resultsId : 'results',
search_fields: [ 'term1', 'term2', 'term3' ], // domIds of search term fields
file_list : 'file-list', // domId of select for logfiles
- logfiles : {}, // hash of log files
past_params : null, // recent request
url : '/perform',
scroll_fnId : null,
// initialize Search form
- // { 'grep': [ log, files, for, grep], 'tail': [ 'log', 'files', 'for', 'tail']}
- init: function(logfiles, params) {
- this.logfiles = logfiles;
+ init: function(params) {
this.past_params = params;
-
- this.bind_grep_tool();
- this.bind_tail_tool();
this.bind_options();
if (!this.past_params) return; // return if no prev settings, nothing to set
// init tool selector
- (this.past_params['tool'] == 'grep') ? $('#grep-label').trigger('click') : $('#tail-tool').trigger('click');
+ (this.past_params['tool'] == 'grep') ? $('#grep-tool').attr('checked', 'checked') : $('#tail-tool').attr('checked', 'checked');
// init log file selector
$('#'+this.file_list).val(this.past_params['file']);
@@ -61,38 +55,6 @@ var Search = {
$('#auto-scroll').attr('checked', true).trigger('change'); // by default, turn on
},
- // bind change grep tool
- bind_grep_tool: function() {
- $('#grep-tool').bind('change', function(e){
- var newlist = ""
- jQuery.each(Search.logfiles['grep'], function(){
- newlist += "<option value='" + this + "'>" + this + "</option>\n"
- });
- $('#'+Search.file_list).html(newlist);
- });
- // watch clicking label as well
- $('#grep-label').bind('click', function(e){
- $('#grep-tool').attr('checked', 'checked').val('grep').trigger('change');
- });
- },
-
-
- // bind change tail tool
- bind_tail_tool: function() {
- $('#tail-tool').bind('change', function(e){
- var newlist = ""
- jQuery.each(Search.logfiles['tail'], function(){
- newlist += "<option value='" + this + "'>" + this + "</option>\n"
- });
- $('#'+ Search.file_list).html(newlist);
- });
- // watch clicking label as well
- $('#tail-label').bind('click', function(e){
- $('#tail-tool').attr('checked', 'checked').val('tail').trigger('change');
- });
- },
-
-
// clears the terms fields
clear: function() {
jQuery.each(this.search_fields, function(){
View
2  public/stylesheets/app.css
@@ -36,7 +36,7 @@ table.actions th { font-size: 11px; color: #333; text-align: left; min-width: 10
table.actions td { padding: 2px 5px; text-align: left; vertical-align: middle;}
table.actions span.note { font-weight: normal; color: #999; }
table.actions span.and { font-size: 11px; color: red; font-weight: bold; }
-table.actions span.label { font-weight: bold; cursor:pointer;}
+table.actions label { font-weight: bold; cursor:pointer;}
table.actions input[type=text] { width: 200px; padding: 2px; border: 1px solid #aaa;}
View
8 views/_toolbar.html.erb
@@ -16,8 +16,8 @@
</tr>
<tr>
<td id='tool-selector'>
- <input type='radio' name='tool' value='grep' id='grep-tool' checked='checked'> <span class='label' id='grep-label'>Search</span> <br/>
- <input type='radio' name='tool' value='tail' id='tail-tool'> <span class='label' id='tail-label'>Tail</span> <br/>
+ <input type='radio' name='tool' value='grep' id='grep-tool' checked='checked'> <label id='grep-label' for="grep-tool">Search</label> <br/>
+ <input type='radio' name='tool' value='tail' id='tail-tool'> <label id='tail-label' for="tail-tool">Tail</span> <br/>
</td>
<td id='file-selector'>
<select id='file-list' name='file'>
@@ -56,7 +56,5 @@
<script>
Search.url = "<%= relative_root %>" + Search.url;
- Search.init({ 'grep': <%= logfiles.map {|f| f }.to_json %>,
- 'tail': <%= logfiles.map {|f| f }.to_json %> },
- <%= params.empty? ? 'null' : json_encode(params) %> );
+ Search.init(<%= params.empty? ? 'null' : json_encode(params) %>);
</script>
Please sign in to comment.
Something went wrong with that request. Please try again.