(function () {
    var Ext = window.Ext4 || window.Ext;

    var appIDMap = {
        milestone: -200004,
        iteration: -200013,
        release: -200012
    };

    Ext.define('Rally.apps.timeboxes.TimeboxesApp', {
        extend: 'Rally.app.GridBoardApp',
        requires: [
            'Deft.Deferred',
            'Rally.apps.timeboxes.IterationVelocityA0Chart',
            'Rally.data.PreferenceManager',
            'Rally.ui.gridboard.GridBoardToggle'
        ],

        enableGridBoardToggle: true,

        xmlExportEnabled: function(){
            return this.selectedType !== 'milestone';
        },

        newPageNoticePreferenceName: 'newMilestonesPageNotice',

        constructor: function() {
            this.callParent(arguments);

            this._showNewPageNoticeIfNeeded();
        },

        loadSettingsAndLaunch: function () {
            if (this.modelPicker) {
                this.callParent(arguments);
            } else {
                this._createPicker().then({
                    success: function (selectedType) {
                        this.changeModelType(selectedType);
                    },
                    scope: this
                });
            }
        },

        changeModelType: function (newType) {
            this.context = this.getContext().clone({
                appID: appIDMap[newType]
            });
            this.selectedType = newType;
            this.modelNames = [newType];
            this.statePrefix = newType;
            this.loadSettingsAndLaunch();
        },

        getGridBoardTogglePluginConfig: function () {
            return _.merge(this.callParent(arguments), {
                autoRefreshComponentOnToggle: false,
                toggleButtonConfig: {
                    showBoardToggle: false,
                    showChartToggle: this._enableCharts() ? true : Rally.ui.gridboard.GridBoardToggle.BUTTON_DISABLED
                }
            });
        },

        getGridConfig: function () {
            return _.merge(this.callParent(arguments), {
                enableSummaryRow: false
            });
        },

        getChartConfig: function () {
            if (this._enableCharts()) {
                return {
                    xtype: 'rallyiterationvelocitya0chart'
                };
            }
        },

        getFieldPickerConfig: function () {
            var config = this.callParent(arguments);

            if (this.selectedType === 'milestone') {
                config.gridFieldBlackList = _.union(config.gridFieldBlackList, [
                    'Artifacts',
                    'CreationDate',
                    'Projects',
                    'VersionId'
                ]);
                return _.merge(config, {
                    gridAlwaysSelectedValues: ['TargetDate', 'TotalArtifactCount', 'TargetProject']
                });
            }

            return config;
        },

        getPermanentFilters: function () {
            return this.selectedType === 'milestone' ? [
                Rally.data.wsapi.Filter.or([
                    { property: 'Projects', operator: 'contains', value: this.getContext().getProjectRef() },
                    { property: 'TargetProject', operator: '=', value: null }
                ])
            ] : [];
        },

        getAddNewConfig: function () {
            return _.merge(this.callParent(arguments), {
                minWidth: 800,
                openEditorAfterAddFailure: false,
                showAddWithDetails: true,
                showRank: false
            });
        },

        getGridStoreConfig: function() {
            return _.merge(this.callParent(arguments), {
                sorters: [ {property: this._getStartDateFieldName(), direction: 'DESC'} ]
            });
        },

        _getStartDateFieldName: function () {
            return {
                milestone: 'TargetDate',
                iteration: 'StartDate',
                release: 'ReleaseStartDate'
            }[this.selectedType];
        },

        _enableCharts: function () {
            return this.selectedType ===  'iteration';
        },

        _createPicker: function () {
            var deferred = new Deft.Deferred();

            this.modelPicker = Ext.create('Rally.ui.combobox.PreferenceEnabledComboBox', {
                context: this.getContext().clone({
                    appID: null
                }),
                listeners: {
                    change: this._onTimeboxTypeChanged,
                    ready: {
                        fn: function (combo) {
                            deferred.resolve(combo.getValue());
                        },
                        single: true
                    },
                    scope: this
                },
                editable: false,
                preferenceName: 'timebox-combobox',
                displayField: 'name',
                valueField: 'type',
                queryMode: 'local',
                renderTo: Ext.query('#content .titlebar .dashboard-timebox-container')[0],
                storeType: 'Ext.data.Store',
                storeConfig: {
                    fields: ['name', 'type'],
                    data: [
                        { name: 'Iterations', type: 'iteration' },
                        { name: 'Releases', type: 'release' },
                        { name: 'Milestones', type: 'milestone' }
                    ]
                }
            });

            return deferred.promise;
        },

        _onTimeboxTypeChanged: function () {
            if (this.modelPicker) {
                this.changeModelType(this.modelPicker.getValue());
            }
        },

        _showNewPageNoticeIfNeeded: function() {
            Rally.data.PreferenceManager.load({
                filterByUser: true,
                additionalFilters: {
                    property: 'Name',
                    value: this.newPageNoticePreferenceName
                },
                success: function(pref) {
                    if (pref[this.newPageNoticePreferenceName] !== 'true') {
                        this._showNewPageNotice();
                    }
                },
                scope: this
            });
        },

        _showNewPageNotice: function() {
            this.newPageNoticePopover = Ext.create('Rally.apps.timeboxes.NewPageNoticePopover', {
                dismissedPrefName: this.newPageNoticePreferenceName,
                listeners: {
                    destroy: function() {
                        delete this.newPageNoticePopover;
                    },
                    scope: this
                },
                target: Ext.getBody().down('.titlebar .title')
            });
        }
    });
})();
@@ -1964,170 +1964,8 @@
 %7D,%0A%0A
-        getGridConfig: function () %7B%0A            return _.merge(this.callParent(arguments), %7B%0A                enableSummaryRow: false%0A            %7D);%0A        %7D,%0A%0A
     

Remove rollup row on custom lists for release and iteration