[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[orion-dev] A complex plugin use case (number 1)
- From: Kris De Volder <kdvolder@xxxxxxxxxx>
- Date: Thu, 23 Feb 2012 16:23:33 -0800 (PST)
- Delivered-to: firstname.lastname@example.org
Following up on the call from this morning where it was mentioned I'm having some problems packaging up gcli stuff to contribute back, as well as separating the bits that are of general utility in such a way that external plugins can contribute the commands we need to support cloudfoundry and node js.
I'll try to present a use case.
Use case: package as a plugin the following functionality:
- contribute a link at the top of the page to open 'my page'
- implement this page so it looks like an orion page
- headers and footers etc.
- body of page contains contributed content
- contributed content displays gcli interface with commands like 'pwd', 'cd' and 'ls'.
- add a link to all pages (easy with 'pageLinks' service)
- able to generate header and footers with all the trimmings (bread crumb, search box, tool bar, etc.).
- access to the fileService to implement the main functionality of the page.
I implemented something that has the right 'look' and works. But it is done mostly by using code like the navigator and git ui as copy pasting example.
The first problem I hit when trying to package this as a plugin is how do I handle all the dependencies on orion modules loaded by requirejs if we are not on the same server (relative urls are all broken).
I managed to get something working here only by hard-coding the paths to stuff on the server in requirejs configuration in the plugin page. That's really no good, since it assumes orion server runs in only exactly one place.
Is there a better way than hard coding paths to orion requirejs modules into the plugin that uses them?
After 'fixing' problem I hit a second problem. Although all requirejs modules got loaded... they were having trouble accessing server side rest APIs (cross domain xhr requests I think?).
At this point I gave up and started packaging my stuff as an eclipse plugin instead. This was much easier and I was able to achieve a very clean separation, no orion code was modified at all.
PS: There's a part 2 to this story (how do I make my contributed stuff extensible itself in the right way. But I'll hold that for later).