This is an automated email from the ASF dual-hosted git repository.
liuxun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new a4a9e07 [ZEPPELIN-4160] Fixed Move this note to trash icon always show
a4a9e07 is described below
commit a4a9e07d8f6f1d322ab8fbab7a60babd1f5dac2f
Author: Xun Liu <[email protected]>
AuthorDate: Thu May 16 09:46:03 2019 +0800
[ZEPPELIN-4160] Fixed Move this note to trash icon always show
### What is this PR for?
when the note moved to trash, the note should show 'Remove this note
permanently', it does not work correctly after clicked again, more ~Trash
folder will be created
### What type of PR is it?
[Bug Fix]
### Todos
* [ ] - Task
### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-4160
### How should this be tested?
* [CI pass](https://travis-ci.org/liuxunorg/zeppelin/builds/532764123)
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update? NO
* Is there breaking changes for older versions? NO
* Does this needs documentation? NO
Author: Xun Liu <[email protected]>
Closes #3365 from liuxunorg/ZEPPELIN-4160 and squashes the following
commits:
03549ce87 [Xun Liu] remove console log.
197cac235 [Xun Liu] [ZEPPELIN-4160] Move this note to trash icon always show
---
.../org/apache/zeppelin/AbstractZeppelinIT.java | 10 ++++++++
.../apache/zeppelin/integration/ZeppelinIT.java | 28 ++++++++++++++++++++++
.../src/app/notebook/notebook.controller.js | 2 +-
.../src/components/note-list/note-list.factory.js | 2 +-
.../java/org/apache/zeppelin/notebook/Note.java | 3 ++-
5 files changed, 42 insertions(+), 3 deletions(-)
diff --git
a/zeppelin-integration/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java
b/zeppelin-integration/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java
index 030ddeb..b7cf80d 100644
---
a/zeppelin-integration/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java
+++
b/zeppelin-integration/src/test/java/org/apache/zeppelin/AbstractZeppelinIT.java
@@ -123,6 +123,16 @@ abstract public class AbstractZeppelinIT {
ZeppelinITUtils.sleep(100, false);
}
+ protected void deleteTrashNotebook(final WebDriver driver) {
+ WebDriverWait block = new WebDriverWait(driver, MAX_BROWSER_TIMEOUT_SEC);
+
driver.findElement(By.xpath(".//*[@id='main']//button[@ng-click='removeNote(note.id)']"))
+ .sendKeys(Keys.ENTER);
+
block.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//*[@id='main']//button[@ng-click='removeNote(note.id)']")));
+ driver.findElement(By.xpath("//div[@class='modal-dialog'][contains(.,'This
cannot be undone. Are you sure?')]" +
+ "//div[@class='modal-footer']//button[contains(.,'OK')]")).click();
+ ZeppelinITUtils.sleep(100, false);
+ }
+
protected void clickAndWait(final By locator) {
pollingWait(locator, MAX_IMPLICIT_WAIT).click();
ZeppelinITUtils.sleep(1000, false);
diff --git
a/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
b/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
index 66ed342..9315056 100644
---
a/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
+++
b/zeppelin-integration/src/test/java/org/apache/zeppelin/integration/ZeppelinIT.java
@@ -323,4 +323,32 @@ public class ZeppelinIT extends AbstractZeppelinIT {
}
}
+
+ @Test
+ public void deleteTrashNode() throws Exception {
+ try {
+ createNewNote();
+
+ // wait for first paragraph's " READY " status text
+ waitForParagraph(1, "READY");
+
+ String currentUrl = driver.getCurrentUrl();
+ LOG.info("currentUrl = " + currentUrl);
+
+ //delete created notebook to trash
+ deleteTestNotebook(driver);
+ ZeppelinITUtils.sleep(3000, false);
+
+ // reopen trash note
+ driver.get(currentUrl);
+ ZeppelinITUtils.sleep(3000, false);
+
+ // delete note from trash
+ deleteTrashNotebook(driver);
+ ZeppelinITUtils.sleep(2000, false);
+ LOG.info("deleteTrashNode executed");
+ } catch (Exception e) {
+ handleException("Exception in ZeppelinIT while deleteTrashNode", e);
+ }
+ }
}
diff --git a/zeppelin-web/src/app/notebook/notebook.controller.js
b/zeppelin-web/src/app/notebook/notebook.controller.js
index 085c94e..e2a05b1 100644
--- a/zeppelin-web/src/app/notebook/notebook.controller.js
+++ b/zeppelin-web/src/app/notebook/notebook.controller.js
@@ -237,7 +237,7 @@ function NotebookCtrl($scope, $route, $routeParams,
$location, $rootScope,
};
$scope.isTrash = function(note) {
- return note ? note.name.split('/')[0] === TRASH_FOLDER_ID : false;
+ return note ? note.path.split('/')[1] === TRASH_FOLDER_ID : false;
};
// Export notebook
diff --git a/zeppelin-web/src/components/note-list/note-list.factory.js
b/zeppelin-web/src/components/note-list/note-list.factory.js
index c20b854..20310e3 100644
--- a/zeppelin-web/src/components/note-list/note-list.factory.js
+++ b/zeppelin-web/src/components/note-list/note-list.factory.js
@@ -26,7 +26,7 @@ function NoteListFactory(arrayOrderingSrv, TRASH_FOLDER_ID) {
// a flat list to boost searching
notes.flatList = _.map(notesList, (note) => {
note.isTrash = note.path
- ? note.path.split('/')[0] === TRASH_FOLDER_ID : false;
+ ? note.path.split('/')[1] === TRASH_FOLDER_ID : false;
return note;
});
diff --git
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
index b5fc876..b01b8c2 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
@@ -92,10 +92,11 @@ public class Note implements JsonSerializable {
*/
private Map<String, Object> info = new HashMap<>();
+ // The front end needs to judge TRASH_FOLDER according to the path
+ private String path;
/********************************** transient fields
******************************************/
private transient boolean loaded = false;
- private transient String path;
private transient InterpreterFactory interpreterFactory;
private transient InterpreterSettingManager interpreterSettingManager;
private transient ParagraphJobListener paragraphJobListener;