You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by GitBox <gi...@apache.org> on 2021/04/12 15:07:01 UTC

[GitHub] [zeppelin] dannycranmer commented on a change in pull request #4092: [ZEPPELIN-4506] Check for duplicate note on rename of a notebook

dannycranmer commented on a change in pull request #4092:
URL: https://github.com/apache/zeppelin/pull/4092#discussion_r611713414



##########
File path: zeppelin-web/src/app/notebook/notebook.controller.js
##########
@@ -539,11 +539,23 @@ function NotebookCtrl($scope, $route, $routeParams, $location, $rootScope,
   $scope.updateNoteName = function(newName) {
     const trimmedNewName = newName.trim();
     if (trimmedNewName.length > 0 && $scope.note.name !== trimmedNewName) {
+      $scope.note.oldName = $scope.note.name;
       $scope.note.name = trimmedNewName;
       websocketMsgSrv.renameNote($scope.note.id, $scope.note.name, true);
     }
   };
 
+  $scope.$on('setNoteMenu', function(event, notes) {
+    $scope.note.oldName = undefined;
+  });
+
+  $scope.$on('errorInfo', function(event, notes) {
+    if ($scope.note.oldName !== undefined) {
+      $scope.note.name = $scope.note.oldName;
+      $scope.note.oldName = undefined;
+    }
+  });

Review comment:
       Yes, I can think of 2 alternatives:
   - Return a specific error response for the rename action
   - Push a `NOTES_INFO` update in the error case to update the UI
   
   What are you thoughts on the 2 approaches?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org