Repository: zeppelin Updated Branches: refs/heads/master 8ffd9af93 -> e7d5d8267
[ZEPPELIN-1183] Replace $window.location by $location ### What is this PR for? There is a native service used across the app to take care of re-routing to different page: `$location`, however there has been a few times where `$window.location` is used instead, and people tend to do it in new PR too. This convert the `$window.location` from the code to use `$location`. Only one was kept in `app.controller.js` for Iframe, so it doesn't flicker. ### What type of PR is it? Refactoring ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-1183 ### How should this be tested? You can try to reproduce the couple of cases that redirection is needed, but overall there shouldn't be any issue from that change. ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Damien CORNEAU <cornead...@gmail.com> Closes #1188 from corneadoug/ZEPPELIN-1183 and squashes the following commits: 1bc5f3b [Damien CORNEAU] unify the paths 469f221 [Damien CORNEAU] Remove unused controller function parameters 60cd327 [Damien CORNEAU] Remove the window.location from the code, for Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/e7d5d826 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/e7d5d826 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/e7d5d826 Branch: refs/heads/master Commit: e7d5d82670a026e761c4dd70deecfae1af19b350 Parents: 8ffd9af Author: Damien CORNEAU <cornead...@gmail.com> Authored: Fri Jul 15 15:11:37 2016 +0900 Committer: Damien CORNEAU <cornead...@gmail.com> Committed: Tue Jul 19 10:54:43 2016 +0900 ---------------------------------------------------------------------- .../src/app/configuration/configuration.controller.js | 4 ++-- zeppelin-web/src/app/credential/credential.controller.js | 3 +-- zeppelin-web/src/app/home/home.controller.js | 2 +- zeppelin-web/src/app/interpreter/interpreter.controller.js | 2 +- zeppelin-web/src/app/jobmanager/jobmanager.controller.js | 3 +-- zeppelin-web/src/app/jobmanager/jobs/job.controller.js | 2 +- zeppelin-web/src/app/notebook/notebook.controller.js | 9 ++++----- .../src/app/notebook/paragraph/paragraph.controller.js | 3 +-- zeppelin-web/src/components/navbar/navbar.controller.js | 2 +- .../src/components/noteName-create/notename.controller.js | 2 +- .../components/websocketEvents/websocketEvents.factory.js | 6 +++--- 11 files changed, 17 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e7d5d826/zeppelin-web/src/app/configuration/configuration.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/configuration/configuration.controller.js b/zeppelin-web/src/app/configuration/configuration.controller.js index 6ac3065..8f11879 100644 --- a/zeppelin-web/src/app/configuration/configuration.controller.js +++ b/zeppelin-web/src/app/configuration/configuration.controller.js @@ -13,8 +13,8 @@ */ 'use strict'; -angular.module('zeppelinWebApp').controller('ConfigurationCtrl', function($scope, $route, $routeParams, $location, - $rootScope, $http, baseUrlSrv, ngToast) { +angular.module('zeppelinWebApp').controller('ConfigurationCtrl', function($scope, $rootScope, $http, + baseUrlSrv, ngToast) { $scope.configrations = []; $scope._ = _; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e7d5d826/zeppelin-web/src/app/credential/credential.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/credential/credential.controller.js b/zeppelin-web/src/app/credential/credential.controller.js index 47450a2..58c1c8b 100644 --- a/zeppelin-web/src/app/credential/credential.controller.js +++ b/zeppelin-web/src/app/credential/credential.controller.js @@ -14,8 +14,7 @@ */ 'use strict'; -angular.module('zeppelinWebApp').controller('CredentialCtrl', function($scope, $route, $routeParams, $location, - $rootScope, $http, baseUrlSrv, ngToast) { +angular.module('zeppelinWebApp').controller('CredentialCtrl', function($scope, $rootScope, $http, baseUrlSrv, ngToast) { $scope._ = _; $scope.credentialInfo = []; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e7d5d826/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 7653902..b733f53 100644 --- a/zeppelin-web/src/app/home/home.controller.js +++ b/zeppelin-web/src/app/home/home.controller.js @@ -14,7 +14,7 @@ 'use strict'; angular.module('zeppelinWebApp').controller('HomeCtrl', function($scope, notebookListDataFactory, websocketMsgSrv, - $rootScope, arrayOrderingSrv, $http, baseUrlSrv) { + $rootScope, arrayOrderingSrv) { var vm = this; vm.notes = notebookListDataFactory; vm.websocketMsgSrv = websocketMsgSrv; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e7d5d826/zeppelin-web/src/app/interpreter/interpreter.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index affd9bd..17e5fcd 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -15,7 +15,7 @@ 'use strict'; angular.module('zeppelinWebApp').controller('InterpreterCtrl', - function($scope, $route, $routeParams, $location, $rootScope, $http, baseUrlSrv, ngToast) { + function($scope, $http, baseUrlSrv, ngToast) { var interpreterSettingsTmp = []; $scope.interpreterSettings = []; $scope.availableInterpreters = {}; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e7d5d826/zeppelin-web/src/app/jobmanager/jobmanager.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/jobmanager/jobmanager.controller.js b/zeppelin-web/src/app/jobmanager/jobmanager.controller.js index e1465d9..410f7c2 100644 --- a/zeppelin-web/src/app/jobmanager/jobmanager.controller.js +++ b/zeppelin-web/src/app/jobmanager/jobmanager.controller.js @@ -16,8 +16,7 @@ angular.module('zeppelinWebApp') .controller('JobmanagerCtrl', - function($scope, $route, $routeParams, $location, $rootScope, $http, $q, - websocketMsgSrv, baseUrlSrv, $interval, $timeout, SaveAsService) { + function($scope, websocketMsgSrv, $interval) { $scope.$on('setNotebookJobs', function(event, responseData) { $scope.lastJobServerUnixTime = responseData.lastResponseUnixTime; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e7d5d826/zeppelin-web/src/app/jobmanager/jobs/job.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/jobmanager/jobs/job.controller.js b/zeppelin-web/src/app/jobmanager/jobs/job.controller.js index 2d31442..331d8e0 100644 --- a/zeppelin-web/src/app/jobmanager/jobs/job.controller.js +++ b/zeppelin-web/src/app/jobmanager/jobs/job.controller.js @@ -15,7 +15,7 @@ 'use strict'; angular.module('zeppelinWebApp') - .controller('JobCtrl', function($scope, $rootScope, $http, baseUrlSrv) { + .controller('JobCtrl', function($scope) { $scope.init = function(jobInformation) { $scope.progressValue = 0; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e7d5d826/zeppelin-web/src/app/notebook/notebook.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/notebook/notebook.controller.js b/zeppelin-web/src/app/notebook/notebook.controller.js index fd9cb3e..f33bfac 100644 --- a/zeppelin-web/src/app/notebook/notebook.controller.js +++ b/zeppelin-web/src/app/notebook/notebook.controller.js @@ -16,7 +16,7 @@ 'use strict'; angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $route, $routeParams, $location, - $rootScope, $http, $window, websocketMsgSrv, + $rootScope, $http, websocketMsgSrv, baseUrlSrv, $timeout, SaveAsService) { $scope.note = null; $scope.showEditor = false; @@ -140,7 +140,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro callback: function(result) { if (result) { websocketMsgSrv.deleteNotebook(noteId); - $location.path('/#'); + $location.path('/'); } } }); @@ -161,7 +161,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro callback: function(result) { if (result) { websocketMsgSrv.cloneNotebook(noteId); - $location.path('/#'); + $location.path('/'); } } }); @@ -749,7 +749,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro label: 'Cancel', action: function(dialog) { dialog.close(); - $window.location.replace('/'); + $location.path('/'); } } ] @@ -973,4 +973,3 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro }); }); - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e7d5d826/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 abf2a3d..9179121 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -14,7 +14,7 @@ */ 'use strict'; -angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $rootScope, $route, $window, $element, +angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $rootScope, $route, $window, $routeParams, $location, $timeout, $compile, $http, websocketMsgSrv, baseUrlSrv, ngToast, SaveAsService) { @@ -2404,4 +2404,3 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r } }); }); - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e7d5d826/zeppelin-web/src/components/navbar/navbar.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/navbar/navbar.controller.js b/zeppelin-web/src/components/navbar/navbar.controller.js index 594356e..50d50ab 100644 --- a/zeppelin-web/src/components/navbar/navbar.controller.js +++ b/zeppelin-web/src/components/navbar/navbar.controller.js @@ -75,7 +75,7 @@ angular.module('zeppelinWebApp') }; $scope.search = function(searchTerm) { - $location.url(/search/ + searchTerm); + $location.path('/search/' + searchTerm); }; function loadNotes() { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e7d5d826/zeppelin-web/src/components/noteName-create/notename.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/noteName-create/notename.controller.js b/zeppelin-web/src/components/noteName-create/notename.controller.js index 9a01cfd..4f85dda 100644 --- a/zeppelin-web/src/components/noteName-create/notename.controller.js +++ b/zeppelin-web/src/components/noteName-create/notename.controller.js @@ -15,7 +15,7 @@ 'use strict'; angular.module('zeppelinWebApp').controller('NotenameCtrl', function($scope, notebookListDataFactory, - $rootScope, $routeParams, websocketMsgSrv) { + $routeParams, websocketMsgSrv) { var vm = this; vm.clone = false; vm.notes = notebookListDataFactory; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/e7d5d826/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js b/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js index 4175818..2fb5003 100644 --- a/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js +++ b/zeppelin-web/src/components/websocketEvents/websocketEvents.factory.js @@ -14,7 +14,7 @@ 'use strict'; angular.module('zeppelinWebApp').factory('websocketEvents', - function($rootScope, $websocket, $location, $window, baseUrlSrv) { + function($rootScope, $websocket, $location, baseUrlSrv) { var websocketCalls = {}; websocketCalls.ws = $websocket(baseUrlSrv.getWebsocketUrl()); @@ -57,7 +57,7 @@ angular.module('zeppelinWebApp').factory('websocketEvents', if (op === 'NOTE') { $rootScope.$broadcast('setNoteContent', data.note); } else if (op === 'NEW_NOTE') { - $location.path('notebook/' + data.note.id); + $location.path('/notebook/' + data.note.id); } else if (op === 'NOTES_INFO') { $rootScope.$broadcast('setNoteMenu', data.notes); } else if (op === 'LIST_NOTEBOOK_JOBS') { @@ -83,7 +83,7 @@ angular.module('zeppelinWebApp').factory('websocketEvents', label: 'Cancel', action: function(dialog) { dialog.close(); - $window.location.replace('/'); + $location.path('/'); } }] });