CSS无法在Jira服务器报告中加载

问题描述 投票:0回答:3

我正在开发jira服务器报告,但无法加载CSS文件。

在我的atlassian-plugin.xml中,我像这样定义我的网络资源:

<web-resource key="jira-reports-resources" name="wl-jira-report-plugin Web Resources">
    <dependency>com.atlassian.auiplugin:ajs</dependency>
    <resource type="download" name="jira-report-plugin.css" location="/css/jira-report-plugin.css"/>
    <resource type="download" name="jira-report-plugin.js" location="/js/jira-report-plugin.js"/>
    <resource type="download" name="images/" location="/images"/>
    <context>jira-reports-context</context>
</web-resource>

和我的报告是这样的:

    <report name="Massnahmen Verantwortlichkeit Report" i18n-name-key="report.massnahme.name"
        key="massnahme-report" class="com.example.reports.massnahme.MassnahmeReport">
    <description key="report.massnahme.description"></description>
    <resource name="view" type="velocity" location="/templates/reports/massnahme/view.vm"/>
    <resource name="i18n" type="i18n" location="report-massnahme"/>
    <label key="report.massnahme.label"></label>
    <!-- the properties of this report which the user must select before running it -->
    <properties>
        <property>
            <key>departmentLeaderId</key>
            <name>report.massnahme.input.user.name</name>
            <description>report.massnahme.input.user.description</description>
            <type>multiselect</type>
            <values class="com.example.reports.massnahme.generator.MassnahmeUserGenerator"/>
        </property>
    </properties>
</report>

在我的报告java类中,将WebResourceManager添加到velocityParams中,并在view.vm中,在第一行中将其调用:

$webResourceManager.requireResourcesForContext("jira-reports-context")

在我的view.vm中,我使用基于表的演示文稿,我想使用手风琴技术折叠表中的行。我的JavaScript已加载,并且点击侦听器可以按预期工作。但是我的css文件被完全忽略了。当我检查chrome页面时,css类根本没有加载。我尝试过一些简单的事情,例如

.test-table{
    border: 1px solid black;
}

没有任何显示。

我必须如何定义CSS类才能在报表中使用它?我很惊讶地发现我不能在报表元素本身中添加CSS或JavaScript。还是我的代码定义有错误?有什么想法吗?

css jira jira-plugin
3个回答
1
投票

尝试一下

webResourceManager.requireResource(“ groupId.artifactid:web-resource”)。

来自以下链接的示例:webResourceManager.requireResource(“ com.avvd.jira.plugin.inquirer:inquirer-resources”)

https://community.atlassian.com/t5/Answers-Developer-Questions/Velocity-don-t-load-resource/qaq-p/489704

谢谢


1
投票

请不要在上下文字符串中使用“-”,将所有“-”替换为“。”

<context>jira.reports.context</context>

$webResourceManager.requireResourcesForContext("jira.reports.context")

0
投票

即使答案不是很正确,@ MrKumar发布的链接也向我显示了正确的方法。显然,对于CustomFields,使用方法requireResource()的方法已经过时,应该将这些资源放在<context>atl.general</context>中。它也直接与我的报告一起使用。

© www.soinside.com 2019 - 2024. All rights reserved.