Question

I am displaying snapshot store records in a rallygrid component and would like to make it so the ID field is clickable and brings up the detail page for that work item. Since snapshot records include an "_UnformattedID" rather than "FormattedID", I tried to accomplish this using a column renderer, which adds the text as a link:

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

This works perfectly for me, as a non-SSO user, but users in our workspace who are using SSO have reported that the link simply brings them to their default start page. Not the detail page they were expecting.

Is there a better way I could be accomplishing this that would allow all users the functionality?

Was it helpful?

Solution

SSO implementation is different across organization, but this trick worked for me. I detect the host:

this._host = window.location.hostname;

and then I use host when building the return value of the renderer since the resulting URL in SSO and Non-SSO scenarios in my environment only differ in the host portion.

{
   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);
             }
     }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top