JIRA-列出配置中的项目并记住选择 [英] JIRA - list projects in configuration and remember selection

查看:107
本文介绍了JIRA-列出配置中的项目并记住选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个仪表板小工具,该小工具小工具将在其配置对话框中显示JIRA项目的列表,并允许用户从列表中进行选择.我需要能够记住此项目列表(因此以某种方式将它们保存在服务器上).我该如何做一个清单?

I am trying to create a dashboard gadget that will display a list of JIRA projects in its configuration dialog and allow the user to select from the list. I need to be able to remember this list of projects (so save them on the server somehow). How do I go about doing that for a list?

我正在使用最新的jira版本

I am using the latest jira version out

谢谢

推荐答案

gadget.xml 文件中使用以下代码:

Use this code in gadget.xml file:

...
<UserPref name="projectId" display_name="Project" datatype="select" default_value=""/>
...
<script type="text/javascript">
    (function () {
        var gadget = AJS.Gadget({
            baseUrl: "__ATLASSIAN_BASE_URL__",
            config: {
            descriptor: function (args) {
              var gadget = this;

              var projects = [{"label":"All","value":""}];
              projectsMap = args.projects.options;
              for(key in projectsMap) {
                projectName = projectsMap[key].label;
                projects.push({"label":projectName,"value":projectName});
              }

              return {
                  fields: [
                      {
                        userpref: "projectId",
                        label: "Project",
                        type: "select",
                        selected: this.getPref("projectId"),
                        options: projects
                      },
                      ...
                      AJS.gadget.fields.nowConfigured()
                  ]
              };
            },
            args : [{
              key: "projects",
              ajaxOptions: "/rest/gadget/1.0/filtersAndProjects?showFilters=false"
            }]
            },
            view: {
                enableReload: true,
                template: function(args) {
                    var gadget = this;
                    ...
                },
                args: [{
                    key: "timesheet",
                    ajaxOptions: function() {
                        return {
                            url: "/rest/timepo-resource/1.0/issues-report.json",  //put your url here
                            data: {
                              projectId: this.getPref("projectId"),
                              ...
                              baseUrl: "__ATLASSIAN_BASE_URL__"
                            }
                        };
                    }
                }]
            }
        });
    })();
</script>

这篇关于JIRA-列出配置中的项目并记住选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆