diff --git a/public/app/features/dashboard/dashboardCtrl.js b/public/app/features/dashboard/dashboardCtrl.js index 30dda154e94..80b3a101f3f 100644 --- a/public/app/features/dashboard/dashboardCtrl.js +++ b/public/app/features/dashboard/dashboardCtrl.js @@ -29,7 +29,7 @@ function (angular, $, config) { var resizeEventTimeout; this.init = function(dashboard) { - $scope.reset_row(); + $scope.resetRow(); $scope.registerWindowResizeEvent(); $scope.onAppEvent('show-json-editor', $scope.showJsonEditor); $scope.setupDashboard(dashboard); @@ -88,17 +88,17 @@ function (angular, $, config) { $rootScope.$broadcast('refresh'); }; - $scope.add_row = function(dash, row) { + $scope.addRow = function(dash, row) { dash.rows.push(row); }; - $scope.add_row_default = function() { - $scope.reset_row(); + $scope.addRowDefault = function() { + $scope.resetRow(); $scope.row.title = 'New row'; - $scope.add_row($scope.dashboard, $scope.row); + $scope.addRow($scope.dashboard, $scope.row); }; - $scope.reset_row = function() { + $scope.resetRow = function() { $scope.row = { title: '', height: '250px', diff --git a/public/app/features/dashboard/dashboardSrv.js b/public/app/features/dashboard/dashboardSrv.js index 66372dea026..21318ac8370 100644 --- a/public/app/features/dashboard/dashboardSrv.js +++ b/public/app/features/dashboard/dashboardSrv.js @@ -118,7 +118,7 @@ function (angular, $, kbn, _, moment) { },0); }; - p.add_panel = function(panel, row) { + p.addPanel = function(panel, row) { var rowSpan = this.rowSpan(row); var panelCount = row.panels.length; var space = (12 - rowSpan) - panel.span; diff --git a/public/app/features/dashboard/rowCtrl.js b/public/app/features/dashboard/rowCtrl.js index 9b5de4c0a1b..5552981421e 100644 --- a/public/app/features/dashboard/rowCtrl.js +++ b/public/app/features/dashboard/rowCtrl.js @@ -28,7 +28,7 @@ function (angular, _, config) { $scope.panelMenuPos = posX; }; - $scope.toggle_row = function(row) { + $scope.toggleRow = function(row) { row.collapse = row.collapse ? false : true; if (!row.collapse) { $timeout(function() { @@ -37,11 +37,11 @@ function (angular, _, config) { } }; - $scope.add_panel = function(panel) { - $scope.dashboard.add_panel(panel, $scope.row); + $scope.addPanel = function(panel) { + $scope.dashboard.addPanel(panel, $scope.row); }; - $scope.delete_row = function() { + $scope.deleteRow = function() { $scope.appEvent('confirm-modal', { title: 'Are you sure you want to delete this row?', icon: 'fa-trash', @@ -52,7 +52,7 @@ function (angular, _, config) { }); }; - $scope.move_row = function(direction) { + $scope.moveRow = function(direction) { var rowsList = $scope.dashboard.rows; var rowIndex = _.indexOf(rowsList, $scope.row); var newIndex = rowIndex; @@ -82,17 +82,7 @@ function (angular, _, config) { } }; - $scope.insert_row = function(direction) { - var rowsList = $scope.dashboard.rows; - var currentRowIndex = _.indexOf(rowsList, $scope.row); - $scope.add_row_default(); - var newIndex = currentRowIndex + direction; - if (newIndex >= 0 && newIndex <= (rowsList.length - 1)) { - _.move(rowsList, rowsList.length - 1, newIndex); - } - }; - - $scope.add_panel_default = function(type) { + $scope.addPanelDefault = function(type) { var defaultSpan = 12; var _as = 12 - $scope.dashboard.rowSpan($scope.row); @@ -104,14 +94,14 @@ function (angular, _, config) { type: type }; - $scope.add_panel(panel); + $scope.addPanel(panel); $timeout(function() { $scope.$broadcast('render'); }); }; - $scope.set_height = function(height) { + $scope.setHeight = function(height) { $scope.row.height = height; $scope.$broadcast('render'); }; diff --git a/public/app/partials/dashboard.html b/public/app/partials/dashboard.html index efbc925e4b1..8a063820a53 100644 --- a/public/app/partials/dashboard.html +++ b/public/app/partials/dashboard.html @@ -18,11 +18,11 @@
- +
-
+
@@ -108,7 +101,7 @@
- + ADD ROW
diff --git a/public/test/specs/dashboardSrv-specs.js b/public/test/specs/dashboardSrv-specs.js index 276e28b32c8..8da659825b8 100644 --- a/public/test/specs/dashboardSrv-specs.js +++ b/public/test/specs/dashboardSrv-specs.js @@ -94,7 +94,7 @@ define([ it('adding default should split span in half', function() { dashboard.rows = [{ panels: [{ span: 12, id: 7 }] }]; - dashboard.add_panel({span: 4}, dashboard.rows[0]); + dashboard.addPanel({span: 4}, dashboard.rows[0]); expect(dashboard.rows[0].panels[0].span).to.be(6); expect(dashboard.rows[0].panels[1].span).to.be(6);