From 5a433ac11cf42cf45e0a364b88cf1bf752b6d88e Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Mon, 15 Oct 2018 16:16:18 +0200 Subject: [PATCH] [ML] Make sure anomalyChartRecords gets initialized as an Array. --- .../plugins/ml/public/explorer/__tests__/explorer_controller.js | 1 + x-pack/plugins/ml/public/explorer/explorer_controller.js | 1 + 2 files changed, 2 insertions(+) diff --git a/x-pack/plugins/ml/public/explorer/__tests__/explorer_controller.js b/x-pack/plugins/ml/public/explorer/__tests__/explorer_controller.js index 40109b4c329ff..671cf0fea1b7b 100644 --- a/x-pack/plugins/ml/public/explorer/__tests__/explorer_controller.js +++ b/x-pack/plugins/ml/public/explorer/__tests__/explorer_controller.js @@ -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); }); }); diff --git a/x-pack/plugins/ml/public/explorer/explorer_controller.js b/x-pack/plugins/ml/public/explorer/explorer_controller.js index a2bd37981bc82..e142ce0f8e3ab 100644 --- a/x-pack/plugins/ml/public/explorer/explorer_controller.js +++ b/x-pack/plugins/ml/public/explorer/explorer_controller.js @@ -81,6 +81,7 @@ module.controller('MlExplorerController', function ( mlSelectIntervalService, mlSelectSeverityService) { + $scope.anomalyChartRecords = []; $scope.timeFieldName = 'timestamp'; $scope.loading = true; timefilter.enableTimeRangeSelector();