在页脚中自定义远程事项报告功能
Codebeamer 提供了远程事项报告功能,客户可以使用该功能直接向 Codebeamer 团队报告 Codebeamer 安装事项。
该功能在所有 Codebeamer 页面的页脚中显示 (如下所示),单击此链接,可以打开向导,向 Codebeamer 报告事项。
为什么要自定义?
这是 Codebeamer 客户提出的要求:他们希望自定义此链接的文本和行为,如下所述:
As an system operator of codebeamer installation, I want to configure the link (target url), which is called by clicking on " Incident / Feature Request / Question " inside of the footer of the codebeamer application.
Optional: If easy possible to extend, we also want to change the displayed link-text to be able to change " Incident / Feature Request / Question " to something like "Need support / help for application ?"
如何自定义?
要自定义此链接,系统管理员应转至
应用程序配置,并在此调整以下设置:这里只是举例说明,请根据需要进行调整。
编辑 "installation" 部分并添加以下选项:
...
"installation" : {
"remoteIssueReport" : {
"footerLabel" : "New Report Bug!",
"footerTooltip" : "This opens a customized remote issue reporting page!",
"url" : "http://127.0.0.1:8080/cb/customRemoteIssueReporting.jsp",
"showInFooter" : true
}
} ...
通过在此添加 remoteIssueReport 块,系统管理员可调整:
• footerLabel:这是在页脚中显示的消息的文本或消息代码,而不是标准标签。如果要翻译/国际化此文本,请将消息代码放在此处,并将翻译的消息放到 my-ApplicationResources.properties 文件中,如下所述:
Codebeamer 本地化指南。
• footerTooltip:这是将鼠标悬停在此链接上时出现在工具提示中的文本或消息代码。可以像在 footerLabel 中一样在此处使用消息代码。
• url:单击此链接时页面将转至的可选 URL。在本示例中,这是包含要显示的自定义页面的 JSP 页面,而不是标准报告事项向导页面。
• showInFooter:可选布尔属性:设置为 false 时,可以将此链接从页脚中完全移除。将始终显示指向知识库的链接。
示例
|
|
以下只是一个自定义示例:具体情况可能需要此 URL 的其他登录页面。
|
假设您希望在单击链接时显示自定义 JSP 页面。在我们的示例中,我将添加要显示的新 JSP 页面或链接。
因此,在 $CB_HOME/tomcat/webapps/cb/web/customRemoteIssueReporting.jsp 中新建包含以下内容的文件,即 JSP 页面:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<meta name="decorator" content="popup"/>
<meta name="module" content="tracker"/>
<meta name="moduleCSSClass" content="trackersModule newskin ${importForm.tracker.isBranch() ? 'tracker-branch' : ''}" />
<body>
<div style="padding:10px;">
<h3>Hello this is a custom remote issue reporting JSP page !</h3>
<p>
Parameters:
</p>
<pre>
<c:forEach var="par" items="${paramValues}"><c:out value="${par.key}"/> = <c:out value="${par.value[0]}"/>
</c:forEach>
</pre>
<!-- reconstruct the url to send the data to cb.com by passing all parameters of this page
the "defaultUrl" contains the cb.com url to send the report to
-->
<c:if test="${! empty param.defaultUrl}">
<c:set var="paramsToSend" value=""/>
<c:forEach var="par" items="${paramValues}">
<c:if test="${par.key != 'defaultUrl'}">
<c:set var="paramsToSend" value="${paramsToSend}${par.key}=${par.value[0]}&"/>
</c:if>
</c:forEach>
<a href="${param.defaultUrl}?${paramsToSend}">Send report to codebeamer.com</a>
</c:if>
</div>
</body>
此页面的作用是,在单击时显示一个简单的页面,用于打印输出传递到远程事项报告 JSP 页面的所有参数。这些参数如下:
参数 | 含义 |
|---|
data | 此参数包含 Codebeamer 安装的相关二进制技术数据,如版本号、内存状况、操作系统等。 |
interceptAttribute = remoteIssueTargetUrl | 需要原样传递至 Codebeamer,而不做任何修改。 |
defaultUrl = https://codebeamer.com/cb/remote/issue/create.spr | codebeamer.com 上的远程 URL,通常报告问题的位置。 |
此外,此示例 JSP 页面添加了一个简单 HTML 链接,用于打开标准事项报告 URL。
这也举例说明了如何拦截远程事项报告流,但如果需要使用标准远程事项报告流,则继续此流程。