将SSO用户链接到项目的详细信息页面

时间:2014-02-11 22:30:10

标签: rally appsdk2

我在一个拉力赛网格组件中显示快照存储记录,并希望这样做,以便可以点击ID字段并显示该工作项的详细信息页面。由于快照记录包含“_UnformattedID”而不是“FormattedID”,因此我尝试使用列呈现器完成此操作,该列呈现器将文本添加为​​链接:

renderer: function(val, meta, record) {
    return '<a href="https://rally1.rallydev.com/#/detail/userstory/' + record.get('ObjectID') + '" target="_blank">US' + record.get('_UnformattedID') + '</a>';
}

这对我来说非常适合作为非SSO 用户,但我们工作区中使用SSO的用户报告该链接只是将它们带到默认的起始页面。不是他们期待的详细页面。

有没有更好的方法来实现这一目标,让所有用户都能获得这些功能?

1 个答案:

答案 0 :(得分:2)

SSO实施在整个组织中是不同的,但这个技巧对我有用。 我检测到主持人:

this._host = window.location.hostname;

然后我在构建renderer的返回值时使用host,因为在我的环境中的SSO和非SSO场景中生成的URL仅在主机部分中有所不同。

{
   text: 'Formatted ID', dataIndex: 'UnformattedID', 
        renderer: function(val, meta, record) {
            return '<a href="https://' + that._host + '/#/detail/userstory/' + record.get('ObjectID') + '" target="_blank">US' + record.get('UnformattedID') + '</a>';
    }
}

Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',
    launch: function() {
    this._host = window.location.hostname;
    console.log('host', this._host);
        var iterationComboBox = Ext.create('Rally.ui.combobox.IterationComboBox',{
                   listeners:{
                           ready: function(combobox){
                                this._iterationOid = combobox.getRecord().get('ObjectID');
                                this._loadStories(this._iterationOid);
                           },
                           select: function(combobox){
                                this._iterationOid = combobox.getRecord().get('ObjectID'); 
                                this._loadStories(this._iterationOid);
                           },
                           scope: this  
                   }
           });
        this.add(iterationComboBox);
    },


     _loadStories:function(iterationOid){
        console.log('loading stories for ', iterationOid);
        var myStore = Ext.create('Rally.data.lookback.SnapshotStore', {
                autoLoad:true,
                fetch    : ['Name','_UnformattedID','ScheduleState','_TypeHierarchy'],

                filters  : [{
                    property : '__At',
                    value    : 'current'
                },
                {
                    property : '_TypeHierarchy',
                    value    : 'HierarchicalRequirement'
                },
                {
                    property : 'Iteration',
                    value    : iterationOid
                }
                ],
        hydrate: ['_TypeHierarchy'],
                listeners: {
                           load: function(store,records,success){
                                   console.log("loaded %i records", records.length);
                                this._onDataLoaded(myStore, records);
                           },
                           scope:this
                   }
        });         
    },

     _onDataLoaded: function(store,data){
                console.log('count',store.getCount());
        var that = this;
        var records = [];
                    Ext.Array.each(data, function(record) {
                        records.push({
                            Name: record.get('Name'),
                            ObjectID: record.get('ObjectID'),
                UnformattedID: record.get('_UnformattedID')
                        });
                    });
            var myStore = Ext.create('Rally.data.custom.Store', {
                data: records
            });
                    if (!this.down('#grid')) {
            this.add({
                xtype: 'rallygrid',
                id: 'grid',
                store: myStore,
                columnCfgs: [
                {
                    text: 'Name', dataIndex: 'Name', flex: 1
                },
                {
                    text: 'Formatted ID', dataIndex: 'UnformattedID', 
                    renderer: function(val, meta, record) {
                        return '<a href="https://' + that._host + '/#/detail/userstory/' + record.get('ObjectID') + '" target="_blank">US' + record.get('UnformattedID') + '</a>';
                    }
                }
                ]
            });
            }
            else{
            console.log(store);
            this.down('#grid').reconfigure(myStore);
             }
     }
});