the experimental hierarchical tree for rally

孤街醉人 提交于 2019-12-11 07:25:19

问题


I see that Hierarchical trees are labeled as experimental on the Rally site (https://help.rallydev.com/apps/2.0rc3/doc/#!/api/Rally.ui.grid.TreeGrid). I wanted to build an app using the hierarchical tree and I had a few questions about the features. Is it possible to filter the tree or no? Also can i add up the totals of the tasks for a given userstory (estimate, todo, actual, etc) and list that total as the userstory value? Is there another way to get a list of the userstories with the tasks in a list beneath it?


回答1:


A not-treegrid example: this app that uses group and summary features in a grid of tasks in current iteration grouped by workproduct (user story), where Estimate values of individual tasks are summed up. Full code is in this github repo.

launch: function() {
        var that = this;
        var today = new Date().toISOString();
        var stories = Ext.create('Rally.data.wsapi.Store', {
            model: 'UserStory',
            fetch: ['Tasks'],
            filters: [
                {
                    property: 'Iteration.StartDate',
                    operator: '<=',
                    value: today
                },
                {
                    property: 'Iteration.EndDate',
                    operator: '>=',
                    value: today
                }
            ]
        });
        stories.load().then({
            success: this.loadTasks,
            scope: this
        }).then({
            success:function(results) {
                that.makeGrid(results);
            },
            failure: function(){
                console.log("oh noes!")
            }
        });
    },

    loadTasks: function(stories){
        console.log("load tasks",stories)
        var promises = [];
        _.each(stories, function(story){
            var tasks = story.get('Tasks');
            if (tasks.Count > 0) {
                tasks.store = story.getCollection('Tasks',{fetch:['Name','FormattedID','Estimate','State','Blocked','WorkProduct']});
                promises.push(tasks.store.load());
            }
        });
        return Deft.Promise.all(promises);
    },


    makeGrid: function(results){
        var tasks = _.flatten(results);
        var data = [];
        _.each(tasks, function(task){
            data.push(task.data);
        })

        _.each(data, function(record){
            record.Story = record.WorkProduct.FormattedID + " " + record.WorkProduct.Name;;
        })


        this.add({
            xtype: 'rallygrid',
            showPagingToolbar: true,
            showRowActionsColumn: true,
            editable: false,
            store: Ext.create('Rally.data.custom.Store', {
                data: data,
                groupField: 'Story',
            }),
            features: [{ftype:'groupingsummary'}],
            columnCfgs: [
                {
                    xtype: 'templatecolumn',text: 'ID',dataIndex: 'FormattedID',width: 100,
                    tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate'),
                    summaryRenderer: function() {
                        return "Estimate Total"; 
                    }
                },
                {
                    text: 'Name',dataIndex: 'Name',
                },
                {
                    text: 'State',dataIndex: 'State',xtype: 'templatecolumn',
                        tpl: Ext.create('Rally.ui.renderer.template.ScheduleStateTemplate',
                            {
                                states: ['Defined', 'In-Progress', 'Completed'],
                                field: {
                                    name: 'State' 
                                }
                        })
                },
                {
                    text: 'Estimate',dataIndex: 'Estimate',
                    summaryType: 'sum',
                },
                {
                    text: 'WorkProduct',dataIndex: 'WorkProduct',
                    renderer: function(val, meta, record) {
                        return '<a href="https://rally1.rallydev.com/#/detail/userstory/' + record.get('WorkProduct').ObjectID + '" target="_blank">' + record.get('WorkProduct').FormattedID + '</a>';
                    }
                },
            ]
        });

    }

Update: If you want to filter the task store include a filter here:

tasks.store = story.getCollection('Tasks',{fetch:['Name','FormattedID','Estimate','State','Blocked','WorkProduct'],filters:{property: 'State',operator: '<',value: 'Completed'}});

A treegrid example: Rally.ui.grid.TreeGrid you referred is still a work in progress. I have not seen a working example of a story hierarchy using a treegrid but it does not mean it's impossible.

When I tested a story hierarchy, child stories did not appear under epic stories, however a story/task hierarchy worked. The filtering worked too. Here is an example:

Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',
    launch:function(){
        Ext.create('Rally.data.wsapi.TreeStoreBuilder').build({
            models: ['userstory'],
             autoLoad: true,
             filters:[
                {
                    property: 'Name',
                    operator: 'contains',
                    value: 'story'
                }
             ],
             enableHierarchy: true
            }).then({
             success: function(store) {
                var grid = Ext.create('Ext.Container', {
                    items: [{
                        xtype: 'rallytreegrid',
                        columnCfgs: [
                            'Name',
                            'Owner'
                        ],
                        store: store
                    }]
                });
                that.add(grid);

            }
        });
    } 

The screenshot below shows that tasks are nested under a child story as expected,but the child story is not nested under parent. The grid is filtered by Name as expected:



来源:https://stackoverflow.com/questions/24459909/the-experimental-hierarchical-tree-for-rally

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!