Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 396646

Summary: Orion Node Breadcrumbs behaving badly
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: NodeAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: kobrigo
Version: 1.0Flags: kobrigo: review? (libingw)
Target Milestone: 2.0 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description libing wang CLA 2012-12-14 15:20:41 EST
1.Go the Navigator page in Orionode.
2.Drill into one of your projects.
3.Observe the breadcrumb (underneath the top nav banner). It looks like this:
Orion Node Content / MyProject / MyProject
The last segment is always listed twice. If you drill deeper into further folders, it'll look like this:

Orion Node Content / MyProject / folder / folder
The problem is probably due a flaw in Orionode's algorithm for generating the Parents array of the file API. Likely culprits are file.js and fileUtils.js.

Also I noticed that the problem is triggered by requesting a directory resource with a trailing slash after it. For example, GET /file/MyProject/?depth=1 has the bad Parents array, but GET /file/MyProject?depth=1 behaves as expected. When Orionode generates a directory listing it always uses the trailing slash to indicate a directory (as expected), so you see this problem all the time.
Comment 1 libing wang CLA 2012-12-14 15:26:35 EST
Transferred https://github.com/mamacdon/orionode/issues/10 here.
Adding the histories from that issue:

From kobrigo:
I have debugged it and found the place where the link is not being build right. On the navigator.
It's under navigatorRenderer.js line 92.
It actually being taken from the ChildrenLocation which is build by the server.

In the BreadCrums the building is done by taking the Parents array and in each Parent the ChildrenLocation is build without the leading "/"

I wonder... I can apply a fix to the client.... but do you think this should be done in the server? 
should the server support both kinds of links (with the trailing "/" and also without) when opened?

There is inconsistency with the ChildrenLocation property.

Should the parent array items should include the ChildrenLocation with the leading "/" to indicate this is a directory (as you mentioned that is what should be expected) but then I guess there would be other places in the code to fix too.
Comment 2 Eyal Kobrigo CLA 2012-12-17 08:25:40 EST
I fixed it. and I would like it to be reviewd:

URL: https://github.com/kobrigo/orion.client.git
The name of the branch contining my fix:breadcrumsBugFix
The Commit id on that branch:breadcrumsBugFix
Comment 3 Eyal Kobrigo CLA 2012-12-17 08:34:14 EST
(Sorry about that, a copy paste mistake)
The Commit id on that branch:bea0c3e
Comment 4 libing wang CLA 2012-12-17 13:43:36 EST
(In reply to comment #3)
> (Sorry about that, a copy paste mistake)
> The Commit id on that branch:bea0c3e

Hi, Eyal:
Thanks a lot for your  fix. 
Mark is on vacation until Jan 3th. So  I will take a look at your fix. We just moved Orion node into Orion client git repo.

As we talked on IRC, here is a temporary step to add the dojo folder back to the node server after you pull it from Orion client git repo.

Copy the dojo folder under mark'sRepo/lib/ and paste it into   yourOrionRepo/modules/orionode/lib. Start node server in  yourOrionRepo/modules/orionode/.

And here is the links on how to contribute and pull request.

http://wiki.eclipse.org/Orion/Contributing_Code

Thanks again,
Libing
Comment 5 libing wang CLA 2012-12-17 15:31:57 EST
Fixed with http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=8fd765d9c1b183e5ba8f60c4557c98a083d433b4.

Eyal, I tried to cherry pick your commit but failed. You fix looks good.
As your fix is simple so I did two lines of manual changes.
In addition to your change, I found that have a folder in the middle of breadcrumb, whose name has white space, will introduce encoded URI character %20.
I have fixed that together with this bug. 

I am trying to triage all the node bug now and I will put "helpwanted" as the keyword of the bug. Will ask you help later...

Next time if you have a fix, could you send us a pull request with comments like below:

I wrote all this code, and I have the right to contribute it to Eclipse under the eclipse.org website terms of use.


Thanks again,
Libing
Comment 6 libing wang CLA 2012-12-17 15:49:20 EST
Eyal, as the commit was a manual merge, I forgot to put your name as the author.
Sorry for that. 
Next time we will follow the process and your commit will be pulled directly with you as the author.