You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2016/05/18 21:31:51 UTC
incubator-zeppelin git commit: Fix notebook folder structure name
match bug
Repository: incubator-zeppelin
Updated Branches:
refs/heads/master be8f47628 -> 98c00eb7d
Fix notebook folder structure name match bug
### What is this PR for?
Current regex match rule for notebook folder takes not only `/` as delimiter but also `[` and `]`.
### What type of PR is it?
Bug Fix
### How should this be tested?
Try to create notebook that contains `[` or `]` in name and see if the folder structure is correct.
### Screenshots (if appropriate)
With notebook name `/A/B[C]D`
**Before**
![screen shot 2016-05-11 at 3 00 42 pm](https://cloud.githubusercontent.com/assets/8503346/15171404/2a7562b6-1789-11e6-87d2-39ba10e962c1.png)
**After**
![screen shot 2016-05-11 at 3 01 31 pm](https://cloud.githubusercontent.com/assets/8503346/15171418/49eb5830-1789-11e6-9362-a15bd9264873.png)
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Author: Mina Lee <mi...@nflabs.com>
Closes #883 from minahlee/fix/notebookFolderBug and squashes the following commits:
51e4bae [Mina Lee] Add test case for notebook folder structure
f83adf4 [Mina Lee] Fix notebook folder structure name match bug
Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/98c00eb7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/98c00eb7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/98c00eb7
Branch: refs/heads/master
Commit: 98c00eb7da48a0a56c594706470add2c60c48d8d
Parents: be8f476
Author: Mina Lee <mi...@nflabs.com>
Authored: Fri May 13 15:31:18 2016 +0900
Committer: Lee moon soo <mo...@apache.org>
Committed: Wed May 18 14:32:40 2016 -0700
----------------------------------------------------------------------
.../notebookList.datafactory.js | 2 +-
zeppelin-web/test/spec/factory/notebookList.js | 20 +++++++++++++++-----
2 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/98c00eb7/zeppelin-web/src/components/notebookListDataFactory/notebookList.datafactory.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/components/notebookListDataFactory/notebookList.datafactory.js b/zeppelin-web/src/components/notebookListDataFactory/notebookList.datafactory.js
index 43fd061..91aa7be 100644
--- a/zeppelin-web/src/components/notebookListDataFactory/notebookList.datafactory.js
+++ b/zeppelin-web/src/components/notebookListDataFactory/notebookList.datafactory.js
@@ -27,7 +27,7 @@ angular.module('zeppelinWebApp').factory('notebookListDataFactory', function() {
notes.root = {children: []};
_.reduce(notesList, function(root, note) {
var noteName = note.name || note.id;
- var nodes = noteName.match(/([^\\\][^\/]|\\\/)+/g);
+ var nodes = noteName.match(/([^\/][^\/]*)/g);
// recursively add nodes
addNode(root, nodes, note.id);
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/98c00eb7/zeppelin-web/test/spec/factory/notebookList.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/test/spec/factory/notebookList.js b/zeppelin-web/test/spec/factory/notebookList.js
index ec67866..10c6981 100644
--- a/zeppelin-web/test/spec/factory/notebookList.js
+++ b/zeppelin-web/test/spec/factory/notebookList.js
@@ -16,17 +16,18 @@ describe('Factory: NotebookList', function() {
var notesList = [
{name: 'A', id: '000001'},
{name: 'B', id: '000002'},
- {id: '000003'}, // notebook without name
+ {id: '000003'}, // notebook without name
{name: '/C/CA', id: '000004'},
{name: '/C/CB', id: '000005'},
{name: '/C/CB/CBA', id: '000006'}, // same name with a dir
- {name: '/C/CB/CBA', id: '000007'}, // same name with another note
- {name: 'C///CB//CBB', id: '000008'}
+ {name: '/C/CB/CBA', id: '000007'}, // same name with another note
+ {name: 'C///CB//CBB', id: '000008'},
+ {name: 'D/D[A/DA]B', id:'000009'} // check if '[' and ']' considered as folder seperator
];
notebookList.setNotes(notesList);
var flatList = notebookList.flatList;
- expect(flatList.length).toBe(8);
+ expect(flatList.length).toBe(9);
expect(flatList[0].name).toBe('A');
expect(flatList[0].id).toBe('000001');
expect(flatList[1].name).toBe('B');
@@ -36,9 +37,10 @@ describe('Factory: NotebookList', function() {
expect(flatList[5].name).toBe('/C/CB/CBA');
expect(flatList[6].name).toBe('/C/CB/CBA');
expect(flatList[7].name).toBe('C///CB//CBB');
+ expect(flatList[8].name).toBe('D/D[A/DA]B');
var folderList = notebookList.root.children;
- expect(folderList.length).toBe(4);
+ expect(folderList.length).toBe(5);
expect(folderList[0].name).toBe('A');
expect(folderList[0].id).toBe('000001');
expect(folderList[1].name).toBe('B');
@@ -64,6 +66,14 @@ describe('Factory: NotebookList', function() {
expect(folderList[3].children[2].children[2].name).toBe('CBB');
expect(folderList[3].children[2].children[2].id).toBe('000008');
expect(folderList[3].children[2].children[2].children).toBeUndefined();
+ expect(folderList[4].name).toBe('D');
+ expect(folderList[4].id).toBeUndefined();
+ expect(folderList[4].children.length).toBe(1);
+ expect(folderList[4].children[0].name).toBe('D[A');
+ expect(folderList[4].children[0].id).toBeUndefined();
+ expect(folderList[4].children[0].children[0].name).toBe('DA]B');
+ expect(folderList[4].children[0].children[0].id).toBe('000009');
+ expect(folderList[4].children[0].children[0].children).toBeUndefined();
});
});