saschakiefer / generator-openui5

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

Northwind mock server location #35

Closed js1972 closed 10 years ago

js1972 commented 10 years ago

As you spotted the northwind mock server url's were hard-coded. This was just to get it working.... Now I'm thinking about dynamically generating them and there's a slight problem if we are using the bower library... It only includes the resources directory and not test_resources where the northwind mock resides.

I could just grab the northwind mock .js file and scaffold it directly, then there is no dependancy - I'll plunk it into the generated models/ directory.

What do you think? I think its safe to scaffold the file as the Northwind service hasn't changed for a very long time so I think its stable. Otherwise we'd need to add the test_resources folder to the bower dependancies as well...

?

js1972 commented 10 years ago

I've taken the option to scaffold a copy of ODataModelFakeService.js with the Tiles app into the model directory. Lets still discuss as to whether this is the best option or if we should refactor.

At the end of the day - the mock data is not the point of our tool - but it is just a way to have a running app out of the box. It will probably be the first thing any user will change.

saschakiefer commented 10 years ago

I think we can point to the Northwind Service directly. As far as I know, it's a reference service provided by Microsoft which should not change easily.

js1972 commented 10 years ago

The reason I stopped pointing to the northwind service directly is because its flakey. Both myself and John Patterson were having lots of trouble with it. Its DNS records do not look right. I cannot get it to work at all from a windows computer yet it works from a mac. ?!?

I reckon this is why sap mocked the service as well as an exact copy of northwind.

On Tue, Feb 4, 2014 at 3:35 AM, saschakiefer notifications@github.com wrote:

I think we can point to the Northwind Service directly. As far as I know, it's a reference service provided by Microsoft which should not change easily.

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

saschakiefer commented 10 years ago

OK, fair enough. I think it's important, to have the oData example working. Currently, even though you create the oData Model, you do not really use it, right? Are you planning to add that to the app as well?

js1972 commented 10 years ago

What do mean? It's working fine isn't it? It is using an OData model exactly the same as if using the real northwind service. Let me know what you mean? I've got some other changes to pull-request as well.../

On Tue, Feb 4, 2014 at 5:34 AM, saschakiefer notifications@github.com wrote:

OK, fair enough. I think it's important, to have the oData example working. Currently, even though you create the oData Model, you do not really use it, right? Are you planning to add that to the app as well?

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

js1972 commented 10 years ago

Oh - do you mean because the details screen is empty?? It still uses the model for the tiles...

On Tue, Feb 4, 2014 at 5:34 AM, saschakiefer notifications@github.com wrote:

OK, fair enough. I think it's important, to have the oData example working. Currently, even though you create the oData Model, you do not really use it, right? Are you planning to add that to the app as well?

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

js1972 commented 10 years ago

ps. To use the real Northwind service provided by msft all a user needs to do is comment two lines of code in the index.html - I have a comment in there explaining it:

<!-- *** Enable fake OData service ***
    These two scripts are provided by UI5 for faking the Northwind sample OData service.
    Delete them if you wish to use the real service or another method to mock your calls.
-->
<script type="text/javascript" src="<%= sinonLocation %>"></script>
<script type="text/javascript" src="model/ODataModelFakeService.js"></script>

Here is the OData model in Component.js:

// set data model on root view
var sURI = "http://localhost:<%= localServerPort %>/Northwind/Northwind.svc/";
if (typeof baseURL === "string") {
    sURI = baseURL; //if mock service use the baseURL
}
oView.setModel(new sap.ui.model.odata.ODataModel(sURI, false)); // use XML for the fake request

"baseURL" is declared by the mock service.

Then in Home.view.js we use the OData model to layout the Tiles in the TileContainer.

What else would you like me to add regarding OData? Two-way binding maybe? Or put some controls into the details screen..?

saschakiefer commented 10 years ago

My bad. I didn't recognize, that the tiles a rendered from the model binding . I also didn't read the comments in Component.js properly.

js1972 commented 10 years ago

No problem- happy to change anyway...

On 4 February 2014 14:50, saschakiefer notifications@github.com wrote:

My bad. I didn't recognize, that the tiles a rendered from the model binding . I also didn't read the comments in Component.js properly.

Reply to this email directly or view it on GitHubhttps://github.com/saschakiefer/generator-openui5/issues/35#issuecomment-34035018 .

saschakiefer commented 10 years ago

I think we can close this, right?

js1972 commented 10 years ago

Yep. Unless you can think of a better way. At the end of the day the mock data really does nothing more than allow us to run the app immediately after generation... Closing.