You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2015/11/07 01:47:14 UTC

incubator-zeppelin git commit: ZEPPELIN-372 : Exporting a notebook

Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 27b7ad52b -> 618bcd878


ZEPPELIN-372 : Exporting a notebook

Exporting a notebook in a JSON format, which can later be used/imported in a different environment.

<img width="203" alt="screen shot 2015-10-29 at 12 29 41 pm" src="https://cloud.githubusercontent.com/assets/674497/10812117/d6611b82-7e38-11e5-9074-d14eebf19e72.png">

Author: Prabhjyot Singh <pr...@gmail.com>

Closes #376 from prabhjyotsingh/ZEPPELIN-372 and squashes the following commits:

462e733 [Prabhjyot Singh] ZEPPELIN-372 : Exporting a notebook in a JSON format, which can later be used/imported in a different environment.


Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/618bcd87
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/618bcd87
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/618bcd87

Branch: refs/heads/master
Commit: 618bcd8785cdde83d5212569be6e54aabb2d6f14
Parents: 27b7ad5
Author: Prabhjyot Singh <pr...@gmail.com>
Authored: Tue Nov 3 14:31:39 2015 +0530
Committer: Lee moon soo <mo...@apache.org>
Committed: Sat Nov 7 09:47:19 2015 +0900

----------------------------------------------------------------------
 zeppelin-web/src/app/notebook/notebook.controller.js | 10 ++++++++++
 zeppelin-web/src/app/notebook/notebook.html          |  7 +++++++
 2 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/618bcd87/zeppelin-web/src/app/notebook/notebook.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/notebook.controller.js b/zeppelin-web/src/app/notebook/notebook.controller.js
index ed1d69b..d8ee83f 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.js
@@ -79,6 +79,16 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
     }
   };
 
+  //Export notebook
+  $scope.exportNotebook = function() {
+    var jsonContent = 'data:text/json;charset=utf-8,' + JSON.stringify($scope.note);
+    var encodedUri = encodeURI(jsonContent);
+    var link = document.createElement('a');
+    link.setAttribute('href', encodedUri);
+    link.setAttribute('download', $scope.note.name + '.json');
+    link.click();
+  };
+
   //Clone note
   $scope.cloneNote = function(noteId) {
     var result = confirm('Do you want to clone this notebook?');

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/618bcd87/zeppelin-web/src/app/notebook/notebook.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/notebook.html b/zeppelin-web/src/app/notebook/notebook.html
index edab9b0..7898249 100644
--- a/zeppelin-web/src/app/notebook/notebook.html
+++ b/zeppelin-web/src/app/notebook/notebook.html
@@ -53,6 +53,13 @@ limitations under the License.
               >
         <i class="fa fa-copy"></i>
       </button>
+      <button type="button"
+              class="btn btn-default btn-xs"
+              ng-hide="viewOnly"
+              ng-click="exportNotebook()"
+              tooltip-placement="bottom" tooltip="Export the notebook">
+        <i class="fa fa-download"></i>
+      </button>
     </span>
 
     <span ng-hide="viewOnly">