From 43dc74df4d8acd7f0b91077e2879af3182e2e5cd Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Wed, 24 Jul 2013 16:13:59 -0700 Subject: [PATCH] Closes #250 --- js/services.js | 3 +-- panels/dashcontrol/editor.html | 23 +++++++++++++---------- panels/dashcontrol/module.js | 8 +++++++- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/js/services.js b/js/services.js index 7cf83ccfbd4..2b9c40fd37b 100644 --- a/js/services.js +++ b/js/services.js @@ -716,8 +716,7 @@ angular.module('kibana.services', []) dashboard: angular.toJson(save) }); - request = type === 'temp' ? request.ttl(ttl) : request; - + request = type === 'temp' && ttl ? request.ttl(ttl) : request; // TOFIX: Implement error handling here return request.doIndex( diff --git a/panels/dashcontrol/editor.html b/panels/dashcontrol/editor.html index 97868ee19bf..7c87e30d1d8 100644 --- a/panels/dashcontrol/editor.html +++ b/panels/dashcontrol/editor.html @@ -2,28 +2,28 @@
Allow saving to
- +
- +
- +
- +
Allow loading from
- +
- +
- +
@@ -31,11 +31,14 @@
Sharing
-
+
-
- +
+ +
+
+
\ No newline at end of file diff --git a/panels/dashcontrol/module.js b/panels/dashcontrol/module.js index 6de4c89b8f3..3604c6a442f 100644 --- a/panels/dashcontrol/module.js +++ b/panels/dashcontrol/module.js @@ -21,6 +21,7 @@ * hide_control :: Upon save, hide this panel * elasticsearch_size :: show this many dashboards under the ES section in the load drop down * temp :: Allow saving of temp dashboards + * ttl :: Enable setting ttl. * temp_ttl :: How long should temp dashboards persist */ @@ -48,6 +49,7 @@ angular.module('kibana.dashcontrol', []) hide_control: false, elasticsearch_size: 20, temp: true, + ttl_enable: true, temp_ttl: '30d' }; _.defaults($scope.panel,_d); @@ -83,7 +85,11 @@ angular.module('kibana.dashcontrol', []) }; $scope.elasticsearch_save = function(type,ttl) { - dashboard.elasticsearch_save(type,($scope.elasticsearch.title || dashboard.current.title),ttl).then( + dashboard.elasticsearch_save( + type, + ($scope.elasticsearch.title || dashboard.current.title), + ($scope.panel.ttl_enable ? ttl : false) + ).then( function(result) { if(!_.isUndefined(result._id)) { $scope.alert('Dashboard Saved','This dashboard has been saved to Elasticsearch as "' +