Skip to content

Commit

Permalink
indexPattern from the Url will work in the /visualizations/create pag…
Browse files Browse the repository at this point in the history
…e, and fixed the date_histogram agg
  • Loading branch information
Spencer Alger committed Apr 17, 2014
1 parent 3e45998 commit ae1ec33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/kibana/apps/visualize/saved_visualizations/_aggs.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ define(function (require) {
},
},
makeLabel: function (params) {
var interval = _.find(aggs.params.interval.options, { val: params.interval });
var agg = aggs.byName.date_histogram;
var interval = _.find(agg.params.interval.options, { val: params.interval });
return interval.display + ' ' + params.field;
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/kibana/apps/visualize/saved_visualizations/_saved_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ define(function (require) {
defaults: {
title: '',
typeName: opts.type,
stateJSON: '{}',
stateJSON: null,
description: '',
savedSearchId: opts.savedSearchId,
},
Expand All @@ -49,11 +49,11 @@ define(function (require) {

afterESResp: function setVisState() {
// get the saved state
var state = {};
var state;
if (vis.stateJSON) try { state = JSON.parse(vis.stateJSON); } catch (e) {}

// set the state on the vis
vis.setState(state);
if (state) vis.setState(state);


// default parent is the rootSearch, mimic the
Expand Down Expand Up @@ -89,6 +89,10 @@ define(function (require) {
}
});

if (opts.indexPattern) {
vis.searchSource.index(opts.indexPattern);
}

// initialize config categories
configCats.forEach(function (category) {
var cat = _.defaults(typeDef.config[category.name] || {}, category.defaults);
Expand Down

0 comments on commit ae1ec33

Please sign in to comment.