Skip to content

Commit

Permalink
tab order and activate log when events are empty
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagotalma committed Mar 25, 2016
1 parent 5bd2b25 commit a24d1bc
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions app/assets/javascripts/components/utils.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,24 @@ class @Utils
.done (json) =>
Utils.showDynamicModal """
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#log" aria-controls="log" role="tab" data-toggle="tab">Log</a></li>
<li role="presentation"><a href="#events" aria-controls="events" role="tab" data-toggle="tab">Events</a></li>
<li role="presentation"><a href="#memory" aria-controls="memory" role="tab" data-toggle="tab">Memory</a></li>
<ul id="resultTabs" class="nav nav-tabs" role="tablist">
<li role="presentation"><a href="#tabEvents" aria-controls="tabEvents" role="tab" data-toggle="tab">Events</a></li>
<li role="presentation"><a href="#tabLog" aria-controls="tabLog" role="tab" data-toggle="tab">Log</a></li>
<li role="presentation"><a href="#tabMemory" aria-controls="tabMemory" role="tab" data-toggle="tab">Memory</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="log">
<div role="tabpanel" class="tab-pane" id="tabEvents">
<p>
<pre class="agent-dry-run-log"></pre>
<pre class="agent-dry-run-events"></pre>
</p>
</div>
<div role="tabpanel" class="tab-pane" id="events">
<div role="tabpanel" class="tab-pane" id="tabLog">
<p>
<pre class="agent-dry-run-events"></pre>
<pre><small class="agent-dry-run-log"></small></pre>
</p>
</div>
<div role="tabpanel" class="tab-pane" id="memory">
<div role="tabpanel" class="tab-pane" id="tabMemory">
<p>
<pre class="agent-dry-run-memory"></pre>
</p>
Expand All @@ -129,6 +129,8 @@ class @Utils
find('.agent-dry-run-log').text(json.log).end().
find('.agent-dry-run-events').text(json.events).end().
find('.agent-dry-run-memory').text(json.memory)
active = if json.events.match(/^\[\s*\]$/) then 'tabLog' else 'tabEvents'
$('#resultTabs a[href="#' + active + '"]').tab('show')
title: 'Dry Run Results',
onHide: callback
.fail (xhr, status, error) ->
Expand Down

0 comments on commit a24d1bc

Please sign in to comment.