[ML] Make sure anomalyChartRecords gets initialized as an Array. (#24021)

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.
This commit is contained in:
Walter Rafelsberger 2018-10-16 08:25:16 +01:00 committed by GitHub
parent 8fe71f888f
commit 81d22d2fea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View file

@ -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);
});
});

View file

@ -81,6 +81,7 @@ module.controller('MlExplorerController', function (
mlSelectIntervalService,
mlSelectSeverityService) {
$scope.anomalyChartRecords = [];
$scope.timeFieldName = 'timestamp';
$scope.loading = true;
timefilter.enableTimeRangeSelector();