Community
Thumb_html_snippet_injector_1

Polarion Notification Bar leveraging the HTML Snippet Injector

 The interface of Polarion can now be adjusted by injecting code snippets to the main Polarion frame.

Description

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.

 

What's New in Version 2.0

Updated September 2023

Changes for 1.0 - 2.0
- Complete overhaul
- Separated into a standalone JavaScript file
- Code fully commented for easier modification
- Added an option to differentiate the message type by color
- If a user hides the notification bar, it will automatically reappear when the message changes
- The notification bar will automatically hide when the message is empty ("message": "")
- Setup variables are extracted from the script to prevent unnecessary script modifications

Version 1.0
- Initial release

Information

Vendor Siemens PLM
Published Version 2.0 - September 2023
Categories
Price Free
540 Downloads
Community Supported Extension This extension is not supported by Siemens PLM.
Requirements Polarion 22 R2 (3.22.2) and newer
Last tested with Polarion 2310 (3.23.10)

Related Extensions