removing $timeout

This commit is contained in:
ppisljar 2016-12-19 10:49:27 +01:00
parent 644453de19
commit 016ab7ef0d
2 changed files with 5 additions and 3 deletions

View file

@ -11,6 +11,7 @@ module.exports = function VislibRenderbotFactory(Private, $injector) {
_.class(VislibRenderbot).inherits(Renderbot);
function VislibRenderbot(vis, $el, uiState) {
VislibRenderbot.Super.call(this, vis, $el, uiState);
this.refreshLegend = 0;
this._createVis();
}
@ -26,6 +27,7 @@ module.exports = function VislibRenderbotFactory(Private, $injector) {
if (this.chartData) {
this.vislibVis.render(this.chartData, this.uiState);
this.refreshLegend++;
}
};
@ -49,6 +51,7 @@ module.exports = function VislibRenderbotFactory(Private, $injector) {
this.chartData = this.buildChartData(esResponse);
return AngularPromise.delay(1).then(() => {
this.vislibVis.render(this.chartData, this.uiState);
this.refreshLegend++;
});
};

View file

@ -21,10 +21,9 @@ uiModules.get('kibana')
$scope.$watch('renderbot.chartData', function (data) {
if (!data) return;
$scope.data = data;
refresh();
});
$scope.$watch('renderbot.vislibParams', () => {
$scope.$watch('renderbot.refreshLegend', () => {
refresh();
});
@ -107,7 +106,7 @@ uiModules.get('kibana')
const vislibVis = $scope.renderbot.vislibVis;
if (!vislibVis.visConfig) {
$scope.labels = [{ label: 'loading ...' }];
return $timeout(refresh, 100);
return;
} // make sure vislib is defined at this point
if ($scope.uiState.get('vis.legendOpen') == null && $scope.vis.params.addLegend != null) {