【问题标题】:How to display defects within a defect suite using a custom grid如何使用自定义网格显示缺陷套件中的缺陷
【发布时间】:2014-01-03 06:16:15
【问题描述】:

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

鉴于关系是从缺陷套件到缺陷(例如,缺陷套件具有缺陷集合),我如何在自定义网格中创建自定义查询,以显示与该缺陷套件相关的所有缺陷?

【问题讨论】:

    标签: rally


    【解决方案1】:

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

    就自定义网格而言,当您在对象下拉列表中选择 DefectSuite 时,DefectSuite 的缺陷集合在自定义网格上的列中不可用。

    Here is an example 的自定义应用程序,显示带有相关缺陷的缺陷套件网格。 DefectSuite 按发布过滤。您可以将this html file 复制/粘贴到 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);
             }
        }
    });
    

    【讨论】:

      猜你喜欢
      • 2013-07-29
      • 1970-01-01
      • 2012-04-11
      • 2014-08-08
      • 1970-01-01
      • 2013-02-20
      • 1970-01-01
      • 1970-01-01
      • 2012-03-18
      相关资源
      最近更新 更多