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

    /**
     * PI Kanban Board App
     * Displays a cardboard and a type selector. Board shows States for the selected Type.
     */
    Ext.define('Rally.apps.portfoliokanban.PortfolioKanbanApp', {
        extend: 'Rally.app.App',
        requires: [
            'Rally.data.util.PortfolioItemHelper',
            'Rally.apps.portfoliokanban.PortfolioKanbanCard',
            'Rally.apps.portfoliokanban.PortfolioKanbanPolicy',
            'Rally.ui.cardboard.KanbanColumn',
            'Rally.ui.cardboard.KanbanPolicy',
            'Rally.ui.cardboard.CardBoard',
            'Rally.ui.cardboard.Card',
            'Rally.data.QueryFilter',
            'Rally.ui.notify.Notifier',
            'Rally.util.Help',
            'Rally.util.Test'
        ],
        layout: 'auto',
        appName: 'Portfolio Kanban',

        cls: 'portfolio-kanban',

        config: {
            defaultSettings: {
                fields: 'PercentDoneByStoryCount'
            }
        },

        clientMetrics: [
            {
                method: '_showHelp',
                defaultUserAction: 'portfolio-kanban-show-help'
            }
        ],

        items: [
            {
                xtype: 'container',
                itemId: 'header',
                cls: 'header'
            },
            {
                xtype: 'container',
                itemId: 'bodyContainer',
                width: '100%'
            }
        ],

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

            if(Rally.environment.getContext().getSubscription().isModuleEnabled('Rally Portfolio Manager')) {

               Rally.data.util.PortfolioItemHelper.loadTypeOrDefault({
                    typeRef: this.getSetting('type'),
                    defaultToLowest: true,
                    context: this.getContext().getDataContext(),
                    success: function(record) {
                        this.currentType = record;

                        this._drawHeader();
                        this._loadCardboard();
                    },
                    scope: this
                });
            } else {
                this.down('#bodyContainer').add({
                    xtype: 'container',
                    html: '<div class="rpm-turned-off" style="padding: 50px; text-align: center;">You do not have RPM enabled for your subscription</div>'
                });

                this._publishContentUpdated();
            }
        },

        _drawHeader: function() {
            var header = this.down('#header');

            header.add([
                this._buildHelpComponent(),
                this._buildShowPolicies(),
                this._buildFilterInfo()
            ]);
        },

        _loadCardboard: function() {
            this._loadStates({
                success: function(states) {
                    var columns = this._createColumns(states);
                    if (this.rendered) {
                        this._drawCardboard(columns);
                    } else {
                        this.on('afterrender', Ext.bind(this._drawCardboard, this, [columns]), this, {single: true});
                    }
                },
                scope: this
            });

        },

        /**
         * @private
         * We need the States of the selected Portfolio Item Type to know what columns to show.
         * Whenever the type changes, reload the states to redraw the cardboard.
         * @param options
         * @param options.success called when states are loaded
         * @param options.scope the scope to call success with
         */
        _loadStates: function(options) {
            Ext.create('Rally.data.WsapiDataStore', {
                model: 'State',
                context: this.getContext().getDataContext(),
                autoLoad: true,
                fetch: ['Name', 'WIPLimit', 'Description'],
                filters: [
                    {
                        property: 'TypeDef',
                        value: this.currentType.get('_ref')
                    },
                    {
                        property: 'Enabled',
                        value: true
                    }
                ],
                sorters: [
                    {
                        property: 'OrderIndex',
                        direction: 'ASC'
                    }
                ],
                listeners: {
                    load: function(store, records) {
                        if (options.success) {
                            options.success.call(options.scope || this, records);
                        }
                    }
                }
            });

        },

        /**
         * Given a set of columns, build a cardboard component. Otherwise show an empty message.
         * @param columns
         */
        _drawCardboard: function(columns) {
            if (columns) {
                this._showColumns(columns);
            }
            else {
                this._showNoColumns();
            }
        },

        _showColumns: function(columns) {
            var cardboard = this.down('#cardboard'),
                filters = [
                    {
                        property: 'PortfolioItemType',
                        value: this.currentType.get('_ref')
                    }
                ];

            if (cardboard) {
                cardboard.destroy();
            }

            if (this.getSetting('query')) {
                try {
                    filters.push(Rally.data.QueryFilter.fromQueryString(this.getSetting('query')));
                } catch (e) {
                    Rally.ui.notify.Notifier.showError({
                        message: e.message
                    });
                }
            }

            var columnConfig = {
                xtype: 'rallykanbancolumn',
                cardLimit: 50,
                drawFooter: Ext.emptyFn,
                enablePolicies: true,
                enableWipLimit: true
            };

            var cardConfig = {
                xtype: 'rallyportfoliokanbancard',
                editable: true,
                showIconMenus: true,
                showIconsAndHighlightBorder: true,
                showColorPopover: true
            };
<commit_msg>DE17705 adding back plus icon and color picker to cards on kanban<commit_after>(function() {
    var Ext = window.Ext4 || window.Ext;

    /**
     * PI Kanban Board App
     * Displays a cardboard and a type selector. Board shows States for the selected Type.
     */
    Ext.define('Rally.apps.portfoliokanban.PortfolioKanbanApp', {
        extend: 'Rally.app.App',
        requires: [
            'Rally.data.util.PortfolioItemHelper',
            'Rally.apps.portfoliokanban.PortfolioKanbanCard',
            'Rally.apps.portfoliokanban.PortfolioKanbanPolicy',
            'Rally.ui.cardboard.KanbanColumn',
            'Rally.ui.cardboard.KanbanPolicy',
            'Rally.ui.cardboard.CardBoard',
            'Rally.ui.cardboard.Card',
            'Rally.data.QueryFilter',
            'Rally.ui.notify.Notifier',
            'Rally.util.Help',
            'Rally.util.Test'
        ],
        layout: 'auto',
        appName: 'Portfolio Kanban',

        cls: 'portfolio-kanban',

        config: {
            defaultSettings: {
                fields: 'PercentDoneByStoryCount'
            }
        },

        clientMetrics: [
            {
                method: '_showHelp',
                defaultUserAction: 'portfolio-kanban-show-help'
            }
        ],

        items: [
            {
                xtype: 'container',
                itemId: 'header',
                cls: 'header'
            },
            {
                xtype: 'container',
                itemId: 'bodyContainer',
                width: '100%'
            }
        ],

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

            if(Rally.environment.getContext().getSubscription().isModuleEnabled('Rally Portfolio Manager')) {

               Rally.data.util.PortfolioItemHelper.loadTypeOrDefault({
                    typeRef: this.getSetting('type'),
                    defaultToLowest: true,
                    context: this.getContext().getDataContext(),
                    success: function(record) {
                        this.currentType = record;

                        this._drawHeader();
                        this._loadCardboard();
                    },
                    scope: this
                });
            } else {
                this.down('#bodyContainer').add({
                    xtype: 'container',
                    html: '<div class="rpm-turned-off" style="padding: 50px; text-align: center;">You do not have RPM enabled for your subscription</div>'
                });

                this._publishContentUpdated();
            }
        },

        _drawHeader: function() {
            var header = this.down('#header');

            header.add([
                this._buildHelpComponent(),
                this._buildShowPolicies(),
                this._buildFilterInfo()
            ]);
        },

        _loadCardboard: function() {
            this._loadStates({
                success: function(states) {
                    var columns = this._createColumns(states);
                    if (this.rendered) {
                        this._drawCardboard(columns);
                    } else {
                        this.on('afterrender', Ext.bind(this._drawCardboard, this, [columns]), this, {single: true});
                    }
                },
                scope: this
            });

        },

        /**
         * @private
         * We need the States of the selected Portfolio Item Type to know what columns to show.
         * Whenever the type changes, reload the states to redraw the cardboard.
         * @param options
         * @param options.success called when states are loaded
         * @param options.scope the scope to call success with
         */
        _loadStates: function(options) {
            Ext.create('Rally.data.WsapiDataStore', {
                model: 'State',
                context: this.getContext().getDataContext(),
                autoLoad: true,
                fetch: ['Name', 'WIPLimit', 'Description'],
                filters: [
                    {
                        property: 'TypeDef',
                        value: this.currentType.get('_ref')
                    },
                    {
                        property: 'Enabled',
                        value: true
                    }
                ],
                sorters: [
                    {
                        property: 'OrderIndex',
                        direction: 'ASC'
                    }
                ],
                listeners: {
                    load: function(store, records) {
                        if (options.success) {
                            options.success.call(options.scope || this, records);
                        }
                    }
                }
            });

        },

        /**
         * Given a set of columns, build a cardboard component. Otherwise show an empty message.
         * @param columns
         */
        _drawCardboard: function(columns) {
            if (columns) {
                this._showColumns(columns);
            }
            else {
                this._showNoColumns();
            }
        },

        _showColumns: function(columns) {
            var cardboard = this.down('#cardboard'),
                filters = [
                    {
                        property: 'PortfolioItemType',
                        value: this.currentType.get('_ref')
                    }
                ];

            if (cardboard) {
                cardboard.destroy();
            }

            if (this.getSetting('query')) {
                try {
                    filters.push(Rally.data.QueryFilter.fromQueryString(this.getSetting('query')));
                } catch (e) {
                    Rally.ui.notify.Notifier.showError({
                        message: e.message
                    });
                }
            }

            var columnConfig = {
                xtype: 'rallykanbancolumn',
                cardLimit: 50,
                drawFooter: Ext.emptyFn,
                enablePolicies: true,
                enableWipLimit: true
            };

            var cardConfig = {
                xtype: 'rallyportfoliokanbancard',
                editable: true,
                showColorIcon: true
            };

{'fraction_non_alphanumeric': 0.09945878108086909, 'fraction_numerical': 0.0016471880147462545, 'mean_word_length': 1.0977295162882528, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1771040', 'n_tokens_mistral': 3185, 'n_tokens_neox': 2940, 'n_words': 583}