Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add work item references report #43

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions template/.polarion/pages/spaces/Reports/Home/page.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
SPDX-License-Identifier: Apache-2.0 -->
<rich-page>
<field id="author">4877</field>
<field id="created">2024-11-08 12:18:43.659 +0100</field>
<field id="title">Reports</field>
</rich-page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
SPDX-License-Identifier: Apache-2.0 -->
<rich-page>
<field id="author">4877</field>
<field id="created">2024-11-08 12:55:44.157 +0100</field>
<field id="homePageContent" text-type="text/html"><![CDATA[<div class="polarion-rp-column" style="width: 100%;">
<h1 id="polarion_hardcoded_0">Referenced Work Items</h1>
<p id="polarion_hardcoded_1">This Page has no content yet</p>
</div>
<div class="polarion-rp-row-separator" page_min_width="1000"></div>
<div class="polarion-rp-column" style="width: 100%;">
<div id="polarion_client5" class="polarion-rp-widget-part" data-widget="com.polarion.pageParametersForm">
<span class="polarion-rp-widget-parameters">
<sub id="title"></sub>
<sub id="content">
<sub>workItemType</sub>
<sub>document</sub>
</sub>
<sub id="width">500</sub>
</span>
</div>
</div>
<div class="polarion-rp-row-separator"></div>
<div class="polarion-rp-column" style="width: 100%;">
<div id="polarion_client8" class="polarion-rp-widget-part" data-widget="com.polarion.scriptBlock">
<span class="polarion-rp-widget-parameters">
<sub id="script">
<sub id="script" style="white-space:pre;">#set($projectId = $page.fields().project().projectId())

#set($query = &quot;project.id: $projectId AND type: $pageParameters.workItemType.toLucene()&quot;)
#if($pageParameters.document.values().size() &gt; 0)
#set($docQuery = $pageParameters.document.toLucene().replaceAll(&quot; / &quot;,&quot;/&quot;))
#set($query = &quot;${query} AND document.id: ${docQuery}&quot;)
#end
#set($workItems = $transaction.workItems().search().query($query))

$query &lt;br&gt;&lt;br&gt;

&lt;table class=&quot;polarion-rpw-table-content&quot;&gt;
&lt;tbody&gt;
&lt;tr class=&quot;polarion-rpw-table-header-row&quot;&gt;
&lt;th&gt;Work Item&lt;/th&gt;
&lt;th&gt;Parent Document&lt;/th&gt;
&lt;th&gt;Referenced Documents&lt;/th&gt;
&lt;/tr&gt;

#foreach($wi in $workItems)
#set($wiOldApi = $wi.getOldApi())
#set($references = $wiOldApi.getExternalLinkingModules())
#if($references.size() &gt; 1)
#set($rowspan = &quot;rowspan=${references.size()}&quot;)
#else
#set($rowspan = &quot;&quot;)
#end
&lt;tr class=&quot;polarion-rpw-table-content-row&quot;&gt;
&lt;td $rowspan&gt;$wi.render().withTitle().withLinks()&lt;/td&gt;
&lt;td $rowspan&gt;$wi.fields().module().render().withLinks()&lt;/td&gt;
#if($references.size() == 0)
&lt;td&gt;&lt;/td&gt;
#end

#foreach($ref in $references)
#if($velocityCount == 1)
&lt;td&gt;$transaction.objects().getForOldApiObject($ref).render().withLinks()&lt;/td&gt;
#else
&lt;tr class=&quot;polarion-rpw-table-content-row&quot;&gt;&lt;td&gt;$transaction.objects().getForOldApiObject($ref).render().withLinks()&lt;/td&gt;&lt;/tr&gt;
#end
#end
&lt;/tr&gt;
#end
&lt;/tbody&gt;
&lt;/table&gt;</sub>
</sub>
</span>
</div>
</div>
<div class="polarion-rp-row-separator"></div>
<span id="polarion-rp-parameters">
<sub id="document" data-label="Document" data-type="Enumeration">
<sub id="enumId">@document</sub>
<sub id="allowNoValue">true</sub>
<sub id="allowMultipleValues">false</sub>
<sub id="loadForAllTypes">true</sub>
</sub>
<sub id="workItemType" data-label="Work Item Type" data-type="Enumeration">
<sub id="values">
<sub>capabilityRealization</sub>
</sub>
<sub id="enumId">workitem-type</sub>
<sub id="allowNoValue">false</sub>
<sub id="allowMultipleValues">false</sub>
<sub id="loadForAllTypes">true</sub>
</sub>
</span>]]></field>
<field id="title">Referenced Work Items</field>
</rich-page>
Loading