Skip to content

Commit

Permalink
Merge pull request #119 from flant/pre_for_values
Browse files Browse the repository at this point in the history
Toggle pre for values to view multiline values
  • Loading branch information
diafour authored Dec 25, 2018
2 parents 047a260 + 290736e commit 03934fb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions public/assets/javascripts/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
window.available_keys = {};
window.hidden_keys = [];
window.preForValues = false;

function commonTimestamp() {
return moment().format('YYYY-MM-DD HH:mm:ss');
Expand Down Expand Up @@ -44,6 +45,7 @@ function queryOlder() {
updateAvailableKeys();
updateAvailableKeysStyles();
updateSelectedKeysClasses();
updateValuesClasses($resultContainer);
oldest = $resultContainer.find('div:last-child .logs-result__entry-timestamp').text();
$resultContainer.data('entry-oldest', oldest);
} else {
Expand Down Expand Up @@ -84,6 +86,7 @@ function queryNewer() {
updateAvailableKeys();
updateAvailableKeysStyles();
updateSelectedKeysClasses();
updateValuesClasses($resultContainer);
newest = $resultContainer.find('div:first-child .logs-result__entry-timestamp').text();
$resultContainer.data('entry-newest', newest);
} else {
Expand Down Expand Up @@ -279,6 +282,17 @@ function updateSelectedKeysUri() {
history.pushState({}, 'Loghouse', uri);
}

function updateValuesClasses(res) {
if (!res) {
res = $('.logs-result__container');
}
if (window.preForValues) {
res.find('.logs-result__entry-value').addClass('logs-result_values_pre');
} else {
res.find('.logs-result__entry-value').removeClass('logs-result_values_pre');
}
}

$(document).ready(function() {

// Lib inits
Expand Down Expand Up @@ -383,6 +397,13 @@ $(document).ready(function() {
queryNewerPause();
});

// Pre for values
var $preForValuesBtn = $("#preForValues");
$preForValuesBtn.on('click', function() {
window.preForValues = !window.preForValues;
updateValuesClasses();
})

// Breakpoint
var $breakpointBtn = $('#breakpointBtn');

Expand Down
4 changes: 4 additions & 0 deletions public/assets/stylesheets/logs.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@
color: #CC9999;
background: #555;
}

.logs-result_values_pre {
white-space: pre;
}
3 changes: 3 additions & 0 deletions views/_filter_form.erb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
<div class="form-group" data-toggle="tooltip" title="Hide/Show keys">
<a class="btn btn-link btn-link-alt hide-show-keys-toggle search-params-btn disabled" role="button" data-target="#hideShowKeys"><span class="glyphicon glyphicon-th" aria-hidden="true"></span></a>
</div>
<div class="form-group" data-toggle="tooltip" title="Pre for values">
<a class="btn btn-link btn-link-alt" role="button" id="preForValues"><span class="glyphicon glyphicon-list" aria-hidden="true"></span></a>
</div>
</div>
<div class="col-xs-2" align="right">
<div class="form-group" data-toggle="tooltip" title="Add breakpoint">
Expand Down

0 comments on commit 03934fb

Please sign in to comment.