From 5f121c6efae6b2cc1c9998594aca9e6377da6850 Mon Sep 17 00:00:00 2001 From: Petro Kostyuk Date: Mon, 19 Dec 2016 19:19:18 +0100 Subject: [PATCH 1/2] ZEPPELIN-727 --- zeppelin-web/src/app/app.controller.js | 18 ++++++++++++++++++ .../notebook/paragraph/paragraph-control.html | 5 ++++- .../notebook/paragraph/paragraph.controller.js | 7 +++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/zeppelin-web/src/app/app.controller.js b/zeppelin-web/src/app/app.controller.js index c51a72ac4c4..6d97650c6cf 100644 --- a/zeppelin-web/src/app/app.controller.js +++ b/zeppelin-web/src/app/app.controller.js @@ -23,6 +23,24 @@ var init = function() { $scope.asIframe = (($window.location.href.indexOf('asIframe') > -1) ? true : false); + + $scope.paragrapScrollTimeout = 0; + + $scope.$on('$includeContentLoaded', function() { + if ($scope.paragrapScrollTimeout !== 0) { + clearTimeout($scope.paragrapScrollTimeout); + } + + $scope.paragrapScrollTimeout = setTimeout(function() { + var paraID = window.location.href.match(/paragraph=([^&#]+)/); + var para = jQuery('#' + paraID[1] + '_container'); + + if (para.length > 0) { + para[0].scrollIntoView(true); + window.scrollBy(0, -120); + } + }, 1000); + }); }; init(); diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html b/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html index 699ef4ceca3..8d7da0f605e 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html @@ -83,7 +83,10 @@ {{paragraph.config.enabled ? "Disable" : "Enable"}} run
  • - Link this paragraph + Link paragrapgh in context +
  • +
  • + Link single paragraph
  • Clear output diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index 9ef943eaedc..574a0c8791f 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -813,6 +813,13 @@ }; /** Utility function */ + $scope.linkToParagraphInContext = function() { + var noteId = $route.current.pathParams.noteId; + var paragraphUrl = location.protocol + '//' + location.host + location.pathname + '#/notebook/' + noteId + + '/?paragraph=' + $scope.paragraph.id; + $window.prompt('Copy url to clipboard: Ctrl+C, Enter', paragraphUrl); + }; + $scope.goToSingleParagraph = function() { var noteId = $route.current.pathParams.noteId; var redirectToUrl = location.protocol + '//' + location.host + location.pathname + '#/notebook/' + noteId + From 43229045c37a7062bec3549e15f8a426bf9af3b5 Mon Sep 17 00:00:00 2001 From: Petro Kostyuk Date: Mon, 19 Dec 2016 19:23:53 +0100 Subject: [PATCH 2/2] typo --- zeppelin-web/src/app/notebook/paragraph/paragraph-control.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html b/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html index 8d7da0f605e..964adcf1d35 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html @@ -83,7 +83,7 @@ {{paragraph.config.enabled ? "Disable" : "Enable"}} run
  • - Link paragrapgh in context + Link to paragrapgh in context
  • Link single paragraph