Skip to content

Commit

Permalink
Code clean up (#9262)
Browse files Browse the repository at this point in the history
  • Loading branch information
stacey-gammon authored Nov 30, 2016
1 parent 6759e25 commit 0266a9a
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions src/core_plugins/kibana/public/dashboard/directives/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ app.directive('dashboardGrid', function ($compile, Notifier) {
$el = $('<ul>').appendTo($container);

const $window = $(window);
const $body = $(document.body);
const binder = new Binder($scope);

// appState from controller
Expand Down Expand Up @@ -221,7 +220,6 @@ app.directive('dashboardGrid', function ($compile, Notifier) {
g.min_widget_width = (g.options.widget_margins[0] * 2) + g.options.widget_base_dimensions[0];
g.min_widget_height = (g.options.widget_margins[1] * 2) + g.options.widget_base_dimensions[1];

// const serializedGrid = g.serialize();
g.$widgets.each(function (i, widget) {
g.resize_widget($(widget));
});
Expand Down
5 changes: 2 additions & 3 deletions src/core_plugins/kibana/public/dashboard/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import _ from 'lodash';
import $ from 'jquery';
import angular from 'angular';
import chrome from 'ui/chrome';
import 'ui/courier';
Expand All @@ -17,8 +16,8 @@ import stateMonitorFactory from 'ui/state_management/state_monitor_factory';
import uiRoutes from 'ui/routes';
import uiModules from 'ui/modules';
import indexTemplate from 'plugins/kibana/dashboard/index.html';

require('ui/saved_objects/saved_object_registry').register(require('plugins/kibana/dashboard/services/saved_dashboard_register'));
import { savedDashboardRegister } from 'plugins/kibana/dashboard/services/saved_dashboard_register';
require('ui/saved_objects/saved_object_registry').register(savedDashboardRegister);

const app = uiModules.get('app/dashboard', [
'elasticsearch',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import angular from 'angular';
import _ from 'lodash';
import moment from 'moment';
import uiModules from 'ui/modules';
const module = uiModules.get('app/dashboard');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default function savedDashboardFn(savedDashboards) {
export function savedDashboardRegister(savedDashboards) {
return savedDashboards;
};

0 comments on commit 0266a9a

Please sign in to comment.