AnsweredAssumed Answered

Issue with filters in custom app Agile Central

Question asked by DarshanaA on Apr 18, 2018
Latest reply on Apr 20, 2018 by DarshanaA

Hello all,

I've created one custom app to show the stories having release date greater than corresponding feature release date.

userstory-->child of -->Feature in the Agile Central.

The code works fine but it shows output only when SHOW=200.

This is happening because of the filter condition on custom store.

filters:[{property:'storiesNotInSyncCount',operator:'!=',value:'0'}] - This condition skips stories that are in sync with feature release

Please suggest any alternate way to implement this filter condition and also let me know if I'm doing anything wrong.

 

Below is the full code:

<!DOCTYPE html>
<html>
<head>
    <title>Grid Example</title>

    <script type="text/javascript" src="/apps/2.1/sdk.js"></script>

   <script type="text/javascript">
        Rally.onReady(function() {
            Ext.define('Rally.example.SimpleGrid', {
                extend: 'Rally.app.App',
                componentCls: 'app',
    launch: function() {
       this._makeStore();
       },
       //create a wsapi store containing all the features with specified columns
       _makeStore: function(){
       console.log("in makestore function");
          Ext.create('Rally.data.WsapiDataStore',{
            model:'PortfolioItem/feature',
            fetch:['FormattedID','Name','Release','UserStories','ReleaseDate','ReleaseStartDate'],
            autoLoad:true,
            listeners:{
              load:this._onFeatureLoaded,
              scope:this
              }
          });
        
       },
       //once the store is loaded, iterate through each feature and fetch the required columns
       //along with children(US) count
       _onFeatureLoaded: function(store,data){
       console.log("in _onEpicLoaded function");
          //empty epics=epicArray+featureArray
          var features=[];
          console.log(data.length);
          var pending = data.length;
           if (data.length ===0) {
            this._createFeatureGrid(features); 
           }
          
         
          Ext.Array.each(data,function(feature){
           var featureArray={
           featureFormattedID:feature.get('FormattedID'),
           featureName:feature.get('Name'),
           featureRelease:null,
           totalStoriesCount:feature.get('UserStories').Count,
           storiesNotInSyncCount:0,
           storiesArray:[] };
           
           if(feature.get('Release')!==null)
           {
           console.log("totalStoriesCount="+featureArray.totalStoriesCount);
        
           var stories=feature.getCollection('UserStories');
           stories.load({
              fetch:['FormattedID','Release','Name','ReleaseDate','ReleaseStartDate','ScheduleState'],
              callback:function(records,operation,success){
              
              var childrenCount=0;
              var fRelease=feature.get('Release');
              var fReleaseDate=fRelease.ReleaseDate;
               Ext.Array.each(records,function(story){
                var usRelease=story.get('Release');
                var usReleaseDate=null;
                 if(usRelease!==null){
                  usReleaseDate=usRelease.ReleaseDate;}
                 else{
                  usReleaseDate=null;}
                
                console.log('usReleaseDate='+usReleaseDate);
                console.log('fReleaseDate='+fReleaseDate);
              if(usRelease!==null)
              {
               if((usReleaseDate> fReleaseDate) && (story.get('ScheduleState')!="Accepted"))
               {
                featureArray.storiesArray.push({
                _ref:story.get('_ref'),
                storyFormattedID:story.get('FormattedID'),
                storyName:story.get('Name'),
                storyRelease:usRelease.Name,
                featureRelease:fRelease.Name,
                storyScheduleState:story.get('ScheduleState')

                });
                console.log('storyFormattedID='+story.get('FormattedID'));
                console.log('storyName='+story.get('Name'));
                console.log('storyRelease='+usRelease.Name);
                console.log('featureRelease='+fRelease.Name);
                console.log('usReleaseDate='+usReleaseDate);
                console.log('fReleaseDate='+fReleaseDate);
                childrenCount=childrenCount+1;
                console.log("childrenCount="+childrenCount);
                console.log("storyScheduleState="+story.get('ScheduleState'));
                
              }} 
              },this); 
              /* if (pending === 0) {
                this._createFeatureGrid(features);
               }*/
             featureArray.storiesNotInSyncCount=childrenCount;
             featureArray.featureRelease=fRelease.Name;
             
             console.log("storiesNotInSyncCount="+featureArray.storiesNotInSyncCount);
              },
              scope:this
           });
           
           features.push(featureArray);
           
          }
           console.log("Pending US="+pending);

          },this);
          this._createFeatureGrid(features);
           
       },

       
       //creating custom store with custom model and attributes
       _createFeatureGrid:function(features){
       console.log("in _createFeatureGrid function");
           var featureStoryStore=Ext.create('Rally.data.custom.Store',{
                    data:features,
                    pagesize:25,
                    filters:[{property:'storiesNotInSyncCount',operator:'!=',value:'0'}]
           });

           this.grid=this.add({
            xtype:'rallygrid', 
           // itemId:'epicGrid',
            store:featureStoryStore,
            columnCfgs:[
            {text:'Feature ID',dataIndex:'featureFormattedID',width:30},
            {text:'Feature Name',dataIndex:'featureName',width:100},
            {text:'Feature Release',dataIndex:'featureRelease',width:40},
            {text:'Total Stories',dataIndex:'totalStoriesCount',width:40},
            {text:'Stories NotIn Sync',dataIndex:'storiesNotInSyncCount',width:40},
            {text:'Stories with Releases',dataIndex:'storiesArray',
                renderer:function(value){
                 var html=[];
                 Ext.Array.each(value,function(story){
                  html.push('<a target="blank" href=" ' + Rally.nav.Manager.getDetailUrl(story) + '">' + story.storyFormattedID+"-"+story.storyRelease+'</a>')
                 });
                 return html.join('<br>');
                },
                width:80
            }],
            showRowActionsColumn:false,
            forceFit:true
            
            
           });
           

       }
    
   });
            Rally.launchApp('Rally.example.SimpleGrid', {
              name: 'Grid Example'
            });
        });
    </script>

    <style type="text/css">
       
    </style>
</head>
<body></body>
</html>

Attachments

Outcomes