2015-08-22 56 views
0

問題1:是否可以向故事板中的每張卡添加自定義數據(例如:testcase count:5)?如果是這樣,怎麼樣?我無法在文檔中找到示例或特定信息。如何在故事板中添加自定義數據?

問題2:是否可以在一個查詢中獲得高級故事的測試用例數(包括兒童故事測試用例)?

請讓我知道。這裏是我的代碼

Ext.define('Rally.Story.View', { 
    extend: 'Rally.app.App', 

    launch: function() { 
     this.add({ 
      xtype: 'rallyfieldvaluecombobox', 
      fieldLabel: 'Filter by Target Release:', 
      model: 'UserStory', 
      field: 'c_TargetRelease', 
      value: '15.0', 
      listeners: { 
       select: this._onSelect, 
       ready: this._onLoad, 
       scope: this 
      } 
     }); 
    }, 

    _onLoad: function() { 
     this.add({ 
      xtype: 'rallycardboard', 
      types: ['User Story'], 
      attribute: 'ScheduleState', 
      readOnly: true, 
      fetch: ['Name', 'TestCases', 'c_StoryType', 'c_TargetRelease', 'PlanEstimate', 'Priority', 'TaskEstimateTotal', 'TaskRemainingTotal'], 
      context: this.getContext(), 
      cardConfig: { 
       editable: false, 
       showIconsAndHighlightBorder: false, 
       fields: ['Name', 'c_StoryType', 'c_TargetRelease', 'PlanEstimate', 'c_PriorityBin', 'Parent', 'TestCases', 'TaskEstimateTotal', 'TaskRemainingTotal'] 
      }, 
      storeConfig: { 
       filters: [ 
        { 
         property: 'c_StoryType', 
         value: 'SAGA Feature' 
        }, 
        { 
         property: 'c_TargetRelease', 
         operator: '=', 
         value: this.down('rallyfieldvaluecombobox').getValue() 
        } 
       ] 
      } 
     }); 
    }, 

    _onSelect: function() { 
     var board = this.down('rallycardboard'); 
     board.refresh({ 
      storeConfig: { 
       filters: [ 
        { 
         property: 'c_StoryType', 
         value: 'SAGA Feature' 
        }, 
        { 
         property: 'c_TargetRelease', 
         operator: '=', 
         value: this.down('rallyfieldvaluecombobox').getValue() 
        } 
       ] 
      } 
     }); 
    },   
}); 

回答

1

這是我由包含測試用例計數的樣本卡:

Card Screenshot

您可以通過簡單地包括在它的一些渲染信息的對象,而不是增加一個字段只是場陣列中的cardConfig在一個簡單的字符串:

cardConfig: { 
    fields: [ 
     'Name', //simple string field to show 
     { 
      name: 'TCCount', //field name 
      hasValue: function() {return true;}, //always show this field 
      renderTpl: Ext.create('Rally.ui.renderer.template.LabeledFieldTemplate', { 
         fieldLabel: 'Test Case Count', //the field label 
         valueTemplate: Ext.create('Ext.XTemplate', 
          ['{[this.getTestCaseCount(values)]}', 
          {getTestCaseCount: function(data) { return data.Summary.TestCases.Count;}}]) 
        }) 
     }, 
     //additional string fields 
     'PlanEstimate', 'Parent', 'TestCases', 'TaskEstimateTotal', 'TaskRemainingTotal'] 
} 

該結束了,比我想migh那麼簡單不過,但至少它是可行的。關鍵部分是使用LabeledFieldTemplate,指定實際呈現內容的字段標籤和值模板。

您還會注意到由於TestCases包含在字段列表中的腳註中會自動顯示小燒杯狀態圖標。

至於你的第二個問題,對於兒童故事中包含的測試用例的總數,故事沒有捲起欄。

+0

非常感謝Kyle。這非常有幫助! – Sharma