diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html b/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html index 7c51f3ad6f3..4ec515654a0 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph-control.html @@ -54,10 +54,10 @@
  • - Move Up + Move Up
  • - Move Down + Move Down
  • Insert New @@ -90,7 +90,7 @@
  • - Remove + Remove
  • diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index c8195658105..22ac8e27bc9 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -522,17 +522,25 @@ angular.module('zeppelinWebApp') }; $scope.removeParagraph = function() { - BootstrapDialog.confirm({ - closable: true, - title: '', - message: 'Do you want to delete this paragraph?', - callback: function(result) { - if (result) { - console.log('Remove paragraph'); - websocketMsgSrv.removeParagraph($scope.paragraph.id); + var paragraphs = angular.element('div[id$="_paragraphColumn_main"'); + if (paragraphs[paragraphs.length-1].id.startsWith($scope.paragraph.id)) { + BootstrapDialog.alert({ + closable: true, + message: 'The last paragraph can\'t be deleted.' + }); + } else { + BootstrapDialog.confirm({ + closable: true, + title: '', + message: 'Do you want to delete this paragraph?', + callback: function(result) { + if (result) { + console.log('Remove paragraph'); + websocketMsgSrv.removeParagraph($scope.paragraph.id); + } } - } - }); + }); + } }; $scope.clearParagraphOutput = function() {