Skip to content

Commit

Permalink
[ML] Make sure anomalyChartRecords gets initialized as an Array. (#24021
Browse files Browse the repository at this point in the history
) (#24061)

Fixes an issue where resizing the Anomaly Explorer window could trigger an error if the only job being loaded so far didn't have any anomalyChartRecords.
  • Loading branch information
walterra authored Oct 16, 2018
1 parent fad44f9 commit 4826063
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('ML - Explorer Controller', () => {
const scope = $rootScope.$new();
$controller('MlExplorerController', { $scope: scope });

expect(Array.isArray(scope.anomalyChartRecords)).to.be(true);
expect(scope.loading).to.be(true);
});
});
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/ml/public/explorer/explorer_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ module.controller('MlExplorerController', function (
mlSelectIntervalService,
mlSelectSeverityService) {

$scope.anomalyChartRecords = [];
$scope.timeFieldName = 'timestamp';
$scope.loading = true;
timefilter.enableTimeRangeSelector();
Expand Down

0 comments on commit 4826063

Please sign in to comment.