Started on row editor, removed lots of 's for nice speed increase

This commit is contained in:
Rashid Khan
2013-02-12 16:25:39 -07:00
parent 0703dd8799
commit 81962c831b
13 changed files with 105 additions and 66 deletions
+26 -6
View File
@@ -6,9 +6,13 @@ angular.module('kibana.controllers', [])
.controller('DashCtrl', function($scope, $rootScope, ejsResource, timer) {
$scope.config = config;
$scope._ = _;
if (Modernizr.localstorage && !(_.isUndefined(localStorage['dashboard']))) {
if (Modernizr.localstorage &&
!(_.isUndefined(localStorage['dashboard'])) &&
localStorage['dashboard'] !== ''
) {
$scope.dashboards = JSON.parse(localStorage['dashboard']);
} else {
$scope.dashboards = dashboards;
@@ -16,11 +20,6 @@ angular.module('kibana.controllers', [])
var ejs = $scope.ejs = ejsResource(config.elasticsearch);
$scope.toggle_row = function(row) {
$scope.$broadcast('toggle_row',row)
row.collapse = row.collapse ? false : true;
}
$scope.export = function() {
var blob = new Blob([angular.toJson($scope.dashboards)], {type: "application/json;charset=utf-8"});
saveAs(blob, $scope.dashboards.title+"-"+new Date().getTime());
@@ -35,6 +34,27 @@ angular.module('kibana.controllers', [])
}
}
$scope.purge = function() {
if (Modernizr.localstorage) {
localStorage['dashboard'] = '';
alert('Default dashboard cleared')
} else {
alert("Sorry, your browser is too old for this functionality");
}
}
})
.controller('RowCtrl', function($scope, $rootScope, $timeout, ejsResource, timer) {
$scope.toggle_row = function(row) {
row.collapse = row.collapse ? false : true;
if (!row.collapse) {
$timeout(function() {
$scope.$broadcast('render')
});
}
}
});