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/22 02:50:04 UTC

incubator-zeppelin git commit: [Zeppelin-136] Zeppelin delete paragraph content after 'Move up'

Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 0e3698222 -> 461b3ea98


[Zeppelin-136] Zeppelin delete paragraph content after 'Move up'

Zeppelin doesn't keep the text change in editor if user tries to "Move up" or "Move down" the paragraph before "auto save"(which is introduced by #168) triggered.

Description of this PR:
* Save moving paragraphs before changing the paragraph location.
* removed unnecessary element
* changed dirty text condition ( color of editor bar is always grey when there is no text, but it should be orange when user is erasing all the text )

Author: Mina Lee <mi...@nflabs.com>

Closes #451 from minahlee/ZEPPELIN-136 and squashes the following commits:

d1e6287 [Mina Lee] [ZEPPELIN-136] Remove unnecessary element and change dirty text condition
8552386 [Mina Lee] [ZEPPELIN-136] zeppelin delete paragraph content after 'Move up' operation


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

Branch: refs/heads/master
Commit: 461b3ea9897a0b769f7807dfd24c9c0e5753ed50
Parents: 0e36982
Author: Mina Lee <mi...@nflabs.com>
Authored: Thu Nov 19 18:57:20 2015 +0900
Committer: Lee moon soo <mo...@apache.org>
Committed: Sun Nov 22 10:50:39 2015 +0900

----------------------------------------------------------------------
 zeppelin-web/src/app/notebook/notebook.controller.js   | 9 ++++++++-
 zeppelin-web/src/app/notebook/paragraph/paragraph.html | 5 +----
 2 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/461b3ea9/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 74bb87a..c7d5347 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.js
@@ -280,10 +280,13 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
         break;
       }
     }
-
     if (newIndex<0 || newIndex>=$scope.note.paragraphs.length) {
       return;
     }
+    // save dirtyText of moving paragraphs.
+    var prevParagraphId = $scope.note.paragraphs[newIndex].id;
+    angular.element('#' + paragraphId + '_paragraphColumn_main').scope().saveParagraph();
+    angular.element('#' + prevParagraphId + '_paragraphColumn_main').scope().saveParagraph();
     websocketMsgSrv.moveParagraph(paragraphId, newIndex);
   });
 
@@ -315,6 +318,10 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
     if (newIndex<0 || newIndex>=$scope.note.paragraphs.length) {
       return;
     }
+    // save dirtyText of moving paragraphs.
+    var nextParagraphId = $scope.note.paragraphs[newIndex].id;
+    angular.element('#' + paragraphId + '_paragraphColumn_main').scope().saveParagraph();
+    angular.element('#' + nextParagraphId + '_paragraphColumn_main').scope().saveParagraph();
     websocketMsgSrv.moveParagraph(paragraphId, newIndex);
   });
 

http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/461b3ea9/zeppelin-web/src/app/notebook/paragraph/paragraph.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.html b/zeppelin-web/src/app/notebook/paragraph/paragraph.html
index e2aa9a3..0ccb716 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.html
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.html
@@ -41,7 +41,7 @@ limitations under the License.
                      require : ['ace/ext/language_tools']
                    }"
            ng-model="paragraph.text"
-           ng-class="{'disable': paragraph.status == 'RUNNING' || paragraph.status == 'PENDING', 'paragraph-text--dirty' : dirtyText}">
+           ng-class="{'disable': paragraph.status == 'RUNNING' || paragraph.status == 'PENDING', 'paragraph-text--dirty' : dirtyText !== undefined}">
       </div>
     </div>
 
@@ -418,9 +418,6 @@ limitations under the License.
           ng-click="toggleEditor()"></span>
     <span class="{{paragraph.config.tableHide ? 'icon-notebook' : 'icon-book-open'}}" style="cursor:pointer;" tooltip-placement="top" tooltip="{{(paragraph.config.tableHide ? 'Show' : 'Hide') + ' output'}}"
           ng-click="toggleOutput()"></span>
-    <span  style="cursor:pointer;"
-          ng-click="saveParagraph()"
-          ng-show="dirtyText"></span>
     <span class="dropdown navbar-right">
       <span class="icon-settings" style="cursor:pointer"
             data-toggle="dropdown"