mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Fix navbar selected menu + small code improvement
This commit is contained in:
parent
a1fe1c1e62
commit
7eccca8d1d
3 changed files with 77 additions and 76 deletions
|
|
@ -48,10 +48,7 @@ angular.module('zeppelinWebApp').controller('NavCtrl', function($scope, $rootSco
|
|||
}
|
||||
|
||||
function isActive(noteId) {
|
||||
if ($routeParams.noteId === noteId) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return ($routeParams.noteId === noteId);
|
||||
}
|
||||
|
||||
vm.loadNotes = loadNotes;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<li><a href="javascript:void(0);" ng-click="navbar.websocketMsgSrv.createNotebook()"><i class="fa fa-plus"></i> Create new note</a></li>
|
||||
<li class="divider"></li>
|
||||
<div id="notebook-list" class="scrollbar-container">
|
||||
<li ng-repeat="note in navbar.notes.list track by $index" ng-class="{'active' : isActive(note.id)}">
|
||||
<li ng-repeat="note in navbar.notes.list track by $index" ng-class="{'active' : navbar.isActive(note.id)}">
|
||||
<a href="#/notebook/{{note.id}}">{{note.name || 'Note ' + note.id}} </a>
|
||||
</li>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -15,89 +15,93 @@
|
|||
|
||||
angular.module('zeppelinWebApp').service('websocketMsgSrv', function($rootScope, websocketEvents) {
|
||||
|
||||
this.createNotebook = function() {
|
||||
websocketEvents.sendNewEvent({op: 'NEW_NOTE'});
|
||||
};
|
||||
return {
|
||||
|
||||
this.deleteNotebook = function(noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'DEL_NOTE', data: {id: noteId}});
|
||||
};
|
||||
createNotebook: function() {
|
||||
websocketEvents.sendNewEvent({op: 'NEW_NOTE'});
|
||||
},
|
||||
|
||||
this.getNotebookList = function() {
|
||||
websocketEvents.sendNewEvent({op: 'LIST_NOTES'});
|
||||
};
|
||||
deleteNotebook: function(noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'DEL_NOTE', data: {id: noteId}});
|
||||
},
|
||||
|
||||
this.getNotebook = function(noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'GET_NOTE', data: {id: noteId}});
|
||||
};
|
||||
getNotebookList: function() {
|
||||
websocketEvents.sendNewEvent({op: 'LIST_NOTES'});
|
||||
},
|
||||
|
||||
this.updateNotebook = function(noteId, noteName, noteConfig) {
|
||||
websocketEvents.sendNewEvent({op: 'NOTE_UPDATE', data: {id: noteId, name: noteName, config : noteConfig}});
|
||||
};
|
||||
getNotebook: function(noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'GET_NOTE', data: {id: noteId}});
|
||||
},
|
||||
|
||||
this.moveParagraph = function(paragraphId, newIndex) {
|
||||
websocketEvents.sendNewEvent({ op: 'MOVE_PARAGRAPH', data : {id: paragraphId, index: newIndex}});
|
||||
};
|
||||
updateNotebook: function(noteId, noteName, noteConfig) {
|
||||
websocketEvents.sendNewEvent({op: 'NOTE_UPDATE', data: {id: noteId, name: noteName, config : noteConfig}});
|
||||
},
|
||||
|
||||
this.insertParagraph = function(newIndex) {
|
||||
websocketEvents.sendNewEvent({ op: 'INSERT_PARAGRAPH', data : {index: newIndex}});
|
||||
};
|
||||
moveParagraph: function(paragraphId, newIndex) {
|
||||
websocketEvents.sendNewEvent({ op: 'MOVE_PARAGRAPH', data : {id: paragraphId, index: newIndex}});
|
||||
},
|
||||
|
||||
this.updateAngularObject = function(noteId, name, value, interpreterGroupId) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'ANGULAR_OBJECT_UPDATED',
|
||||
data: {
|
||||
noteId: noteId,
|
||||
name: name,
|
||||
value: value,
|
||||
interpreterGroupId: interpreterGroupId
|
||||
}
|
||||
});
|
||||
};
|
||||
insertParagraph: function(newIndex) {
|
||||
websocketEvents.sendNewEvent({ op: 'INSERT_PARAGRAPH', data : {index: newIndex}});
|
||||
},
|
||||
|
||||
this.cancelParagraphRun = function(paragraphId) {
|
||||
websocketEvents.sendNewEvent({op: 'CANCEL_PARAGRAPH', data: {id: paragraphId}});
|
||||
};
|
||||
updateAngularObject: function(noteId, name, value, interpreterGroupId) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'ANGULAR_OBJECT_UPDATED',
|
||||
data: {
|
||||
noteId: noteId,
|
||||
name: name,
|
||||
value: value,
|
||||
interpreterGroupId: interpreterGroupId
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
this.runParagraph = function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'RUN_PARAGRAPH',
|
||||
data: {
|
||||
id: paragraphId,
|
||||
title: paragraphTitle,
|
||||
paragraph: paragraphData,
|
||||
config: paragraphConfig,
|
||||
params: paragraphParams
|
||||
}
|
||||
});
|
||||
};
|
||||
cancelParagraphRun: function(paragraphId) {
|
||||
websocketEvents.sendNewEvent({op: 'CANCEL_PARAGRAPH', data: {id: paragraphId}});
|
||||
},
|
||||
|
||||
this.removeParagraph = function(paragraphId) {
|
||||
websocketEvents.sendNewEvent({op: 'PARAGRAPH_REMOVE', data: {id: paragraphId}});
|
||||
};
|
||||
runParagraph: function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'RUN_PARAGRAPH',
|
||||
data: {
|
||||
id: paragraphId,
|
||||
title: paragraphTitle,
|
||||
paragraph: paragraphData,
|
||||
config: paragraphConfig,
|
||||
params: paragraphParams
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
this.completion = function(paragraphId, buf, cursor) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op : 'COMPLETION',
|
||||
data : {
|
||||
id : paragraphId,
|
||||
buf : buf,
|
||||
cursor : cursor
|
||||
}
|
||||
});
|
||||
};
|
||||
removeParagraph: function(paragraphId) {
|
||||
websocketEvents.sendNewEvent({op: 'PARAGRAPH_REMOVE', data: {id: paragraphId}});
|
||||
},
|
||||
|
||||
completion: function(paragraphId, buf, cursor) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op : 'COMPLETION',
|
||||
data : {
|
||||
id : paragraphId,
|
||||
buf : buf,
|
||||
cursor : cursor
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
commitParagraph: function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'COMMIT_PARAGRAPH',
|
||||
data: {
|
||||
id: paragraphId,
|
||||
title : paragraphTitle,
|
||||
paragraph: paragraphData,
|
||||
config: paragraphConfig,
|
||||
params: paragraphParams
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.commitParagraph = function(paragraphId, paragraphTitle, paragraphData, paragraphConfig, paragraphParams) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'COMMIT_PARAGRAPH',
|
||||
data: {
|
||||
id: paragraphId,
|
||||
title : paragraphTitle,
|
||||
paragraph: paragraphData,
|
||||
config: paragraphConfig,
|
||||
params: paragraphParams
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue