- Description
- How to use it
- Methods
- Message Parameter Class
- Examples
- Example for opening a screen
- Example for sending a message
- Example for a message from backend
- Further documentation
Description
This chapter describes the usage of the Build.One UI Connector, which is part of the B1 Plattform. The UI Connector is typical used in a Progress Backend to send messages to the Build.One Frontend (e.g. to update a status in the frontend from a function, which runs in the backend) or to open a screen in Build.One.
Some examples for Progress Backends are the development plattform of Build.One, any Progress client or an existing application build with Progress. So this program can also be run outside of B1.
Technically the UI Connector works with the messaging server of Build.One and is implemented as a wrapper class, which implement REST-Calls to the messaging server. The messaging server is running on the NodeJS Backend. So it’s also possible to reuse the architecture of the UI Connector (which is written in Progress ABL) also in other programming language.
Here you can see a potential landscape and show the potential caller of the UI Connector (Progress OpenEdge and also 3rd party technologies like salesforce or windows client). All of them can send messages to the Build.One frontend via the messaging server.
How to use it
The UiConnector is a progress class provided by Build.One, which offers the following methods
Methods
- ShowMessage - shows a new notification
poMessage AS Akioma.Swat.Integration.Client.UiMessage
- UpdateMessage - updates an existing notification, by its id; if the notification has already been closed by the user, nothing will happen
pcId AS CHARACTER
poMessage AS Akioma.Swat.Integration.Client.UiMessage
- RemoveMessage - removes a message by its id
pcId
AS CHARACTER
- LaunchContainer - launches a container by name, or by hdl, if name is not specified; this will be triggered for all users
pcContainer AS CHARACTER
pcHdl AS CHARACTER
- LaunchContainer - same as above, but it supports an additional parameter to specify the user who should be affected by the message
pcContainer AS CHARACTER
pcHdl AS CHARACTER
pcUser AS CHARACTER
(Here also a session token can be specified)
Message Parameter Class
The message related methods use a message class to provide the message definition Akioma.Swat.Integration.Client.UiMessage
.
The message class has the following properties:
- id - the message id; it will be automatically be assigned a guid
- text - the message text
- type - the message type; default value “info”
- title - the message title; default value “Message from Server”
- moretext - the additional text that will be displayed when pressing the ‘More’ button in the notification
- expire - the time in ms until the notification is closed
- user - the user that will receive the notification; by default, only the current user’s session receive it; to broadcast a message to all users ? can be used
- linkdesc - the text which should be displayed for the download text
- linkvalue - the url to which the download text will point
All the properties have a set method (ex. SetText), which can be used to configure a message by chaining them:
NEW Akioma.Swat.Integration.Client.UiMessage():SetText("text"):SetTitle("title"):SetMoreText("additional details").
Examples
Here you will find some examples. Please keep in mind, that the user has to be logged in into the Build.One platform to see the information provided by the backend. So the browser must be opened and there must be an active Build.One session (by user login), when you’re calling the UI Connector from another application.
Example for opening a screen
Afterwards you see a code example for opening a screen CustomerChooseDialog
in the Build.One application, which runs on http://localhost:59002
. This is the standard URL to use the UI Connector in a gitpod environment. This snippet can be included in an own .p-file or can be run in the integrated Progress client.
DEFINE VARIABLE oUIConnector AS Akioma.Swat.Integration.Client.UiConnector NO-UNDO.
ASSIGN oUIConnector = NEW
Akioma.Swat.Integration.Client.UiConnector().
oUIConnector:launchContainer("CustomerChooseDialog", "").
Example for sending a message
Afterwards you see a code example for sending a message to the Build.One application, which runs on http://localhost:59002
. In this example the text can be edited when the program is started by enter some values in the variable txt
. These will be send with the string build.one says
to the application and displayed to the user developer
.
DEFINE VARIABLE cTxt AS CHARACTER FORMAT "x(80)" NO-UNDO.
DEFINE VARIABLE oUIConnector AS Akioma.Swat.Integration.Client.UiConnector NO-UNDO.
ASSIGN oUIConnector = NEW Akioma.Swat.Integration.Client.UiConnector().
REPEAT:
UPDATE cTxt.
oUIConnector:showMessage(NEW Akioma.Swat.Integration.Client.UiMessage():SetText(cTxt):SetTitle("build.one says"):SetUser("developer")).
END.
Akioma.Swat.SessionManager:SocketIoHost
will be used, from env.NODE_URL
.Example for a message from backend
def var connector as Akioma.Swat.Integration.Client.UiConnector no-undo.
def var lcText as char init "message from backend".
assign connector = new
Akioma.Swat.Integration.Client.UiConnector("http://localhost:59002").
connector:launchContainer("CustomerChooseDialog", "").
Further documentation
- For more information about notifications see Notification Messages
- The API documentation of the Node Backend can be reached in your gitpod workspace by using
<gitpodenv>/node/docs/
Back to Documentation
Back to Home Page