通过Confluence HTML为标准报告传递API密钥

时间:2016-04-11 18:18:45

标签: javascript rally confluence confluence-rest-api code-rally

我已经能够将Java API代码用于Iteration TreeGrid和Iteration Burndown / Release Burnup图表。我们一直试图让这个在Confluence上运行,并且有些问题试图传递iframe,而IT则存在一些绕过选项的问题。我们已经能够通过下面的脚本获得一些相似的功能。事实上,Iteration TreeGrid每次都能成功运行,但大多数情况下,标准报告只会显示Rally登录屏幕。这是不一致的,有时这适用于我在Chrome中,但不适用于Firefox / IE等。如果通过链接以及脚本中的内容输入,我们将API附加到汇合页面的路径。是否有另一种方法可以传递标准报告的密钥以便生成?

谢谢! 标记

enter code here {html}      

<script type="text/javascript">
    var field = 'apiKey';
    var url = window.location.href;
    if(
        (url.indexOf('?' + field + '=') != -1) ||
        (url.indexOf('&' + field + '=') != -1)
    ){
        //alert("**** 001");
    } else {        
        var myURL = document.location;
        if(window.location.href.indexOf('?') > 0){
            document.location = myURL + "&apiKey=_1OS4fhAQBi101VTZ4PytkQXb9jYEt0qYx79WXJacc";
        } else {
            document.location = myURL + "?apiKey=_1OS4fhAQBi101VTZ4PytkQXb9jYEt0qYx79WXJacc";
        }
    }

</script>


<div id="div-iterationburndown"></div>

    <script type="text/javascript">
        Rally.onReady(function() {
            Ext.create("Ext.Container", {
                context: {},
                items: [{
                    xtype: "rallystandardreport",
                    width: 750,
                    height: 500,
                    reportConfig: {
                        report: "IterationBurndown",
                        iteration: "April",
                        subchart: "hide",
                        title: "Iteration Burndown"
                    },
                    project: "https://rally1.rallydev.com/slm/webservice/v2.0/project/51186094804",
                    projectScopeUp: !1,
                    projectScopeDown: !0
                }],
                renderTo: Ext.get("div-iterationburndown")
            });


            Rally.launchApp('CustomApp', {
                name: "iterationburndown",
                parentRepos: ""
            });
        });
    </script>


<div id="div-releaseburnup"></div>

    <script type="text/javascript">
        Rally.onReady(function() {
            Ext.create("Ext.Container", {
                context: {},
                items: [{
                    xtype: "rallystandardreport",
                    width: 750,
                    height: 500,
                    reportConfig: {
                        report: "ReleaseBurnup",
                        subchart: "hide",
                        title: "Release Burnup"
                    },
                    project: "https://rally1.rallydev.com/slm/webservice/v2.0/project/51186094804",
                    projectScopeUp: !1,
                    projectScopeDown: !0
                }],
                renderTo: Ext.get("div-releaseburnup")
            });
            Rally.launchApp('CustomApp', {
                name: "releaseburnup",
                parentRepos: ""
            });
        });
    </script>

<div id="div-RallyGrid" style="border-width:5px 5px 5px 5px;width:300px;height:150px;"></div>

 <script type="text/javascript">
        Rally.onReady(function() {
            Ext.create("Rally.data.wsapi.TreeStoreBuilder").build({
                models: ["userstory"],
                autoLoad: !0,
                context: {
                    workspace: "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/50876644101",
                    project: "https://rally1.rallydev.com/slm/webservice/v2.0/project/50891172431"
                },
                enableHierarchy: !0,
                filters: [{
                    property: "Iteration.Name",
                    operator: "=",
                    value: "April"
                }, {
                    property: "Project.Name",
                    operator: "=",
                    value: "Harrier"
                }]
            }).then({
                success: function(store) {
                    Ext.create("Ext.Container", {
                        width: 1e3,
                        height: 1e3,
                        border: 5,
                        items: [{
                            xtype: "rallytreegrid",
                            columnCfgs: ["DisplayColor", "Name", "ScheduleState", "Blocked", "TaskEstimateTotal", "TaskRemainingTotal", "Owner", "Notes"],
                            store: store
                        }],
                        renderTo: Ext.get("div-RallyGrid")
                    })
                }
            });
            Rally.launchApp('CustomApp', {
                name: "RallyGrid",
                parentRepos: ""
            });
        });
    </script>





{html}

2 个答案:

答案 0 :(得分:0)

AppSDK2中的

StandardReport component是早于ApiKey的第一代分析服务的包装器。这是一种分析服务,可为您提供报告&gt;报告页面的报告。这些报告也可以通过AppSDK1中的StandardReport组件获得。

第一代图表不支持ApiKey。 AppSDK2支持ApiKey,如Embedding Apps指南中所述。 AppSDK2应用程序可以使用ApiKey进行身份验证。但是,如果AppSDK2应用程序正在使用StandardReport组件,则报告后面的分析服务将提示您登录 - 它不适用于ApiKey。在您的场景中,遗憾的是,它失败了将报表嵌入到其他Web内容中的目的,以供可能不一定拥有Rally凭据的利益相关者查看。

我怀疑如果它似乎偶尔起作用,可能是因为您已经在同一浏览器窗口的另一个选项卡中登录到Rally。如果您在隐身模式下打开一个新窗口,系统将提示您登录。<​​/ p>

答案 1 :(得分:0)

好消息! AppSDK 2.1中的StandardReport组件和支持A1 Analytics服务现在完全支持Api Keys,因此您应该能够相当轻松地完成此操作。

一些有用的链接:

StandardReport组件:https://help.rallydev.com/apps/2.1/doc/#!/api/Rally.ui.report.StandardReport

在外部嵌入应用: https://help.rallydev.com/apps/2.1/doc/#!/guide/embedding_apps