Repository: zeppelin Updated Branches: refs/heads/master f689e26e5 -> 7b0315240
[ZEPPELIN-1578] notes list in customizing zeppelin homepage isn't working ### What is this PR for? Customizing the Zeppelin Homepage to show the notebook list does not work as [0.6.2 document](http://zeppelin.apache.org/docs/0.6.2/manuala/notebookashomepage.html#show-notebooks-list-in-your-custom-homepage). Furthermore, it is not working on 0.7.0 version ([0.7.0 document](http://zeppelin.apache.org/docs/0.7.0-SNAPSHOT/manual/notebookashomepage.html#show-notes-list-in-your-custom-homepage)). That reason is that get_home message of zeppelin websocket is called in zeppelin-web twice. At this chance, I suggest to split role to HomeCtrl and CustomHomeCtrl because when "Home.controller.js" is update, It could be conflicted like current issue. So I think it would be more convenient to manage the roles separately. ### What type of PR is it? [Bug Fix | Feature | Documentation ] ### Todos * None ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-1578 ### How should this be tested? - After write the following code in paragraph, run it. ``` println( """%angular <div ng-include="'app/home/notebook.html'"></div> """) ``` ### Screenshots (if appropriate)  ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? Yes Author: soralee <[email protected]> Closes #1804 from soralee/ZEPPELIN-1578 and squashes the following commits: 1422ebe [soralee] modify document and screenshot da5b852 [soralee] modify document and screenshot c228f61 [soralee] enable homescreen without browser error 6b3881f [soralee] enable homescreen 8b605c8 [soralee] rm old files e752e48 [soralee] modify screenshot a9036a8 [soralee] rename files 473bce4 [soralee] using home-template both home.html and customHome.html 028f873 [soralee] resolve conflict 55b7ddc [soralee] resolve conflict 229ed37 [soralee] bug fix d18e513 [soralee] for rebase it b933784 [soralee] apply homepage template f4917eb [soralee] remove old img file f7e6bc6 [soralee] remove file f77a32c [soralee] improve customer hompage b836354 [soralee] rebase master cad590f [soralee] fix to show text after searching note 58d08f8 [soralee] notes list in custom homepage isn't working Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/7b031524 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/7b031524 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/7b031524 Branch: refs/heads/master Commit: 7b0315240f81091c22c38e25492deac0a1f187a1 Parents: f689e26 Author: soralee <[email protected]> Authored: Tue Jan 31 21:53:17 2017 +0900 Committer: Mina Lee <[email protected]> Committed: Wed Feb 1 20:51:35 2017 +0900 ---------------------------------------------------------------------- .../docs-img/homepage_custom_notebook_list.png | Bin 0 -> 34835 bytes .../img/screenshots/homepage_notebook_list.png | Bin 35186 -> 0 bytes docs/manual/notebookashomepage.md | 31 ++--- zeppelin-web/src/app/home/home.controller.js | 14 ++- zeppelin-web/src/app/home/home.html | 112 +----------------- .../src/app/home/notebook-template.html | 115 +++++++++++++++++++ zeppelin-web/src/app/home/notebook.html | 42 +++++++ .../notebook/paragraph/paragraph.controller.js | 4 +- .../paragraph/result/result.controller.js | 5 +- 9 files changed, 187 insertions(+), 136 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b031524/docs/assets/themes/zeppelin/img/docs-img/homepage_custom_notebook_list.png ---------------------------------------------------------------------- diff --git a/docs/assets/themes/zeppelin/img/docs-img/homepage_custom_notebook_list.png b/docs/assets/themes/zeppelin/img/docs-img/homepage_custom_notebook_list.png new file mode 100644 index 0000000..13bcadc Binary files /dev/null and b/docs/assets/themes/zeppelin/img/docs-img/homepage_custom_notebook_list.png differ http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b031524/docs/assets/themes/zeppelin/img/screenshots/homepage_notebook_list.png ---------------------------------------------------------------------- diff --git a/docs/assets/themes/zeppelin/img/screenshots/homepage_notebook_list.png b/docs/assets/themes/zeppelin/img/screenshots/homepage_notebook_list.png deleted file mode 100644 index a5ac6f2..0000000 Binary files a/docs/assets/themes/zeppelin/img/screenshots/homepage_notebook_list.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b031524/docs/manual/notebookashomepage.md ---------------------------------------------------------------------- diff --git a/docs/manual/notebookashomepage.md b/docs/manual/notebookashomepage.md index a82d100..b85f631 100644 --- a/docs/manual/notebookashomepage.md +++ b/docs/manual/notebookashomepage.md @@ -65,38 +65,25 @@ Restart your Zeppelin server That's it! Open your browser and navigate to Apache Zeppelin and see your customized homepage. <br /> -## Show notes list in your custom homepage +## Show note list in your custom homepage If you want to display the list of notes on your custom Apache Zeppelin homepage all you need to do is use our %angular support. -Add the following code to a paragraph in you home page and run it... Voila! You have your notes list. +Add the following code to a paragraph in your Apache Zeppelin note and run it. ```javascript +%spark + println( """%angular - <div class="col-md-4" ng-controller="HomeCtrl as home"> - <h4>Notebooks</h4> - <div> - <h5><a href="" data-toggle="modal" data-target="#noteNameModal" style="text-decoration: none;"> - <i style="font-size: 15px;" class="icon-notebook"></i> Create new note</a></h5> - <ul style="list-style-type: none;"> - <li ng-repeat="note in home.notes.list track by $index"><i style="font-size: 10px;" class="icon-doc"></i> - <a style="text-decoration: none;" href="#/notebook/{{"{{note.id"}}}}>{{"{{noteName(note)"}}}}</a> - </li> - </ul> - </div> - </div> + <div ng-include="'app/home/notebook.html'"></div> """) ``` -After running the note you will see output similar to this one: -<img src="/assets/themes/zeppelin/img/screenshots/homepage_notebook_list.png" /> +After running the paragraph, you will see output similar to this one: -The main trick here relays in linking the ```<div>``` to the controller: +<img src="/assets/themes/zeppelin/img/docs-img/homepage_custom_notebook_list.png" /> + +That's it! Voila! You have your note list. -```javascript -<div class="col-md-4" ng-controller="HomeCtrl as home"> -``` -Once we have ```home``` as our controller variable in our ```<div></div>``` -we can use ```home.notes.list``` to get access to the note list. http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b031524/zeppelin-web/src/app/home/home.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/home/home.controller.js b/zeppelin-web/src/app/home/home.controller.js index a014037..0fa055d 100644 --- a/zeppelin-web/src/app/home/home.controller.js +++ b/zeppelin-web/src/app/home/home.controller.js @@ -34,6 +34,7 @@ function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arra vm.arrayOrderingSrv = arrayOrderingSrv; vm.notebookHome = false; + vm.noteCustomHome = true; if ($rootScope.ticket !== undefined) { vm.staticHome = false; } else { @@ -44,12 +45,11 @@ function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arra $scope.TRASH_FOLDER_ID = TRASH_FOLDER_ID; $scope.query = {q: ''}; - var initHome = function() { + $scope.initHome = function() { websocketMsgSrv.getHomeNote(); + vm.noteCustomHome = false; }; - initHome(); - $scope.reloadNoteList = function() { websocketMsgSrv.reloadAllNotesFromRepo(); $scope.isReloadingNotes = true; @@ -72,6 +72,10 @@ function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arra }); $scope.$on('setNoteContent', function(event, note) { + if (vm.noteCustomHome) { + return; + } + if (note) { vm.note = note; @@ -144,4 +148,8 @@ function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arra } return false; }; + + $scope.getNoteName = function(note) { + return arrayOrderingSrv.getNoteName(note); + }; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b031524/zeppelin-web/src/app/home/home.html ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/home/home.html b/zeppelin-web/src/app/home/home.html index e6a628f..b86671d 100644 --- a/zeppelin-web/src/app/home/home.html +++ b/zeppelin-web/src/app/home/home.html @@ -11,111 +11,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -<!-- Template of Home --> -<script type="text/ng-template" id="note_renderer.html"> - <!-- note --> - <div ng-if="node.children == null && isFilterNote(node)" ng-mouseenter="showNoteButton=true" - ng-mouseleave="showNoteButton=false"> - <a style="text-decoration: none;" href="#/notebook/{{node.id}}"> - <i style="font-size: 10px;" - ng-class="query.q && node.isTrash ? 'fa fa-trash-o' : 'icon-doc'" /> {{noteName(node)}} - </a> - <!-- if note is not in trash --> - <a ng-if="!node.isTrash" style="text-decoration: none;"> - <i style="margin-left: 10px;" - class="fa fa-pencil notebook-list-btn" ng-show="showNoteButton" - ng-click="node.path ? renameNote(node.id, node.path) : renameNote(node.id, node.name)" - tooltip-placement="bottom" tooltip="Rename note"> - </i> - </a> - <a ng-if="!node.isTrash" style="text-decoration: none;"> - <i class="fa fa-eraser notebook-list-btn" ng-show="showNoteButton" ng-click="clearAllParagraphOutput(node.id)" - tooltip-placement="bottom" tooltip="Clear output"> - </i> - </a> - <a ng-if="!node.isTrash" style="text-decoration: none;"> - <i class="fa fa-trash-o notebook-list-btn" ng-show="showNoteButton" ng-click="moveNoteToTrash(node.id)" - tooltip-placement="bottom" tooltip="Move note to Trash"> - </i> - </a> - <!-- if note is in trash --> - <a ng-if="node.isTrash"> - <i class="fa fa-undo notebook-list-btn" ng-show="showNoteButton" ng-click="restoreNote(node.id)" - tooltip-placement="bottom" tooltip="Restore note"> - </i> - </a> - <a ng-if="node.isTrash" style="font-size: 16px;"> - <i class="fa fa-times notebook-list-btn" ng-show="showNoteButton" ng-click="removeNote(node.id)" - tooltip-placement="bottom" tooltip="Remove note permanently"> - </i> - </a> - </div> - - <!-- folder --> - <div ng-if="node.children != null && node.id !== TRASH_FOLDER_ID"> - <div ng-mouseenter="showFolderButton=true" - ng-mouseleave="showFolderButton=false"> - <a style="text-decoration: none; cursor: pointer;" ng-click="toggleFolderNode(node)"> - <i style="font-size: 10px;" ng-class="node.hidden ? 'icon-folder' : 'icon-folder-alt'" /> {{noteName(node)}} - </a> - <a ng-if="!node.isTrash" style="text-decoration: none;"> - <i style="margin-left: 10px;" - class="fa fa-pencil notebook-list-btn" ng-show="showFolderButton" ng-click="renameFolder(node)" - tooltip-placement="bottom" tooltip="Rename folder"> - </i> - </a> - <!-- if folder is not in trash --> - <a ng-if="!node.isTrash"> - <i class="fa fa-trash-o notebook-list-btn" ng-show="showFolderButton" ng-click="moveFolderToTrash(node.id)" - tooltip-placement="bottom" tooltip="Move folder to Trash"> - </i> - </a> - <!-- if folder is in trash --> - <a ng-if="node.isTrash"> - <i class="fa fa-undo notebook-list-btn" ng-show="showFolderButton" ng-click="restoreFolder(node.id)" - tooltip-placement="bottom" tooltip="Restore folder"> - </i> - </a> - <a ng-if="node.isTrash" style="font-size: 16px"> - <i class="fa fa-times notebook-list-btn" ng-show="showFolderButton" ng-click="removeFolder(node.id)" - tooltip-placement="bottom" tooltip="Remove folder permanently"> - </i> - </a> - </div> - <div ng-if="!node.hidden"> - <ul style="list-style-type: none; padding-left:15px;"> - <li ng-repeat="node in node.children" ng-include="'note_renderer.html'" /> - </ul> - </div> - </div> - <!-- trash folder --> - <div ng-if="node.id === TRASH_FOLDER_ID"> - <div ng-mouseenter="showFolderButton=true" - ng-mouseleave="showFolderButton=false"> - <a style="text-decoration: none; cursor: pointer;" ng-click="toggleFolderNode(node)"> - <i style="font-size: 14px;" class="fa fa-trash-o" /> Trash - </a> - <a style="text-decoration: none;"> - <i style="margin-left: 10px" - class="fa fa-undo notebook-list-btn" ng-show="showFolderButton" ng-click="restoreAll()" - tooltip-placement="bottom" tooltip="Restore all"> - </i> - <i style="font-size: 16px;" - class="fa fa-times notebook-list-btn" ng-show="showFolderButton" ng-click="emptyTrash()" - tooltip-placement="bottom" tooltip="Empty trash"> - </i> - </a> - </div> - <div ng-if="!node.hidden"> - <ul style="list-style-type: none; padding-left:15px;"> - <li ng-repeat="node in node.children" ng-include="'note_renderer.html'" /> - </ul> - </div> - </div> -</script> - -<!-- HomeCtrl --> -<div ng-controller="HomeCtrl as home"> +<div ng-controller="HomeCtrl as home" data-ng-init="initHome()"> <div ng-show="home.staticHome" class="box width-full home"> <div class="zeppelin"> <div class="zeppelin2"></div> @@ -150,11 +46,11 @@ limitations under the License. </li> <div ng-if="!query.q || query.q === ''"> <li ng-repeat="node in home.notes.root.children | orderBy:home.arrayOrderingSrv.noteListOrdering track by $index" - ng-include="'note_renderer.html'" /> + ng-include src="'app/home/notebook-template.html'" ng-class="note_folder_renderer"></li> </div> <div ng-if="query.q"> <li ng-repeat="node in home.notes.flatList| filter:query.q | orderBy:home.arrayOrderingSrv.noteListOrdering track by $index" - ng-include="'note_renderer.html'" /> + ng-include src="'app/home/notebook-template.html'" ng-class="note_folder_renderer"></li> </div> </ul> </div> @@ -188,7 +84,7 @@ limitations under the License. ng-class="columnWidthClass(currentParagraph.config.colWidth)" class="paragraph-col"> <div id="{{currentParagraph.id}}_paragraphColumn" - ng-if="currentParagraph.result" + ng-if="currentParagraph.results" ng-include src="'app/notebook/paragraph/paragraph.html'" ng-class="{'paragraph-space box paragraph-margin': !asIframe, 'focused': paragraphFocused}" ng-hide="currentParagraph.config.tableHide && home.viewOnly"> http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b031524/zeppelin-web/src/app/home/notebook-template.html ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/home/notebook-template.html b/zeppelin-web/src/app/home/notebook-template.html new file mode 100644 index 0000000..5b9f76b --- /dev/null +++ b/zeppelin-web/src/app/home/notebook-template.html @@ -0,0 +1,115 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> + +<div ng-class="note_folder_renderer"> + <!-- note --> + <div ng-if="node.children == null && isFilterNote(node)" ng-mouseenter="showNoteButton=true" + ng-mouseleave="showNoteButton=false"> + <a style="text-decoration: none;" href="#/notebook/{{node.id}}"> + <i style="font-size: 10px;" + ng-class="query.q && node.isTrash ? 'fa fa-trash-o' : 'icon-doc'"></i> {{getNoteName(node)}} + </a> + <!-- if note is not in trash --> + <a ng-if="!node.isTrash" style="text-decoration: none;"> + <i style="margin-left: 10px;" + class="fa fa-pencil notebook-list-btn" ng-show="showNoteButton" + ng-click="node.path ? renameNote(node.id, node.path) : renameNote(node.id, node.name)" + tooltip-placement="bottom" tooltip="Rename note"> + </i> + </a> + <a ng-if="!node.isTrash" style="text-decoration: none;"> + <i class="fa fa-eraser notebook-list-btn" ng-show="showNoteButton" ng-click="clearAllParagraphOutput(node.id)" + tooltip-placement="bottom" tooltip="Clear output"> + </i> + </a> + <a ng-if="!node.isTrash" style="text-decoration: none;"> + <i class="fa fa-trash-o notebook-list-btn" ng-show="showNoteButton" ng-click="moveNoteToTrash(node.id)" + tooltip-placement="bottom" tooltip="Move note to Trash"> + </i> + </a> + <!-- if note is in trash --> + <a ng-if="node.isTrash"> + <i class="fa fa-undo notebook-list-btn" ng-show="showNoteButton" ng-click="restoreNote(node.id)" + tooltip-placement="bottom" tooltip="Restore note"> + </i> + </a> + <a ng-if="node.isTrash" style="font-size: 16px;"> + <i class="fa fa-times notebook-list-btn" ng-show="showNoteButton" ng-click="removeNote(node.id)" + tooltip-placement="bottom" tooltip="Remove note permanently"> + </i> + </a> + </div> + + <!-- folder --> + <div ng-if="node.children != null && node.id !== TRASH_FOLDER_ID"> + <div ng-mouseenter="showFolderButton=true" + ng-mouseleave="showFolderButton=false"> + <a style="text-decoration: none; cursor: pointer;" ng-click="toggleFolderNode(node)"> + <i style="font-size: 10px;" ng-class="node.hidden ? 'icon-folder' : 'icon-folder-alt'"></i> {{getNoteName(node)}} + </a> + <a ng-if="!node.isTrash" style="text-decoration: none;"> + <i style="margin-left: 10px;" + class="fa fa-pencil notebook-list-btn" ng-show="showFolderButton" ng-click="renameFolder(node)" + tooltip-placement="bottom" tooltip="Rename folder"> + </i> + </a> + <!-- if folder is not in trash --> + <a ng-if="!node.isTrash"> + <i class="fa fa-trash-o notebook-list-btn" ng-show="showFolderButton" ng-click="moveFolderToTrash(node.id)" + tooltip-placement="bottom" tooltip="Move folder to Trash"> + </i> + </a> + <!-- if folder is in trash --> + <a ng-if="node.isTrash"> + <i class="fa fa-undo notebook-list-btn" ng-show="showFolderButton" ng-click="restoreFolder(node.id)" + tooltip-placement="bottom" tooltip="Restore folder"> + </i> + </a> + <a ng-if="node.isTrash" style="font-size: 16px"> + <i class="fa fa-times notebook-list-btn" ng-show="showFolderButton" ng-click="removeFolder(node.id)" + tooltip-placement="bottom" tooltip="Remove folder permanently"> + </i> + </a> + </div> + <div ng-if="!node.hidden"> + <ul style="list-style-type: none; padding-left:15px;"> + <li ng-repeat="node in node.children" ng-include="'app/home/notebook-template.html'" ng-class="'note_folder_renderer'"></li> + </ul> + </div> + </div> + <!-- trash folder --> + <div ng-if="node.id === TRASH_FOLDER_ID"> + <div ng-mouseenter="showFolderButton=true" + ng-mouseleave="showFolderButton=false"> + <a style="text-decoration: none; cursor: pointer;" ng-click="toggleFolderNode(node)"> + <i style="font-size: 14px;" class="fa fa-trash-o"></i> Trash + </a> + <a style="text-decoration: none;"> + <i style="margin-left: 10px" + class="fa fa-undo notebook-list-btn" ng-show="showFolderButton" ng-click="restoreAll()" + tooltip-placement="bottom" tooltip="Restore all"> + </i> + <i style="font-size: 16px;" + class="fa fa-times notebook-list-btn" ng-show="showFolderButton" ng-click="emptyTrash()" + tooltip-placement="bottom" tooltip="Empty trash"> + </i> + </a> + </div> + <div ng-if="!node.hidden"> + <ul style="list-style-type: none; padding-left:15px;"> + <li ng-repeat="node in node.children" ng-include="'app/home/notebook-template.html'" ng-class="'note_folder_renderer'"></li> + </ul> + </div> + </div> +</div> http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b031524/zeppelin-web/src/app/home/notebook.html ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/home/notebook.html b/zeppelin-web/src/app/home/notebook.html new file mode 100644 index 0000000..8c3b1fb --- /dev/null +++ b/zeppelin-web/src/app/home/notebook.html @@ -0,0 +1,42 @@ +<!-- +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<div ng-controller="HomeCtrl as home"> + <div class="row"> + <div class="col-md-4"> + <h4>Notebook + <i ng-class="isReloadingNotes ? 'fa fa-refresh fa-spin' : 'fa fa-refresh'" + ng-style="!isReloadingNotes && {'cursor': 'pointer'}" style="font-size: 13px;" + ng-click="reloadNoteList();" + tooltip-placement="bottom" tooltip="Reload notes from storage"> + </i> + </h4> + <h5><a href="" data-toggle="modal" data-target="#noteImportModal" style="text-decoration: none;"> + <i style="font-size: 15px;" class="fa fa-upload"></i> Import note</a></h5> + <h5><a href="" data-toggle="modal" data-target="#noteNameModal" style="text-decoration: none;"> + <i style="font-size: 15px;" class="icon-notebook"></i> Create new note</a></h5> + <ul id="notebook-names"> + <li class="filter-names" ng-include="'components/filterNoteNames/filter-note-names.html'"></li> + <div ng-if="!query.q || query.q === ''"> + <li ng-repeat="node in home.notes.root.children | orderBy:home.arrayOrderingSrv.noteListOrdering track by $index" + ng-include src="'app/home/notebook-template.html'" ng-class="note_folder_renderer"></li> + </div> + <div ng-if="query.q"> + <li ng-repeat="node in home.notes.flatList | filter:query.q | orderBy:home.arrayOrderingSrv.noteListOrdering track by $index" + ng-include src="'app/home/notebook-template.html'" ng-class="note_folder_renderer"></li> + </div> + </ul> + </div> + <br/><br/><br/> + </div> +</div> http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b031524/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index 228bb77..ef35b49 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -456,7 +456,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat var session = editor.getSession(); var dirtyText = session.getValue(); $scope.dirtyText = dirtyText; - $scope.startSaveTimer(); + $scope.$broadcast('startSaveTimer'); setParagraphMode(session, dirtyText, editor.getCursorPosition()); }; @@ -696,7 +696,7 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat return match[1].trim(); // get default interpreter name if paragraph text doesn't start with '%' // TODO(mina): dig into the cause what makes interpreterBindings to have no element - } else if ($scope.$parent.interpreterBindings.length !== 0) { + } else if ($scope.$parent.interpreterBindings && $scope.$parent.interpreterBindings.length !== 0) { return $scope.$parent.interpreterBindings[0].name; } return ''; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7b031524/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js b/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js index 6d56fe4..40f8248 100644 --- a/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js @@ -166,7 +166,7 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location class: vis.class }; }); - + updateData(result, config, paragraph, index); renderResult($scope.type); }; @@ -716,6 +716,9 @@ function ResultCtrl($scope, $rootScope, $route, $window, $routeParams, $location var getSuggestions = function() { // Get suggested apps var noteId = $route.current.pathParams.noteId; + if (!noteId) { + return; + } $http.get(baseUrlSrv.getRestApiBase() + '/helium/suggest/' + noteId + '/' + paragraph.id) .success(function(data, status, headers, config) { $scope.suggestion = data.body;
