mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
ZEPPELIN-1254 boradcast after updating the interpreter bindings
This commit is contained in:
parent
299bb511bf
commit
ab0bced9d6
3 changed files with 14 additions and 6 deletions
|
|
@ -187,6 +187,7 @@ public class NotebookRestApi {
|
|||
public Response bind(@PathParam("noteId") String noteId) {
|
||||
List<InterpreterSettingsList> settingList =
|
||||
InterpreterBindingUtils.getInterpreterBindings(notebook, noteId);
|
||||
notebookServer.broadcastInterpreterBindings(noteId, settingList);
|
||||
return new JsonResponse<>(Status.OK, "", settingList).build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -418,11 +418,14 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
}
|
||||
|
||||
public void saveInterpreterBindings(NotebookSocket conn, Message fromMessage) {
|
||||
String noteId = (String) fromMessage.data.get("noteID");
|
||||
try {
|
||||
List<String> settingIdList = gson.fromJson(String.valueOf(
|
||||
fromMessage.data.get("selectedSettingIds")), new TypeToken<ArrayList<String>>() {
|
||||
}.getType());
|
||||
notebook().bindInterpretersToNote((String) fromMessage.data.get("noteID"), settingIdList);
|
||||
notebook().bindInterpretersToNote(noteId, settingIdList);
|
||||
broadcastInterpreterBindings(noteId,
|
||||
InterpreterBindingUtils.getInterpreterBindings(notebook(), noteId));
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error while saving interpreter bindings", e);
|
||||
}
|
||||
|
|
@ -433,9 +436,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
String noteID = (String) fromMessage.data.get("noteID");
|
||||
List<InterpreterSettingsList> settingList =
|
||||
InterpreterBindingUtils.getInterpreterBindings(notebook(), noteID);
|
||||
|
||||
conn.send(serializeMessage(new Message(OP.INTERPRETER_BINDINGS)
|
||||
.put("interpreterBindings", settingList)));
|
||||
broadcastInterpreterBindings(noteID, settingList);
|
||||
}
|
||||
|
||||
public List<Map<String, String>> generateNotebooksInfo(boolean needsReload,
|
||||
|
|
@ -477,6 +478,12 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
broadcast(note.id(), new Message(OP.NOTE).put("note", note));
|
||||
}
|
||||
|
||||
public void broadcastInterpreterBindings(String noteId,
|
||||
List settingList) {
|
||||
broadcast(noteId, new Message(OP.INTERPRETER_BINDINGS)
|
||||
.put("interpreterBindings", settingList));
|
||||
}
|
||||
|
||||
public void broadcastNoteList(AuthenticationInfo subject) {
|
||||
List<Map<String, String>> notesInfo = generateNotebooksInfo(false, subject);
|
||||
broadcastAll(new Message(OP.NOTES_INFO).put("notes", notesInfo));
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
|
|||
}
|
||||
};
|
||||
|
||||
var getInterpreterBindings = function(callback) {
|
||||
var getInterpreterBindings = function() {
|
||||
websocketMsgSrv.getInterpreterBindings($scope.note.id);
|
||||
};
|
||||
|
||||
|
|
@ -967,7 +967,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl', function($scope, $ro
|
|||
}
|
||||
initializeLookAndFeel();
|
||||
//open interpreter binding setting when there're none selected
|
||||
getInterpreterBindings(); //getInterpreterBindings(getInterpreterBindingsCallBack);
|
||||
getInterpreterBindings();
|
||||
});
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue