From 0acf6c82e65efa6c7e45341ea9512f646d1e2a98 Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Fri, 11 Jan 2019 10:58:50 +0100 Subject: [PATCH 1/3] [ML] Remove deprecated show-charts directive. --- ..._directive.js => checkbox_showcharts_service.js} | 13 ++----------- .../controls/checkbox_showcharts/index.js | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) rename x-pack/plugins/ml/public/components/controls/checkbox_showcharts/{checkbox_showcharts_directive.js => checkbox_showcharts_service.js} (69%) diff --git a/x-pack/plugins/ml/public/components/controls/checkbox_showcharts/checkbox_showcharts_directive.js b/x-pack/plugins/ml/public/components/controls/checkbox_showcharts/checkbox_showcharts_service.js similarity index 69% rename from x-pack/plugins/ml/public/components/controls/checkbox_showcharts/checkbox_showcharts_directive.js rename to x-pack/plugins/ml/public/components/controls/checkbox_showcharts/checkbox_showcharts_service.js index 80679234be71bd..b17b19a6b3fbe5 100644 --- a/x-pack/plugins/ml/public/components/controls/checkbox_showcharts/checkbox_showcharts_directive.js +++ b/x-pack/plugins/ml/public/components/controls/checkbox_showcharts/checkbox_showcharts_service.js @@ -12,7 +12,7 @@ import { stateFactoryProvider } from 'plugins/ml/factories/state_factory'; import { uiModules } from 'ui/modules'; const module = uiModules.get('apps/ml', ['react']); -import { CheckboxShowCharts, mlCheckboxShowChartsService } from './checkbox_showcharts'; +import { mlCheckboxShowChartsService } from './checkbox_showcharts'; module.service('mlCheckboxShowChartsService', function (Private) { const stateFactory = Private(stateFactoryProvider); @@ -20,13 +20,4 @@ module.service('mlCheckboxShowChartsService', function (Private) { showCharts: true }); mlCheckboxShowChartsService.initialized = true; -}) - .directive('mlCheckboxShowCharts', function ($injector) { - const reactDirective = $injector.get('reactDirective'); - - return reactDirective( - CheckboxShowCharts, - undefined, - { restrict: 'E' }, - ); - }); +}); diff --git a/x-pack/plugins/ml/public/components/controls/checkbox_showcharts/index.js b/x-pack/plugins/ml/public/components/controls/checkbox_showcharts/index.js index 0b0705d617adb5..7c11d47bae2df6 100644 --- a/x-pack/plugins/ml/public/components/controls/checkbox_showcharts/index.js +++ b/x-pack/plugins/ml/public/components/controls/checkbox_showcharts/index.js @@ -5,4 +5,4 @@ */ -import './checkbox_showcharts_directive'; +import './checkbox_showcharts_service'; From b7b4ca2e20ebc57cdc9a26ee75090faac3015efd Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Fri, 11 Jan 2019 11:00:11 +0100 Subject: [PATCH 2/3] [ML] Remove deprecated ml-controls-select directive. --- .../__tests__/controls_select_directive.js | 80 ------------------- .../controls_select/_controls_select.scss | 44 ---------- .../controls/controls_select/_index.scss | 1 - .../controls_select/controls_select.html | 11 --- .../controls_select_directive.js | 39 --------- .../controls/controls_select/index.js | 9 --- .../ml/public/components/controls/index.js | 1 - 7 files changed, 185 deletions(-) delete mode 100644 x-pack/plugins/ml/public/components/controls/controls_select/__tests__/controls_select_directive.js delete mode 100644 x-pack/plugins/ml/public/components/controls/controls_select/_controls_select.scss delete mode 100644 x-pack/plugins/ml/public/components/controls/controls_select/_index.scss delete mode 100644 x-pack/plugins/ml/public/components/controls/controls_select/controls_select.html delete mode 100644 x-pack/plugins/ml/public/components/controls/controls_select/controls_select_directive.js delete mode 100644 x-pack/plugins/ml/public/components/controls/controls_select/index.js diff --git a/x-pack/plugins/ml/public/components/controls/controls_select/__tests__/controls_select_directive.js b/x-pack/plugins/ml/public/components/controls/controls_select/__tests__/controls_select_directive.js deleted file mode 100644 index a2a4b1f4494ba3..00000000000000 --- a/x-pack/plugins/ml/public/components/controls/controls_select/__tests__/controls_select_directive.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - - - -import ngMock from 'ng_mock'; -import expect from 'expect.js'; - -describe('ML - ', () => { - let $scope; - let $compile; - let $element; - - beforeEach(ngMock.module('kibana')); - beforeEach(() => { - ngMock.inject(function ($injector) { - $compile = $injector.get('$compile'); - const $rootScope = $injector.get('$rootScope'); - $scope = $rootScope.$new(); - }); - }); - - afterEach(() => { - $scope.$destroy(); - }); - - it('Plain initialization doesn\'t throw an error', () => { - $element = $compile('')($scope); - const scope = $element.isolateScope(); - - expect(scope.identifier).to.be.an('undefined'); - expect(scope.label).to.be.an('undefined'); - expect(scope.options).to.be.an('undefined'); - expect(scope.selected).to.be.an('undefined'); - expect(scope.setOption).to.be.a('function'); - expect(scope.showIcons).to.be.an('undefined'); - expect(scope.updateFn).to.be.a('undefined'); - }); - - it('Initialize with attributes, call pass-through function', (done) => { - $scope.intervalOptions = [ - { display: 'testOptionLabel1', val: 'testOptionValue1' }, - { display: 'testOptionLabel2', val: 'testOptionValue2' } - ]; - $scope.selectedOption = $scope.intervalOptions[1]; - - $scope.testUpdateFn = function () { - done(); - }; - - $element = $compile(` - - `)($scope); - - const scope = $element.isolateScope(); - - expect(scope.identifier).to.be('testIdentifier'); - expect(scope.label).to.be('testLabel'); - expect(scope.options).to.equal($scope.intervalOptions); - expect(scope.selected).to.equal($scope.selectedOption); - expect(scope.setOption).to.be.a('function'); - expect(scope.showIcons).to.be.false; - expect(scope.updateFn).to.be.a('function'); - - // this should call the function passed through ($scope.testUpdateFn) - // which in return calls done() to finish the test - scope.setOption(); - }); - -}); diff --git a/x-pack/plugins/ml/public/components/controls/controls_select/_controls_select.scss b/x-pack/plugins/ml/public/components/controls/controls_select/_controls_select.scss deleted file mode 100644 index fc489d18feb05e..00000000000000 --- a/x-pack/plugins/ml/public/components/controls/controls_select/_controls_select.scss +++ /dev/null @@ -1,44 +0,0 @@ -ml-controls-select { - .dropdown-group { - position: relative; - display: inline-block; - vertical-align: middle; - } - - .dropdown-toggle { - cursor: pointer; - } - .dropdown-toggle { - cursor: pointer; - } - - .dropdown-menu { - min-width: 120px; - font-size: $euiFontSizeXS; - - > li > a { - color: $euiColorDarkestShade;; - text-decoration: none; - - &:hover, &:active, &:focus { - color: $euiColorEmptyShade; - box-shadow: none; - } - } - } - - button.dropdown-toggle { - text-align: left; - margin-bottom: $euiSizeXS; - - // SASSTODO: Needs more specific selectors - span { - font-size: $euiSizeXS; - } - } - - button.dropdown-toggle:hover, - button.dropdown-toggle:focus { - color: $euiColorDarkestShade; - } -} diff --git a/x-pack/plugins/ml/public/components/controls/controls_select/_index.scss b/x-pack/plugins/ml/public/components/controls/controls_select/_index.scss deleted file mode 100644 index 4d58129f311b21..00000000000000 --- a/x-pack/plugins/ml/public/components/controls/controls_select/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import 'controls_select'; \ No newline at end of file diff --git a/x-pack/plugins/ml/public/components/controls/controls_select/controls_select.html b/x-pack/plugins/ml/public/components/controls/controls_select/controls_select.html deleted file mode 100644 index 07e1e3b85f7a2f..00000000000000 --- a/x-pack/plugins/ml/public/components/controls/controls_select/controls_select.html +++ /dev/null @@ -1,11 +0,0 @@ - - diff --git a/x-pack/plugins/ml/public/components/controls/controls_select/controls_select_directive.js b/x-pack/plugins/ml/public/components/controls/controls_select/controls_select_directive.js deleted file mode 100644 index 8d209c31ffb0ee..00000000000000 --- a/x-pack/plugins/ml/public/components/controls/controls_select/controls_select_directive.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - - - -/* - * AngularJS directive for rendering a select element with threshold levels. - */ - -import template from './controls_select.html'; - -import { uiModules } from 'ui/modules'; -const module = uiModules.get('apps/ml'); - -module.directive('mlControlsSelect', function () { - return { - restrict: 'E', - scope: { - identifier: '@', - label: '@', - narrowStyle: '=', - options: '=', - showIcons: '=', - selected: '=', - updateFn: '=' - }, - template, - link: function (scope) { - scope.setOption = function (d) { - if (typeof scope.updateFn === 'function') { - scope.updateFn(d); - } - }; - } - }; -}); diff --git a/x-pack/plugins/ml/public/components/controls/controls_select/index.js b/x-pack/plugins/ml/public/components/controls/controls_select/index.js deleted file mode 100644 index 06074fc5219af4..00000000000000 --- a/x-pack/plugins/ml/public/components/controls/controls_select/index.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - - - -import './controls_select_directive.js'; diff --git a/x-pack/plugins/ml/public/components/controls/index.js b/x-pack/plugins/ml/public/components/controls/index.js index 1b9348db9c5163..275c6e6a6790d7 100644 --- a/x-pack/plugins/ml/public/components/controls/index.js +++ b/x-pack/plugins/ml/public/components/controls/index.js @@ -7,6 +7,5 @@ import './checkbox_showcharts'; -import './controls_select'; import './select_interval'; import './select_severity'; From 901a33d4a3289eb6d7232faa13630e8a4d5e8a33 Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Fri, 11 Jan 2019 12:03:26 +0100 Subject: [PATCH 3/3] [ML] Remove deprecated SCSS import. --- x-pack/plugins/ml/public/components/controls/_index.scss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x-pack/plugins/ml/public/components/controls/_index.scss b/x-pack/plugins/ml/public/components/controls/_index.scss index 7bb8b08c658590..84c0e21734b892 100644 --- a/x-pack/plugins/ml/public/components/controls/_index.scss +++ b/x-pack/plugins/ml/public/components/controls/_index.scss @@ -1,3 +1,2 @@ @import 'controls'; -@import 'controls_select/index'; -@import 'select_severity/index'; \ No newline at end of file +@import 'select_severity/index';