1
這是我的代碼:拉力無法加載數據SnapshotStore
_update_feature: function(fID){
var query = Ext.create('Rally.data.lookback.QueryFilter',{
property: '_ItemHierarchy', operator: 'in', value: fID
}).and(Ext.create('Rally.data.lookback.QueryFilter',{
property: '_TypeHierarchy', operator: '=', value: "HierarchicalRequirement"
})).and(Ext.create('Rally.data.lookback.QueryFilter',{
property: 'Children', operator: '=', value: null
}));
query = query.and(Ext.create('Rally.data.lookback.QueryFilter',{property: '__At', operator: '=',value: 'current' }));
var me = this;
Ext.create('Rally.data.lookback.SnapshotStore',{
autoLoad: true,
fetch: ['Iteration','Name','ObjectID'],
filters: query,
sorters:[{property: 'Iteration', direction: 'DESC'}],
listeners:{
load: function(store,data,success){
console.log("data ",data,' success ',success); //returns empty array but success returns true
var iter_array = [];
var unscheduled = false;
var that = this;
for(var i=0;i<data.length;i++){
if(data[i].data.Iteration.length!=0)
iter_array[i] = parseInt(data[i].data.Iteration);
}
if(data.length!=iter_array.length)
unscheduled = true;
var groupedByEndDate = _.uniq(me.store_iterations);
var latest_iteration = _.first(_.intersection(groupedByEndDate,iter_array));
var first_iteration = _.last(_.intersection(groupedByEndDate,iter_array));
console.log('FI ',first_iteration,' LI ',latest_iteration);
//use async.js here
var configs = [];
configs.push({
model: "Iteration",
fetch: ['Name','StartDate','EndDate','ObjectID'],
filters: [{property: 'ObjectID', operator: '=' , value: first_iteration}]
});
configs.push({
model: "Iteration",
fetch: ['Name','StartDate','EndDate','ObjectID'],
filters: [{property: 'ObjectID', operator: '=' , value: latest_iteration}]
});
console.log('Configs before ',configs);
async.map(configs, this.wsapiQuery, function(err,results){
console.log('Configs After ',configs);
var firstIteration = results[0];
var lastIteration = results[1];
console.log('FID: ',fID,' First Data ',firstIteration[0].get("StartDate"),' Second Data ',lastIteration[0].get("EndDate"));
var startDate = firstIteration[0].get("StartDate");
var EndDate = lastIteration[0].get("EndDate");
var dIteration = lastIteration[0].get("Name");
me._set_feature_level_values(fID,dIteration,unscheduled,startDate,EndDate);
});
}, scope: this
}
});
},
wsapiQuery: function (config,callback){
Ext.create('Rally.data.WsapiDataStore',{
autoLoad: true,
model: config.model,
fetch: config.fetch,
filters: config.filters,
listeners: {
scope: this,
load: function(store,data){
callback(null,data);
}
}
});
}
我無法加載數據,返回的數據是空的,但是成功是真實的。我的SnapshotStore代碼有什麼問題嗎?我期待從它的一些數據。我正在嘗試使用給定的要素對象ID來獲取某個要素的所有子葉節點故事。
我已成功在拉力賽中的自定義應用中運行您的代碼。我使用不存在的功能ID調用this._update_feature,並且完全按照您的要求返回0結果。然後,我放入一個有權限的有效功能ID,然後取回所有快照。所以你的代碼似乎是合適的,但可能傳入的fID不正確,或者你沒有權限訪問該功能?嘗試使用硬編碼的功能ID從應用程序啓動()中調用_update_feature,您可以通過Rally訪問該功能並查看結果是否有所不同。 –