Allow visualizations to specify open editor tab (#13977)
* pull active tab from visType * open first tab be default when no tab marked as active and data not used
This commit is contained in:
parent
94d14e5060
commit
d6a5470779
|
@ -1,3 +1,4 @@
|
|||
import _ from 'lodash';
|
||||
import './agg_group';
|
||||
import './vis_options';
|
||||
import { uiModules } from 'ui/modules';
|
||||
|
@ -18,7 +19,15 @@ uiModules
|
|||
$scope.$watch('vis.type', (visType) => {
|
||||
if (visType) {
|
||||
this.showData = visType.schemas.buckets || visType.schemas.metrics;
|
||||
this.section = this.section || (this.showData ? 'data' : 'options');
|
||||
if (_.has(visType, 'editorConfig.optionTabs')) {
|
||||
const activeTabs = visType.editorConfig.optionTabs.filter((tab) => {
|
||||
return _.get(tab, 'active', false);
|
||||
});
|
||||
if (activeTabs.length > 0) {
|
||||
this.section = activeTabs[0].name;
|
||||
}
|
||||
}
|
||||
this.section = this.section || (this.showData ? 'data' : _.get(visType, 'editorConfig.optionTabs[0].name'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue