Interface rendering
After a plugin JSON has been added to a Pline web application, it's ready to launch its GUI. For that, Pline includes an interface generator that implements the plugin API, translating program descriptions into graphical
user interfaces at runtime. The generator is written in JavaScript, runs
natively inside any modern web browser, and is incorporated to web pages as a library. The library exposes functions like addPlugin()
for importing plugin descriptions and plugin.draw()
for rendering interfaces for the imported plugins. The first function translates a plugin description (given as URL or raw text) to an internal data model, whereas the second one converts the model to the final interface (HTML and JavaScript code) and places it to a chosen container in the web page. Integrating Pline to any web content is therefore straightforward - the default web page in Pline web application is a blank container that populates its interface by calling these functions for any description files it finds from its plugins folder.
In the example in Figure \ref{477555}, Pline has translated each parameter in the JSON to corresponding input element in the interface. Pline supports both simple input types like text, files, checkboxes or selection lists, and advanced ones that merge or modify values from linked inputs. In addition to input elements, Pline interface includes a header that displays the program description and provides an option to name the program execution session, as well as to save or restore sets of user input values.
A Pline-generated GUI is not static – the HTML interface is bound to an
internal data model and event listeners that enforce the dependency
rules between the program parameters and adjust the interface according
to user interactions. User input is tracked in real-time: as soon as a
tick-box is clicked or a number is typed, the interface updates
accordingly, e.g. by hiding, revealing, or changing the values of all
the linked input elements. The conditionals in the Pline JSON therefore
provide a quick way to construct sophisticated interfaces that hide
invalid inputs and guide the user through program configuration options.
In addition to generating standalone GUIs, Pline can chain multiple
interfaces together, forming a pipeline – a set of commands executed in
succession. The information about input and output files in the program
description is used to control the data flow between the pipeline steps.
The current state of a single interface or a full pipeline can be stored
to a file and distributed as a reusable Pline pipeline with pre-filled
input values.
By default, Pline stacks interface elements (e.g. inputs and pipeline sections) into a single column. This layout is optimized for tight spaces, like windowing systems in web applications or mobile device screens. In plugin JSON, the inputs can be rearranged to rows and static or collapsible sections by grouping the elements with brackets. For further interface customization (e.g. element spacing, dimensions and the color scheme), the styling rules in the included CSS file can be modified, overriden by the host website or replaced altogether (e.g. with a CSS library like Bootstrap\cite{bootstrap}).
Command-line management
The "Run" button in the plugin interface initiates the third workflow step: the application checks for missing user input, prepares the input files and constructs the terminal command for launching the CLI program (or pipeline). For the interface shown in Figure \ref{477555}, it would display an error message "Input file missing" next to the empty file input, since the associated parameter is marked as compulsory in the source JSON. Filling all the inputs would produce a command with three parameters as shown on the figure together with a confirmation message on the submission button.
Next, the CLI program is launched by the Pline-generated web application. Since the web browser security
sandbox prevents direct command-line access, the program launch data is
passed on to a backend server for execution. Pline includes a
lightweight python script that acts as a server module to launch the commands, either on a local computer or over the web. The Pline server
accepts the command data sent by the interface via an HTTP request,
sanitizes the input, and manages the execution process. It also supports follow-up requests to send execution status updates back to the interface,
pause, cancel or resume running pipelines, or send email notifications
after a command or pipeline has finished.