2525import java .util .Map ;
2626import java .util .Set ;
2727import javax .servlet .http .HttpServletRequest ;
28+
29+ import org .apache .zeppelin .conf .ZeppelinConfiguration ;
30+ import org .apache .zeppelin .conf .ZeppelinConfiguration .ConfVars ;
2831import org .apache .zeppelin .display .AngularObject ;
2932import org .apache .zeppelin .display .AngularObjectRegistry ;
3033import org .apache .zeppelin .display .AngularObjectRegistryListener ;
@@ -110,6 +113,9 @@ public void onMessage(NotebookSocket conn, String msg) {
110113 case LIST_NOTES :
111114 broadcastNoteList ();
112115 break ;
116+ case GET_HOME_NOTE :
117+ sendHomeNote (conn , notebook );
118+ break ;
113119 case GET_NOTE :
114120 sendNote (conn , notebook , messagereceived );
115121 break ;
@@ -279,10 +285,20 @@ private void broadcastNote(Note note) {
279285
280286 private void broadcastNoteList () {
281287 Notebook notebook = notebook ();
288+
289+ ZeppelinConfiguration conf = notebook .getConf ();
290+ String homescreenNotebookId = conf .getString (ConfVars .ZEPPELIN_NOTEBOOK_HOMESCREEN );
291+ boolean hideHomeScreenNotebookFromList = conf
292+ .getBoolean (ConfVars .ZEPPELIN_NOTEBOOK_HOMESCREEN_HIDE );
293+
282294 List <Note > notes = notebook .getAllNotes ();
283295 List <Map <String , String >> notesInfo = new LinkedList <>();
284296 for (Note note : notes ) {
285297 Map <String , String > info = new HashMap <>();
298+ if (hideHomeScreenNotebookFromList && note .id ().equals (homescreenNotebookId )) {
299+ continue ;
300+ }
301+
286302 info .put ("id" , note .id ());
287303 info .put ("name" , note .getName ());
288304 notesInfo .add (info );
@@ -306,6 +322,23 @@ private void sendNote(NotebookSocket conn, Notebook notebook,
306322 }
307323 }
308324
325+ private void sendHomeNote (NotebookSocket conn , Notebook notebook ) throws IOException {
326+ String noteId = notebook .getConf ().getString (ConfVars .ZEPPELIN_NOTEBOOK_HOMESCREEN );
327+
328+ Note note = null ;
329+ if (noteId != null ) {
330+ note = notebook .getNote (noteId );
331+ }
332+
333+ if (note != null ) {
334+ addConnectionToNote (note .id (), conn );
335+ conn .send (serializeMessage (new Message (OP .NOTE ).put ("note" , note )));
336+ sendAllAngularObjects (note , conn );
337+ } else {
338+ conn .send (serializeMessage (new Message (OP .NOTE ).put ("note" , null )));
339+ }
340+ }
341+
309342 private void updateNote (WebSocket conn , Notebook notebook , Message fromMessage )
310343 throws SchedulerException , IOException {
311344 String noteId = (String ) fromMessage .get ("id" );
0 commit comments