Rally 如何使用自定义网格显示缺陷套件中的缺陷

Rally 如何使用自定义网格显示缺陷套件中的缺陷,rally,Rally,我有一个场景,我想创建一个自定义网格,显示项目中链接到特定缺陷套件的所有缺陷 考虑到缺陷套件与缺陷之间的关系(例如,缺陷套件有一组缺陷),我如何在自定义网格中创建一个自定义查询,以显示与该缺陷套件相关的所有缺陷?在WS-API的v2.0中,出于性能原因,我们取消了在同一响应中返回子集合的功能。在v2.0中,获取集合将返回一个对象,该对象包含计数和从中获取集合的url。这意味着当我们查询DefectSuite对象时,不会返回其缺陷集合 对于自定义网格,在对象下拉列表中选择DefectSuite时,

我有一个场景,我想创建一个自定义网格,显示项目中链接到特定缺陷套件的所有缺陷


考虑到缺陷套件与缺陷之间的关系(例如,缺陷套件有一组缺陷),我如何在自定义网格中创建一个自定义查询,以显示与该缺陷套件相关的所有缺陷?

在WS-API的v2.0中,出于性能原因,我们取消了在同一响应中返回子集合的功能。在v2.0中,获取集合将返回一个对象,该对象包含计数和从中获取集合的url。这意味着当我们查询DefectSuite对象时,不会返回其缺陷集合

对于自定义网格,在对象下拉列表中选择DefectSuite时,DefectSuite的缺陷集合在自定义网格的列中不可用

一个自定义应用程序,该应用程序显示带有关联缺陷的缺陷套件网格。缺陷套件按版本过滤。您可以在Rally中复制/粘贴到自定义页面

js文件:

Ext.define('CustomApp', {
    extend: 'Rally.app.TimeboxScopedApp',
    componentCls: 'app',
    scopeType: 'release',
    addContent: function() {
        this._makeStore();
    },
   onScopeChange: function() {
        console.log('onScopeChange');
        this._makeStore();
    },
_makeStore: function(){
        Ext.create('Rally.data.WsapiDataStore', {
                model: 'DefectSuite',
                fetch: ['FormattedID', 'Defects', 'DefectStatus'],  
                pageSize: 100,
                autoLoad: true,
                filters: [this.getContext().getTimeboxScope().getQueryFilter()],
                listeners: {
                    load: this._onDefectSuitesLoaded,
                    scope: this
                }
            }); 
    },
     _onDefectSuitesLoaded: function(store, data){
        var defectSuites = [];
        var pendingDefects = data.length;
         console.log(data.length);
         if (data.length ===0) {
            this._createDefectSuitesGrid(defectSuites);  
         }
         Ext.Array.each(data, function(defectsuite){ 
            var ds  = {
                FormattedID: defectsuite.get('FormattedID'),   
                _ref: defectsuite.get('_ref'),  
                DefectStatus: defectsuite.get('DefectStatus'),
                DefectCount: defectsuite.get('Defects').Count,
                Defects: []
            };
            var defects = defectsuite.getCollection('Defects');
            defects.load({
                                fetch: ['FormattedID'],
                                callback: function(records, operation, success){
                                    Ext.Array.each(records, function(defect){
                                        ds.Defects.push({_ref: defect.get('_ref'),
                                                        FormattedID: defect.get('FormattedID')
                                                    });
                                    }, this);
                                    --pendingDefects;
                                    if (pendingDefects === 0) {
                                        this._createDefectSuitesGrid(defectSuites);
                                    }
                                },
                                scope: this
                            });
            defectSuites.push(ds);
     },this);
 },

      _createDefectSuitesGrid: function(defectsuites) {
        var defectSuiteStore = Ext.create('Rally.data.custom.Store', {
                data: defectsuites,
                pageSize: 100,  
            });
        if (!this.down('#defectsuitegrid')) {
         this.grid = this.add({
            xtype: 'rallygrid',
            itemId: 'defectsuitegrid',
            store: defectSuiteStore,
            columnCfgs: [
                {
                   text: 'Formatted ID', dataIndex: 'FormattedID', xtype: 'templatecolumn',
                    tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
                },
                {
                    text: 'Defect Count', dataIndex: 'DefectCount',
                },
                {
                    text: 'Defect Status', dataIndex: 'DefectStatus',flex:1
                },
                {
                    text: 'Defects', dataIndex: 'Defects',flex:1, 
                    renderer: function(value) {
                        var html = [];
                        Ext.Array.each(value, function(defect){
                            html.push('<a href="' + Rally.nav.Manager.getDetailUrl(defect) + '">' + defect.FormattedID + '</a>')
                        });
                        return html.join(', ');
                    }
                }
            ]
        });
         }else{
            this.grid.reconfigure(defectSuiteStore);
         }
    }
});
Ext.define('CustomApp'{
扩展:“Rally.app.TimeboxScopedApp”,
组件CLS:“应用程序”,
scopeType:“发布”,
addContent:function(){
这个;
},
onScopeChange:function(){
log('onScopeChange');
这个;
},
_makeStore:function(){
Ext.create('Rally.data.WsapiDataStore'{
型号:'DefectSuite',
获取:['FormattedID','Defects','DefectStatus'],
页面大小:100,
自动加载:对,
筛选器:[this.getContext().getTimeboxScope().getQueryFilter()],
听众:{
加载:此。已加载,
范围:本
}
}); 
},
_OnDecectSitesLoaded:函数(存储、数据){
var=[];
var pendingDefects=data.length;
console.log(data.length);
如果(data.length==0){
这是.\u createDefectSuitesGrid(defectSuites);
}
Ext.Array.each(数据、函数(缺陷套件){
变量ds={
FormattedID:defectsuite.get('FormattedID'),
_ref:defectsuite.get(“u ref”),
DefectStatus:defectsuite.get('DefectStatus'),
DefectCount:defectsuite.get('Defects').Count,
缺陷:[]
};
var defects=defectsuite.getCollection('defects');
缺陷和负载({
获取:['FormattedID'],
回调:函数(记录、操作、成功){
Ext.Array.each(记录、功能(缺陷){
ds.Defects.push({u-ref:defect.get(''u-ref'),
FormattedID:defect.get('FormattedID')
});
},这个);
--悬而未决的缺陷;
如果(未决缺陷===0){
这是.\u createDefectSuitesGrid(defectSuites);
}
},
范围:本
});
推送(ds);
},这个);
},
_createDefectSuitesGrid:函数(defectsuites){
var defectSuiteStore=Ext.create('Rally.data.custom.Store'{
数据来源:defectsuites,
页面大小:100,
});
如果(!this.down('#defectsuitegrid')){
this.grid=this.add({
xtype:“rallygrid”,
itemId:'defectsuitegrid',
商店:defectSuiteStore,
专栏CFGS:[
{
text:'Formatted ID',dataIndex:'FormattedID',xtype:'templatecolumn',
tpl:Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
},
{
文本:“缺陷计数”,数据索引:“缺陷计数”,
},
{
文本:“缺陷状态”,数据索引:“缺陷状态”,flex:1
},
{
文本:“缺陷”,数据索引:“缺陷”,flex:1,
渲染器:函数(值){
var html=[];
Ext.Array.each(值、函数(缺陷){
html.push(“”)
});
返回html.join(',');
}
}
]
});
}否则{
此.grid.reconfigure(defectSuiteStore);
}
}
});