From 40bcb60fd0d81deaec05671417a7a4bb3475dd8f Mon Sep 17 00:00:00 2001 From: Khalid Huseynov Date: Fri, 24 Jun 2016 10:27:52 -0700 Subject: [PATCH] initial implemenation of offline view --- zeppelin-web/src/app/app.js | 4 ++ .../src/app/notebook/notebook-actionBar.html | 42 ++++++++++++------- .../src/app/notebook/notebook.controller.js | 19 ++++++++- zeppelin-web/src/app/notebook/notebook.html | 2 +- .../notebook/paragraph/paragraph-control.html | 2 + .../paragraph/paragraph.controller.js | 12 ++++++ .../src/app/notebook/paragraph/paragraph.html | 4 +- 7 files changed, 66 insertions(+), 19 deletions(-) diff --git a/zeppelin-web/src/app/app.js b/zeppelin-web/src/app/app.js index 3cbfe3f4be2..a854a8809c1 100644 --- a/zeppelin-web/src/app/app.js +++ b/zeppelin-web/src/app/app.js @@ -62,6 +62,10 @@ templateUrl: 'app/notebook/notebook.html', controller: 'NotebookCtrl' }) + .when('/notebook/:noteId/offlineView', { + templateUrl: 'app/notebook/notebook.html', + controller: 'NotebookCtrl' + }) .when('/jobmanager', { templateUrl: 'app/jobmanager/jobmanager.html', controller: 'JobmanagerCtrl' diff --git a/zeppelin-web/src/app/notebook/notebook-actionBar.html b/zeppelin-web/src/app/notebook/notebook-actionBar.html index dc7a3ecff54..6b637442fb6 100644 --- a/zeppelin-web/src/app/notebook/notebook-actionBar.html +++ b/zeppelin-web/src/app/notebook/notebook-actionBar.html @@ -15,8 +15,8 @@

-

{{noteName(note)}}

+ ng-show="showEditor" ng-model="note.name" ng-blur="sendNewName();showEditor = false;" ng-enter="sendNewName();showEditor = false;" ng-escape="note.name = oldName; showEditor = false" focus-if="showEditor" ng-disabled="{{offlineView}}"/> +

{{noteName(note)}}

@@ -24,20 +24,23 @@

class="btn btn-default btn-xs" ng-click="runNote()" ng-class="{'disabled':isNoteRunning()}" - tooltip-placement="bottom" tooltip="Run all paragraphs"> + tooltip-placement="bottom" tooltip="Run all paragraphs" + ng-disabled="{{offlineView}}"> @@ -54,21 +58,23 @@

ng-hide="viewOnly" tooltip-placement="bottom" tooltip="Clone the notebook" data-toggle="modal" data-target="#noteNameModal" data-clone="true" - > + ng-disabled="{{offlineView}}">

+ diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index 1febeb1cca4..c7f5ddc1ef9 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -385,6 +385,9 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r // TODO: this may have impact on performance when there are many paragraphs in a note. $scope.$on('updateParagraph', function(event, data) { + if ($scope.offlineView) { + return; + } if (data.paragraph.id === $scope.paragraph.id && (data.paragraph.dateCreated !== $scope.paragraph.dateCreated || data.paragraph.dateFinished !== $scope.paragraph.dateFinished || @@ -528,6 +531,9 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r }; $scope.runParagraph = function(data) { + if ($scope.offlineView) { + return; + } websocketMsgSrv.runParagraph($scope.paragraph.id, $scope.paragraph.title, data, $scope.paragraph.config, $scope.paragraph.settings.params); $scope.originalText = angular.copy(data); @@ -599,6 +605,9 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r }; $scope.toggleEditor = function() { + if ($scope.offlineView) { + return; + } if ($scope.paragraph.config.editorHide) { $scope.openEditor(); } else { @@ -720,6 +729,9 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r }; $scope.toggleOutput = function() { + if ($scope.offlineView) { + return; + } var newConfig = angular.copy($scope.paragraph.config); newConfig.tableHide = !newConfig.tableHide; var newParams = angular.copy($scope.paragraph.settings.params); diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.html b/zeppelin-web/src/app/notebook/paragraph/paragraph.html index 54d15af48c2..c1e9e574ada 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.html +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.html @@ -28,7 +28,7 @@ ng-blur="setTitle(); showTitleEditor = false" ng-enter="setTitle(); showTitleEditor = false" focus-if="showTitleEditor" /> -
@@ -45,7 +45,7 @@ require : ['ace/ext/language_tools'] }" ng-model="paragraph.text" - ng-class="{'disable': paragraph.status == 'RUNNING' || paragraph.status == 'PENDING', + ng-class="{'disable': {{offlineView}} || paragraph.status == 'RUNNING' || paragraph.status == 'PENDING', 'paragraph-text--dirty' : dirtyText !== originalText && dirtyText !== undefined}">