1

我正在使用带有登录密钥的 Rally SDK 1.33 来创建报告页面。我需要在 Rally 之外显示迭代摘要应用程序。我一直在尝试使用以下内容编写此代码,以查找有关 Rally 中迭代的信息:

    rallyDataSource.findAll({
          key: "sprints",
          type: "Iteration",
          query: '(EndDate > "today")',
          fetch: true
      }, displayIterationSummary);

displayIterationSummary 函数看起来像这样:

    function displayIterationSummary(results) {
           //access "Start Date" and "End Date" attribute from results.sprints to set up "DaysRemaining" and "TotalDays"
           var panelConfig = {
               title: "Sprint Summary",
               columnKeys: ['Name', 'DaysRemaining', 'TotalDays', 'State'],
               width: 600,
               height: 300

           };
           //take appropriate steps to display the result of this

       }

我的想法是,我可以得到迭代“结束日期”和“开始日期”,然后我可以使用这些属性来设置“剩余天数”和“总天数”属性。如何在函数“displayIterationSummary”中访问这些属性?此外,如果有任何其他方式可以在 Rally 之外编写和显示迭代摘要应用程序,请告诉我!谢谢

4

1 回答 1

1

这是一个示例,它打印出包含 StartDate、EndDate 和其他一些数据的迭代表。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Copyright (c) 2010  Rally Software Development Corp.  All rights reserved -->
<html>
<head>
    <title>Table Component Example</title>
    <meta name="Name"    content="App Example: Table of Iterations" />
    <meta name="Version" content="2010.4" />
    <meta name="Vendor"  content="Rally Lab - Nick" />
    <script type="text/javascript" src="https://rally1.rallydev.com/apps/1.33/sdk.js"></script>
    <script type="text/javascript">

        function tableExample() {
            var rallyDataSource = new rally.sdk.data.RallyDataSource('1111', '22222',
            'false', 'true');
            function itemQuery() {
                var queryObject = {
                    key: 'it',
                    type: 'iteration',
                    fetch: 'Name,ObjectID,Project,StartDate,EndDate',
                    query:'(EndDate > Today)'
                };
                rallyDataSource.findAll(queryObject, populateTable);
            }

            function populateTable(results) {

                for (var i=0; i < results.it.length; i++) {
                    results.it[i].Difference = rally.sdk.util.DateTime.getDifference(new Date(rally.sdk.util.DateTime.
                    fromIsoString(results.it[i].EndDate)),new Date(rally.sdk.util.DateTime.
                    fromIsoString(results.it[i].StartDate, "day")));
                }

                var tableDiv = document.getElementById('aDiv');
                if(table) {
                    table.destroy();
                }
                var config = { 
                    columns:
                    [
                        {key: 'Name'},
                        {key: 'ObjectID'},
                        {key: 'StartDate'},
                        {key: 'EndDate'},
                        {key: 'Difference'},
                        {key: 'Project.Name'}
                    ]
                };
                var table = new rally.sdk.ui.Table(config);
                table.addRows(results.it);
                table.display(tableDiv);

            };
            itemQuery();
        }

        rally.addOnLoad(tableExample);
    </script>
</head>
<body>
   <div id="aDiv"></div>
</body>
</html>

要在 Rally 之外运行应用程序,例如直接在浏览器中运行,需要 sdk.js 的完整 URL:

<script type="text/javascript" src="https://rally1.rallydev.com/apps/1.33/sdk.js"></script>

本文档描述了如何在 Rally 之外运行应用程序 无需使用 LoginKey 即可在 Rally 之外运行应用程序。LoginKey 功能允许在不提示登录 Rally 的情况下运行自定义应用程序或标准报告,因为它具有只读用户凭据编码。

于 2013-07-25T19:49:18.750 回答