Skip to content

Commit 2fde749

Browse files
committed
finish cleaning the controller
1 parent be18547 commit 2fde749

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

zeppelin-web/src/app/app.controller.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
'use strict';
1515

16-
angular.module('zeppelinWebApp').controller('MainCtrl', function($scope, $rootScope, $window) {
16+
angular.module('zeppelinWebApp').controller('MainCtrl', function($scope, $rootScope, $window, arrayOrderingSrv) {
1717
$scope.looknfeel = 'default';
1818

1919
var init = function() {
@@ -41,6 +41,12 @@ angular.module('zeppelinWebApp').controller('MainCtrl', function($scope, $rootSc
4141
$rootScope.$broadcast('setLookAndFeel', 'default');
4242
});
4343

44+
$rootScope.noteName = function(note) {
45+
if (!_.isEmpty(note)) {
46+
return arrayOrderingSrv.getNoteName(note);
47+
}
48+
};
49+
4450
BootstrapDialog.defaultOptions.onshown = function() {
4551
angular.element('#' + this.id).find('.btn:last').focus();
4652
};

zeppelin-web/src/components/navbar/navbar.controller.js

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,16 @@ angular.module('zeppelinWebApp')
2121
var vm = this;
2222
vm.arrayOrderingSrv = arrayOrderingSrv;
2323
vm.connected = websocketMsgSrv.isConnected();
24+
vm.isActive = isActive;
25+
vm.logout = logout;
2426
vm.notes = notebookListDataFactory;
27+
vm.search = search;
2528
vm.searchForm = searchService;
26-
vm.websocketMsgSrv = websocketMsgSrv;
29+
vm.showLoginWindow = showLoginWindow;
2730

2831
$scope.query = {q: ''};
29-
/** Current list of notes (ids) */
3032

31-
angular.element('#notebook-list').perfectScrollbar({suppressScrollX: true});
32-
33-
angular.element(document).click(function() {
34-
$scope.query.q = '';
35-
});
33+
initController();
3634

3735
function getZeppelinVersion() {
3836
$http.get(baseUrlSrv.getRestApiBase() + '/version').success(
@@ -44,6 +42,17 @@ angular.module('zeppelinWebApp')
4442
});
4543
}
4644

45+
function initController() {
46+
angular.element('#notebook-list').perfectScrollbar({suppressScrollX: true});
47+
48+
angular.element(document).click(function() {
49+
$scope.query.q = '';
50+
});
51+
52+
getZeppelinVersion();
53+
loadNotes();
54+
}
55+
4756
function isActive(noteId) {
4857
return ($routeParams.noteId === noteId);
4958
}
@@ -84,21 +93,6 @@ angular.module('zeppelinWebApp')
8493
}, 500);
8594
}
8695

87-
$rootScope.noteName = function(note) {
88-
if (!_.isEmpty(note)) {
89-
return arrayOrderingSrv.getNoteName(note);
90-
}
91-
};
92-
93-
vm.loadNotes = loadNotes;
94-
vm.isActive = isActive;
95-
vm.logout = logout;
96-
vm.search = search;
97-
vm.showLoginWindow = showLoginWindow;
98-
99-
getZeppelinVersion();
100-
vm.loadNotes();
101-
10296
/*
10397
** $scope.$on functions below
10498
*/
@@ -112,7 +106,7 @@ angular.module('zeppelinWebApp')
112106
});
113107

114108
$scope.$on('loginSuccess', function(event, param) {
115-
vm.loadNotes();
109+
loadNotes();
116110
});
117111

118112
});

0 commit comments

Comments
 (0)