@@ -168,10 +168,11 @@ Ext.define("custom-grid-with-deep-export", {
168168 } ) ;
169169 } ,
170170 _getExportMenuItems : function ( ) {
171+ var result = [ ] ;
171172 this . logger . log ( '_getExportMenuItems' , this . modelNames [ 0 ] ) ;
172-
173- if ( this . modelNames [ 0 ] . toLowerCase ( ) === 'hierarchicalrequirement' ) {
174- return [ {
173+ var currentModel = this . modelNames [ 0 ] . toLowerCase ( ) ;
174+ if ( currentModel === 'hierarchicalrequirement' ) {
175+ result = [ {
175176 text : 'Export User Stories...' ,
176177 handler : this . _export ,
177178 scope : this ,
@@ -187,40 +188,72 @@ Ext.define("custom-grid-with-deep-export", {
187188 scope : this ,
188189 childModels : [ 'hierarchicalrequirement' , 'task' , 'defect' , 'testcase' ]
189190 } ] ;
190- }
191-
192- //If its not a story, then its a PI
193- var idx = _ . indexOf ( this . getPortfolioItemTypeNames ( ) , this . modelNames [ 0 ] . toLowerCase ( ) ) ;
194- var childModels = [ ] ;
195- if ( idx > 0 ) {
196- for ( var i = idx ; i > 0 ; i -- ) {
197- childModels . push ( this . getPortfolioItemTypeNames ( ) [ i - 1 ] . toLowerCase ( ) ) ;
191+ } else if ( currentModel . startsWith ( "portfolioitem" ) ) {
192+ var idx = _ . indexOf ( this . getPortfolioItemTypeNames ( ) , currentModel ) ;
193+ var childModels = [ ] ;
194+ if ( idx > 0 ) {
195+ for ( var i = idx ; i > 0 ; i -- ) {
196+ childModels . push ( this . getPortfolioItemTypeNames ( ) [ i - 1 ] . toLowerCase ( ) ) ;
197+ }
198198 }
199+
200+ result = [ {
201+ text : 'Export Portfolio Items...' ,
202+ handler : this . _export ,
203+ scope : this ,
204+ childModels : childModels
205+ } , {
206+ text : 'Export Portfolio Items and User Stories...' ,
207+ handler : this . _export ,
208+ scope : this ,
209+ includeStories : true ,
210+ includeTasks : false ,
211+ childModels : childModels . concat ( [ 'hierarchicalrequirement' ] )
212+ } , {
213+ text : 'Export Portfolio Items, User Stories and Tasks...' ,
214+ handler : this . _export ,
215+ scope : this ,
216+ childModels : childModels . concat ( [ 'hierarchicalrequirement' , 'task' ] )
217+ } , {
218+ text : 'Export Portfolio Items and Child Items...' ,
219+ handler : this . _export ,
220+ scope : this ,
221+ childModels : childModels . concat ( [ 'hierarchicalrequirement' , 'defect' , 'testcase' ] )
222+ } ] ;
223+ } else if ( currentModel == 'defect' ) {
224+ result = [ {
225+ text : 'Export Defects...' ,
226+ handler : this . _export ,
227+ scope : this ,
228+ childModels : [ ]
229+ } , {
230+ text : 'Export Defects and Child Items...' ,
231+ handler : this . _export ,
232+ scope : this ,
233+ childModels : [ 'defect' , 'task' , 'testcase' ]
234+ } ] ;
235+ } else if ( currentModel == 'testcase' ) {
236+ result = [ {
237+ text : 'Export Test Cases...' ,
238+ handler : this . _export ,
239+ scope : this ,
240+ childModels : [ ]
241+ } , {
242+ text : 'Export Test Cases and Child Items...' ,
243+ handler : this . _export ,
244+ scope : this ,
245+ childModels : [ 'defect' , 'task' , 'testcase' ]
246+ } ] ;
247+ } else {
248+ result = [ {
249+ text : 'Export to CSV...' ,
250+ handler : this . _export ,
251+ scope : this ,
252+ childModels : [ ]
253+ } ] ;
199254 }
200-
201- return [ {
202- text : 'Export Portfolio Items...' ,
203- handler : this . _export ,
204- scope : this ,
205- childModels : childModels
206- } , {
207- text : 'Export Portfolio Items and User Stories...' ,
208- handler : this . _export ,
209- scope : this ,
210- includeStories : true ,
211- includeTasks : false ,
212- childModels : childModels . concat ( [ 'hierarchicalrequirement' ] )
213- } , {
214- text : 'Export Portfolio Items, User Stories and Tasks...' ,
215- handler : this . _export ,
216- scope : this ,
217- childModels : childModels . concat ( [ 'hierarchicalrequirement' , 'task' ] )
218- } , {
219- text : 'Export Portfolio Items and Child Items...' ,
220- handler : this . _export ,
221- scope : this ,
222- childModels : childModels . concat ( [ 'hierarchicalrequirement' , 'defect' , 'testcase' ] )
223- } ] ;
255+
256+ return result ;
224257 } ,
225258 getPortfolioItemTypeNames : function ( ) {
226259 return _ . pluck ( this . portfolioItemTypes , 'typePath' ) ;
@@ -245,7 +278,15 @@ Ext.define("custom-grid-with-deep-export", {
245278 _getExportColumns : function ( ) {
246279 var grid = this . down ( 'rallygridboard' ) . getGridOrBoard ( ) ;
247280 if ( grid ) {
248- return _ . filter ( grid . columns , function ( item ) { return ( item . dataIndex && item . dataIndex != "DragAndDropRank" ) ; } ) ;
281+ return _ . filter ( grid . columns , function ( item ) {
282+ return (
283+ item . dataIndex &&
284+ item . dataIndex != "DragAndDropRank" &&
285+ item . xtype &&
286+ item . xtype != "rallytreerankdraghandlecolumn" &&
287+ item . xtype != "rallyrowactioncolumn" &&
288+ item . text != " " ) ;
289+ } ) ;
249290 }
250291 return [ ] ;
251292 } ,
@@ -289,6 +330,7 @@ Ext.define("custom-grid-with-deep-export", {
289330 this . logger . log ( '_export' , fetch , args , columns , filters . toString ( ) , childModels , sorters ) ;
290331
291332 var exporter = Ext . create ( 'Rally.technicalservices.HierarchyExporter' , {
333+ modelName : modelName ,
292334 fileName : 'hierarchy-export.csv' ,
293335 columns : columns ,
294336 portfolioItemTypeObjects : this . portfolioItemTypes
0 commit comments