Commit 0bf37b8c by Torkel Ödegaard

Merge pull request #981 from swoop-inc/mb_value_update_bug

When get_data fails the legend should be cleared
parents 0e5dbf38 5cec9361
...@@ -203,6 +203,7 @@ function (angular, app, $, _, kbn, moment, TimeSeries) { ...@@ -203,6 +203,7 @@ function (angular, app, $, _, kbn, moment, TimeSeries) {
$scope.panelMeta.loading = false; $scope.panelMeta.loading = false;
$scope.panelMeta.error = err.message || "Timeseries data request error"; $scope.panelMeta.error = err.message || "Timeseries data request error";
$scope.inspector.error = err; $scope.inspector.error = err;
$scope.legend = [];
$scope.render([]); $scope.render([]);
}); });
}; };
......
...@@ -36,6 +36,20 @@ define([ ...@@ -36,6 +36,20 @@ define([
var data = ctx.scope.render.getCall(0).args[0]; var data = ctx.scope.render.getCall(0).args[0];
expect(data.length).to.be(2); expect(data.length).to.be(2);
}); });
describe('get_data failure following success', function() {
beforeEach(function() {
ctx.datasource.query = sinon.stub().returns(ctx.$q.reject('Datasource Error'));
ctx.scope.get_data();
ctx.scope.$digest();
});
it('should clear the legend data', function() {
expect(ctx.scope.legend).to.eql([]);
});
});
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment