0

我有一个我写的 Jira 小工具,我想在 Confluence 中使用它。我有 Jira 和 Confluence 在我的机器上本地运行。我已将我的小工具安装到我的 jira 实例中,并且我将两个实例都以完全信任的方式链接为应用程序链接。我已经在管理员的外部小工具部分安装了我的小工具。然后我创建了一个简单的页面并通过选择宏添加了我的小工具。当我单击我的小工具时,我的配置屏幕显示出现问题。它似乎缺少我的 i18n 资源,因为我看到这个标签是 gadget.common.project.label。此外,iframe 并未扩展为包含我的所有配置。

这是我的小工具在融合中的样子:

在此处输入图像描述

这是我的小工具 gadget.xml 的头部:

<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="__MSG_gadget.title__" 
             directory_title="__MSG_gadget.title__"
             description="__MSG_gadget.description__"
             author="__MSG_gadget.author__"
             thumbnail='#staticResourceUrl("TechnicalDebtTracker:TechnicalDebtTracker-resources", "thumbnail.png")'>
    <Optional feature="gadget-directory">
        <Param name="categories">
            . JIRA
        </Param>
    </Optional>
    <Optional feature="atlassian.util"/>
    <Optional feature="auth-refresh"/>
    <Require feature="setprefs" />
    <Require feature="dynamic-height"/>
    <Require feature="settitle"/>
    <Require feature="views"/>
    <Require feature="oauthpopup"/>
    #oauth
    #supportedLocales("gadget.common,gadget.user.activity")
    <Locale messages="__ATLASSIAN_BASE_URL__/download/resources/TechnicalDebtTracker/i18n/ALL_ALL.xml"/>
</ModulePrefs>
<UserPref name="isConfigured" datatype="hidden" default_value="false" />
<UserPref name="project" datatype="hidden" required="true" />
<UserPref name="methodology_type" datatype="hidden" required="true" default_value="scrum" />
<UserPref name="warning_threshold" datatype="hidden" required="true" default_value="10" />
<UserPref name="critical_threshold" datatype="hidden" required="true" default_value="20" />
<UserPref name="paid_down_period" datatype="hidden" required="true" default_value="90" />
<UserPref name="normal_color" datatype="hidden" required="true" default_value="#61F553" />
<UserPref name="warning_color" datatype="hidden" required="true" default_value="#FFFA66" />
<UserPref name="critical_color" datatype="hidden" required="true" default_value="#FF7A66" />
<UserPref name="refresh" datatype="hidden" default_value="false" />
<Content type="html">
    <![CDATA[
        #requireResource("com.atlassian.gadgets.publisher:ajs-gadgets")
        #requireResource("com.atlassian.jira.gadgets:g-filter-results")
        #requireResource("TechnicalDebtTracker:TechnicalDebtTracker-resources")
        #includeResources()

(function () 
        {       
        var gadget = AJS.Gadget({
            baseUrl: "__ATLASSIAN_BASE_URL__",
            useOauth: "/rest/gadget/1.0/currentUser",
            config: {
                descriptor: function(args) {
                    var gadget = this;

                    var projectPicker = AJS.gadget.fields.projectPicker(gadget, "project", args.projectOptions);
                    return {
                        fields: [
                            projectPicker,
                            {
                                id: "methodology_type-id",
                                userpref: "methodology_type",
                                label: "__MSG_gadget.config.SetMethodology__",
                                description: "",
                                type: "select",
                                selected: gadget.getPref("methodology_type"),
                                options: [
                                            {
                                                label:"Scrum",
                                                value:"scrum"
                                            },
                                            {
                                                label:"Kanban",
                                                value:"kanban"
                                            }
                                         ]
                            },
                            {
                                id: "warning_threshold-id",
                                userpref: "warning_threshold",
                                label: "__MSG_gadget.config.SetWarning__",
                                description: "__MSG_gadget.config.InStoryPoints__",
                                type: "text",
                                value: gadget.getPref("warning_threshold")
                            },
                            {
                                id: "critical_threshold-id",
                                userpref: "critical_threshold",
                                label: "__MSG_gadget.config.SetCritical__",
                                description: "__MSG_gadget.config.InStoryPoints__",
                                type: "text",
                                value: gadget.getPref("critical_threshold")
                            },
                            {
                                id: "paid_down_period-id",
                                userpref: "paid_down_period",
                                label: "__MSG_gadget.config.SetPaidDownPeriod__",
                                description: "__MSG_gadget.config.InDays__",
                                type: "text",
                                value: gadget.getPref("paid_down_period")
                            },
                            {
                                id: "normal_color-id",
                                userpref: "normal_color",
                                label: "__MSG_gadget.config.SetNormalColor__",
                                description: "__MSG_gadget.config.HexCode__",
                                type: "text",
                                value: gadget.getPref("normal_color")
                            },
                            {
                                id: "warning_color-id",
                                userpref: "warning_color",
                                label: "__MSG_gadget.config.SetWarningColor__",
                                description: "__MSG_gadget.config.HexCode__",
                                type: "text",
                                value: gadget.getPref("warning_color")
                            },
                            {
                                id: "critical_color-id",
                                userpref: "critical_color",
                                label: "__MSG_gadget.config.SetCriticalColor__",
                                description: "__MSG_gadget.config.HexCode__",
                                type: "text",
                                value: gadget.getPref("critical_color")
                            },
                            AJS.gadget.fields.nowConfigured()
                        ]
                    };
                },
                args: function()
                {
                    return [
                        {
                            key: "projectOptions",
                            ajaxOptions:  "/rest/gadget/1.0/filtersAndProjects?showFilters=false"
                        },
                    ];
                }()
            },
4

1 回答 1

2

看看我的“projectPicker”。我认为这可能会有所帮助:

AJS.$.extend(true, {}, AJS.gadget.fields.projectPicker(gadget, "project", args.projectOptions),
    {description: "select a project", 
     label: "Project"}
)

在那里你可以像这样添加你的消息:

AJS.$.extend(true, {}, AJS.gadget.fields.projectPicker(gadget, "project", args.projectOptions),
    {description: "__MSG_gadget.common.project.label__", 
     label: "__MSG_gadget.common.project.description__"}
) 
于 2013-05-07T15:23:39.663 回答