mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Fix some wrong written term: Notebook -> Note
This commit is contained in:
parent
cc0d3151ef
commit
294bea522f
26 changed files with 184 additions and 185 deletions
|
|
@ -142,7 +142,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -238,7 +238,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -267,7 +267,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -306,7 +306,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -350,7 +350,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -378,7 +378,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -424,7 +424,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]/[paragraphId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]/[paragraphId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -460,7 +460,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]/[paragraphId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]/[paragraphId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -498,7 +498,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]/[paragraphId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]/[paragraphId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -548,7 +548,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]/[paragraphId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]/[paragraphId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -575,7 +575,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[notebookId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[noteId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -607,7 +607,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[notebookId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[noteId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -636,7 +636,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[notebookId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[noteId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -702,7 +702,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]/paragraph```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]/paragraph```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -752,7 +752,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]/paragraph/[paragraphId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]/paragraph/[paragraphId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -819,7 +819,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]/paragraph/[paragraphId]/move/[newIndex]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]/paragraph/[paragraphId]/move/[newIndex]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -847,7 +847,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]/paragraph/[paragraphId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]/paragraph/[paragraphId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
@ -874,7 +874,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/export/[notebookId]```</td>
|
||||
<td>```http://[zeppelin-server]:[zeppelin-port]/api/notebook/export/[noteId]```</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Success code</td>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.apache.zeppelin.notebook.NotebookAuthorization;
|
|||
import org.apache.zeppelin.notebook.Paragraph;
|
||||
import org.apache.zeppelin.rest.message.CronRequest;
|
||||
import org.apache.zeppelin.types.InterpreterSettingsList;
|
||||
import org.apache.zeppelin.rest.message.NewNotebookRequest;
|
||||
import org.apache.zeppelin.rest.message.NewNoteRequest;
|
||||
import org.apache.zeppelin.rest.message.NewParagraphRequest;
|
||||
import org.apache.zeppelin.rest.message.RunParagraphWithParametersRequest;
|
||||
import org.apache.zeppelin.search.SearchService;
|
||||
|
|
@ -195,16 +195,16 @@ public class NotebookRestApi {
|
|||
@GET
|
||||
@Path("/")
|
||||
@ZeppelinApi
|
||||
public Response getNotebookList() throws IOException {
|
||||
public Response getNoteList() throws IOException {
|
||||
AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
|
||||
List<Map<String, String>> notesInfo = notebookServer.generateNotebooksInfo(false, subject);
|
||||
List<Map<String, String>> notesInfo = notebookServer.generateNotesInfo(false, subject);
|
||||
return new JsonResponse<>(Status.OK, "", notesInfo).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("{noteId}")
|
||||
@ZeppelinApi
|
||||
public Response getNotebook(@PathParam("noteId") String noteId) throws IOException {
|
||||
public Response getNote(@PathParam("noteId") String noteId) throws IOException {
|
||||
Note note = notebook.getNote(noteId);
|
||||
if (note == null) {
|
||||
return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build();
|
||||
|
|
@ -223,7 +223,7 @@ public class NotebookRestApi {
|
|||
@GET
|
||||
@Path("export/{id}")
|
||||
@ZeppelinApi
|
||||
public Response exportNoteBook(@PathParam("id") String noteId) throws IOException {
|
||||
public Response exportNote(@PathParam("id") String noteId) throws IOException {
|
||||
String exportJson = notebook.exportNote(noteId);
|
||||
return new JsonResponse<>(Status.OK, "", exportJson).build();
|
||||
}
|
||||
|
|
@ -256,7 +256,7 @@ public class NotebookRestApi {
|
|||
@ZeppelinApi
|
||||
public Response createNote(String message) throws IOException {
|
||||
LOG.info("Create new notebook by JSON {}", message);
|
||||
NewNotebookRequest request = gson.fromJson(message, NewNotebookRequest.class);
|
||||
NewNoteRequest request = gson.fromJson(message, NewNoteRequest.class);
|
||||
AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
|
||||
Note note = notebook.createNote(subject);
|
||||
List<NewParagraphRequest> initialParagraphs = request.getParagraphs();
|
||||
|
|
@ -283,7 +283,7 @@ public class NotebookRestApi {
|
|||
/**
|
||||
* Delete note REST API
|
||||
*
|
||||
* @param noteId ID of Notebook
|
||||
* @param noteId ID of Note
|
||||
* @return JSON with status.OK
|
||||
* @throws IOException
|
||||
*/
|
||||
|
|
@ -291,7 +291,7 @@ public class NotebookRestApi {
|
|||
@Path("{noteId}")
|
||||
@ZeppelinApi
|
||||
public Response deleteNote(@PathParam("noteId") String noteId) throws IOException {
|
||||
LOG.info("Delete notebook {} ", noteId);
|
||||
LOG.info("Delete note {} ", noteId);
|
||||
AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
|
||||
if (!(noteId.isEmpty())) {
|
||||
Note note = notebook.getNote(noteId);
|
||||
|
|
@ -317,7 +317,7 @@ public class NotebookRestApi {
|
|||
public Response cloneNote(@PathParam("noteId") String noteId, String message)
|
||||
throws IOException, CloneNotSupportedException, IllegalArgumentException {
|
||||
LOG.info("clone notebook by JSON {}", message);
|
||||
NewNotebookRequest request = gson.fromJson(message, NewNotebookRequest.class);
|
||||
NewNoteRequest request = gson.fromJson(message, NewNoteRequest.class);
|
||||
String newNoteName = null;
|
||||
if (request != null) {
|
||||
newNoteName = request.getName();
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ import java.util.Map;
|
|||
import org.apache.zeppelin.interpreter.InterpreterOption;
|
||||
|
||||
/**
|
||||
* NewNotebookRequest rest api request message
|
||||
* NewNoteRequest rest api request message
|
||||
*
|
||||
*/
|
||||
public class NewNotebookRequest {
|
||||
public class NewNoteRequest {
|
||||
String name;
|
||||
List<NewParagraphRequest> paragraphs;
|
||||
|
||||
public NewNotebookRequest (){
|
||||
public NewNoteRequest (){
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -459,13 +459,13 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
.put("interpreterBindings", settingList)));
|
||||
}
|
||||
|
||||
public List<Map<String, String>> generateNotebooksInfo(boolean needsReload,
|
||||
AuthenticationInfo subject) {
|
||||
public List<Map<String, String>> generateNotesInfo(boolean needsReload,
|
||||
AuthenticationInfo subject) {
|
||||
|
||||
Notebook notebook = notebook();
|
||||
|
||||
ZeppelinConfiguration conf = notebook.getConf();
|
||||
String homescreenNotebookId = conf.getString(ConfVars.ZEPPELIN_NOTEBOOK_HOMESCREEN);
|
||||
String homescreenNoteId = conf.getString(ConfVars.ZEPPELIN_NOTEBOOK_HOMESCREEN);
|
||||
boolean hideHomeScreenNotebookFromList = conf
|
||||
.getBoolean(ConfVars.ZEPPELIN_NOTEBOOK_HOMESCREEN_HIDE);
|
||||
|
||||
|
|
@ -481,7 +481,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
for (Note note : notes) {
|
||||
Map<String, String> info = new HashMap<>();
|
||||
|
||||
if (hideHomeScreenNotebookFromList && note.getId().equals(homescreenNotebookId)) {
|
||||
if (hideHomeScreenNotebookFromList && note.getId().equals(homescreenNoteId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -504,17 +504,17 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
}
|
||||
|
||||
public void broadcastNoteList(AuthenticationInfo subject) {
|
||||
List<Map<String, String>> notesInfo = generateNotebooksInfo(false, subject);
|
||||
List<Map<String, String>> notesInfo = generateNotesInfo(false, subject);
|
||||
broadcastAll(new Message(OP.NOTES_INFO).put("notes", notesInfo));
|
||||
}
|
||||
|
||||
public void unicastNoteList(NotebookSocket conn, AuthenticationInfo subject) {
|
||||
List<Map<String, String>> notesInfo = generateNotebooksInfo(false, subject);
|
||||
List<Map<String, String>> notesInfo = generateNotesInfo(false, subject);
|
||||
unicast(new Message(OP.NOTES_INFO).put("notes", notesInfo), conn);
|
||||
}
|
||||
|
||||
public void broadcastReloadedNoteList(AuthenticationInfo subject) {
|
||||
List<Map<String, String>> notesInfo = generateNotebooksInfo(true, subject);
|
||||
List<Map<String, String>> notesInfo = generateNotesInfo(true, subject);
|
||||
broadcastAll(new Message(OP.NOTES_INFO).put("notes", notesInfo));
|
||||
}
|
||||
|
||||
|
|
@ -1342,7 +1342,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
|
||||
List<Map<String, Object>> notesInfo = new LinkedList<>();
|
||||
Map<String, Object> info = new HashMap<>();
|
||||
info.put("notebookId", note.getId());
|
||||
info.put("noteId", note.getId());
|
||||
// set paragraphs
|
||||
List<Map<String, Object>> paragraphsInfo = new LinkedList<>();
|
||||
|
||||
|
|
@ -1379,7 +1379,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
@Override
|
||||
public void onNoteCreate(Note note) {
|
||||
Notebook notebook = notebookServer.notebook();
|
||||
List<Map<String, Object>> notebookJobs = notebook.getJobListBymNotebookId(
|
||||
List<Map<String, Object>> notebookJobs = notebook.getJobListByNoteId(
|
||||
note.getId()
|
||||
);
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
|
@ -1408,7 +1408,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
@Override
|
||||
public void onUnbindInterpreter(Note note, InterpreterSetting setting) {
|
||||
Notebook notebook = notebookServer.notebook();
|
||||
List<Map<String, Object>> notebookJobs = notebook.getJobListBymNotebookId(
|
||||
List<Map<String, Object>> notebookJobs = notebook.getJobListByNoteId(
|
||||
note.getId()
|
||||
);
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
|
|
|||
|
|
@ -147,28 +147,28 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCloneNotebook() throws IOException {
|
||||
public void testCloneNote() throws IOException {
|
||||
Note note1 = ZeppelinServer.notebook.createNote(null);
|
||||
PostMethod post = httpPost("/notebook/" + note1.getId(), "");
|
||||
LOG.info("testCloneNotebook response\n" + post.getResponseBodyAsString());
|
||||
LOG.info("testCloneNote response\n" + post.getResponseBodyAsString());
|
||||
assertThat(post, isCreated());
|
||||
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
String clonedNotebookId = (String) resp.get("body");
|
||||
String clonedNoteId = (String) resp.get("body");
|
||||
post.releaseConnection();
|
||||
|
||||
GetMethod get = httpGet("/notebook/" + clonedNotebookId);
|
||||
GetMethod get = httpGet("/notebook/" + clonedNoteId);
|
||||
assertThat(get, isAllowed());
|
||||
Map<String, Object> resp2 = gson.fromJson(get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
Map<String, Object> resp2Body = (Map<String, Object>) resp2.get("body");
|
||||
|
||||
assertEquals((String)resp2Body.get("name"), "Note " + clonedNotebookId);
|
||||
assertEquals((String)resp2Body.get("name"), "Note " + clonedNoteId);
|
||||
get.releaseConnection();
|
||||
|
||||
//cleanup
|
||||
ZeppelinServer.notebook.removeNote(note1.getId(), null);
|
||||
ZeppelinServer.notebook.removeNote(clonedNotebookId, null);
|
||||
ZeppelinServer.notebook.removeNote(clonedNoteId, null);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,18 +107,18 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNotebookCreateWithName() throws IOException {
|
||||
public void testNoteCreateWithName() throws IOException {
|
||||
String noteName = "Test note name";
|
||||
testNotebookCreate(noteName);
|
||||
testNoteCreate(noteName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotebookCreateNoName() throws IOException {
|
||||
testNotebookCreate("");
|
||||
public void testNoteCreateNoName() throws IOException {
|
||||
testNoteCreate("");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotebookCreateWithParagraphs() throws IOException {
|
||||
public void testNoteCreateWithParagraphs() throws IOException {
|
||||
// Call Create Notebook REST API
|
||||
String noteName = "test";
|
||||
String jsonRequest = "{\"name\":\"" + noteName + "\", \"paragraphs\": [" +
|
||||
|
|
@ -126,22 +126,22 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
"{\"title\": \"title2\", \"text\": \"text2\"}" +
|
||||
"]}";
|
||||
PostMethod post = httpPost("/notebook/", jsonRequest);
|
||||
LOG.info("testNotebookCreate \n" + post.getResponseBodyAsString());
|
||||
assertThat("test notebook create method:", post, isCreated());
|
||||
LOG.info("testNoteCreate \n" + post.getResponseBodyAsString());
|
||||
assertThat("test note create method:", post, isCreated());
|
||||
|
||||
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
|
||||
String newNotebookId = (String) resp.get("body");
|
||||
LOG.info("newNotebookId:=" + newNotebookId);
|
||||
Note newNote = ZeppelinServer.notebook.getNote(newNotebookId);
|
||||
String newNoteId = (String) resp.get("body");
|
||||
LOG.info("newNoteId:=" + newNoteId);
|
||||
Note newNote = ZeppelinServer.notebook.getNote(newNoteId);
|
||||
assertNotNull("Can not find new note by id", newNote);
|
||||
// This is partial test as newNote is in memory but is not persistent
|
||||
String newNoteName = newNote.getName();
|
||||
LOG.info("new note name is: " + newNoteName);
|
||||
String expectedNoteName = noteName;
|
||||
if (noteName.isEmpty()) {
|
||||
expectedNoteName = "Note " + newNotebookId;
|
||||
expectedNoteName = "Note " + newNoteId;
|
||||
}
|
||||
assertEquals("compare note name", expectedNoteName, newNoteName);
|
||||
assertEquals("initial paragraph check failed", 3, newNote.getParagraphs().size());
|
||||
|
|
@ -153,34 +153,34 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
assertTrue("paragraph text check failed", p.getText().startsWith("text"));
|
||||
}
|
||||
// cleanup
|
||||
ZeppelinServer.notebook.removeNote(newNotebookId, null);
|
||||
ZeppelinServer.notebook.removeNote(newNoteId, null);
|
||||
post.releaseConnection();
|
||||
}
|
||||
|
||||
private void testNotebookCreate(String noteName) throws IOException {
|
||||
private void testNoteCreate(String noteName) throws IOException {
|
||||
// Call Create Notebook REST API
|
||||
String jsonRequest = "{\"name\":\"" + noteName + "\"}";
|
||||
PostMethod post = httpPost("/notebook/", jsonRequest);
|
||||
LOG.info("testNotebookCreate \n" + post.getResponseBodyAsString());
|
||||
LOG.info("testNoteCreate \n" + post.getResponseBodyAsString());
|
||||
assertThat("test notebook create method:", post, isCreated());
|
||||
|
||||
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
|
||||
String newNotebookId = (String) resp.get("body");
|
||||
LOG.info("newNotebookId:=" + newNotebookId);
|
||||
Note newNote = ZeppelinServer.notebook.getNote(newNotebookId);
|
||||
String newNoteId = (String) resp.get("body");
|
||||
LOG.info("newNoteId:=" + newNoteId);
|
||||
Note newNote = ZeppelinServer.notebook.getNote(newNoteId);
|
||||
assertNotNull("Can not find new note by id", newNote);
|
||||
// This is partial test as newNote is in memory but is not persistent
|
||||
String newNoteName = newNote.getName();
|
||||
LOG.info("new note name is: " + newNoteName);
|
||||
String expectedNoteName = noteName;
|
||||
if (noteName.isEmpty()) {
|
||||
expectedNoteName = "Note " + newNotebookId;
|
||||
expectedNoteName = "Note " + newNoteId;
|
||||
}
|
||||
assertEquals("compare note name", expectedNoteName, newNoteName);
|
||||
// cleanup
|
||||
ZeppelinServer.notebook.removeNote(newNotebookId, null);
|
||||
ZeppelinServer.notebook.removeNote(newNoteId, null);
|
||||
post.releaseConnection();
|
||||
|
||||
}
|
||||
|
|
@ -191,20 +191,20 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
//Create note and get ID
|
||||
Note note = ZeppelinServer.notebook.createNote(null);
|
||||
String noteId = note.getId();
|
||||
testDeleteNotebook(noteId);
|
||||
testDeleteNote(noteId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteNoteBadId() throws IOException {
|
||||
LOG.info("testDeleteNoteBadId");
|
||||
testDeleteNotebook("2AZFXEX97");
|
||||
testDeleteNotebook("bad_ID");
|
||||
testDeleteNote("2AZFXEX97");
|
||||
testDeleteNote("bad_ID");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testExportNotebook() throws IOException {
|
||||
LOG.info("testExportNotebook");
|
||||
public void testexportNote() throws IOException {
|
||||
LOG.info("testexportNote");
|
||||
Note note = ZeppelinServer.notebook.createNote(null);
|
||||
assertNotNull("can't create new note", note);
|
||||
note.setName("source note for export");
|
||||
|
|
@ -283,22 +283,22 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
return body;
|
||||
}
|
||||
|
||||
private void testDeleteNotebook(String notebookId) throws IOException {
|
||||
private void testDeleteNote(String noteId) throws IOException {
|
||||
|
||||
DeleteMethod delete = httpDelete(("/notebook/" + notebookId));
|
||||
LOG.info("testDeleteNotebook delete response\n" + delete.getResponseBodyAsString());
|
||||
DeleteMethod delete = httpDelete(("/notebook/" + noteId));
|
||||
LOG.info("testDeleteNote delete response\n" + delete.getResponseBodyAsString());
|
||||
assertThat("Test delete method:", delete, isAllowed());
|
||||
delete.releaseConnection();
|
||||
// make sure note is deleted
|
||||
if (!notebookId.isEmpty()) {
|
||||
Note deletedNote = ZeppelinServer.notebook.getNote(notebookId);
|
||||
if (!noteId.isEmpty()) {
|
||||
Note deletedNote = ZeppelinServer.notebook.getNote(noteId);
|
||||
assertNull("Deleted note should be null", deletedNote);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCloneNotebook() throws IOException, CloneNotSupportedException, IllegalArgumentException {
|
||||
LOG.info("testCloneNotebook");
|
||||
public void testCloneNote() throws IOException, CloneNotSupportedException, IllegalArgumentException {
|
||||
LOG.info("testCloneNote");
|
||||
// Create note to clone
|
||||
Note note = ZeppelinServer.notebook.createNote(null);
|
||||
assertNotNull("can't create new note", note);
|
||||
|
|
@ -321,9 +321,9 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
|
||||
String newNotebookId = (String) resp.get("body");
|
||||
LOG.info("newNotebookId:=" + newNotebookId);
|
||||
Note newNote = ZeppelinServer.notebook.getNote(newNotebookId);
|
||||
String newNoteId = (String) resp.get("body");
|
||||
LOG.info("newNoteId:=" + newNoteId);
|
||||
Note newNote = ZeppelinServer.notebook.getNote(newNoteId);
|
||||
assertNotNull("Can not find new note by id", newNote);
|
||||
assertEquals("Compare note names", noteName, newNote.getName());
|
||||
assertEquals("Compare paragraphs count", note.getParagraphs().size(), newNote.getParagraphs().size());
|
||||
|
|
|
|||
|
|
@ -18,17 +18,17 @@
|
|||
|
||||
HomeCtrl.$inject = [
|
||||
'$scope',
|
||||
'notebookListDataFactory',
|
||||
'noteListDataFactory',
|
||||
'websocketMsgSrv',
|
||||
'$rootScope',
|
||||
'arrayOrderingSrv',
|
||||
'ngToast'
|
||||
];
|
||||
|
||||
function HomeCtrl($scope, notebookListDataFactory, websocketMsgSrv, $rootScope, arrayOrderingSrv, ngToast) {
|
||||
function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arrayOrderingSrv, ngToast) {
|
||||
ngToast.dismiss();
|
||||
var vm = this;
|
||||
vm.notes = notebookListDataFactory;
|
||||
vm.notes = noteListDataFactory;
|
||||
vm.websocketMsgSrv = websocketMsgSrv;
|
||||
vm.arrayOrderingSrv = arrayOrderingSrv;
|
||||
|
||||
|
|
@ -42,12 +42,12 @@
|
|||
$scope.isReloading = false;
|
||||
|
||||
var initHome = function() {
|
||||
websocketMsgSrv.getHomeNotebook();
|
||||
websocketMsgSrv.getHomeNote();
|
||||
};
|
||||
|
||||
initHome();
|
||||
|
||||
$scope.reloadNotebookList = function() {
|
||||
$scope.reloadNoteList = function() {
|
||||
websocketMsgSrv.reloadAllNotesFromRepo();
|
||||
$scope.isReloadingNotes = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ limitations under the License.
|
|||
<h4>Notebook
|
||||
<i ng-class="isReloadingNotes ? 'fa fa-refresh fa-spin' : 'fa fa-refresh'"
|
||||
ng-style="!isReloadingNotes && {'cursor': 'pointer'}" style="font-size: 13px;"
|
||||
ng-click="reloadNotebookList();"
|
||||
ng-click="reloadNoteList();"
|
||||
tooltip-placement="bottom" tooltip="Reload notes from storage">
|
||||
</i>
|
||||
</h4>
|
||||
|
|
@ -59,15 +59,15 @@ limitations under the License.
|
|||
<i style="font-size: 15px;" class="icon-notebook"></i> Create new note</a></h5>
|
||||
<ul id="notebook-names">
|
||||
<li class="filter-names" ng-include="'components/filterNoteNames/filter-note-names.html'"></li>
|
||||
<li ng-repeat="note in home.notes.list | filter:query.q | orderBy:home.arrayOrderingSrv.notebookListOrdering track by $index">
|
||||
<li ng-repeat="note in home.notes.list | filter:query.q | orderBy:home.arrayOrderingSrv.noteListOrdering track by $index">
|
||||
<i style="font-size: 10px;" class="icon-doc"></i>
|
||||
<a style="text-decoration: none;" href="#/notebook/{{note.id}}">{{noteName(note)}}</a>
|
||||
</li>
|
||||
<div ng-if="!query || query.name === ''">
|
||||
<li ng-repeat="node in home.notes.root.children | orderBy:home.arrayOrderingSrv.notebookListOrdering track by $index" ng-include="'notebook_folder_renderer.html'" />
|
||||
<li ng-repeat="node in home.notes.root.children | orderBy:home.arrayOrderingSrv.noteListOrdering track by $index" ng-include="'notebook_folder_renderer.html'" />
|
||||
</div>
|
||||
<div ng-if="query && query.name !== ''">
|
||||
<li ng-repeat="note in home.notes.flatList | filter:query.q | orderBy:home.arrayOrderingSrv.notebookListOrdering track by $index">
|
||||
<li ng-repeat="note in home.notes.flatList | filter:query.q | orderBy:home.arrayOrderingSrv.noteListOrdering track by $index">
|
||||
<i style="font-size: 10px;" class="icon-doc"></i>
|
||||
<a style="text-decoration: none;" href="#/notebook/{{note.id}}">{{noteName(note)}}</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
$scope.$on('setNotebookJobs', function(event, responseData) {
|
||||
$scope.lastJobServerUnixTime = responseData.lastResponseUnixTime;
|
||||
$scope.jobInfomations = responseData.jobs;
|
||||
$scope.jobInfomationsIndexs = $scope.jobInfomations ? _.indexBy($scope.jobInfomations, 'notebookId') : {};
|
||||
$scope.jobInfomationsIndexs = $scope.jobInfomations ? _.indexBy($scope.jobInfomations, 'noteId') : {};
|
||||
});
|
||||
|
||||
$scope.$on('setUpdateNotebookJobs', function(event, responseData) {
|
||||
|
|
@ -57,22 +57,22 @@
|
|||
$scope.lastJobServerUnixTime = responseData.lastResponseUnixTime;
|
||||
var notes = responseData.jobs;
|
||||
notes.map(function(changedItem) {
|
||||
if (indexStore[changedItem.notebookId] === undefined) {
|
||||
if (indexStore[changedItem.noteId] === undefined) {
|
||||
var newItem = angular.copy(changedItem);
|
||||
jobInfomations.push(newItem);
|
||||
indexStore[changedItem.notebookId] = newItem;
|
||||
indexStore[changedItem.noteId] = newItem;
|
||||
} else {
|
||||
var changeOriginTarget = indexStore[changedItem.notebookId];
|
||||
var changeOriginTarget = indexStore[changedItem.noteId];
|
||||
|
||||
if (changedItem.isRemoved !== undefined && changedItem.isRemoved === true) {
|
||||
|
||||
// remove Item.
|
||||
var removeIndex = _.findIndex(indexStore, changedItem.notebookId);
|
||||
var removeIndex = _.findIndex(indexStore, changedItem.noteId);
|
||||
if (removeIndex > -1) {
|
||||
indexStore.splice(removeIndex, 1);
|
||||
}
|
||||
|
||||
removeIndex = _.findIndex(jobInfomations, {'notebookId': changedItem.notebookId});
|
||||
removeIndex = _.findIndex(jobInfomations, {'noteId': changedItem.noteId});
|
||||
if (removeIndex) {
|
||||
jobInfomations.splice(removeIndex, 1);
|
||||
}
|
||||
|
|
@ -80,8 +80,8 @@
|
|||
} else {
|
||||
// change value for item.
|
||||
changeOriginTarget.isRunningJob = changedItem.isRunningJob;
|
||||
changeOriginTarget.notebookName = changedItem.notebookName;
|
||||
changeOriginTarget.notebookType = changedItem.notebookType;
|
||||
changeOriginTarget.noteName = changedItem.noteName;
|
||||
changeOriginTarget.noteType = changedItem.noteType;
|
||||
changeOriginTarget.interpreter = changedItem.interpreter;
|
||||
changeOriginTarget.unixTimeLastRun = changedItem.unixTimeLastRun;
|
||||
changeOriginTarget.paragraphs = changedItem.paragraphs;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
-->
|
||||
|
||||
<div id="{{notebookJob.notebookId}}_control" class="control">
|
||||
<div id="{{notebookJob.noteId}}_control" class="control">
|
||||
<span>
|
||||
{{lastExecuteTime(notebookJob.unixTimeLastRun)}}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
-->
|
||||
|
||||
<div id="{{notebookJob.notebookId}}_runControl" class="runControl">
|
||||
<div id="{{notebookJob.notebookId}}_progress" class="progress" ng-if="notebookJob.isRunningJob === true">
|
||||
<div id="{{notebookJob.noteId}}_runControl" class="runControl">
|
||||
<div id="{{notebookJob.noteId}}_progress" class="progress" ng-if="notebookJob.isRunningJob === true">
|
||||
<div ng-if="getProgress()>0 && getProgress()<100 && notebookJob.isRunningJob === true"
|
||||
class="progress-bar" role="progressbar" ng-style="{width:getProgress()+'%'}"></div>
|
||||
<div ng-if="(getProgress()<=0 || getProgress()>=100) && (notebookJob.isRunningJob === true)"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ limitations under the License.
|
|||
<i ng-switch-default class="icon-question"></i>
|
||||
</span>
|
||||
|
||||
<a style="text-decoration: none !important;" ng-href="#/notebook/{{notebookJob.notebookId}}">
|
||||
<a style="text-decoration: none !important;" ng-href="#/notebook/{{notebookJob.noteId}}">
|
||||
<span>
|
||||
{{notebookJob.notebookName}}
|
||||
</span>
|
||||
|
|
@ -48,7 +48,7 @@ limitations under the License.
|
|||
ng-switch="paragraphJob.status">
|
||||
<a ng-switch-when="READY"
|
||||
style="text-decoration: none !important;"
|
||||
ng-href="#/notebook/{{notebookJob.notebookId}}/paragraph/{{paragraphJob.id}}">
|
||||
ng-href="#/notebook/{{notebookJob.noteId}}/paragraph/{{paragraphJob.id}}">
|
||||
<i style="color: green" class="fa fa-circle-o"
|
||||
tooltip-placement="top-left"
|
||||
tooltip="{{paragraphJob.name}} is READY">
|
||||
|
|
@ -56,7 +56,7 @@ limitations under the License.
|
|||
</a>
|
||||
<a ng-switch-when="FINISHED"
|
||||
style="text-decoration: none !important;"
|
||||
ng-href="#/notebook/{{notebookJob.notebookId}}/paragraph/{{paragraphJob.id}}">
|
||||
ng-href="#/notebook/{{notebookJob.noteId}}/paragraph/{{paragraphJob.id}}">
|
||||
<i style="color: green" class="fa fa-circle"
|
||||
tooltip-placement="top-left"
|
||||
tooltip="{{paragraphJob.name}} is FINISHED">
|
||||
|
|
@ -64,7 +64,7 @@ limitations under the License.
|
|||
</a>
|
||||
<a ng-switch-when="ABORT"
|
||||
style="text-decoration: none !important;"
|
||||
ng-href="#/notebook/{{notebookJob.notebookId}}/paragraph/{{paragraphJob.id}}">
|
||||
ng-href="#/notebook/{{notebookJob.noteId}}/paragraph/{{paragraphJob.id}}">
|
||||
<i style="color: orange" class="fa fa-circle"
|
||||
tooltip-placement="top-left"
|
||||
tooltip="{{paragraphJob.name}} is ABORT">
|
||||
|
|
@ -72,7 +72,7 @@ limitations under the License.
|
|||
</a>
|
||||
<a ng-switch-when="ERROR"
|
||||
style="text-decoration: none !important;"
|
||||
ng-href="#/notebook/{{notebookJob.notebookId}}/paragraph/{{paragraphJob.id}}">
|
||||
ng-href="#/notebook/{{notebookJob.noteId}}/paragraph/{{paragraphJob.id}}">
|
||||
<i style="color: red" class="fa fa-circle"
|
||||
tooltip-placement="top-left"
|
||||
tooltip="{{paragraphJob.name}} is ERROR">
|
||||
|
|
@ -80,7 +80,7 @@ limitations under the License.
|
|||
</a>
|
||||
<a ng-switch-when="PENDING"
|
||||
style="text-decoration: none !important;"
|
||||
ng-href="#/notebook/{{notebookJob.notebookId}}/paragraph/{{paragraphJob.id}}">
|
||||
ng-href="#/notebook/{{notebookJob.noteId}}/paragraph/{{paragraphJob.id}}">
|
||||
<i style="color: gray" class="fa fa-circle"
|
||||
tooltip-placement="top-left"
|
||||
tooltip="{{paragraphJob.name}} is PENDING">
|
||||
|
|
@ -88,7 +88,7 @@ limitations under the License.
|
|||
</a>
|
||||
<a ng-switch-when="RUNNING"
|
||||
style="text-decoration: none !important;"
|
||||
ng-href="#/notebook/{{notebookJob.notebookId}}/paragraph/{{paragraphJob.id}}">
|
||||
ng-href="#/notebook/{{notebookJob.noteId}}/paragraph/{{paragraphJob.id}}">
|
||||
<i style="color: blue" class="fa fa-spinner spinAnimation"
|
||||
tooltip-placement="top-left"
|
||||
tooltip="{{paragraphJob.name}} is RUNNING">
|
||||
|
|
@ -96,7 +96,7 @@ limitations under the License.
|
|||
</a>
|
||||
<a ng-switch-default class="icon-question"
|
||||
style="text-decoration: none !important;"
|
||||
ng-href="#/notebook/{{notebookJob.notebookId}}/paragraph/{{paragraphJob.id}}">
|
||||
ng-href="#/notebook/{{notebookJob.noteId}}/paragraph/{{paragraphJob.id}}">
|
||||
<i class="icon-question"
|
||||
tooltip-placement="top-left"
|
||||
tooltip="{{paragraphJob.name}} is {{paragraphJob.status}}">
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ limitations under the License.
|
|||
<button type="button"
|
||||
class="btn btn-default btn-xs"
|
||||
ng-hide="viewOnly"
|
||||
tooltip-placement="bottom" tooltip="Clone the notebook" data-source-note-name="{{note.name}}"
|
||||
tooltip-placement="bottom" tooltip="Clone the note" data-source-note-name="{{note.name}}"
|
||||
data-toggle="modal" data-target="#noteNameModal" data-clone="true"
|
||||
>
|
||||
<i class="fa fa-copy"></i>
|
||||
|
|
@ -61,8 +61,8 @@ limitations under the License.
|
|||
<button type="button"
|
||||
class="btn btn-default btn-xs"
|
||||
ng-hide="viewOnly"
|
||||
ng-click="exportNotebook()"
|
||||
tooltip-placement="bottom" tooltip="Export the notebook">
|
||||
ng-click="exportNote()"
|
||||
tooltip-placement="bottom" tooltip="Export the note">
|
||||
<i class="fa fa-download"></i>
|
||||
</button>
|
||||
</span>
|
||||
|
|
@ -93,7 +93,7 @@ limitations under the License.
|
|||
ng-hide="viewOnly"
|
||||
ng-click="checkpointNotebook(note.checkpoint.message)"
|
||||
style="margin-left: 4px;"
|
||||
tooltip-placement="bottom" tooltip="Commit the notebook">Commit
|
||||
tooltip-placement="bottom" tooltip="Commit the note">Commit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -130,7 +130,7 @@ limitations under the License.
|
|||
class="btn btn-default btn-xs"
|
||||
ng-click="removeNote(note.id)"
|
||||
ng-hide="viewOnly"
|
||||
tooltip-placement="bottom" tooltip="Remove the notebook">
|
||||
tooltip-placement="bottom" tooltip="Remove the note">
|
||||
<i class="icon-trash"></i>
|
||||
</button>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@
|
|||
|
||||
/** Init the new controller */
|
||||
var initNotebook = function() {
|
||||
websocketMsgSrv.getNotebook($routeParams.noteId);
|
||||
websocketMsgSrv.getNote($routeParams.noteId);
|
||||
websocketMsgSrv.listRevisionHistory($routeParams.noteId);
|
||||
var currentRoute = $route.current;
|
||||
if (currentRoute) {
|
||||
|
|
@ -148,7 +148,7 @@
|
|||
message: 'Do you want to delete this notebook?',
|
||||
callback: function(result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.deleteNotebook(noteId);
|
||||
websocketMsgSrv.deleteNote(noteId);
|
||||
$location.path('/');
|
||||
}
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@
|
|||
};
|
||||
|
||||
//Export notebook
|
||||
$scope.exportNotebook = function() {
|
||||
$scope.exportNote = function() {
|
||||
var jsonContent = JSON.stringify($scope.note);
|
||||
saveAsService.saveAs(jsonContent, $scope.note.name, 'json');
|
||||
};
|
||||
|
|
@ -169,7 +169,7 @@
|
|||
message: 'Do you want to clone this notebook?',
|
||||
callback: function(result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.cloneNotebook(noteId);
|
||||
websocketMsgSrv.cloneNote(noteId);
|
||||
$location.path('/');
|
||||
}
|
||||
}
|
||||
|
|
@ -336,13 +336,13 @@
|
|||
if (config) {
|
||||
$scope.note.config = config;
|
||||
}
|
||||
websocketMsgSrv.updateNotebook($scope.note.id, $scope.note.name, $scope.note.config);
|
||||
websocketMsgSrv.updateNote($scope.note.id, $scope.note.name, $scope.note.config);
|
||||
};
|
||||
|
||||
/** Update the note name */
|
||||
$scope.sendNewName = function() {
|
||||
if ($scope.note.name) {
|
||||
websocketMsgSrv.updateNotebook($scope.note.id, $scope.note.name, $scope.note.config);
|
||||
websocketMsgSrv.updateNote($scope.note.id, $scope.note.name, $scope.note.config);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
function arrayOrderingSrv() {
|
||||
var arrayOrderingSrv = this;
|
||||
|
||||
this.notebookListOrdering = function(note) {
|
||||
this.noteListOrdering = function(note) {
|
||||
return arrayOrderingSrv.getNoteName(note);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ limitations under the License.
|
|||
</div>
|
||||
<div class="expandable" style="color: black;">
|
||||
<ul>
|
||||
<li ng-repeat="note in note.children | orderBy:navbar.arrayOrderingSrv.notebookListOrdering track by $index"
|
||||
<li ng-repeat="note in note.children | orderBy:navbar.arrayOrderingSrv.noteListOrdering track by $index"
|
||||
ng-class="{'active' : navbar.isActive(note.id)}"
|
||||
ng-include="'components/navbar/navbar-notebookList-elem.html'">
|
||||
ng-include="'components/navbar/navbar-noteList-elem.html'">
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
'$http',
|
||||
'$routeParams',
|
||||
'$location',
|
||||
'notebookListDataFactory',
|
||||
'noteListDataFactory',
|
||||
'baseUrlSrv',
|
||||
'websocketMsgSrv',
|
||||
'arrayOrderingSrv',
|
||||
|
|
@ -30,14 +30,14 @@
|
|||
];
|
||||
|
||||
function NavCtrl($scope, $rootScope, $http, $routeParams, $location,
|
||||
notebookListDataFactory, baseUrlSrv, websocketMsgSrv,
|
||||
noteListDataFactory, baseUrlSrv, websocketMsgSrv,
|
||||
arrayOrderingSrv, searchService) {
|
||||
var vm = this;
|
||||
vm.arrayOrderingSrv = arrayOrderingSrv;
|
||||
vm.connected = websocketMsgSrv.isConnected();
|
||||
vm.isActive = isActive;
|
||||
vm.logout = logout;
|
||||
vm.notes = notebookListDataFactory;
|
||||
vm.notes = noteListDataFactory;
|
||||
vm.search = search;
|
||||
vm.searchForm = searchService;
|
||||
vm.showLoginWindow = showLoginWindow;
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
}
|
||||
|
||||
function loadNotes() {
|
||||
websocketMsgSrv.getNotebookList();
|
||||
websocketMsgSrv.getNoteList();
|
||||
}
|
||||
|
||||
function logout() {
|
||||
|
|
@ -112,7 +112,7 @@
|
|||
*/
|
||||
|
||||
$scope.$on('setNoteMenu', function(event, notes) {
|
||||
notebookListDataFactory.setNotes(notes);
|
||||
noteListDataFactory.setNotes(notes);
|
||||
});
|
||||
|
||||
$scope.$on('setConnectedStatus', function(event, param) {
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ limitations under the License.
|
|||
<li class="divider"></li>
|
||||
<div id="notebook-list" class="scrollbar-container">
|
||||
<li class="filter-names" ng-include="'components/filterNoteNames/filter-note-names.html'"></li>
|
||||
<li ng-repeat="note in navbar.notes.root.children | filter:query.q | orderBy:navbar.arrayOrderingSrv.notebookListOrdering track by $index"
|
||||
ng-class="{'active' : navbar.isActive(note.id)}" ng-include="'components/navbar/navbar-notebookList-elem.html'">
|
||||
<li ng-repeat="note in navbar.notes.root.children | filter:query.q | orderBy:navbar.arrayOrderingSrv.noteListOrdering track by $index"
|
||||
ng-class="{'active' : navbar.isActive(note.id)}" ng-include="'components/navbar/navbar-noteList-elem.html'">
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
|
|
@ -57,7 +57,7 @@ limitations under the License.
|
|||
id="searchTermId"
|
||||
ng-disabled="!navbar.connected"
|
||||
class="form-control"
|
||||
placeholder="Search your Notebooks"
|
||||
placeholder="Search your Notes"
|
||||
/>
|
||||
<span class="input-group-btn">
|
||||
<button
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
'use strict';
|
||||
(function() {
|
||||
|
||||
angular.module('zeppelinWebApp').factory('notebookListDataFactory', notebookListDataFactory);
|
||||
angular.module('zeppelinWebApp').factory('noteListDataFactory', noteListDataFactory);
|
||||
|
||||
function notebookListDataFactory() {
|
||||
function noteListDataFactory() {
|
||||
var notes = {
|
||||
root: {children: []},
|
||||
flatList: [],
|
||||
|
|
@ -18,24 +18,24 @@
|
|||
|
||||
NotenameCtrl.$inject = [
|
||||
'$scope',
|
||||
'notebookListDataFactory',
|
||||
'noteListDataFactory',
|
||||
'$routeParams',
|
||||
'websocketMsgSrv'
|
||||
];
|
||||
|
||||
function NotenameCtrl($scope, notebookListDataFactory, $routeParams, websocketMsgSrv) {
|
||||
function NotenameCtrl($scope, noteListDataFactory, $routeParams, websocketMsgSrv) {
|
||||
var vm = this;
|
||||
vm.clone = false;
|
||||
vm.notes = notebookListDataFactory;
|
||||
vm.notes = noteListDataFactory;
|
||||
vm.websocketMsgSrv = websocketMsgSrv;
|
||||
$scope.note = {};
|
||||
|
||||
vm.createNote = function() {
|
||||
if (!vm.clone) {
|
||||
vm.websocketMsgSrv.createNotebook($scope.note.notename);
|
||||
vm.websocketMsgSrv.createNote($scope.note.notename);
|
||||
} else {
|
||||
var noteId = $routeParams.noteId;
|
||||
vm.websocketMsgSrv.cloneNotebook(noteId, $scope.note.notename);
|
||||
vm.websocketMsgSrv.cloneNote(noteId, $scope.note.notename);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -21,23 +21,23 @@
|
|||
function websocketMsgSrv($rootScope, websocketEvents) {
|
||||
return {
|
||||
|
||||
getHomeNotebook: function() {
|
||||
getHomeNote: function() {
|
||||
websocketEvents.sendNewEvent({op: 'GET_HOME_NOTE'});
|
||||
},
|
||||
|
||||
createNotebook: function(noteName) {
|
||||
createNote: function(noteName) {
|
||||
websocketEvents.sendNewEvent({op: 'NEW_NOTE',data: {name: noteName}});
|
||||
},
|
||||
|
||||
deleteNotebook: function(noteId) {
|
||||
deleteNote: function(noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'DEL_NOTE', data: {id: noteId}});
|
||||
},
|
||||
|
||||
cloneNotebook: function(noteIdToClone, newNoteName) {
|
||||
cloneNote: function(noteIdToClone, newNoteName) {
|
||||
websocketEvents.sendNewEvent({op: 'CLONE_NOTE', data: {id: noteIdToClone, name: newNoteName}});
|
||||
},
|
||||
|
||||
getNotebookList: function() {
|
||||
getNoteList: function() {
|
||||
websocketEvents.sendNewEvent({op: 'LIST_NOTES'});
|
||||
},
|
||||
|
||||
|
|
@ -45,11 +45,11 @@
|
|||
websocketEvents.sendNewEvent({op: 'RELOAD_NOTES_FROM_REPO'});
|
||||
},
|
||||
|
||||
getNotebook: function(noteId) {
|
||||
getNote: function(noteId) {
|
||||
websocketEvents.sendNewEvent({op: 'GET_NOTE', data: {id: noteId}});
|
||||
},
|
||||
|
||||
updateNotebook: function(noteId, noteName, noteConfig) {
|
||||
updateNote: function(noteId, noteName, noteConfig) {
|
||||
websocketEvents.sendNewEvent({op: 'NOTE_UPDATE', data: {id: noteId, name: noteName, config: noteConfig}});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ limitations under the License.
|
|||
<script src="components/noteName-create/visible.directive.js"></script>
|
||||
<script src="components/websocketEvents/websocketMsg.service.js"></script>
|
||||
<script src="components/websocketEvents/websocketEvents.factory.js"></script>
|
||||
<script src="components/notebookListDataFactory/notebookList.datafactory.js"></script>
|
||||
<script src="components/noteListDataFactory/noteList.datafactory.js"></script>
|
||||
<script src="components/baseUrl/baseUrl.service.js"></script>
|
||||
<script src="components/browser-detect/browserDetect.service.js"></script>
|
||||
<script src="components/saveAs/saveAs.service.js"></script>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ describe('Controller: NotebookCtrl', function() {
|
|||
var scope;
|
||||
|
||||
var websocketMsgSrvMock = {
|
||||
getNotebook: function() {},
|
||||
getNote: function() {},
|
||||
listRevisionHistory: function() {},
|
||||
getInterpreterBindings: function() {}
|
||||
};
|
||||
|
|
@ -19,7 +19,7 @@ describe('Controller: NotebookCtrl', function() {
|
|||
|
||||
var noteMock = {
|
||||
id: 1,
|
||||
name: 'my notebook',
|
||||
name: 'my note',
|
||||
config: {},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ describe('Controller: NotenameCtrl', function() {
|
|||
|
||||
var scope;
|
||||
var ctrl;
|
||||
var notebookList;
|
||||
var noteList;
|
||||
|
||||
beforeEach(inject(function($injector, $rootScope, $controller) {
|
||||
notebookList = $injector.get('notebookListDataFactory');
|
||||
noteList = $injector.get('noteListDataFactory');
|
||||
scope = $rootScope.$new();
|
||||
ctrl = $controller('NotenameCtrl', {
|
||||
$scope: scope,
|
||||
notebookListDataFactory: notebookList
|
||||
noteListDataFactory: noteList
|
||||
});
|
||||
}));
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ describe('Controller: NotenameCtrl', function() {
|
|||
{name: 'Untitled Note 6', id: '4'}
|
||||
];
|
||||
|
||||
notebookList.setNotes(notesList);
|
||||
noteList.setNotes(notesList);
|
||||
|
||||
ctrl.sourceNoteName = 'test name';
|
||||
expect(ctrl.cloneNoteName()).toEqual('test name 1');
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
describe('Factory: NotebookList', function() {
|
||||
describe('Factory: NoteList', function() {
|
||||
|
||||
var notebookList;
|
||||
var noteList;
|
||||
|
||||
beforeEach(function() {
|
||||
module('zeppelinWebApp');
|
||||
|
||||
inject(function($injector) {
|
||||
notebookList = $injector.get('notebookListDataFactory');
|
||||
noteList = $injector.get('noteListDataFactory');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ describe('Factory: NotebookList', function() {
|
|||
var notesList = [
|
||||
{name: 'A', id: '000001'},
|
||||
{name: 'B', id: '000002'},
|
||||
{id: '000003'}, // notebook without name
|
||||
{id: '000003'}, // note without name
|
||||
{name: '/C/CA', id: '000004'},
|
||||
{name: '/C/CB', id: '000005'},
|
||||
{name: '/C/CB/CBA', id: '000006'}, // same name with a dir
|
||||
|
|
@ -24,9 +24,9 @@ describe('Factory: NotebookList', function() {
|
|||
{name: 'C///CB//CBB', id: '000008'},
|
||||
{name: 'D/D[A/DA]B', id: '000009'} // check if '[' and ']' considered as folder seperator
|
||||
];
|
||||
notebookList.setNotes(notesList);
|
||||
noteList.setNotes(notesList);
|
||||
|
||||
var flatList = notebookList.flatList;
|
||||
var flatList = noteList.flatList;
|
||||
expect(flatList.length).toBe(9);
|
||||
expect(flatList[0].name).toBe('A');
|
||||
expect(flatList[0].id).toBe('000001');
|
||||
|
|
@ -39,7 +39,7 @@ describe('Factory: NotebookList', function() {
|
|||
expect(flatList[7].name).toBe('C///CB//CBB');
|
||||
expect(flatList[8].name).toBe('D/D[A/DA]B');
|
||||
|
||||
var folderList = notebookList.root.children;
|
||||
var folderList = noteList.root.children;
|
||||
expect(folderList.length).toBe(5);
|
||||
expect(folderList[0].name).toBe('A');
|
||||
expect(folderList[0].id).toBe('000001');
|
||||
|
|
@ -38,7 +38,6 @@ import com.google.common.collect.Sets;
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import org.apache.commons.codec.binary.StringUtils;
|
||||
import org.quartz.CronScheduleBuilder;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.JobBuilder;
|
||||
|
|
@ -622,14 +621,14 @@ public class Notebook implements NoteEventListener {
|
|||
gotNoteId = note.getId();
|
||||
}
|
||||
}
|
||||
return getJobListBymNotebookId(gotNoteId);
|
||||
return getJobListByNoteId(gotNoteId);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getJobListBymNotebookId(String notebookID) {
|
||||
public List<Map<String, Object>> getJobListByNoteId(String noteID) {
|
||||
final String CRON_TYPE_NOTEBOOK_KEYWORD = "cron";
|
||||
long lastRunningUnixTime = 0;
|
||||
boolean isNotebookRunning = false;
|
||||
Note jobNote = getNote(notebookID);
|
||||
Note jobNote = getNote(noteID);
|
||||
List<Map<String, Object>> notesInfo = new LinkedList<>();
|
||||
if (jobNote == null) {
|
||||
return notesInfo;
|
||||
|
|
@ -637,19 +636,19 @@ public class Notebook implements NoteEventListener {
|
|||
|
||||
Map<String, Object> info = new HashMap<>();
|
||||
|
||||
info.put("notebookId", jobNote.getId());
|
||||
String notebookName = jobNote.getName();
|
||||
if (notebookName != null && !notebookName.equals("")) {
|
||||
info.put("notebookName", jobNote.getName());
|
||||
info.put("noteId", jobNote.getId());
|
||||
String noteName = jobNote.getName();
|
||||
if (noteName != null && !noteName.equals("")) {
|
||||
info.put("noteName", jobNote.getName());
|
||||
} else {
|
||||
info.put("notebookName", "Note " + jobNote.getId());
|
||||
info.put("noteName", "Note " + jobNote.getId());
|
||||
}
|
||||
// set notebook type ( cron or normal )
|
||||
if (jobNote.getConfig().containsKey(CRON_TYPE_NOTEBOOK_KEYWORD) && !jobNote.getConfig()
|
||||
.get(CRON_TYPE_NOTEBOOK_KEYWORD).equals("")) {
|
||||
info.put("notebookType", "cron");
|
||||
info.put("noteType", "cron");
|
||||
} else {
|
||||
info.put("notebookType", "normal");
|
||||
info.put("noteType", "normal");
|
||||
}
|
||||
|
||||
// set paragraphs
|
||||
|
|
@ -699,28 +698,28 @@ public class Notebook implements NoteEventListener {
|
|||
List<Note> notes = getAllNotes();
|
||||
List<Map<String, Object>> notesInfo = new LinkedList<>();
|
||||
for (Note note : notes) {
|
||||
boolean isNotebookRunning = false;
|
||||
boolean isUpdateNotebook = false;
|
||||
boolean isNoteRunning = false;
|
||||
boolean isUpdateNote = false;
|
||||
long lastRunningUnixTime = 0;
|
||||
Map<String, Object> info = new HashMap<>();
|
||||
|
||||
// set notebook ID
|
||||
info.put("notebookId", note.getId());
|
||||
info.put("noteId", note.getId());
|
||||
|
||||
// set notebook Name
|
||||
String notebookName = note.getName();
|
||||
if (notebookName != null && !notebookName.equals("")) {
|
||||
info.put("notebookName", note.getName());
|
||||
String noteName = note.getName();
|
||||
if (noteName != null && !noteName.equals("")) {
|
||||
info.put("noteName", note.getName());
|
||||
} else {
|
||||
info.put("notebookName", "Note " + note.getId());
|
||||
info.put("noteName", "Note " + note.getId());
|
||||
}
|
||||
|
||||
// set notebook type ( cron or normal )
|
||||
if (note.getConfig().containsKey(CRON_TYPE_NOTEBOOK_KEYWORD) && !note.getConfig()
|
||||
.get(CRON_TYPE_NOTEBOOK_KEYWORD).equals("")) {
|
||||
info.put("notebookType", "cron");
|
||||
info.put("noteType", "cron");
|
||||
} else {
|
||||
info.put("notebookType", "normal");
|
||||
info.put("noteType", "normal");
|
||||
}
|
||||
|
||||
// set paragraphs
|
||||
|
|
@ -728,17 +727,17 @@ public class Notebook implements NoteEventListener {
|
|||
for (Paragraph paragraph : note.getParagraphs()) {
|
||||
// check paragraph's status.
|
||||
if (paragraph.getStatus().isRunning()) {
|
||||
isNotebookRunning = true;
|
||||
isUpdateNotebook = true;
|
||||
isNoteRunning = true;
|
||||
isUpdateNote = true;
|
||||
}
|
||||
|
||||
// get data for the job manager.
|
||||
Map<String, Object> paragraphItem = getParagraphForJobManagerItem(paragraph);
|
||||
lastRunningUnixTime = getUnixTimeLastRunParagraph(paragraph);
|
||||
|
||||
// is update notebook for last server update time.
|
||||
// is update note for last server update time.
|
||||
if (lastRunningUnixTime > lastUpdateServerUnixTime) {
|
||||
isUpdateNotebook = true;
|
||||
isUpdateNote = true;
|
||||
}
|
||||
paragraphsInfo.add(paragraphItem);
|
||||
}
|
||||
|
|
@ -751,13 +750,13 @@ public class Notebook implements NoteEventListener {
|
|||
}
|
||||
|
||||
// not update and not running -> pass
|
||||
if (!isUpdateNotebook && !isNotebookRunning) {
|
||||
if (!isUpdateNote && !isNoteRunning) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// notebook json object root information.
|
||||
// note json object root information.
|
||||
info.put("interpreter", interpreterGroupName);
|
||||
info.put("isRunningJob", isNotebookRunning);
|
||||
info.put("isRunningJob", isNoteRunning);
|
||||
info.put("unixTimeLastRun", lastRunningUnixTime);
|
||||
info.put("paragraphs", paragraphsInfo);
|
||||
notesInfo.add(info);
|
||||
|
|
|
|||
Loading…
Reference in a new issue