As of Polarion 22 R2 admins can customize the Polarion user interface by injecting HTML and JavaScript snippets into Polarion’s HTML pages. This extension is an example of a simple notification bar that alerts users about upcoming downtimes of Polarion by reading a remote text file and displaying the bar atop of Polarion content frame.
The concept of this example javascript snipped extension is to periodically pull a JSON file that contains data for notifications to be displayed. The content of the file is transformed to HTML and appended to the main Polarion window. If the message is empty, the header is hidden.
Use this example to get inspiration on what can be achieved by injecting HTML and JavaScript snippets into Polarion. Bear in mind that the HTML elements, their classes, and IDs are not stable Polarion API and be changed or removed in future Polarion versions.
In version 2310, the possibility of injection into DLE and Print Preview has been added. Example usage will be included on the Extension Portal after the new version is released to customers with Early Access.
You have two options to inject JavaScript into Polarion's main content frame:
- Via Polarion properties (Requires access to the filesystem)
- Configuration Properties in Polarion Global Administration
For this example, we are using the Polarion property com.siemens.polarion.scriptInjection.mainHead in the polarion.properties file, which appends the string (of HTML/JS/CSS) to the <head>) tag of the main pages of Polarion.
Alternatively, you can insert the custom code via the following runtime Configuration Properties in Polarion Global Administration:
scriptInjection.mainHead=<string>
Please note, that the string needs to be in one-line format. To get your HTML in one line you can use tools such as this one.
For more details, please see the Customize Polarion User Interface section in Polarion help.
HTML snippet customization offers a lot of power and flexibility, but be careful. With great power comes great responsibility and admins implementing these extensions need to adequately understand the functional, performance, security, and end-user impact they can have on end users.
Visit our Polarion Community for guidance and learn how other customers leverage the benefits of this new feature.