15

Click here to load reader

Displaying server-side OData messages in ui5 (Ui5con 2017)

Embed Size (px)

Citation preview

Page 1: Displaying server-side OData messages in ui5 (Ui5con 2017)

© nabisoft. All rights reserved. Proprietary and confidential.

Displaying Server Side OData Messages in UI5

Success, error, information, and warning messages can be so easy in UI5

www.nabisoft.com

Nabi Zamani, CEO & Software Engineer3/24/2017

Page 2: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 2

Message Handling is described in the Fiori Design Guidelines

Source: https://experience.sap.com/fiori-design-web/messaging/

How can we implement this in UI5?- UI messages- Server-side messages (OData)

Page 3: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 3

There is little information about messages in the Developer Guide

Page 4: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 4

I‘ve prepared 3 examples in my local Explored App

Page 5: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 5

Demo will be available online soon...

Live DemoLet’s have a look at the 3 examples now

Page 6: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 6

Hint: There is a gap between MassageType and ValueState

There is currently no mapping for MessageType.Information

Page 7: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 7

OData has a well defined format for error responses

Source: http://www.odata.org/documentation/odata-version-2-0/operations/

No information found here (anymore?)

OData 2.0

Page 8: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 8

OData has a well defined format for error responses

Source: http://www.odata.org/documentation/odata-version-3-0/json-verbose-format/

OData 3.0

Page 9: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 9

OData has a well defined format for error responses

Source: http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata03/os/odata-json-format-v4.0-errata03-os-complete.html#_Toc453766668

OData 4.0

Page 10: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 10

SAP Gateway supports error responses as well

- This is a simple example every ABAP developer knows- By using Message Containers you can add more details

Page 11: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 11

Previous ABAP code leads to the following OData error response

Page 12: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 12

Unfortunately, this causes „double“ messages in MessagePopover

Page 13: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 13

...because UI5 parses the messages like this

Relevant code snippet of sap.ui.model.odata.ODataMessageParser:

Page 14: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 14

...and because SAP Gateway seems not to be correctly aligned with UI5

Page 15: Displaying server-side OData messages in ui5 (Ui5con 2017)

www.nabisoft.com 15

Thank You

Code is on github:

git clone https://github.com/nzamani/openui5.git cd openui5 git checkout ui5con2017-odata-messages npm install grunt serve

http://localhost:8080/testsuite/explored.html#/entity/sap.ui.core.message.MessageManager/samples