2014-05-09 1 views
0

다른 사용자 이외에도 특정 사용자 스토리를 수정 한 모든 사용자의 목록을 원합니다.출력에 소유자 이름이있는 룩백 룩백 API를 쿼리하십시오.

나는 다음과 같은 JSON 데이터로 랠리 전환 추적 REST API를 쿼리 해요 :

{ 
    "find" : { "FormattedID": "$STORY" }, 
    "fields" : ["ObjectID", "_ValidFrom", "_ValidTo", "Blocked", "c_KanbanState", "Owner"], 
    "compress" : true 
} 

를이 쿼리와 함께, 그래서 같이 소유자의 OID 얻을 :

{ 
    "_ValidFrom": "2014-05-09T15:18:29.912Z", 
    "_ValidTo": "9999-01-01T00:00:00.000Z", 
    "ObjectID": 18326652440, 
    "Blocked": false, 
    "Owner": 13786838413, 
    "c_KanbanState": "Accepted" 
} 

는 방법이 있나요 그 소유자 필드를 수화 하는가? 나는 "John Smith"를보고 싶습니다만, " [email protected]"에 정착합니다.

WSAPI를 사용해야하는 경우 한 번에 소유자 OID 그룹을 쿼리 할 수있는 방법이 있습니까? 그렇다면 샘플이 도움이 될 것입니다. 또는 컬렉션을 반복해야합니다. 값을 입력하고 각 소유자에게 개별적으로 쿼리 하시겠습니까?

답변

1

Trever 말했듯이,의 the hydration section 참조하십시오.

은 훨씬 wsapi를 사용하여 사용자 필드 수분을 예로서, 아래의 코드는 여기서 '_PreviousValues.Blocked' : {$exists: true} 스냅 샷을 얻을 shapshotstore를 사용하고, 각각의 스냅 샷에 소유자의 표시 이름을 얻을 Rally.data.ModelFactory를 이용한다.

Ext.define('CustomApp', { 
    extend: 'Rally.app.App', 
    componentCls: 'app', 
    scopeType: 'iteration', 
    comboboxConfig: { 
     labelWidth: 100, 
     width: 300 
    }, 
    launch: function() { 
     var that = this; 
     var iterationComboBox = Ext.create('Rally.ui.combobox.IterationComboBox',{ 
     listeners:{ 
      ready: function(combobox){ 
           var iterationOid = combobox.getRecord().get('ObjectID'); 
           that._loadStories(iterationOid); 
      }, 
      select: function(combobox){ 
           var iterationOid = combobox.getRecord().get('ObjectID'); 
           this._loadStories(iterationOid); 
      }, 
      scope: this 
     } 
    }); 
     this.add(iterationComboBox); 
    }, 

    _loadStories:function(iterationOid){ 
     var that = this; 
     var snapshotStore = Ext.create('Rally.data.lookback.SnapshotStore', { 
      autoLoad:true, 
      find: { 
       '_TypeHierarchy': 'HierarchicalRequirement', 
       '_ProjectHierarchy': 12352608219,  
       '_PreviousValues.Blocked' : {$exists: true}, 
       'Iteration': iterationOid 

      }, 
      fetch: ['Name','FormattedID','ScheduleState','Blocked','_ValidFrom','_ValidTo', 'BlockedReason','Owner'], 
      order: 'OpenedDate DESC', 
      hydrate: ['Blocked','ScheduleState'], 
      compress: true, 
      listeners: { 
     load: function(store,records,success){ 
      console.log("loaded %i records", records.length); 
        that._onStoriesLoaded(snapshotStore, records); 
     }, 
     scope:this 
     } 
     });   
    }, 
    _onStoriesLoaded:function(store, records){ 
     var that = this; 
     var promises = []; 
     _.each(records, function(story) { 
      promises.push(that._hydrateOwner(story, that)); 
     }); 

     Deft.Promise.all(promises).then({ 
      success: function(results) { 
       that._stories = results; 
       console.log('that._stories', that._stories); 
       that._makeGrid(); 
      } 
     }); 
    }, 
    _hydrateOwner:function(story, scope){ 
     var deferred = Ext.create('Deft.Deferred'); 
     var that = scope; 
     var ownerDisplayName = null; 
     var userOid = story.get('Owner'); 

     var storyBlocked = story.get('Blocked'); 
     Rally.data.ModelFactory.getModel({ 
      type: 'User', 
      scope: this, 
      success: function(model, operation) { 
       fetch: ['UserName', 'DisplayName'], 
       model.load(userOid, { 
        scope: this, 
        success: function(record, operation) { 
         owner = record.get('DisplayName'); 
         var fid = story.get('FormattedID'); 
         var state = story.get('ScheduleState'); 
         var name = story.get('Name'); 
         var blocked = story.get('Blocked'); 

         result = { 
            "fid"  : fid, 
            "name"  : name, 
            "state"  : state, 
            "blocked" : blocked, 
            "owner"  : owner  
           }; 

         deferred.resolve(result);  
        } 
       }); 
      } 
     }); 

     return deferred; 
    }, 

     _makeGrid: function() { 

     if (this.down('#grid')) { 
      this.down('#grid').destroy(); 
     } 

     var gridStore = Ext.create('Rally.data.custom.Store', { 
      data: this._stories 
     }); 

     var _grid = Ext.create('Rally.ui.grid.Grid', { 
      itemId: 'grid', 
      store: gridStore, 
      columnCfgs: [ 
       { 
        text: 'Name', dataIndex: 'name' 
       }, 
       { 
        text: 'FormattedID', dataIndex: 'fid' 
       }, 
       { 
        text: 'ScheduleState', dataIndex: 'state' 
       }, 
       { 
        text: 'Blocked', dataIndex: 'blocked' 
       }, 
       { 
        text: 'Owner', dataIndex: 'owner' 
       } 

      ] 
     }); 

     this.add(_grid); 
     this._grid.reconfigure(gridStore); 
    } 
}); 
+0

랠리 API를 쿼리하는 독립 실행 형 응용 프로그램으로이 작업을 수행하고 있지만이 게시물은 올바른 방향으로 나를 가리켰습니다. – neontapir

1

불행하게도, the documentation 당 -

몇 가지 필드 유형 (예를 들어, 사용자)를 수화 할 수 없습니다.

은 수화 수 없습니다 전환 추적 API 사용자 필드에 문서

1

그리고 당신은 주어진 이야기를 개정했다 누군지 알고 싶은 경우에, 닉과 Trever가 말한에 추가 할, 당신이 찾고있는 필드는 "_USER"입니다. 소유자가 소유자이고 _User가 개정을 만든 사람입니다. Nick의 예제 코드는 Owner와 같은 OID 일 뿐이므로 _User를 수화하기 위해 조정될 수 있습니다.

주의 사항 : 누군가 변경된 경우 설명과 같은 큰 텍스트 필드 만 스냅 샷을 만들지 않으므로 반환되지 않습니다.