mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Merge pull request #1 from minahlee/ZEPPELIN-1549
Change notebook to note and fix indentation
This commit is contained in:
commit
ac03666da7
19 changed files with 190 additions and 200 deletions
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
layout: page
|
||||
title: "Customize Apache Zeppelin homepage"
|
||||
description: "Apache Zeppelin allows you to use one of the notebooks you create as your Zeppelin Homepage. With that you can brand your Zeppelin installation, adjust the instruction to your users needs and even translate to other languages."
|
||||
description: "Apache Zeppelin allows you to use one of the notes you create as your Zeppelin Homepage. With that you can brand your Zeppelin installation, adjust the instruction to your users needs and even translate to other languages."
|
||||
group: manual
|
||||
---
|
||||
<!--
|
||||
|
|
@ -23,28 +23,28 @@ limitations under the License.
|
|||
|
||||
<div id="toc"></div>
|
||||
|
||||
Apache Zeppelin allows you to use one of the notebooks you create as your Zeppelin Homepage.
|
||||
Apache Zeppelin allows you to use one of the notes you create as your Zeppelin Homepage.
|
||||
With that you can brand your Zeppelin installation, adjust the instruction to your users needs and even translate to other languages.
|
||||
|
||||
## How to set a notebook as your Zeppelin homepage
|
||||
## How to set a note as your Zeppelin homepage
|
||||
|
||||
The process for creating your homepage is very simple as shown below:
|
||||
|
||||
1. Create a notebook using Zeppelin
|
||||
1. Create a note using Zeppelin
|
||||
2. Set the note id in the config file
|
||||
3. Restart Zeppelin
|
||||
|
||||
### Create a notebook using Zeppelin
|
||||
Create a new notebook using Zeppelin,
|
||||
### Create a note using Zeppelin
|
||||
Create a new note using Zeppelin,
|
||||
you can use ```%md``` interpreter for markdown content or any other interpreter you like.
|
||||
You can also use the display system to generate [text](../displaysystem/basicdisplaysystem.html#text), [html](../displaysystem/basicdisplaysystem.html#html), [table](../displaysystem/basicdisplaysystem.html#table) or
|
||||
Angular ([backend API](../displaysystem/back-end-angular.html), [frontend API](../displaysystem/front-end-angular.html)).
|
||||
|
||||
Run (shift+Enter) the notebook and see the output. Optionally, change the notebook view to report to hide
|
||||
Run (shift+Enter) the note and see the output. Optionally, change the note view to report to hide
|
||||
the code sections.
|
||||
|
||||
### Set the note id in the config file
|
||||
To set the note id in the config file, you should copy it from the last word in the notebook url.
|
||||
To set the note id in the config file, you should copy it from the last word in the note url.
|
||||
For example,
|
||||
|
||||
<img src="/assets/themes/zeppelin/img/screenshots/homepage_notebook_id.png" width="400px" />
|
||||
|
|
@ -53,7 +53,7 @@ Set the note id to the ```ZEPPELIN_NOTEBOOK_HOMESCREEN``` environment variable
|
|||
or ```zeppelin.notebook.homescreen``` property.
|
||||
|
||||
You can also set the ```ZEPPELIN_NOTEBOOK_HOMESCREEN_HIDE``` environment variable
|
||||
or ```zeppelin.notebook.homescreen.hide``` property to hide the new notebook from the notebook list.
|
||||
or ```zeppelin.notebook.homescreen.hide``` property to hide the new note from the note list.
|
||||
|
||||
### Restart Zeppelin
|
||||
Restart your Zeppelin server
|
||||
|
|
@ -89,7 +89,7 @@ println(
|
|||
""")
|
||||
```
|
||||
|
||||
After running the notebook you will see output similar to this one:
|
||||
After running the note you will see output similar to this one:
|
||||
<img src="/assets/themes/zeppelin/img/screenshots/homepage_notebook_list.png" />
|
||||
|
||||
The main trick here relays in linking the ```<div>``` to the controller:
|
||||
|
|
@ -99,4 +99,4 @@ The main trick here relays in linking the ```<div>``` to the controller:
|
|||
```
|
||||
|
||||
Once we have ```home``` as our controller variable in our ```<div></div>```
|
||||
we can use ```home.notes.list``` to get access to the notebook list.
|
||||
we can use ```home.notes.list``` to get access to the note list.
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
|
||||
Notebooks REST API supports the following operations: List, Create, Get, Delete, Clone, Run, Export, Import as detailed in the following tables.
|
||||
|
||||
### List of the notebooks
|
||||
### List of the notes
|
||||
<table class="table-configuration">
|
||||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```GET``` method lists the available notebooks on your server.
|
||||
Notebook JSON contains the ```name``` and ```id``` of all notebooks.
|
||||
<td>This ```GET``` method lists the available notes on your server.
|
||||
Notebook JSON contains the ```name``` and ```id``` of all notes.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -77,12 +77,12 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</table>
|
||||
|
||||
<br/>
|
||||
### Create a new notebook
|
||||
### Create a new note
|
||||
<table class="table-configuration">
|
||||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```POST``` method creates a new notebook using the given name or default name if none given.
|
||||
<td>This ```POST``` method creates a new note using the given name or default name if none given.
|
||||
The body field of the returned JSON contains the new note id.
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -100,13 +100,13 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td> sample JSON input (without paragraphs) </td>
|
||||
<td><pre>{"name": "name of new notebook"}</pre></td>
|
||||
<td><pre>{"name": "name of new note"}</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> sample JSON input (with initial paragraphs) </td>
|
||||
<td><pre>
|
||||
{
|
||||
"name": "name of new notebook",
|
||||
"name": "name of new note",
|
||||
"paragraphs": [
|
||||
{
|
||||
"title": "paragraph title1",
|
||||
|
|
@ -131,13 +131,13 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</table>
|
||||
|
||||
<br/>
|
||||
### Get an existing notebook information
|
||||
### Get an existing note information
|
||||
<table class="table-configuration">
|
||||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```GET``` method retrieves an existing notebook's information using the given id.
|
||||
The body field of the returned JSON contain information about paragraphs in the notebook.
|
||||
<td>This ```GET``` method retrieves an existing note's information using the given id.
|
||||
The body field of the returned JSON contain information about paragraphs in the note.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -228,12 +228,12 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</table>
|
||||
|
||||
<br/>
|
||||
### Delete a notebook
|
||||
### Delete a note
|
||||
<table class="table-configuration">
|
||||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```DELETE``` method deletes a notebook by the given note id.
|
||||
<td>This ```DELETE``` method deletes a note by the given note id.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -255,12 +255,12 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</table>
|
||||
|
||||
<br/>
|
||||
### Clone a notebook
|
||||
### Clone a note
|
||||
<table class="table-configuration">
|
||||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```POST``` method clones a notebook by the given id and create a new notebook using the given name
|
||||
<td>This ```POST``` method clones a note by the given id and create a new note using the given name
|
||||
or default name if none given.
|
||||
The body field of the returned JSON contains the new note id.
|
||||
</td>
|
||||
|
|
@ -279,7 +279,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td> sample JSON input </td>
|
||||
<td><pre>{"name": "name of new notebook"}</pre></td>
|
||||
<td><pre>{"name": "name of new note"}</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> sample JSON response </td>
|
||||
|
|
@ -418,7 +418,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```GET``` method gets the status of a single paragraph by the given notebook and paragraph id.
|
||||
<td>This ```GET``` method gets the status of a single paragraph by the given note and paragraph id.
|
||||
The body field of the returned JSON contains of the array that compose of the paragraph id, paragraph status, paragraph finish date, paragraph started date.
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -455,7 +455,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```POST``` method runs the paragraph asynchronously by given notebook and paragraph id. This API always return SUCCESS even if the execution of the paragraph fails later because the API is asynchronous
|
||||
<td>This ```POST``` method runs the paragraph asynchronously by given note and paragraph id. This API always return SUCCESS even if the execution of the paragraph fails later because the API is asynchronous
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -474,7 +474,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
<td> sample JSON input (optional, only needed when if you want to update dynamic form's value) </td>
|
||||
<td><pre>
|
||||
{
|
||||
"name": "name of new notebook",
|
||||
"name": "name of new note",
|
||||
"params": {
|
||||
"formLabel1": "value1",
|
||||
"formLabel2": "value2"
|
||||
|
|
@ -493,7 +493,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td> This ```POST``` method runs the paragraph synchronously by given notebook and paragraph id. This API can return SUCCESS or ERROR depending on the outcome of the paragraph execution
|
||||
<td> This ```POST``` method runs the paragraph synchronously by given note and paragraph id. This API can return SUCCESS or ERROR depending on the outcome of the paragraph execution
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -512,7 +512,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
<td> sample JSON input (optional, only needed when if you want to update dynamic form's value) </td>
|
||||
<td><pre>
|
||||
{
|
||||
"name": "name of new notebook",
|
||||
"name": "name of new note",
|
||||
"params": {
|
||||
"formLabel1": "value1",
|
||||
"formLabel2": "value2"
|
||||
|
|
@ -543,7 +543,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```DELETE``` method stops the paragraph by given notebook and paragraph id.
|
||||
<td>This ```DELETE``` method stops the paragraph by given note and paragraph id.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -587,7 +587,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</tr>
|
||||
<tr>
|
||||
<td> sample JSON input </td>
|
||||
<td><pre>{"cron": "cron expression of notebook"}</pre></td>
|
||||
<td><pre>{"cron": "cron expression of note"}</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> sample JSON response </td>
|
||||
|
|
@ -653,7 +653,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</table>
|
||||
|
||||
<br />
|
||||
### Full text search through the paragraphs in all notebooks
|
||||
### Full text search through the paragraphs in all notes
|
||||
<table class="table-configuration">
|
||||
<col width="200">
|
||||
<tr>
|
||||
|
|
@ -681,7 +681,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
"body": [
|
||||
{
|
||||
"id": "<noteId>/paragraph/<paragraphId>",
|
||||
"name":"Notebook Name",
|
||||
"name":"Note Name",
|
||||
"snippet":"",
|
||||
"text":""
|
||||
}
|
||||
|
|
@ -814,7 +814,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```POST``` method moves a paragraph to the specific index (order) from the notebook.
|
||||
<td>This ```POST``` method moves a paragraph to the specific index (order) from the note.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -842,7 +842,7 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```DELETE``` method deletes a paragraph by the given notebook and paragraph id.
|
||||
<td>This ```DELETE``` method deletes a paragraph by the given note and paragraph id.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -864,12 +864,12 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</table>
|
||||
|
||||
<br />
|
||||
### Export a notebook
|
||||
### Export a note
|
||||
<table class="table-configuration">
|
||||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```GET``` method exports a notebook by the given id and gernerates a JSON
|
||||
<td>This ```GET``` method exports a note by the given id and gernerates a JSON
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -914,12 +914,12 @@ If you work with Apache Zeppelin and find a need for an additional REST API, ple
|
|||
</table>
|
||||
|
||||
<br />
|
||||
### Import a notebook
|
||||
### Import a note
|
||||
<table class="table-configuration">
|
||||
<col width="200">
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>This ```POST``` method imports a notebook from the notebook JSON input
|
||||
<td>This ```POST``` method imports a note from the note JSON input
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ import org.apache.zeppelin.user.AuthenticationInfo;
|
|||
import org.apache.zeppelin.utils.SecurityUtils;
|
||||
|
||||
/**
|
||||
* Rest api endpoint for the noteBook.
|
||||
* Rest api endpoint for the notebook.
|
||||
*/
|
||||
@Path("/notebook")
|
||||
@Produces("application/json")
|
||||
|
|
@ -181,7 +181,7 @@ public class NotebookRestApi {
|
|||
}
|
||||
|
||||
/**
|
||||
* list binded setting
|
||||
* list bound setting
|
||||
*/
|
||||
@GET
|
||||
@Path("interpreter/bind/{noteId}")
|
||||
|
|
@ -223,9 +223,9 @@ public class NotebookRestApi {
|
|||
* @throws IOException
|
||||
*/
|
||||
@GET
|
||||
@Path("export/{id}")
|
||||
@Path("export/{noteId}")
|
||||
@ZeppelinApi
|
||||
public Response exportNote(@PathParam("id") String noteId) throws IOException {
|
||||
public Response exportNote(@PathParam("noteId") String noteId) throws IOException {
|
||||
String exportJson = notebook.exportNote(noteId);
|
||||
return new JsonResponse<>(Status.OK, "", exportJson).build();
|
||||
}
|
||||
|
|
@ -233,14 +233,14 @@ public class NotebookRestApi {
|
|||
/**
|
||||
* import new note REST API
|
||||
*
|
||||
* @param req - notebook Json
|
||||
* @param req - note Json
|
||||
* @return JSON with new note ID
|
||||
* @throws IOException
|
||||
*/
|
||||
@POST
|
||||
@Path("import")
|
||||
@ZeppelinApi
|
||||
public Response importNotebook(String req) throws IOException {
|
||||
public Response importNote(String req) throws IOException {
|
||||
AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
|
||||
Note newNote = notebook.importNote(req, null, subject);
|
||||
return new JsonResponse<>(Status.CREATED, "", newNote.getId()).build();
|
||||
|
|
@ -257,7 +257,7 @@ public class NotebookRestApi {
|
|||
@Path("/")
|
||||
@ZeppelinApi
|
||||
public Response createNote(String message) throws IOException {
|
||||
LOG.info("Create new notebook by JSON {}", message);
|
||||
LOG.info("Create new note by JSON {}", message);
|
||||
NewNoteRequest request = gson.fromJson(message, NewNoteRequest.class);
|
||||
AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
|
||||
Note note = notebook.createNote(subject);
|
||||
|
|
@ -318,7 +318,7 @@ public class NotebookRestApi {
|
|||
@ZeppelinApi
|
||||
public Response cloneNote(@PathParam("noteId") String noteId, String message)
|
||||
throws IOException, CloneNotSupportedException, IllegalArgumentException {
|
||||
LOG.info("clone notebook by JSON {}", message);
|
||||
LOG.info("clone note by JSON {}", message);
|
||||
NewNoteRequest request = gson.fromJson(message, NewNoteRequest.class);
|
||||
String newNoteName = null;
|
||||
if (request != null) {
|
||||
|
|
@ -477,7 +477,7 @@ public class NotebookRestApi {
|
|||
@ZeppelinApi
|
||||
public Response runNoteJobs(@PathParam("noteId") String noteId)
|
||||
throws IOException, IllegalArgumentException {
|
||||
LOG.info("run notebook jobs {} ", noteId);
|
||||
LOG.info("run note jobs {} ", noteId);
|
||||
Note note = notebook.getNote(noteId);
|
||||
if (note == null) {
|
||||
return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build();
|
||||
|
|
@ -521,7 +521,7 @@ public class NotebookRestApi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get notebook job status REST API
|
||||
* Get note job status REST API
|
||||
*
|
||||
* @param noteId ID of Note
|
||||
* @return JSON with status.OK
|
||||
|
|
@ -532,7 +532,7 @@ public class NotebookRestApi {
|
|||
@ZeppelinApi
|
||||
public Response getNoteJobStatus(@PathParam("noteId") String noteId)
|
||||
throws IOException, IllegalArgumentException {
|
||||
LOG.info("get notebook job status.");
|
||||
LOG.info("get note job status.");
|
||||
Note note = notebook.getNote(noteId);
|
||||
if (note == null) {
|
||||
return new JsonResponse<>(Status.NOT_FOUND, "note not found.").build();
|
||||
|
|
@ -542,7 +542,7 @@ public class NotebookRestApi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get notebook paragraph job status REST API
|
||||
* Get note paragraph job status REST API
|
||||
*
|
||||
* @param noteId ID of Note
|
||||
* @param paragraphId ID of Paragraph
|
||||
|
|
@ -669,10 +669,6 @@ public class NotebookRestApi {
|
|||
@ZeppelinApi
|
||||
public Response stopParagraph(@PathParam("noteId") String noteId,
|
||||
@PathParam("paragraphId") String paragraphId) throws IOException, IllegalArgumentException {
|
||||
/**
|
||||
* TODO(jl): Fixed noteId to noteId
|
||||
* https://issues.apache.org/jira/browse/ZEPPELIN-1163
|
||||
*/
|
||||
LOG.info("stop paragraph job {} ", noteId);
|
||||
Note note = notebook.getNote(noteId);
|
||||
if (note == null) {
|
||||
|
|
@ -699,7 +695,6 @@ public class NotebookRestApi {
|
|||
@ZeppelinApi
|
||||
public Response registerCronJob(@PathParam("noteId") String noteId, String message)
|
||||
throws IOException, IllegalArgumentException {
|
||||
// TODO(jl): Fixed noteId to noteId
|
||||
LOG.info("Register cron job note={} request cron msg={}", noteId, message);
|
||||
|
||||
CronRequest request = gson.fromJson(message, CronRequest.class);
|
||||
|
|
@ -733,7 +728,6 @@ public class NotebookRestApi {
|
|||
@ZeppelinApi
|
||||
public Response removeCronJob(@PathParam("noteId") String noteId)
|
||||
throws IOException, IllegalArgumentException {
|
||||
// TODO(jl): Fixed noteId to noteId
|
||||
LOG.info("Remove cron job note {}", noteId);
|
||||
|
||||
Note note = notebook.getNote(noteId);
|
||||
|
|
@ -761,7 +755,6 @@ public class NotebookRestApi {
|
|||
@ZeppelinApi
|
||||
public Response getCronJob(@PathParam("noteId") String noteId)
|
||||
throws IOException, IllegalArgumentException {
|
||||
// TODO(jl): Fixed noteId to noteId
|
||||
LOG.info("Get cron job note {}", noteId);
|
||||
|
||||
Note note = notebook.getNote(noteId);
|
||||
|
|
@ -773,7 +766,7 @@ public class NotebookRestApi {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get notebook jobs for job manager
|
||||
* Get note jobs for job manager
|
||||
*
|
||||
* @return JSON with status.OK
|
||||
* @throws IOException, IllegalArgumentException
|
||||
|
|
@ -781,22 +774,22 @@ public class NotebookRestApi {
|
|||
@GET
|
||||
@Path("jobmanager/")
|
||||
@ZeppelinApi
|
||||
public Response getJobListforNotebook() throws IOException, IllegalArgumentException {
|
||||
LOG.info("Get notebook jobs for job manager");
|
||||
public Response getJobListforNote() throws IOException, IllegalArgumentException {
|
||||
LOG.info("Get note jobs for job manager");
|
||||
|
||||
AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
|
||||
List<Map<String, Object>> notebookJobs = notebook
|
||||
.getJobListByUnixTime(false, 0, subject);
|
||||
List<Map<String, Object>> noteJobs = notebook
|
||||
.getJobListByUnixTime(false, 0, subject);
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
||||
response.put("lastResponseUnixTime", System.currentTimeMillis());
|
||||
response.put("jobs", notebookJobs);
|
||||
response.put("jobs", noteJobs);
|
||||
|
||||
return new JsonResponse<>(Status.OK, response).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get updated notebook jobs for job manager
|
||||
* Get updated note jobs for job manager
|
||||
*
|
||||
* Return the `Note` change information within the post unix timestamp.
|
||||
*
|
||||
|
|
@ -806,18 +799,18 @@ public class NotebookRestApi {
|
|||
@GET
|
||||
@Path("jobmanager/{lastUpdateUnixtime}/")
|
||||
@ZeppelinApi
|
||||
public Response getUpdatedJobListforNotebook(
|
||||
public Response getUpdatedJobListforNote(
|
||||
@PathParam("lastUpdateUnixtime") long lastUpdateUnixTime)
|
||||
throws IOException, IllegalArgumentException {
|
||||
LOG.info("Get updated notebook jobs lastUpdateTime {}", lastUpdateUnixTime);
|
||||
LOG.info("Get updated note jobs lastUpdateTime {}", lastUpdateUnixTime);
|
||||
|
||||
List<Map<String, Object>> notebookJobs;
|
||||
List<Map<String, Object>> noteJobs;
|
||||
AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
|
||||
notebookJobs = notebook.getJobListByUnixTime(false, lastUpdateUnixTime, subject);
|
||||
noteJobs = notebook.getJobListByUnixTime(false, lastUpdateUnixTime, subject);
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
||||
response.put("lastResponseUnixTime", System.currentTimeMillis());
|
||||
response.put("jobs", notebookJobs);
|
||||
response.put("jobs", noteJobs);
|
||||
|
||||
return new JsonResponse<>(Status.OK, response).build();
|
||||
}
|
||||
|
|
@ -835,19 +828,19 @@ public class NotebookRestApi {
|
|||
HashSet<String> userAndRoles = new HashSet<>();
|
||||
userAndRoles.add(principal);
|
||||
userAndRoles.addAll(roles);
|
||||
List<Map<String, String>> notes = noteSearchService.query(queryTerm);
|
||||
for (int i = 0; i < notes.size(); i++) {
|
||||
String[] Id = notes.get(i).get("id").split("/", 2);
|
||||
List<Map<String, String>> notesFound = noteSearchService.query(queryTerm);
|
||||
for (int i = 0; i < notesFound.size(); i++) {
|
||||
String[] Id = notesFound.get(i).get("id").split("/", 2);
|
||||
String noteId = Id[0];
|
||||
if (!notebookAuthorization.isOwner(noteId, userAndRoles) &&
|
||||
!notebookAuthorization.isReader(noteId, userAndRoles) &&
|
||||
!notebookAuthorization.isWriter(noteId, userAndRoles)) {
|
||||
notes.remove(i);
|
||||
notesFound.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
LOG.info("{} notes found", notes.size());
|
||||
return new JsonResponse<>(Status.OK, notes).build();
|
||||
LOG.info("{} notes found", notesFound.size());
|
||||
return new JsonResponse<>(Status.OK, notesFound).build();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -856,7 +849,7 @@ public class NotebookRestApi {
|
|||
// handle params if presented
|
||||
if (!StringUtils.isEmpty(message)) {
|
||||
RunParagraphWithParametersRequest request =
|
||||
gson.fromJson(message, RunParagraphWithParametersRequest.class);
|
||||
gson.fromJson(message, RunParagraphWithParametersRequest.class);
|
||||
Map<String, Object> paramsForUpdating = request.getParams();
|
||||
if (paramsForUpdating != null) {
|
||||
paragraph.settings.getParams().putAll(paramsForUpdating);
|
||||
|
|
|
|||
|
|
@ -235,8 +235,8 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
case LIST_CONFIGURATIONS:
|
||||
sendAllConfigurations(conn, userAndRoles, notebook);
|
||||
break;
|
||||
case CHECKPOINT_NOTEBOOK:
|
||||
checkpointNotebook(conn, notebook, messagereceived);
|
||||
case CHECKPOINT_NOTE:
|
||||
checkpointNote(conn, notebook, messagereceived);
|
||||
break;
|
||||
case LIST_REVISION_HISTORY:
|
||||
listRevisionHistory(conn, notebook, messagereceived);
|
||||
|
|
@ -244,11 +244,11 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
case NOTE_REVISION:
|
||||
getNoteByRevision(conn, notebook, messagereceived);
|
||||
break;
|
||||
case LIST_NOTEBOOK_JOBS:
|
||||
unicastNotebookJobInfo(conn, messagereceived);
|
||||
case LIST_NOTE_JOBS:
|
||||
unicastNoteJobInfo(conn, messagereceived);
|
||||
break;
|
||||
case UNSUBSCRIBE_UPDATE_NOTEBOOK_JOBS:
|
||||
unsubscribeNotebookJobInfo(conn);
|
||||
case UNSUBSCRIBE_UPDATE_NOTE_JOBS:
|
||||
unsubscribeNoteJobInfo(conn);
|
||||
break;
|
||||
case GET_INTERPRETER_BINDINGS:
|
||||
getInterpreterBindings(conn, messagereceived);
|
||||
|
|
@ -430,38 +430,38 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
}
|
||||
}
|
||||
|
||||
public void unicastNotebookJobInfo(NotebookSocket conn, Message fromMessage) throws IOException {
|
||||
public void unicastNoteJobInfo(NotebookSocket conn, Message fromMessage) throws IOException {
|
||||
addConnectionToNote(JOB_MANAGER_SERVICE.JOB_MANAGER_PAGE.getKey(), conn);
|
||||
AuthenticationInfo subject = new AuthenticationInfo(fromMessage.principal);
|
||||
List<Map<String, Object>> notebookJobs = notebook()
|
||||
List<Map<String, Object>> noteJobs = notebook()
|
||||
.getJobListByUnixTime(false, 0, subject);
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
||||
response.put("lastResponseUnixTime", System.currentTimeMillis());
|
||||
response.put("jobs", notebookJobs);
|
||||
response.put("jobs", noteJobs);
|
||||
|
||||
conn.send(serializeMessage(new Message(OP.LIST_NOTEBOOK_JOBS)
|
||||
.put("notebookJobs", response)));
|
||||
conn.send(serializeMessage(new Message(OP.LIST_NOTE_JOBS)
|
||||
.put("noteJobs", response)));
|
||||
}
|
||||
|
||||
public void broadcastUpdateNotebookJobInfo(long lastUpdateUnixTime) throws IOException {
|
||||
List<Map<String, Object>> notebookJobs = new LinkedList<>();
|
||||
public void broadcastUpdateNoteJobInfo(long lastUpdateUnixTime) throws IOException {
|
||||
List<Map<String, Object>> noteJobs = new LinkedList<>();
|
||||
Notebook notebookObject = notebook();
|
||||
List<Map<String, Object>> jobNotes = null;
|
||||
if (notebookObject != null) {
|
||||
jobNotes = notebook().getJobListByUnixTime(false, lastUpdateUnixTime, null);
|
||||
notebookJobs = jobNotes == null ? notebookJobs : jobNotes;
|
||||
noteJobs = jobNotes == null ? noteJobs : jobNotes;
|
||||
}
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("lastResponseUnixTime", System.currentTimeMillis());
|
||||
response.put("jobs", notebookJobs != null ? notebookJobs : new LinkedList<>());
|
||||
response.put("jobs", noteJobs != null ? noteJobs : new LinkedList<>());
|
||||
|
||||
broadcast(JOB_MANAGER_SERVICE.JOB_MANAGER_PAGE.getKey(),
|
||||
new Message(OP.LIST_UPDATE_NOTEBOOK_JOBS).put("notebookRunningJobs", response));
|
||||
new Message(OP.LIST_UPDATE_NOTE_JOBS).put("noteRunningJobs", response));
|
||||
}
|
||||
|
||||
public void unsubscribeNotebookJobInfo(NotebookSocket conn) {
|
||||
public void unsubscribeNoteJobInfo(NotebookSocket conn) {
|
||||
removeConnectionFromNote(JOB_MANAGER_SERVICE.JOB_MANAGER_PAGE.getKey(), conn);
|
||||
}
|
||||
|
||||
|
|
@ -785,8 +785,8 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
throws IOException {
|
||||
Note note = null;
|
||||
if (fromMessage != null) {
|
||||
String noteName = (String) ((Map) fromMessage.get("notebook")).get("name");
|
||||
String noteJson = gson.toJson(fromMessage.get("notebook"));
|
||||
String noteName = (String) ((Map) fromMessage.get("note")).get("name");
|
||||
String noteJson = gson.toJson(fromMessage.get("note"));
|
||||
AuthenticationInfo subject = null;
|
||||
if (fromMessage.principal != null) {
|
||||
subject = new AuthenticationInfo(fromMessage.principal);
|
||||
|
|
@ -1096,12 +1096,12 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
final AngularObject removed = registry.remove(varName, noteId, paragraphId);
|
||||
if (removed != null) {
|
||||
this.broadcastExcept(
|
||||
noteId,
|
||||
new Message(OP.ANGULAR_OBJECT_REMOVE).put("angularObject", removed)
|
||||
.put("interpreterGroupId", interpreterGroupId)
|
||||
.put("noteId", noteId)
|
||||
.put("paragraphId", paragraphId),
|
||||
conn);
|
||||
noteId,
|
||||
new Message(OP.ANGULAR_OBJECT_REMOVE).put("angularObject", removed)
|
||||
.put("interpreterGroupId", interpreterGroupId)
|
||||
.put("noteId", noteId)
|
||||
.put("paragraphId", paragraphId),
|
||||
conn);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1132,7 +1132,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
private void insertParagraph(NotebookSocket conn, HashSet<String> userAndRoles,
|
||||
Notebook notebook, Message fromMessage) throws IOException {
|
||||
final int index = (int) Double.parseDouble(fromMessage.get("index")
|
||||
.toString());
|
||||
.toString());
|
||||
String noteId = getOpenNoteId(conn);
|
||||
final Note note = notebook.getNote(noteId);
|
||||
NotebookAuthorization notebookAuthorization = notebook.getNotebookAuthorization();
|
||||
|
|
@ -1252,7 +1252,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
.put("configurations", configurations)));
|
||||
}
|
||||
|
||||
private void checkpointNotebook(NotebookSocket conn, Notebook notebook,
|
||||
private void checkpointNote(NotebookSocket conn, Notebook notebook,
|
||||
Message fromMessage) throws IOException {
|
||||
String noteId = (String) fromMessage.get("noteId");
|
||||
String commitMessage = (String) fromMessage.get("commitMessage");
|
||||
|
|
@ -1384,7 +1384,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
@Override
|
||||
public void onParagraphRemove(Paragraph p) {
|
||||
try {
|
||||
notebookServer.broadcastUpdateNotebookJobInfo(System.currentTimeMillis() - 5000);
|
||||
notebookServer.broadcastUpdateNoteJobInfo(System.currentTimeMillis() - 5000);
|
||||
} catch (IOException ioe) {
|
||||
LOG.error("can not broadcast for job manager {}", ioe.getMessage());
|
||||
}
|
||||
|
|
@ -1393,7 +1393,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
@Override
|
||||
public void onNoteRemove(Note note) {
|
||||
try {
|
||||
notebookServer.broadcastUpdateNotebookJobInfo(System.currentTimeMillis() - 5000);
|
||||
notebookServer.broadcastUpdateNoteJobInfo(System.currentTimeMillis() - 5000);
|
||||
} catch (IOException ioe) {
|
||||
LOG.error("can not broadcast for job manager {}", ioe.getMessage());
|
||||
}
|
||||
|
|
@ -1416,7 +1416,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
response.put("jobs", notesInfo);
|
||||
|
||||
notebookServer.broadcast(JOB_MANAGER_SERVICE.JOB_MANAGER_PAGE.getKey(),
|
||||
new Message(OP.LIST_UPDATE_NOTEBOOK_JOBS).put("notebookRunningJobs", response));
|
||||
new Message(OP.LIST_UPDATE_NOTE_JOBS).put("noteRunningJobs", response));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1424,35 +1424,35 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
public void onParagraphCreate(Paragraph p) {
|
||||
Notebook notebook = notebookServer.notebook();
|
||||
List<Map<String, Object>> notebookJobs = notebook.getJobListByParagraphId(
|
||||
p.getId()
|
||||
p.getId()
|
||||
);
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("lastResponseUnixTime", System.currentTimeMillis());
|
||||
response.put("jobs", notebookJobs);
|
||||
|
||||
notebookServer.broadcast(JOB_MANAGER_SERVICE.JOB_MANAGER_PAGE.getKey(),
|
||||
new Message(OP.LIST_UPDATE_NOTEBOOK_JOBS).put("notebookRunningJobs", response));
|
||||
new Message(OP.LIST_UPDATE_NOTE_JOBS).put("noteRunningJobs", response));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNoteCreate(Note note) {
|
||||
Notebook notebook = notebookServer.notebook();
|
||||
List<Map<String, Object>> notebookJobs = notebook.getJobListByNoteId(
|
||||
note.getId()
|
||||
note.getId()
|
||||
);
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("lastResponseUnixTime", System.currentTimeMillis());
|
||||
response.put("jobs", notebookJobs);
|
||||
|
||||
notebookServer.broadcast(JOB_MANAGER_SERVICE.JOB_MANAGER_PAGE.getKey(),
|
||||
new Message(OP.LIST_UPDATE_NOTEBOOK_JOBS).put("notebookRunningJobs", response));
|
||||
new Message(OP.LIST_UPDATE_NOTE_JOBS).put("noteRunningJobs", response));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onParagraphStatusChange(Paragraph p, Status status) {
|
||||
Notebook notebook = notebookServer.notebook();
|
||||
List<Map<String, Object>> notebookJobs = notebook.getJobListByParagraphId(
|
||||
p.getId()
|
||||
p.getId()
|
||||
);
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
|
@ -1460,21 +1460,21 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
response.put("jobs", notebookJobs);
|
||||
|
||||
notebookServer.broadcast(JOB_MANAGER_SERVICE.JOB_MANAGER_PAGE.getKey(),
|
||||
new Message(OP.LIST_UPDATE_NOTEBOOK_JOBS).put("notebookRunningJobs", response));
|
||||
new Message(OP.LIST_UPDATE_NOTE_JOBS).put("noteRunningJobs", response));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnbindInterpreter(Note note, InterpreterSetting setting) {
|
||||
Notebook notebook = notebookServer.notebook();
|
||||
List<Map<String, Object>> notebookJobs = notebook.getJobListByNoteId(
|
||||
note.getId()
|
||||
note.getId()
|
||||
);
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("lastResponseUnixTime", System.currentTimeMillis());
|
||||
response.put("jobs", notebookJobs);
|
||||
|
||||
notebookServer.broadcast(JOB_MANAGER_SERVICE.JOB_MANAGER_PAGE.getKey(),
|
||||
new Message(OP.LIST_UPDATE_NOTEBOOK_JOBS).put("notebookRunningJobs", response));
|
||||
new Message(OP.LIST_UPDATE_NOTE_JOBS).put("noteRunningJobs", response));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1523,7 +1523,7 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
notebookServer.broadcastNote(note);
|
||||
|
||||
try {
|
||||
notebookServer.broadcastUpdateNotebookJobInfo(System.currentTimeMillis() - 5000);
|
||||
notebookServer.broadcastUpdateNoteJobInfo(System.currentTimeMillis() - 5000);
|
||||
} catch (IOException e) {
|
||||
LOG.error("can not broadcast for job manager {}", e);
|
||||
}
|
||||
|
|
@ -1538,9 +1538,9 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
@Override
|
||||
public void onOutputAppend(Paragraph paragraph, InterpreterOutput out, String output) {
|
||||
Message msg = new Message(OP.PARAGRAPH_APPEND_OUTPUT)
|
||||
.put("noteId", paragraph.getNote().getId())
|
||||
.put("paragraphId", paragraph.getId())
|
||||
.put("data", output);
|
||||
.put("noteId", paragraph.getNote().getId())
|
||||
.put("paragraphId", paragraph.getId())
|
||||
.put("data", output);
|
||||
|
||||
notebookServer.broadcast(paragraph.getNote().getId(), msg);
|
||||
}
|
||||
|
|
@ -1554,9 +1554,9 @@ public class NotebookServer extends WebSocketServlet implements
|
|||
@Override
|
||||
public void onOutputUpdate(Paragraph paragraph, InterpreterOutput out, String output) {
|
||||
Message msg = new Message(OP.PARAGRAPH_UPDATE_OUTPUT)
|
||||
.put("noteId", paragraph.getNote().getId())
|
||||
.put("paragraphId", paragraph.getId())
|
||||
.put("data", output);
|
||||
.put("noteId", paragraph.getNote().getId())
|
||||
.put("paragraphId", paragraph.getId())
|
||||
.put("data", output);
|
||||
|
||||
notebookServer.broadcast(paragraph.getNote().getId(), msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,8 +96,8 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
paragraph.setText(paragraphText);
|
||||
note.persist(anonymous);
|
||||
|
||||
String sourcenoteId = note.getId();
|
||||
GetMethod get = httpGet("/notebook/" + sourcenoteId);
|
||||
String sourceNoteId = note.getId();
|
||||
GetMethod get = httpGet("/notebook/" + sourceNoteId);
|
||||
LOG.info("testGetNoteInfo \n" + get.getResponseBodyAsString());
|
||||
assertThat("test note get method:", get, isAllowed());
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
assertTrue(paragraphs.size() > 0);
|
||||
assertEquals(paragraphText, paragraphs.get(0).get("text"));
|
||||
//
|
||||
ZeppelinServer.notebook.removeNote(sourcenoteId, anonymous);
|
||||
ZeppelinServer.notebook.removeNote(sourceNoteId, anonymous);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -142,16 +142,16 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
|
||||
String newnoteId = (String) resp.get("body");
|
||||
LOG.info("newnoteId:=" + newnoteId);
|
||||
Note newNote = ZeppelinServer.notebook.getNote(newnoteId);
|
||||
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 " + newnoteId;
|
||||
expectedNoteName = "Note " + newNoteId;
|
||||
}
|
||||
assertEquals("compare note name", expectedNoteName, newNoteName);
|
||||
assertEquals("initial paragraph check failed", 3, newNote.getParagraphs().size());
|
||||
|
|
@ -163,7 +163,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
assertTrue("paragraph text check failed", p.getText().startsWith("text"));
|
||||
}
|
||||
// cleanup
|
||||
ZeppelinServer.notebook.removeNote(newnoteId, anonymous);
|
||||
ZeppelinServer.notebook.removeNote(newNoteId, anonymous);
|
||||
post.releaseConnection();
|
||||
}
|
||||
|
||||
|
|
@ -177,20 +177,20 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
|
||||
String newnoteId = (String) resp.get("body");
|
||||
LOG.info("newnoteId:=" + newnoteId);
|
||||
Note newNote = ZeppelinServer.notebook.getNote(newnoteId);
|
||||
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 " + newnoteId;
|
||||
expectedNoteName = "Note " + newNoteId;
|
||||
}
|
||||
assertEquals("compare note name", expectedNoteName, newNoteName);
|
||||
// cleanup
|
||||
ZeppelinServer.notebook.removeNote(newnoteId, anonymous);
|
||||
ZeppelinServer.notebook.removeNote(newNoteId, anonymous);
|
||||
post.releaseConnection();
|
||||
|
||||
}
|
||||
|
|
@ -224,9 +224,9 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
paragraph.setConfig(config);
|
||||
paragraph.setText("%md This is my new paragraph in my new note");
|
||||
note.persist(anonymous);
|
||||
String sourcenoteId = note.getId();
|
||||
String sourceNoteId = note.getId();
|
||||
// Call export Note REST API
|
||||
GetMethod get = httpGet("/notebook/export/" + sourcenoteId);
|
||||
GetMethod get = httpGet("/notebook/export/" + sourceNoteId);
|
||||
LOG.info("testNoteExport \n" + get.getResponseBodyAsString());
|
||||
assertThat("test note export method:", get, isAllowed());
|
||||
|
||||
|
|
@ -237,7 +237,7 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
String exportJSON = (String) resp.get("body");
|
||||
assertNotNull("Can not find new notejson", exportJSON);
|
||||
LOG.info("export JSON:=" + exportJSON);
|
||||
ZeppelinServer.notebook.removeNote(sourcenoteId, anonymous);
|
||||
ZeppelinServer.notebook.removeNote(sourceNoteId, anonymous);
|
||||
get.releaseConnection();
|
||||
|
||||
}
|
||||
|
|
@ -257,9 +257,9 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
paragraph.setConfig(config);
|
||||
paragraph.setText("%md This is my new paragraph in my new note");
|
||||
note.persist(anonymous);
|
||||
String sourcenoteId = note.getId();
|
||||
String sourceNoteId = note.getId();
|
||||
// get note content as JSON
|
||||
String oldJson = getNoteContent(sourcenoteId);
|
||||
String oldJson = getNoteContent(sourceNoteId);
|
||||
// call note post
|
||||
PostMethod importPost = httpPost("/notebook/import/", oldJson);
|
||||
assertThat(importPost, isCreated());
|
||||
|
|
@ -319,21 +319,21 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
|
|||
paragraph.setConfig(config);
|
||||
paragraph.setText("%md This is my new paragraph in my new note");
|
||||
note.persist(anonymous);
|
||||
String sourcenoteId = note.getId();
|
||||
String sourceNoteId = note.getId();
|
||||
|
||||
String noteName = "clone Note Name";
|
||||
// Call Clone Note REST API
|
||||
String jsonRequest = "{\"name\":\"" + noteName + "\"}";
|
||||
PostMethod post = httpPost("/notebook/" + sourcenoteId, jsonRequest);
|
||||
PostMethod post = httpPost("/notebook/" + sourceNoteId, jsonRequest);
|
||||
LOG.info("testNoteClone \n" + post.getResponseBodyAsString());
|
||||
assertThat("test note clone method:", post, isCreated());
|
||||
|
||||
Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
|
||||
String newnoteId = (String) resp.get("body");
|
||||
LOG.info("newnoteId:=" + newnoteId);
|
||||
Note newNote = ZeppelinServer.notebook.getNote(newnoteId);
|
||||
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());
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
$scope.jobInfomations = [];
|
||||
$scope.JobInfomationsByFilter = $scope.jobInfomations;
|
||||
|
||||
websocketMsgSrv.getNotebookJobsList();
|
||||
websocketMsgSrv.getNoteJobsList();
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
websocketMsgSrv.unsubscribeJobManager();
|
||||
|
|
@ -45,13 +45,13 @@
|
|||
** $scope.$on functions below
|
||||
*/
|
||||
|
||||
$scope.$on('setNotebookJobs', function(event, responseData) {
|
||||
$scope.$on('setNoteJobs', function(event, responseData) {
|
||||
$scope.lastJobServerUnixTime = responseData.lastResponseUnixTime;
|
||||
$scope.jobInfomations = responseData.jobs;
|
||||
$scope.jobInfomationsIndexs = $scope.jobInfomations ? _.indexBy($scope.jobInfomations, 'noteId') : {};
|
||||
});
|
||||
|
||||
$scope.$on('setUpdateNotebookJobs', function(event, responseData) {
|
||||
$scope.$on('setUpdateNoteJobs', function(event, responseData) {
|
||||
var jobInfomations = $scope.jobInfomations;
|
||||
var indexStore = $scope.jobInfomationsIndexs;
|
||||
$scope.lastJobServerUnixTime = responseData.lastResponseUnixTime;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ limitations under the License.
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
You can monitor the written notebook. Check the status of the Notebook and can control the action.
|
||||
You can monitor the status of notebook and navigate to note or paragraph.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ limitations under the License.
|
|||
</span>
|
||||
<span>
|
||||
<span ng-if="notebookJob.isRunningJob === true">
|
||||
Notebook is RUNNING
|
||||
Note is RUNNING
|
||||
</span>
|
||||
<span ng-if="notebookJob.isRunningJob === false">
|
||||
Notebook is READY
|
||||
Note is READY
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
<div ng-include src="'app/jobmanager/jobs/job-control.html'"></div>
|
||||
<span
|
||||
class="job-types"
|
||||
ng-switch="notebookJob.notebookType">
|
||||
ng-switch="notebookJob.noteType">
|
||||
<i ng-switch-when="normal" class="icon-doc"></i>
|
||||
<i ng-switch-when="cron" class="icon-clock"></i>
|
||||
<i ng-switch-default class="icon-question"></i>
|
||||
|
|
@ -25,7 +25,7 @@ limitations under the License.
|
|||
|
||||
<a style="text-decoration: none !important;" ng-href="#/notebook/{{notebookJob.noteId}}">
|
||||
<span>
|
||||
{{notebookJob.notebookName}}
|
||||
{{notebookJob.noteName}}
|
||||
</span>
|
||||
<span>
|
||||
-
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ limitations under the License.
|
|||
<button type="button"
|
||||
class="btn btn-default btn-xs"
|
||||
ng-hide="viewOnly"
|
||||
ng-click="checkpointNotebook(note.checkpoint.message)"
|
||||
ng-click="checkpointNote(note.checkpoint.message)"
|
||||
style="margin-left: 4px;"
|
||||
tooltip-placement="bottom" tooltip="Commit this note">Commit
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -177,14 +177,14 @@
|
|||
};
|
||||
|
||||
// checkpoint/commit notebook
|
||||
$scope.checkpointNotebook = function(commitMessage) {
|
||||
$scope.checkpointNote = function(commitMessage) {
|
||||
BootstrapDialog.confirm({
|
||||
closable: true,
|
||||
title: '',
|
||||
message: 'Commit notebook to current repository?',
|
||||
message: 'Commit note to current repository?',
|
||||
callback: function(result) {
|
||||
if (result) {
|
||||
websocketMsgSrv.checkpointNotebook($routeParams.noteId, commitMessage);
|
||||
websocketMsgSrv.checkpointNote($routeParams.noteId, commitMessage);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
}
|
||||
|
||||
function initController() {
|
||||
$scope.isDrawNavbarNotebookList = false;
|
||||
$scope.isDrawNavbarNoteList = false;
|
||||
angular.element('#notebook-list').perfectScrollbar({suppressScrollX: true});
|
||||
|
||||
angular.element(document).click(function() {
|
||||
|
|
@ -129,11 +129,11 @@
|
|||
*/
|
||||
angular.element(document).ready(function() {
|
||||
angular.element('.notebook-list-dropdown').on('show.bs.dropdown', function() {
|
||||
$scope.isDrawNavbarNotebookList = true;
|
||||
$scope.isDrawNavbarNoteList = true;
|
||||
});
|
||||
|
||||
angular.element('.notebook-list-dropdown').on('hide.bs.dropdown', function() {
|
||||
$scope.isDrawNavbarNotebookList = false;
|
||||
$scope.isDrawNavbarNoteList = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ limitations under the License.
|
|||
<ul class="dropdown-menu navbar-dropdown-maxHeight" role="menu">
|
||||
<li><a href="" data-toggle="modal" data-target="#noteNameModal"><i class="fa fa-plus"></i> Create new note</a></li>
|
||||
<li class="divider"></li>
|
||||
<div id="notebook-list" class="scrollbar-container" ng-if="isDrawNavbarNotebookList">
|
||||
<div id="notebook-list" class="scrollbar-container" ng-if="isDrawNavbarNoteList">
|
||||
<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.noteListOrdering track by $index"
|
||||
ng-class="{'active' : navbar.isActive(note.id)}" ng-include="'components/navbar/navbar-noteList-elem.html'">
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@
|
|||
} else {
|
||||
result.name = $scope.note.noteImportName;
|
||||
}
|
||||
websocketMsgSrv.importNotebook(result);
|
||||
websocketMsgSrv.importNote(result);
|
||||
//angular.element('#noteImportModal').modal('hide');
|
||||
} else {
|
||||
$scope.note.errorText = 'Invalid JSON';
|
||||
|
|
|
|||
|
|
@ -64,10 +64,10 @@
|
|||
$location.path('/notebook/' + data.note.id);
|
||||
} else if (op === 'NOTES_INFO') {
|
||||
$rootScope.$broadcast('setNoteMenu', data.notes);
|
||||
} else if (op === 'LIST_NOTEBOOK_JOBS') {
|
||||
$rootScope.$broadcast('setNotebookJobs', data.notebookJobs);
|
||||
} else if (op === 'LIST_UPDATE_NOTEBOOK_JOBS') {
|
||||
$rootScope.$broadcast('setUpdateNotebookJobs', data.notebookRunningJobs);
|
||||
} else if (op === 'LIST_NOTE_JOBS') {
|
||||
$rootScope.$broadcast('setNoteJobs', data.noteJobs);
|
||||
} else if (op === 'LIST_UPDATE_NOTE_JOBS') {
|
||||
$rootScope.$broadcast('setUpdateNoteJobs', data.noteRunningJobs);
|
||||
} else if (op === 'AUTH_INFO') {
|
||||
BootstrapDialog.show({
|
||||
closable: false,
|
||||
|
|
|
|||
|
|
@ -146,18 +146,18 @@
|
|||
});
|
||||
},
|
||||
|
||||
importNotebook: function(notebook) {
|
||||
importNote: function(note) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'IMPORT_NOTE',
|
||||
data: {
|
||||
notebook: notebook
|
||||
note: note
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
checkpointNotebook: function(noteId, commitMessage) {
|
||||
checkpointNote: function(noteId, commitMessage) {
|
||||
websocketEvents.sendNewEvent({
|
||||
op: 'CHECKPOINT_NOTEBOOK',
|
||||
op: 'CHECKPOINT_NOTE',
|
||||
data: {
|
||||
noteId: noteId,
|
||||
commitMessage: commitMessage
|
||||
|
|
@ -198,18 +198,18 @@
|
|||
return websocketEvents.isConnected();
|
||||
},
|
||||
|
||||
getNotebookJobsList: function() {
|
||||
websocketEvents.sendNewEvent({op: 'LIST_NOTEBOOK_JOBS'});
|
||||
getNoteJobsList: function() {
|
||||
websocketEvents.sendNewEvent({op: 'LIST_NOTE_JOBS'});
|
||||
},
|
||||
|
||||
getUpdateNotebookJobsList: function(lastUpdateServerUnixTime) {
|
||||
getUpdateNoteJobsList: function(lastUpdateServerUnixTime) {
|
||||
websocketEvents.sendNewEvent(
|
||||
{op: 'LIST_UPDATE_NOTEBOOK_JOBS', data: {lastUpdateUnixTime: lastUpdateServerUnixTime * 1}}
|
||||
{op: 'LIST_UPDATE_NOTE_JOBS', data: {lastUpdateUnixTime: lastUpdateServerUnixTime * 1}}
|
||||
);
|
||||
},
|
||||
|
||||
unsubscribeJobManager: function() {
|
||||
websocketEvents.sendNewEvent({op: 'UNSUBSCRIBE_UPDATE_NOTEBOOK_JOBS'});
|
||||
websocketEvents.sendNewEvent({op: 'UNSUBSCRIBE_UPDATE_NOTE_JOBS'});
|
||||
},
|
||||
|
||||
getInterpreterBindings: function(noteId) {
|
||||
|
|
|
|||
|
|
@ -317,9 +317,8 @@ public class Notebook implements NoteEventListener {
|
|||
synchronized (notes) {
|
||||
note = notes.remove(id);
|
||||
}
|
||||
|
||||
noteSearchService.deleteIndexDocs(note);
|
||||
replFactory.removeNoteInterpreterSettingBinding(subject.getUser(), id);
|
||||
noteSearchService.deleteIndexDocs(note);
|
||||
notebookAuthorization.removeNote(id);
|
||||
|
||||
// remove from all interpreter instance's angular object registry
|
||||
|
|
@ -340,7 +339,7 @@ public class Notebook implements NoteEventListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
// remove notebook scope object
|
||||
// remove note scope object
|
||||
((RemoteAngularObjectRegistry) registry).removeAllAndNotifyRemoteProcess(id, null);
|
||||
} else {
|
||||
// remove paragraph scope object
|
||||
|
|
@ -355,7 +354,7 @@ public class Notebook implements NoteEventListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
// remove notebook scope object
|
||||
// remove note scope object
|
||||
registry.removeAll(id, null);
|
||||
}
|
||||
}
|
||||
|
|
@ -473,7 +472,7 @@ public class Notebook implements NoteEventListener {
|
|||
|
||||
/**
|
||||
* Reload all notes from repository after clearing `notes`
|
||||
* to reflect the changes of added/deleted/modified notebooks on file system level.
|
||||
* to reflect the changes of added/deleted/modified notes on file system level.
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
|
|
@ -633,7 +632,7 @@ public class Notebook implements NoteEventListener {
|
|||
}
|
||||
|
||||
public List<Map<String, Object>> getJobListByNoteId(String noteId) {
|
||||
final String CRON_TYPE_NOTEBOOK_KEYWORD = "cron";
|
||||
final String CRON_TYPE_NOTE_KEYWORD = "cron";
|
||||
long lastRunningUnixTime = 0;
|
||||
boolean isNoteRunning = false;
|
||||
Note jobNote = getNote(noteId);
|
||||
|
|
@ -652,8 +651,8 @@ public class Notebook implements NoteEventListener {
|
|||
info.put("noteName", "Note " + jobNote.getId());
|
||||
}
|
||||
// set note type ( cron or normal )
|
||||
if (jobNote.getConfig().containsKey(CRON_TYPE_NOTEBOOK_KEYWORD) && !jobNote.getConfig()
|
||||
.get(CRON_TYPE_NOTEBOOK_KEYWORD).equals("")) {
|
||||
if (jobNote.getConfig().containsKey(CRON_TYPE_NOTE_KEYWORD) && !jobNote.getConfig()
|
||||
.get(CRON_TYPE_NOTE_KEYWORD).equals("")) {
|
||||
info.put("noteType", "cron");
|
||||
} else {
|
||||
info.put("noteType", "normal");
|
||||
|
|
@ -681,7 +680,7 @@ public class Notebook implements NoteEventListener {
|
|||
interpreterGroupName = replFactory.getInterpreterSettings(jobNote.getId()).get(0).getName();
|
||||
}
|
||||
|
||||
// notebook json object root information.
|
||||
// note json object root information.
|
||||
info.put("interpreter", interpreterGroupName);
|
||||
info.put("isRunningJob", isNoteRunning);
|
||||
info.put("unixTimeLastRun", lastRunningUnixTime);
|
||||
|
|
@ -693,7 +692,7 @@ public class Notebook implements NoteEventListener {
|
|||
|
||||
public List<Map<String, Object>> getJobListByUnixTime(boolean needsReload,
|
||||
long lastUpdateServerUnixTime, AuthenticationInfo subject) {
|
||||
final String CRON_TYPE_NOTEBOOK_KEYWORD = "cron";
|
||||
final String CRON_TYPE_NOTE_KEYWORD = "cron";
|
||||
|
||||
if (needsReload) {
|
||||
try {
|
||||
|
|
@ -723,8 +722,8 @@ public class Notebook implements NoteEventListener {
|
|||
}
|
||||
|
||||
// set note type ( cron or normal )
|
||||
if (note.getConfig().containsKey(CRON_TYPE_NOTEBOOK_KEYWORD) && !note.getConfig()
|
||||
.get(CRON_TYPE_NOTEBOOK_KEYWORD).equals("")) {
|
||||
if (note.getConfig().containsKey(CRON_TYPE_NOTE_KEYWORD) && !note.getConfig()
|
||||
.get(CRON_TYPE_NOTE_KEYWORD).equals("")) {
|
||||
info.put("noteType", "cron");
|
||||
} else {
|
||||
info.put("noteType", "normal");
|
||||
|
|
|
|||
|
|
@ -54,9 +54,7 @@ public class NotebookRepoSync implements NotebookRepo {
|
|||
private final boolean oneWaySync;
|
||||
|
||||
/**
|
||||
* @param noteIndex
|
||||
* @param (conf)
|
||||
* @throws - Exception
|
||||
* @param conf
|
||||
*/
|
||||
@SuppressWarnings("static-access")
|
||||
public NotebookRepoSync(ZeppelinConfiguration conf) {
|
||||
|
|
@ -70,7 +68,7 @@ public class NotebookRepoSync implements NotebookRepo {
|
|||
String[] storageClassNames = allStorageClassNames.split(",");
|
||||
if (storageClassNames.length > getMaxRepoNum()) {
|
||||
LOG.warn("Unsupported number {} of storage classes in ZEPPELIN_NOTEBOOK_STORAGE : {}\n" +
|
||||
"first {} will be used", storageClassNames.length, allStorageClassNames, getMaxRepoNum());
|
||||
"first {} will be used", storageClassNames.length, allStorageClassNames, getMaxRepoNum());
|
||||
}
|
||||
|
||||
for (int i = 0; i < Math.min(storageClassNames.length, getMaxRepoNum()); i++) {
|
||||
|
|
@ -79,7 +77,7 @@ public class NotebookRepoSync implements NotebookRepo {
|
|||
try {
|
||||
notebookStorageClass = getClass().forName(storageClassNames[i].trim());
|
||||
Constructor<?> constructor = notebookStorageClass.getConstructor(
|
||||
ZeppelinConfiguration.class);
|
||||
ZeppelinConfiguration.class);
|
||||
repos.add((NotebookRepo) constructor.newInstance(conf));
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException |
|
||||
InstantiationException | IllegalAccessException | IllegalArgumentException |
|
||||
|
|
@ -89,7 +87,7 @@ public class NotebookRepoSync implements NotebookRepo {
|
|||
}
|
||||
// couldn't initialize any storage, use default
|
||||
if (getRepoCount() == 0) {
|
||||
LOG.info("No storages could be initialized, using default {} storage", defaultStorage);
|
||||
LOG.info("No storage could be initialized, using default {} storage", defaultStorage);
|
||||
initializeDefaultStorage(conf);
|
||||
}
|
||||
if (getRepoCount() > 1) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class Message {
|
|||
// @param id note id
|
||||
|
||||
NOTE, // [s-c] note info
|
||||
// @param note serlialized Note object
|
||||
// @param note serialized Note object
|
||||
|
||||
PARAGRAPH, // [s-c] paragraph info
|
||||
// @param paragraph serialized paragraph object
|
||||
|
|
@ -115,7 +115,7 @@ public class Message {
|
|||
CONFIGURATIONS_INFO, // [s-c] all key/value pairs of configurations
|
||||
// @param settings serialized Map<String, String> object
|
||||
|
||||
CHECKPOINT_NOTEBOOK, // [c-s] checkpoint notebook to storage repository
|
||||
CHECKPOINT_NOTE, // [c-s] checkpoint note to storage repository
|
||||
// @param noteId
|
||||
// @param checkpointName
|
||||
|
||||
|
|
@ -130,9 +130,9 @@ public class Message {
|
|||
APP_LOAD, // [s-c] on app load
|
||||
APP_STATUS_CHANGE, // [s-c] on app status change
|
||||
|
||||
LIST_NOTEBOOK_JOBS, // [c-s] get notebook job management infomations
|
||||
LIST_UPDATE_NOTEBOOK_JOBS, // [c-s] get job management informations for until unixtime
|
||||
UNSUBSCRIBE_UPDATE_NOTEBOOK_JOBS, // [c-s] unsubscribe job information for job management
|
||||
LIST_NOTE_JOBS, // [c-s] get note job management information
|
||||
LIST_UPDATE_NOTE_JOBS, // [c-s] get job management information for until unixtime
|
||||
UNSUBSCRIBE_UPDATE_NOTE_JOBS, // [c-s] unsubscribe job information for job management
|
||||
// @param unixTime
|
||||
GET_INTERPRETER_BINDINGS, // [c-s] get interpreter bindings
|
||||
// @param noteId
|
||||
|
|
|
|||
Loading…
Reference in a new issue