Improve spy tab performance on Discover (#9599)

Backports PR #9590

**Commit 1:**
Improve spy tab performance on Discover

Switching between tabs in the spy panel takes a really long time in the
Discover histogram. The root cause is that there is an expensive forced
layout happening. It's expensive because the "response" tab includes all
500 hits from the search response which is a lot of content. This
affects all the tabs because we're using ng-show instead of ng-if,
meaning we're incurring the cost of layout on all that content even when
it's not being shown. This PR switches to ng-if to speed up all of the
tabs other than "Response".

The response tab remains slow because the vis is re-rendered any time
uiState changes, and when the vis is re-rendered it triggers forced
reflows. This is a non-trivial issue to fix that Peter is already
working on separately, so for now we'll settle for only speeding up the
other tabs.

Fixes https://github.com/elastic/kibana/issues/9464

* Original sha: e333cc7cf2
* Authored by Matthew Bargar <mbargar@gmail.com> on 2016-12-21T16:44:43Z
This commit is contained in:
jasper 2016-12-21 16:08:08 -05:00 committed by Matt Bargar
parent 15b7de3455
commit ca32e8feca

View file

@ -10,25 +10,25 @@
<i class="fa fa-danger"></i> Request Failed
</div>
<div ng-show="spy.mode.name === 'request'">
<div ng-if="spy.mode.name === 'request'">
<label>
Elasticsearch request body &nbsp;
</label>
<pre>{{req.fetchParams.body | json}}</pre>
</div>
<div ng-show="spy.mode.name === 'response'">
<div ng-if="spy.mode.name === 'response'">
<label>
Elasticsearch response body &nbsp;
</label>
<pre>{{req.resp | json}}</pre>
</div>
<div ng-show="spy.mode.name === 'stats'">
<div ng-if="spy.mode.name === 'stats'">
<table class="table">
<tr ng-repeat="pair in stats">
<td>{{pair[0]}}</td>
<td>{{pair[1]}}</td>
</tr>
</table>
</div>
</div>