Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.apache.zeppelin.interpreter.remote.RemoteInterpreterProcessListener;
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
import org.apache.zeppelin.notebook.*;
import org.apache.zeppelin.notebook.repo.NotebookRepo;
import org.apache.zeppelin.notebook.repo.NotebookRepo.Revision;
import org.apache.zeppelin.notebook.socket.Message;
import org.apache.zeppelin.notebook.socket.Message.OP;
Expand Down Expand Up @@ -237,7 +236,7 @@ public void onMessage(NotebookSocket conn, String msg) {
listRevisionHistory(conn, notebook, messagereceived);
break;
case NOTE_REVISION:
getNoteRevision(conn, notebook, messagereceived);
getNoteByRevision(conn, notebook, messagereceived);
break;
case LIST_NOTEBOOK_JOBS:
unicastNotebookJobInfo(conn, messagereceived);
Expand Down Expand Up @@ -1182,7 +1181,7 @@ private void checkpointNotebook(NotebookSocket conn, Notebook notebook,
AuthenticationInfo subject = new AuthenticationInfo(fromMessage.principal);
Revision revision = notebook.checkpointNote(noteId, commitMessage, subject);
if (revision != null) {
List<NotebookRepo.Revision> revisions = notebook.listRevisionHistory(noteId, subject);
List<Revision> revisions = notebook.listRevisionHistory(noteId, subject);
conn.send(serializeMessage(new Message(OP.LIST_REVISION_HISTORY)
.put("revisionList", revisions)));
}
Expand All @@ -1192,21 +1191,21 @@ private void listRevisionHistory(NotebookSocket conn, Notebook notebook,
Message fromMessage) throws IOException {
String noteId = (String) fromMessage.get("noteId");
AuthenticationInfo subject = new AuthenticationInfo(fromMessage.principal);
List<NotebookRepo.Revision> revisions = notebook.listRevisionHistory(noteId, subject);
List<Revision> revisions = notebook.listRevisionHistory(noteId, subject);

conn.send(serializeMessage(new Message(OP.LIST_REVISION_HISTORY)
.put("revisionList", revisions)));
}

private void getNoteRevision(NotebookSocket conn, Notebook notebook, Message fromMessage)
private void getNoteByRevision(NotebookSocket conn, Notebook notebook, Message fromMessage)
throws IOException {
String noteId = (String) fromMessage.get("noteId");
Revision revision = (Revision) fromMessage.get("revision");
String revisionId = (String) fromMessage.get("revisionId");
AuthenticationInfo subject = new AuthenticationInfo(fromMessage.principal);
Note revisionNote = notebook.getNoteRevision(noteId, revision, subject);
Note revisionNote = notebook.getNoteByRevision(noteId, revisionId, subject);
conn.send(serializeMessage(new Message(OP.NOTE_REVISION)
.put("noteId", noteId)
.put("revisionId", revision)
.put("revisionId", revisionId)
.put("data", revisionNote)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ angular.module('zeppelinWebApp').service('websocketMsgSrv', function($rootScope,
});
},

getNoteRevision: function(noteId, revision) {
getNoteByRevision: function(noteId, revisionId) {
websocketEvents.sendNewEvent({
op: 'NOTE_REVISION',
data: {
noteId: noteId,
revision: revision
revisionId: revisionId
}
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,14 +358,14 @@ public Revision checkpointNote(String noteId, String checkpointMessage,
return notebookRepo.checkpoint(noteId, checkpointMessage, subject);
}

public List<NotebookRepo.Revision> listRevisionHistory(String noteId,
public List<Revision> listRevisionHistory(String noteId,
AuthenticationInfo subject) {
return notebookRepo.revisionHistory(noteId, subject);
}

public Note getNoteRevision(String noteId, Revision revision, AuthenticationInfo subject)
public Note getNoteByRevision(String noteId, String revisionId, AuthenticationInfo subject)
throws IOException {
return notebookRepo.get(noteId, revision, subject);
return notebookRepo.get(noteId, revisionId, subject);
}

@SuppressWarnings("rawtypes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public Revision checkpoint(String noteId, String checkpointMsg, AuthenticationIn
}

@Override
public Note get(String noteId, Revision rev, AuthenticationInfo subject) throws IOException {
public Note get(String noteId, String revId, AuthenticationInfo subject) throws IOException {
// Auto-generated method stub
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public Revision checkpoint(String pattern, String commitMessage, AuthenticationI
* 4. apply stash on top and remove it
*/
@Override
public synchronized Note get(String noteId, Revision rev, AuthenticationInfo subject)
public synchronized Note get(String noteId, String revId, AuthenticationInfo subject)
throws IOException {
Note note = null;
RevCommit stash = null;
Expand All @@ -123,7 +123,7 @@ public synchronized Note get(String noteId, Revision rev, AuthenticationInfo sub
}
ObjectId head = git.getRepository().resolve(Constants.HEAD);
// checkout to target revision
git.checkout().setStartPoint(rev.id).addPath(noteId).call();
git.checkout().setStartPoint(revId).addPath(noteId).call();
// get the note
note = super.get(noteId, subject);
// checkout back to head
Expand All @@ -137,7 +137,7 @@ public synchronized Note get(String noteId, Revision rev, AuthenticationInfo sub
stashes.size());
}
} catch (GitAPIException e) {
LOG.error("Failed to return note from revision \"{}\"", rev.message, e);
LOG.error("Failed to return note from revision \"{}\"", revId, e);
}
return note;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public interface NotebookRepo {
* @return a Notebook
* @throws IOException
*/
@ZeppelinApi public Note get(String noteId, Revision rev, AuthenticationInfo subject)
@ZeppelinApi public Note get(String noteId, String revId, AuthenticationInfo subject)
throws IOException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ public Revision checkpoint(String noteId, String checkpointMsg, AuthenticationIn
}

@Override
public Note get(String noteId, Revision rev, AuthenticationInfo subject) {
public Note get(String noteId, String revId, AuthenticationInfo subject) {
Note revisionNote = null;
try {
revisionNote = getRepo(0).get(noteId, rev, subject);
revisionNote = getRepo(0).get(noteId, revId, subject);
} catch (IOException e) {
LOG.error("Failed to get revision {} of note {}", rev.id, noteId, e);
LOG.error("Failed to get revision {} of note {}", revId, noteId, e);
}
return revisionNote;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public Revision checkpoint(String noteId, String checkpointMsg, AuthenticationIn
}

@Override
public Note get(String noteId, Revision rev, AuthenticationInfo subject) throws IOException {
public Note get(String noteId, String revId, AuthenticationInfo subject) throws IOException {
// Auto-generated method stub
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public Revision checkpoint(String noteId, String checkpointMsg, AuthenticationIn
}

@Override
public Note get(String noteId, Revision rev, AuthenticationInfo subject) throws IOException {
public Note get(String noteId, String revId, AuthenticationInfo subject) throws IOException {
// Auto-generated method stub
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public Revision checkpoint(String noteId, String checkpointMsg, AuthenticationIn
}

@Override
public Note get(String noteId, Revision rev, AuthenticationInfo subject) throws IOException {
public Note get(String noteId, String revId, AuthenticationInfo subject) throws IOException {
// Auto-generated method stub
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public void getRevisionTest() throws IOException {
assertThat(paragraphCount_2).isEqualTo(paragraphCount_1 + 1);

// get note from revision 1
Note noteRevision_1 = notebookRepo.get(TEST_NOTE_ID, revision_1, null);
Note noteRevision_1 = notebookRepo.get(TEST_NOTE_ID, revision_1.id, null);
assertThat(noteRevision_1.getParagraphs().size()).isEqualTo(paragraphCount_1);

// get current note
Expand All @@ -252,7 +252,7 @@ public void getRevisionTest() throws IOException {
assertThat(paragraphCount_3).isEqualTo(paragraphCount_2 + 1);

// get revision 1 again
noteRevision_1 = notebookRepo.get(TEST_NOTE_ID, revision_1, null);
noteRevision_1 = notebookRepo.get(TEST_NOTE_ID, revision_1.id, null);
assertThat(noteRevision_1.getParagraphs().size()).isEqualTo(paragraphCount_1);

// check that note is unchanged
Expand Down Expand Up @@ -287,7 +287,7 @@ public void getRevisionFailTest() throws IOException {
int paragraphCount_2 = note.getParagraphs().size();

// get note from revision 1
Note noteRevision_1 = notebookRepo.get(TEST_NOTE_ID, revision_1, null);
Note noteRevision_1 = notebookRepo.get(TEST_NOTE_ID, revision_1.id, null);
assertThat(noteRevision_1.getParagraphs().size()).isEqualTo(paragraphCount_1);

// get current note
Expand All @@ -296,7 +296,7 @@ public void getRevisionFailTest() throws IOException {

// test for absent revision
Revision absentRevision = new Revision("absentId", StringUtils.EMPTY, 0);
note = notebookRepo.get(TEST_NOTE_ID, absentRevision, null);
note = notebookRepo.get(TEST_NOTE_ID, absentRevision.id, null);
assertThat(note).isNull();
}

Expand Down