From 0266a9adbe4f6998f11a31e6ea62a8d50fbbd255 Mon Sep 17 00:00:00 2001 From: Stacey Gammon Date: Wed, 30 Nov 2016 12:28:19 -0500 Subject: [PATCH] Code clean up (#9262) --- .../dashboard/components/panel/lib/load_panel.js | 12 ++++++------ .../public/dashboard/components/panel/lib/search.js | 2 +- .../dashboard/components/panel/lib/visualization.js | 2 +- .../public/dashboard/components/panel/panel.js | 10 ++++------ .../kibana/public/dashboard/directives/grid.js | 2 -- src/core_plugins/kibana/public/dashboard/index.js | 5 ++--- .../public/dashboard/services/_saved_dashboard.js | 1 - .../dashboard/services/saved_dashboard_register.js | 2 +- 8 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/core_plugins/kibana/public/dashboard/components/panel/lib/load_panel.js b/src/core_plugins/kibana/public/dashboard/components/panel/lib/load_panel.js index 54e12f3fd4d7e..9f2502292a026 100644 --- a/src/core_plugins/kibana/public/dashboard/components/panel/lib/load_panel.js +++ b/src/core_plugins/kibana/public/dashboard/components/panel/lib/load_panel.js @@ -1,11 +1,11 @@ -import _ from 'lodash'; -import PluginsKibanaDashboardComponentsPanelLibVisualizationProvider from 'plugins/kibana/dashboard/components/panel/lib/visualization'; -import PluginsKibanaDashboardComponentsPanelLibSearchProvider from 'plugins/kibana/dashboard/components/panel/lib/search'; -export default function loadPanelFunction(Private) { // Inject services here +import { visualizationLoaderProvider } from 'plugins/kibana/dashboard/components/panel/lib/visualization'; +import { searchLoaderProvider } from 'plugins/kibana/dashboard/components/panel/lib/search'; + +export function loadPanelProvider(Private) { // Inject services here return function (panel, $scope) { // Function parameters here const panelTypes = { - visualization: Private(PluginsKibanaDashboardComponentsPanelLibVisualizationProvider), - search: Private(PluginsKibanaDashboardComponentsPanelLibSearchProvider) + visualization: Private(visualizationLoaderProvider), + search: Private(searchLoaderProvider) }; try { diff --git a/src/core_plugins/kibana/public/dashboard/components/panel/lib/search.js b/src/core_plugins/kibana/public/dashboard/components/panel/lib/search.js index e0d7a914b2f4f..fe7e13ee4be03 100644 --- a/src/core_plugins/kibana/public/dashboard/components/panel/lib/search.js +++ b/src/core_plugins/kibana/public/dashboard/components/panel/lib/search.js @@ -1,4 +1,4 @@ -export default function searchLoader(savedSearches, Private) { // Inject services here +export function searchLoaderProvider(savedSearches, Private) { // Inject services here return function (panel, $scope) { // Function parameters here return savedSearches.get(panel.id) .then(function (savedSearch) { diff --git a/src/core_plugins/kibana/public/dashboard/components/panel/lib/visualization.js b/src/core_plugins/kibana/public/dashboard/components/panel/lib/visualization.js index 90d9b655456a0..885e2aac8035c 100644 --- a/src/core_plugins/kibana/public/dashboard/components/panel/lib/visualization.js +++ b/src/core_plugins/kibana/public/dashboard/components/panel/lib/visualization.js @@ -1,7 +1,7 @@ import UtilsBrushEventProvider from 'ui/utils/brush_event'; import FilterBarFilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler'; -export default function visualizationLoader(savedVisualizations, Private) { // Inject services here +export function visualizationLoaderProvider(savedVisualizations, Private) { // Inject services here const brushEvent = Private(UtilsBrushEventProvider); const filterBarClickHandler = Private(FilterBarFilterBarClickHandlerProvider); diff --git a/src/core_plugins/kibana/public/dashboard/components/panel/panel.js b/src/core_plugins/kibana/public/dashboard/components/panel/panel.js index f115e8ccec017..776f1f04fbcb9 100644 --- a/src/core_plugins/kibana/public/dashboard/components/panel/panel.js +++ b/src/core_plugins/kibana/public/dashboard/components/panel/panel.js @@ -1,18 +1,16 @@ -import moment from 'moment'; -import $ from 'jquery'; import _ from 'lodash'; import 'ui/visualize'; import 'ui/doc_table'; -import PluginsKibanaDashboardComponentsPanelLibLoadPanelProvider from 'plugins/kibana/dashboard/components/panel/lib/load_panel'; +import { loadPanelProvider } from 'plugins/kibana/dashboard/components/panel/lib/load_panel'; import FilterManagerProvider from 'ui/filter_manager'; import uiModules from 'ui/modules'; import panelTemplate from 'plugins/kibana/dashboard/components/panel/panel.html'; + uiModules .get('app/dashboard') .directive('dashboardPanel', function (savedVisualizations, savedSearches, Notifier, Private, $injector) { - const loadPanel = Private(PluginsKibanaDashboardComponentsPanelLibLoadPanelProvider); + const loadPanel = Private(loadPanelProvider); const filterManager = Private(FilterManagerProvider); - const notify = new Notifier(); const services = require('plugins/kibana/management/saved_object_registry').all().map(function (serviceObj) { const service = $injector.get(serviceObj.service); @@ -30,7 +28,7 @@ uiModules restrict: 'E', template: panelTemplate, requires: '^dashboardGrid', - link: function ($scope, $el) { + link: function ($scope) { // using $scope inheritance, panels are available in AppState const $state = $scope.state; diff --git a/src/core_plugins/kibana/public/dashboard/directives/grid.js b/src/core_plugins/kibana/public/dashboard/directives/grid.js index ef4ea724aab88..7b744ba9a1572 100644 --- a/src/core_plugins/kibana/public/dashboard/directives/grid.js +++ b/src/core_plugins/kibana/public/dashboard/directives/grid.js @@ -16,7 +16,6 @@ app.directive('dashboardGrid', function ($compile, Notifier) { $el = $('