diff --git a/docs/rest-api/rest-notebook.md b/docs/rest-api/rest-notebook.md index edbb595e5c9..42aca477a71 100644 --- a/docs/rest-api/rest-notebook.md +++ b/docs/rest-api/rest-notebook.md @@ -142,7 +142,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]``` Success code @@ -238,7 +238,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]``` Success code @@ -267,7 +267,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]``` Success code @@ -303,7 +303,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]``` Success code @@ -330,7 +330,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]``` Success code @@ -358,7 +358,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]``` Success code @@ -403,7 +403,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]/[paragraphId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]/[paragraphId]``` Success code @@ -441,7 +441,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[notebookId]/[paragraphId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/job/[noteId]/[paragraphId]``` Success code @@ -468,7 +468,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[notebookId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[noteId]``` Success code @@ -500,7 +500,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[notebookId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[noteId]``` Success code @@ -529,7 +529,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[notebookId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/cron/[noteId]``` Success code @@ -595,7 +595,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]/paragraph``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]/paragraph``` Success code @@ -645,7 +645,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]/paragraph/[paragraphId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]/paragraph/[paragraphId]``` Success code @@ -712,7 +712,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]/paragraph/[paragraphId]/move/[newIndex]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]/paragraph/[paragraphId]/move/[newIndex]``` Success code @@ -740,7 +740,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[notebookId]/paragraph/[paragraphId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/[noteId]/paragraph/[paragraphId]``` Success code @@ -767,7 +767,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple URL - ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/export/[notebookId]``` + ```http://[zeppelin-server]:[zeppelin-port]/api/notebook/export/[noteId]``` Success code @@ -865,4 +865,4 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple - \ No newline at end of file + diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java index 700fe1a1c2d..47c9373709a 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java @@ -113,13 +113,8 @@ private String ownerPermissionError(Set current, Set allowed) th @ZeppelinApi public Response putNotePermissions(@PathParam("noteId") String noteId, String req) throws IOException { - /** - * TODO(jl): Fixed the type of HashSet - * https://issues.apache.org/jira/browse/ZEPPELIN-1162 - */ - HashMap permMap = - gson.fromJson(req, new TypeToken>() { - }.getType()); + HashMap permMap = gson.fromJson(req, + new TypeToken>(){}.getType()); Note note = notebook.getNote(noteId); String principal = SecurityUtils.getPrincipal(); HashSet roles = SecurityUtils.getRoles(); @@ -222,10 +217,10 @@ public Response getNotebookList() throws IOException { } @GET - @Path("{notebookId}") + @Path("{noteId}") @ZeppelinApi - public Response getNotebook(@PathParam("notebookId") String notebookId) throws IOException { - Note note = notebook.getNote(notebookId); + public Response getNotebook(@PathParam("noteId") String noteId) throws IOException { + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } @@ -308,15 +303,15 @@ public Response createNote(String message) throws IOException { * @throws IOException */ @DELETE - @Path("{notebookId}") + @Path("{noteId}") @ZeppelinApi - public Response deleteNote(@PathParam("notebookId") String notebookId) throws IOException { - LOG.info("Delete notebook {} ", notebookId); + public Response deleteNote(@PathParam("noteId") String noteId) throws IOException { + LOG.info("Delete notebook {} ", noteId); AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal()); - if (!(notebookId.isEmpty())) { - Note note = notebook.getNote(notebookId); + if (!(noteId.isEmpty())) { + Note note = notebook.getNote(noteId); if (note != null) { - notebook.removeNote(notebookId, subject); + notebook.removeNote(noteId, subject); } } @@ -332,15 +327,16 @@ public Response deleteNote(@PathParam("notebookId") String notebookId) throws IO * @throws IOException, CloneNotSupportedException, IllegalArgumentException */ @POST - @Path("{notebookId}") + @Path("{noteId}") @ZeppelinApi - public Response cloneNote(@PathParam("notebookId") String notebookId, String message) - throws IOException, CloneNotSupportedException, IllegalArgumentException { - LOG.info("clone notebook by JSON {}", message); - NewNotebookRequest request = gson.fromJson(message, NewNotebookRequest.class); + 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); String newNoteName = request.getName(); AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal()); - Note newNote = notebook.cloneNote(notebookId, newNoteName, subject); + Note newNote = notebook.cloneNote(noteId, newNoteName, subject); notebookServer.broadcastNote(newNote); notebookServer.broadcastNoteList(subject); return new JsonResponse<>(Status.CREATED, "", newNote.getId()).build(); @@ -354,13 +350,13 @@ public Response cloneNote(@PathParam("notebookId") String notebookId, String mes * @throws IOException */ @POST - @Path("{notebookId}/paragraph") + @Path("{noteId}/paragraph") @ZeppelinApi - public Response insertParagraph(@PathParam("notebookId") String notebookId, String message) + public Response insertParagraph(@PathParam("noteId") String noteId, String message) throws IOException { - LOG.info("insert paragraph {} {}", notebookId, message); + LOG.info("insert paragraph {} {}", noteId, message); - Note note = notebook.getNote(notebookId); + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } @@ -391,13 +387,13 @@ public Response insertParagraph(@PathParam("notebookId") String notebookId, Stri * @throws IOException */ @GET - @Path("{notebookId}/paragraph/{paragraphId}") + @Path("{noteId}/paragraph/{paragraphId}") @ZeppelinApi - public Response getParagraph(@PathParam("notebookId") String notebookId, - @PathParam("paragraphId") String paragraphId) throws IOException { - LOG.info("get paragraph {} {}", notebookId, paragraphId); + public Response getParagraph(@PathParam("noteId") String noteId, + @PathParam("paragraphId") String paragraphId) throws IOException { + LOG.info("get paragraph {} {}", noteId, paragraphId); - Note note = notebook.getNote(notebookId); + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse(Status.NOT_FOUND, "note not found.").build(); } @@ -418,14 +414,14 @@ public Response getParagraph(@PathParam("notebookId") String notebookId, * @throws IOException */ @POST - @Path("{notebookId}/paragraph/{paragraphId}/move/{newIndex}") + @Path("{noteId}/paragraph/{paragraphId}/move/{newIndex}") @ZeppelinApi - public Response moveParagraph(@PathParam("notebookId") String notebookId, - @PathParam("paragraphId") String paragraphId, @PathParam("newIndex") String newIndex) + public Response moveParagraph(@PathParam("noteId") String noteId, + @PathParam("paragraphId") String paragraphId, @PathParam("newIndex") String newIndex) throws IOException { - LOG.info("move paragraph {} {} {}", notebookId, paragraphId, newIndex); + LOG.info("move paragraph {} {} {}", noteId, paragraphId, newIndex); - Note note = notebook.getNote(notebookId); + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse(Status.NOT_FOUND, "note not found.").build(); } @@ -456,13 +452,13 @@ public Response moveParagraph(@PathParam("notebookId") String notebookId, * @throws IOException */ @DELETE - @Path("{notebookId}/paragraph/{paragraphId}") + @Path("{noteId}/paragraph/{paragraphId}") @ZeppelinApi - public Response deleteParagraph(@PathParam("notebookId") String notebookId, - @PathParam("paragraphId") String paragraphId) throws IOException { - LOG.info("delete paragraph {} {}", notebookId, paragraphId); + public Response deleteParagraph(@PathParam("noteId") String noteId, + @PathParam("paragraphId") String paragraphId) throws IOException { + LOG.info("delete paragraph {} {}", noteId, paragraphId); - Note note = notebook.getNote(notebookId); + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse(Status.NOT_FOUND, "note not found.").build(); } @@ -488,12 +484,12 @@ public Response deleteParagraph(@PathParam("notebookId") String notebookId, * @throws IOException, IllegalArgumentException */ @POST - @Path("job/{notebookId}") + @Path("job/{noteId}") @ZeppelinApi - public Response runNoteJobs(@PathParam("notebookId") String notebookId) - throws IOException, IllegalArgumentException { - LOG.info("run notebook jobs {} ", notebookId); - Note note = notebook.getNote(notebookId); + public Response runNoteJobs(@PathParam("noteId") String noteId) throws + IOException, IllegalArgumentException { + LOG.info("run notebook jobs {} ", noteId); + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } @@ -510,12 +506,12 @@ public Response runNoteJobs(@PathParam("notebookId") String notebookId) * @throws IOException, IllegalArgumentException */ @DELETE - @Path("job/{notebookId}") + @Path("job/{noteId}") @ZeppelinApi - public Response stopNoteJobs(@PathParam("notebookId") String notebookId) - throws IOException, IllegalArgumentException { - LOG.info("stop notebook jobs {} ", notebookId); - Note note = notebook.getNote(notebookId); + public Response stopNoteJobs(@PathParam("noteId") String noteId) + throws IOException, IllegalArgumentException { + LOG.info("stop notebook jobs {} ", noteId); + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } @@ -536,12 +532,12 @@ public Response stopNoteJobs(@PathParam("notebookId") String notebookId) * @throws IOException, IllegalArgumentException */ @GET - @Path("job/{notebookId}") + @Path("job/{noteId}") @ZeppelinApi - public Response getNoteJobStatus(@PathParam("notebookId") String notebookId) - throws IOException, IllegalArgumentException { + public Response getNoteJobStatus(@PathParam("noteId") String noteId) throws + IOException, IllegalArgumentException { LOG.info("get notebook job status."); - Note note = notebook.getNote(notebookId); + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } @@ -558,14 +554,15 @@ public Response getNoteJobStatus(@PathParam("notebookId") String notebookId) * @throws IOException, IllegalArgumentException */ @POST - @Path("job/{notebookId}/{paragraphId}") + @Path("job/{noteId}/{paragraphId}") @ZeppelinApi - public Response runParagraph(@PathParam("notebookId") String notebookId, - @PathParam("paragraphId") String paragraphId, String message) - throws IOException, IllegalArgumentException { - LOG.info("run paragraph job {} {} {}", notebookId, paragraphId, message); + public Response runParagraph(@PathParam("noteId") String noteId, + @PathParam("paragraphId") String paragraphId, + String message) throws + IOException, IllegalArgumentException { + LOG.info("run paragraph job {} {} {}", noteId, paragraphId, message); - Note note = notebook.getNote(notebookId); + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } @@ -601,16 +598,13 @@ public Response runParagraph(@PathParam("notebookId") String notebookId, * @throws IOException, IllegalArgumentException */ @DELETE - @Path("job/{notebookId}/{paragraphId}") + @Path("job/{noteId}/{paragraphId}") @ZeppelinApi - public Response stopParagraph(@PathParam("notebookId") String notebookId, - @PathParam("paragraphId") String paragraphId) throws IOException, IllegalArgumentException { - /** - * TODO(jl): Fixed notebookId to noteId - * https://issues.apache.org/jira/browse/ZEPPELIN-1163 - */ - LOG.info("stop paragraph job {} ", notebookId); - Note note = notebook.getNote(notebookId); + public Response stopParagraph(@PathParam("noteId") String noteId, + @PathParam("paragraphId") String paragraphId) throws + IOException, IllegalArgumentException { + LOG.info("stop paragraph job {} ", noteId); + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } @@ -631,16 +625,15 @@ public Response stopParagraph(@PathParam("notebookId") String notebookId, * @throws IOException, IllegalArgumentException */ @POST - @Path("cron/{notebookId}") + @Path("cron/{noteId}") @ZeppelinApi - public Response registerCronJob(@PathParam("notebookId") String notebookId, String message) - throws IOException, IllegalArgumentException { - // TODO(jl): Fixed notebookId to noteId - LOG.info("Register cron job note={} request cron msg={}", notebookId, message); + public Response registerCronJob(@PathParam("noteId") String noteId, String message) throws + IOException, IllegalArgumentException { + LOG.info("Register cron job note={} request cron msg={}", noteId, message); CronRequest request = gson.fromJson(message, CronRequest.class); - - Note note = notebook.getNote(notebookId); + + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } @@ -665,14 +658,13 @@ public Response registerCronJob(@PathParam("notebookId") String notebookId, Stri * @throws IOException, IllegalArgumentException */ @DELETE - @Path("cron/{notebookId}") + @Path("cron/{noteId}") @ZeppelinApi - public Response removeCronJob(@PathParam("notebookId") String notebookId) - throws IOException, IllegalArgumentException { - // TODO(jl): Fixed notebookId to noteId - LOG.info("Remove cron job note {}", notebookId); + public Response removeCronJob(@PathParam("noteId") String noteId) throws + IOException, IllegalArgumentException { + LOG.info("Remove cron job note {}", noteId); - Note note = notebook.getNote(notebookId); + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } @@ -693,14 +685,13 @@ public Response removeCronJob(@PathParam("notebookId") String notebookId) * @throws IOException, IllegalArgumentException */ @GET - @Path("cron/{notebookId}") + @Path("cron/{noteId}") @ZeppelinApi - public Response getCronJob(@PathParam("notebookId") String notebookId) - throws IOException, IllegalArgumentException { - // TODO(jl): Fixed notebookId to noteId - LOG.info("Get cron job note {}", notebookId); + public Response getCronJob(@PathParam("noteId") String noteId) throws + IOException, IllegalArgumentException { + LOG.info("Get cron job note {}", noteId); - Note note = notebook.getNote(notebookId); + Note note = notebook.getNote(noteId); if (note == null) { return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build(); } diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java index 00a81066316..485215f74f4 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/ZeppelinRestApiTest.java @@ -284,15 +284,15 @@ private String getNoteContent(String id) throws IOException { return body; } - private void testDeleteNotebook(String notebookId) throws IOException { + private void testDeleteNotebook(String noteId) throws IOException { - DeleteMethod delete = httpDelete(("/notebook/" + notebookId)); + DeleteMethod delete = httpDelete(("/notebook/" + noteId)); LOG.info("testDeleteNotebook 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); } } diff --git a/zeppelin-web/src/app/jobmanager/jobmanager.controller.js b/zeppelin-web/src/app/jobmanager/jobmanager.controller.js index e1465d95010..7e749807fa1 100644 --- a/zeppelin-web/src/app/jobmanager/jobmanager.controller.js +++ b/zeppelin-web/src/app/jobmanager/jobmanager.controller.js @@ -22,7 +22,7 @@ angular.module('zeppelinWebApp') $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) { @@ -31,22 +31,22 @@ angular.module('zeppelinWebApp') $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); } diff --git a/zeppelin-web/src/app/jobmanager/jobs/job-control.html b/zeppelin-web/src/app/jobmanager/jobs/job-control.html index 2cd0bf8e05b..050d998704c 100644 --- a/zeppelin-web/src/app/jobmanager/jobs/job-control.html +++ b/zeppelin-web/src/app/jobmanager/jobs/job-control.html @@ -12,7 +12,7 @@ limitations under the License. --> -
+
{{lastExecuteTime(notebookJob.unixTimeLastRun)}} diff --git a/zeppelin-web/src/app/jobmanager/jobs/job-progressBar.html b/zeppelin-web/src/app/jobmanager/jobs/job-progressBar.html index 11e3c172e10..00b290bac17 100644 --- a/zeppelin-web/src/app/jobmanager/jobs/job-progressBar.html +++ b/zeppelin-web/src/app/jobmanager/jobs/job-progressBar.html @@ -12,8 +12,8 @@ limitations under the License. --> -