Rally 如何使用AppSDK 2构建一个网格,其中列是分辨率的下拉值?
我想显示通过迭代过滤的已关闭缺陷的摘要,每个分辨率的缺陷总数如下所示:Rally 如何使用AppSDK 2构建一个网格,其中列是分辨率的下拉值?,rally,appsdk2,Rally,Appsdk2,我想显示通过迭代过滤的已关闭缺陷的摘要,每个分辨率的缺陷总数如下所示: 下面是一个网格示例。替换中的“111” workspace: '/workspace/1111' 使用工作区的ObjectID。显示如何查找工作区的OID <!DOCTYPE html> <html> <head> <title>closed defects by iteration</title> <script type="text/javascript
下面是一个网格示例。替换中的“111”
workspace: '/workspace/1111'
使用工作区的ObjectID。显示如何查找工作区的OID
<!DOCTYPE html>
<html>
<head>
<title>closed defects by iteration</title>
<script type="text/javascript" src="/apps/2.0rc1/sdk.js"></script>
<script type="text/javascript">
Rally.onReady(function () {
Ext.define('CustomApp', {
extend: 'Rally.app.TimeboxScopedApp',
componentCls: 'app',
scopeType: 'iteration',
comboboxConfig: {
fieldLabel: 'Select an Iteration:',
labelWidth: 100,
width: 300
},
addContent: function() {
this._arr = [];
var that = this;
console.log('_addContent');
Rally.data.ModelFactory.getModel({
type: 'Defect',
context: {
workspace: '/workspace/1111'
},
success: function(model) {
that._allowedValuesStore = model.getField( 'Resolution' ).getAllowedValueStore( );
console.log("allowed values count", that._allowedValuesStore.getCount());
that._getDropdownValues();
that._makeStore();
}
});
},
_getDropdownValues: function(){
var that = this;
this._allowedValuesStore.load({
scope: this,
callback: function(records, operation, success){
console.log(records[1].get('StringValue'));
Ext.Array.each(records, function(val) {
var s = val.get('StringValue');
that._arr.push(s);
});
console.log("arr[2]", this._arr[2])
}
});
},
_makeStore: function(){
console.log('_makeStore');
var filter = Ext.create('Rally.data.QueryFilter', {
property: 'Priority',
operator: '=',
value: 'Resolve Immediately'
});
filter = filter.or({
property: 'Priority',
operator: '=',
value: 'High Attention'
});
filter = filter.and({
property: 'State',
operator: '=',
value: 'Closed'
});
filter = filter.and(this.getContext().getTimeboxScope().getQueryFilter());
filter.toString();
Ext.create('Rally.data.WsapiDataStore', {
model: 'Defect',
fetch: ['FormattedID','Name','Tasks','State','Resolution','Priority'],
pageSize: 100,
autoLoad: true,
filters: [filter],
listeners: {
load: this._onDataLoaded,
scope: this
}
});
},
onScopeChange: function() {
console.log('onScopeChange');
this._makeStore();
},
_onDataLoaded: function(store, data){
console.log('_onDataLoaded');
var defects = [];
if (data.length === 0) {
this._createGrid(defects);
}
var countArchitecture=0;
var countCodeChange=0;
var countNotADefect=0;
var countNone = 0;
var countConfigurationChange =0;
var countDatabaseChange = 0;
var countDuplicate = 0;
var countNeedMoreInformation =0;
var countSoftwareLimitation =0;
var countUserInterface = 0;
Ext.Array.each(data, function(defect) {
var resolution = defect.get('Resolution');
switch(resolution)
{
case "Architecture":
countArchitecture++;
break;
case "Code Change":
countCodeChange++;
break;
case "Not a Defect":
countNotADefect++;
break;
case "None":
countNone++;
break;
case "Configuration Change":
countConfigurationChange++;
break;
case "Database Change":
countDatabaseChange++;
break;
case "Duplicate":
countDuplicate++;
break;
case "Need More Information":
countDuplicate++;
break;
case "Software Limitation":
countSoftwareLimitation++;
break;
case "User Interface":
countUserInterface++;
break;
default:
countNone++;
}
});
var d = {
'Architecture': countArchitecture,
'Code Change': countCodeChange,
'Not a Defect' : countNotADefect,
'' : countNone,
'Configuration Change': countConfigurationChange,
'Database Change': countDatabaseChange,
'Duplicate': countDuplicate,
'Need More Information': countNeedMoreInformation,
'Software Limitation': countSoftwareLimitation,
'User Interface':countUserInterface,
};
defects.push(d);
this._createGrid(defects);
},
_createGrid: function(defects) {
console.log('_createGrid');
console.log('this._arr[3]', this._arr[3]);
var that = this;
var myStore = Ext.create('Rally.data.custom.Store', {
data: defects,
pageSize: 100,
});
var columnConfig = [];
for (var i=0;i<this._arr.length; i++) {
var columnConfigElement = {};
columnConfigElement['text'] = that._arr[i];
columnConfigElement['dataIndex'] = that._arr[i];
columnConfig.push(columnConfigElement);
}
console.log('columnConfig', columnConfig);
if (!this.grid) {
this.grid = this.add({
xtype: 'rallygrid',
itemId: 'mygrid',
store: myStore,
columnCfgs: columnConfig
});
}else{
this.grid.reconfigure(myStore);
}
}
});
Rally.launchApp('CustomApp', {
name:"closed defects by iteration",
//parentRepos:""
});
});
</script>
<style type="text/css">
.app {
margin: 10px;
}
.header {
margin: 5px;
}
</style>
</head>
<body></body>
</html>
迭代闭合缺陷
Rally.onReady(函数(){
Ext.define('CustomApp'{
扩展:“Rally.app.TimeboxScopedApp”,
组件CLS:“应用程序”,
scopeType:'迭代',
comboboxConfig:{
fieldLabel:“选择迭代:”,
标签宽度:100,
宽度:300
},
addContent:function(){
这个。_arr=[];
var=这个;
console.log(“添加内容”);
Rally.data.ModelFactory.getModel({
类型:“缺陷”,
背景:{
工作区:'/workspace/1111'
},
成功:功能(模型){
即.u allowedValuesStore=model.getField('Resolution').getAllowedValueStore();
log(“允许的值计数”,即._allowedValuesStore.getCount());
那就是。_getDropdownValues();
那个;
}
});
},
_getDropdownValues:function(){
var=这个;
此.\u允许值存储.load({
范围:本,,
回调:函数(记录、操作、成功){
log(记录[1].get('StringValue');
Ext.Array.each(记录、函数(val){
var s=val.get('StringValue');
那._arr.push(s);
});
console.log(“arr[2]”,this.\u arr[2])
}
});
},
_makeStore:function(){
控制台日志(“makeStore”);
var filter=Ext.create('Rally.data.QueryFilter'{
属性:“优先级”,
运算符:'=',
值:“立即解决”
});
filter=filter.or({
属性:“优先级”,
运算符:'=',
价值:“高度关注”
});
filter=filter.and({
财产:'国家',
运算符:'=',
值:“已关闭”
});
filter=filter.and(this.getContext().getTimeboxScope().getQueryFilter());
filter.toString();
Ext.create('Rally.data.WsapiDataStore'{
模型:“缺陷”,
获取:['FormattedID','Name','Tasks','State','Resolution','Priority',],
页面大小:100,
自动加载:对,
过滤器:[过滤器],
听众:{
加载:这个。加载后,
范围:本
}
});
},
onScopeChange:function(){
log('onScopeChange');
这个;
},
_onDataLoaded:函数(存储、数据){
控制台日志(“已加载”);
var缺陷=[];
如果(data.length==0){
这是.\u createGrid(缺陷);
}
var=0;
var countCodeChange=0;
var countNotADefect=0;
var countNone=0;
var countConfigurationChange=0;
var countDatabaseChange=0;
var countreplicate=0;
var countNeedMoreInformation=0;
var CountSoftwareLimition=0;
var countUserInterface=0;
Ext.Array.each(数据、函数(缺陷){
var resolution=defect.get('resolution');
开关(分辨率)
{
案例“架构”:
countArchitecture++;
打破
案例“代码更改”:
countCodeChange++;
打破
案例“非缺陷”:
countnotadeffect++;
打破
案例“无”:
countNone++;
打破
案例“配置更改”:
countConfigurationChange++;
打破
案例“数据库更改”:
countDatabaseChange++;
打破
“重复”一案:
countreplicate++;
打破
案例“需要更多信息”:
countreplicate++;
打破
案例“软件限制”:
CountSoftwareLimition++;
打破
案例“用户界面”:
countUserInterface++;
打破
违约:
countNone++;
}
});
变量d={
"建筑":建筑,,
“代码更改”:countCodeChange,
“非缺陷”:countnota缺陷,
'':countNone,
“配置更改”:countConfigurationChange,
“数据库更改”:countDatabaseChange,
“重复”:countreplicate,
“需要更多信息”:countNeedMoreInformation,
“软件限制”:CountSoftwareLimition,
“用户界面”:countUserInterface,
};
缺陷。推(d);
这是.\u createGrid(缺陷);
},
_createGrid:函数(缺陷){
console.log(“创建网格”);
log('this.'u arr[3]”,this.'u arr[3]);
var=这个;
var myStore=Ext.create('Rall