Provide content for a Job with a web-form.
The example is based on thedemoJob
from scala-adapters.
By default there is no payload when you start a Job.
Examples for when you might need a payload:
- Uploading a file as an input source.
- Providing an email address for sending the Job results.
Constraints
Create a Dialog
We will create a Dialog to provide the form when running the Job on the root URL http://localhost:9000
.
We want to add one additional image with its description to our demoJob
(see DemoRunJobDialog
for the full code).
Here is the form:
Again a nice example of Binding working with HTML and Semantic.
You can use the validation provided by Semantic.
scala-adapters just added some classes (Form
, Field
, Rule
) to make it more type-safe.
We then wrap the payload in a class
(ImageUpload
) and send it via the websocket to the server.
Add the Dialog
Next we need to tell the framework to use this dialog.
This is done in the routing of the client (DemoClient
):
Use the dialog (DemoRunJobDialog
) in the JobProcessView
.
The rest is handled by the scala-adapters
.
Usage in the Job Process
The payload is available in the JobProcess.
Here is the signature:
So all you need to do is extract the payload to the exchange format (ImageUpload
):