Improved portability of exported JSON files, updated underscore.js

This commit is contained in:
Rashid Khan
2013-02-13 14:51:56 -07:00
parent 42b415cf26
commit 22d3fdace1
9 changed files with 40 additions and 63 deletions
+11 -3
View File
@@ -3,8 +3,13 @@
'use strict';
angular.module('kibana.controllers', [])
.controller('DashCtrl', function($scope, $rootScope, ejsResource, timer) {
.controller('DashCtrl', function($scope, $rootScope, $http, ejsResource, timer) {
var _d = {
title: "",
editable: true,
rows: [],
}
$scope.init = function() {
$scope.config = config;
@@ -18,14 +23,17 @@ angular.module('kibana.controllers', [])
) {
$scope.dashboards = JSON.parse(localStorage['dashboard']);
} else {
$scope.dashboards = dashboards;
$scope.dashboards = dashboards
}
_.defaults($scope.dashboards,_d)
var ejs = $scope.ejs = ejsResource(config.elasticsearch);
}
$scope.export = function() {
var blob = new Blob([angular.toJson($scope.dashboards)], {type: "application/json;charset=utf-8"});
var blob = new Blob([angular.toJson($scope.dashboards,true)], {type: "application/json;charset=utf-8"});
saveAs(blob, $scope.dashboards.title+"-"+new Date().getTime());
}