diff --git a/common/lib/shared.js b/common/lib/shared.js index ca4f2b73ab1..9d4f45fca8a 100644 --- a/common/lib/shared.js +++ b/common/lib/shared.js @@ -437,4 +437,19 @@ function htmlEntities(str) { //g, '>').replace( /"/g, '"'); -} \ No newline at end of file +} + + +_.mixin({ + move: function (array, fromIndex, toIndex) { + array.splice(toIndex, 0, array.splice(fromIndex, 1)[0] ); + return array; + } +}); + +_.mixin({ + remove: function (array, index) { + array.splice(index, 1); + return array; + } +}); diff --git a/js/controllers.js b/js/controllers.js index d72df596de9..81fab71812c 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -9,6 +9,7 @@ angular.module('kibana.controllers', []) $scope._ = _; + // The global dashboards object should be moved to an $http request for json if (Modernizr.localstorage && !(_.isUndefined(localStorage['dashboard'])) && localStorage['dashboard'] !== '' @@ -46,6 +47,10 @@ angular.module('kibana.controllers', []) }) .controller('RowCtrl', function($scope, $rootScope, $timeout, ejsResource, timer) { + $scope.init = function(){ + $scope.reset_panel(); + } + $scope.toggle_row = function(row) { row.collapse = row.collapse ? false : true; if (!row.collapse) { @@ -55,6 +60,21 @@ angular.module('kibana.controllers', []) } } + $scope.add_panel = function(row,panel) { + console.log(panel) + $scope.row.panels.push(panel); + } + + $scope.reset_panel = function() { + $scope.panel = { + span: 1, + editable: true, + groups: ['default'], + }; + }; + + $scope.init(); + }); diff --git a/panels/fields/editor.html b/panels/fields/editor.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/panels/histogram/editor.html b/panels/histogram/editor.html index 67eb79dd7b2..543260ce9e6 100644 --- a/panels/histogram/editor.html +++ b/panels/histogram/editor.html @@ -1,4 +1,4 @@ -