saschakiefer / generator-openui5

yeoman generator for OpenUI5 applications and assets
Other
64 stars 17 forks source link

Investigate Routing for generated apps #37

Closed js1972 closed 9 years ago

js1972 commented 10 years ago

Testing with a generated Tiles app. There is a problem that routes cannot be bookmarked. Even the sap.m.SplitApp example provided with the SDK does not bookmark. You should be able to navigate within your app and then bookmark where you are. Upon loading the bookmark you are taken back to where you left off. This does work with routing frameworks such as Director.js that I have tested. However not for jQuery.sap.history.

It seems that when you load the bookmark then history route handler is executed before the view which the page relies on is instantiated - and therefore in the route handler you cannot call to() or back() rendering the logic useless.?!? In fact with Chrome tools you can see the the app does not even GET the view file.

Anyone got example of this working?

js1972 commented 10 years ago

See this test app: https://github.com/js1972/test

js1972 commented 10 years ago

Added a "route" branch to the above test repo. The test app now uses the new component-based routing mechanism. Still seems to be an issue in that bookmarked routes do not work. The SDK-provided splitapp example also does not work with bookmarked routes.

Its as if the data binding is not set.

js1972 commented 10 years ago

Using the new component-based routing mechanism, the router takes over all navigation and view instantiation responsibilities. Given that this is a totally different application architecture it probably should be give an another option to the user: "add routing".

saschakiefer commented 10 years ago

Is that sth. you just add as a feature or would that be new application template?

js1972 commented 10 years ago

I'm out at the moment but when I'm back online I'll forward you a sample app to have a look at which uses routing. I need to think about it more as to whether we can just have an option to add it in or whether we need a whole separate template. 

Basically if you write an app for a mobile phone in phone gap or sap smp and it's running on iOS then your fine. But if it runs on android with a phone with a back button then you need to handle routing. Also if its a desktop app you need routing as you always wanna use the back button, etc so routing is definitely something we need to look at.

On Sat, Feb 22, 2014 at 1:53 PM, saschakiefer notifications@github.com wrote:

Is that sth. you just add as a feature or would that be new application template?

Reply to this email directly or view it on GitHub: https://github.com/saschakiefer/generator-openui5/issues/37#issuecomment-35795639

js1972 commented 10 years ago

See this sample app and readme for details. We just need to think about how to architect this into the generator.

https://github.com/js1972/test_ui5_routing

We could: a) Have a completely different set of template apps that include routing out of the box; b) Have a routing sub-generator that is clever enough to do the refactoring of your app to include routing based on a few questions - this would be fantastic but difficult I expect as you need to wire any views into the routes; c) Default all generated apps to use routing as standard.

(I'm probably thinking to go with option (a) at the moment.)

Anything else @saschakiefer or anyone else can think of?

js1972 commented 10 years ago

The test app https://github.com/js1972/test_ui5_routing has been updated and now works perfectly as expected. After much investigation there are issues with both the real Northwind oData service as well as the mock one provided by the UI5 team. The real one has DNS issues and does not work from Windows computer here (yet works just fine on my Mac). The fake one does not handle all nuances of oData and crashes the model binding in certain situations (such as when loading from a route).

Answer - write my own bloody test data! Problem solved - routing and model binding work perfectly again!

@saschakiefer if you get a chance can you have a quick look at this app. I want to add the detail screen onto our template Tiles app just so that it displays something and not an empty page as it does currently. You'll also see how the component-based routing works so that we can decide whether not to support it....

js1972 commented 9 years ago

This has already been done in the new component-based app templates. Just needs to be merged into master.

js1972 commented 9 years ago

Closing. See the TDG app template for an example of routing or scaffold out your project in WebIDE where you will get the latest component based routing mechanism.