diff --git a/zeppelin-web/src/app/notebook/notebook.controller.js b/zeppelin-web/src/app/notebook/notebook.controller.js index e481e9be4cd..4b02f1a979d 100644 --- a/zeppelin-web/src/app/notebook/notebook.controller.js +++ b/zeppelin-web/src/app/notebook/notebook.controller.js @@ -483,20 +483,23 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope, } $scope.$on('addParagraph', function (event, paragraph, index) { - if ($scope.paragraphUrl) { + if ($scope.paragraphUrl || $scope.revisionView === true) { return } addPara(paragraph, index) }) $scope.$on('removeParagraph', function (event, paragraphId) { - if ($scope.paragraphUrl) { + if ($scope.paragraphUrl || $scope.revisionView === true) { return } removePara(paragraphId) }) $scope.$on('moveParagraph', function (event, paragraphId, newIdx) { + if ($scope.revisionView === true) { + return + } let removedPara = removePara(paragraphId) if (removedPara && removedPara.length === 1) { addPara(removedPara[0], newIdx) @@ -958,6 +961,9 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope, }) $scope.$on('insertParagraph', function (event, paragraphId, position) { + if ($scope.revisionView === true) { + return + } let newIndex = -1 for (let i = 0; i < $scope.note.paragraphs.length; i++) { if ($scope.note.paragraphs[i].id === paragraphId) { diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index 1a921769f49..ae28e457ba5 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -610,7 +610,9 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca let session = editor.getSession() let dirtyText = session.getValue() $scope.dirtyText = dirtyText - $scope.startSaveTimer() + if ($scope.dirtyText !== $scope.originalText) { + $scope.startSaveTimer() + } setParagraphMode(session, dirtyText, editor.getCursorPosition()) } @@ -1241,23 +1243,28 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca } $scope.updateParagraph = function (oldPara, newPara, updateCallback) { - // 1. get status, refreshed + // 1. can't update on revision view + if ($scope.revisionView === true) { + return + } + + // 2. get status, refreshed const statusChanged = (newPara.status !== oldPara.status) const resultRefreshed = (newPara.dateFinished !== oldPara.dateFinished) || isEmpty(newPara.results) !== isEmpty(oldPara.results) || newPara.status === ParagraphStatus.ERROR || (newPara.status === ParagraphStatus.FINISHED && statusChanged) - // 2. update texts managed by $scope + // 3. update texts managed by $scope $scope.updateAllScopeTexts(oldPara, newPara) - // 3. execute callback to update result + // 4. execute callback to update result updateCallback() - // 4. update remaining paragraph objects + // 5. update remaining paragraph objects $scope.updateParagraphObjectWhenUpdated(newPara) - // 5. handle scroll down by key properly if new paragraph is added + // 6. handle scroll down by key properly if new paragraph is added if (statusChanged || resultRefreshed) { // when last paragraph runs, zeppelin automatically appends new paragraph. // this broadcast will focus to the newly inserted paragraph