Skip to content

Commit

Permalink
chore: Webhooks documentation extended
Browse files Browse the repository at this point in the history
Refs: #91
  • Loading branch information
yurtsevich-sbb committed Aug 13, 2024
1 parent c151b10 commit 679dcce
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ ch.sbb.polarion.extension.pdf-exporter.internalizeExternalCss=true

1. On the top of the project's navigation pane click ⚙ (Actions) ➙ 🔧 Administration. Project's administration page will be opened.
2. On the administration's navigation pane select `PDF Export`. There are 5 sub-menus with different configuration options for PDF Exporter.
3. For 3 of these options (Cover page, Header and Footer and Localization) `Quick Help` section available with option short description. For the rest 2
(Style package, Stylesheets) there's no `Quick Help` section, but their content is self-evident.
3. For 5 of these options (Cover page, Header and Footer, Localization, Webhooks and Filename template) `Quick Help` section available with option short description. For the rest 2
(Style package, Stylesheets) there's no `Quick Help` section as their content is self-evident.
4. To change configuration of PDF exporter extension just edit corresponding section and press `Save` button.

## Usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const WebHooks = {
const fieldCell = document.createElement('td');
const field = document.createElement('input');
field.classList.add('fs-14', 'webhook');
field.setAttribute("placeholder", "https://my.domain.com/my-webhook");
if (value) {
field.setAttribute("value", value);
}
Expand Down
21 changes: 18 additions & 3 deletions src/main/resources/webapp/pdf-exporter-admin/pages/webhooks.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
<jsp:include page='/common/jsp/configurations.jsp' />

<h2 class="align-left">List of webhooks</h2>
<p>Here you can add, edit or remove a webhook applied to selected configuration. A webhook is a REST endpoint (POST) accepting initial HTML as a string,
making some modification to this HTML and returning resulting HTML as a string back. Webhooks are invoked in an order they entered on this page.
If certain webhook fails with an error, it's just skipped, remaining webhooks will still be invoked. Webhooks will be invoked during PDF export in the order they are entered on this page.</p>
<table id="webhooks-table"><!-- Filled by JS --></table>
<button class="toolbar-button webhook-button" onclick="WebHooks.addHook()" title="Add a webhook" style="margin-top: 10px; margin-left: 3px;"><img src='/polarion/ria/images/control/tablePlus.png' alt="Plus"></button>

Expand All @@ -75,6 +72,24 @@
<jsp:param name="defaultFunction" value="WebHooks.revertToDefault()"/>
</jsp:include>

<div class="standard-admin-page help">
<h2 class="align-left">Quick Help</h2>

<div>
<p>On this page you can add, edit or remove a webhook applied to selected configuration.</p>

<h3>What is a webhook</h3>
<p>
A webhook is a REST endpoint accepting initial HTML as a string (POST request), making some modification to this HTML and returning resulting HTML as a string back in body of response.
A webhook endpoint can locate anywhere, either within Polarion itself or outside of it.
</p>
<h3>Webhooks processing</h3>
<p>
Webhooks are invoked in an order they entered on this page. If certain webhook fails with an error, it's just skipped, remaining webhooks will still be invoked.
</p>
</div>
</div>

<script type="text/javascript" src="../ui/generic/js/common.js?bundle=<%= bundleTimestamp %>"></script>
<script type="text/javascript" src="../ui/generic/js/custom-select.js?bundle=<%= bundleTimestamp %>"></script>
<script type="text/javascript" src="../ui/generic/js/configurations.js?bundle=<%= bundleTimestamp %>"></script>
Expand Down

0 comments on commit 679dcce

Please sign in to comment.