elasticsearch/kibana — pull request #1617 by w33ble (2014-10-09 19:19:59+00:00)
Title: Index pattern/loading 2

Replaces #1601
Fixes #1561
Fixes a bug introduced by aca24577e990643aaf71a9350218bfa0b8405d37.

The code in aca24577e990643aaf71a9350218bfa0b8405d37 assumes that `SearchSources` would have an `indexPattern` defined on them. This is the case with `savedSearches` but not for visualizations. Rather than use the `indexPattern` saving build into the `SavedObject`, they manage a separate `indexPattern` property, and link it to the `SearchSource` in the `SavedObject#afterEsResp()` callback.

This fixes the bug with the following updates:
- `SavedVis` no longer manages it's own `indexPattern`, it is managed by the underlying `SavedObject`
- `searchSource.get('index')` will always work synchronously
- Previously, if a searchSource inherited it's index pattern from the global searchSource, it would return `undefined`.
- `rootSearchSource` does not update it's index pattern when the config is changed
- it now happens in routeSetup, which is what allowed us to make the calls to `DataSource#getParent()` and `DataSource#get()` behave synchronously.