teaLocation
The service is available under tea. services. The teaLocation service parses the URL in the browser address bar (based on AngularJS $location) and makes the URL available to your application. Changes to the URL in the address bar are reflected into teaLocation service. USe teaLocation to navigate from one page/view to another.
URLs in TEA have the following form:http://localhost:8777/tea/view/{agentType}/{objectType}/{viewName}[?{query}]
Methods
- params – {object} – Parameters object containing the following properties ([propKey] indicates that a property is optional):
- agentType - {string} - The agent name. Used to set agent token in the URL.
- objectType - {string} - The object type. Used to set objType token in the URL.
- [viewName] - {string} - The view name. Used to set objView token in the URL. If no view is specified, the view name will be '_'.
- [query] - {object} - Query object. Specifies name-value pairs that will be added as query parameters within the URL.
Events
Parameters- event - {object} - Synthetic event object.
- newInfo - {object} - info property that represents information about the new URL. See teaLocation.info for more information about the attributes of this object.
- oldInfo - {object} - info property that represents information about the old URL. See teaLocation.info for more information about the attributes of this object.
Usage
The goto method facilitates linking from one screen to another. It allows the implementers of TEA screens to support pivoting to related objects, without having to hard-code the URL structure everywhere and without needing to know details of how TEA accomplishes the link.
teaLocation.goto() will automatically URL-encode the query string parameters. TEA does not impose any limitations on the characters being used in object keys, query parameters, etc. The query string may contain any valid UTF-8 character. As a result, screen developers should not need to implement URL encoding or decoding for these parameters, as this is provided by teaLocation.
Example
One of the BusinessWorks screens within TEA displays details about an AppNode. This screen contains a table of Apps that are associated with the AppNode. Each row in the table shows a very brief summary view of one App. The first column in the table shows the App's unique ID from the BusinessWorks object model. This value is rendered as a link. If the user clicks on the link, TEA navigates to the TEA screen that displays details about a single App.
One of the BusinessWorks screens within TEA displays details about a Process. This screen contains a table of SAP Adapter Endpoints that are associated with the Process. Each row in the table shows a very brief summary view of one SAP Adapter Endpoint, with information retrieved from BusinessWorks's own process model. The first column in the table shows the SAP Adapter Endpoint's ID. This value is rendered as a link. If the user clicks on the link, TEA navigates to the TEA screen that displays details about a single SAP Adapter Endpoint. Note that this screen is not contributed to TEA by the BW agent, but rather by the SAP Adapter agent. The information about this agent - agent name, agent version, available object types, available views, etc - is published as a spec by the Adapters team and used by the BW team when developing the BusinessWorks UI.