<commit_before>var Oro = Oro || {};
Oro.Datagrid = Oro.Datagrid || {};
Oro.Datagrid.Action = Oro.Datagrid.Action || {};

/**
 * Basic mass action class.
 *
 * @class   Oro.Datagrid.MassAction
 * @extends Oro.Datagrid.Action.AbstractAction
 */
Oro.Datagrid.Action.MassAction = Oro.Datagrid.Action.AbstractAction.extend({
    /** @property {String} */
    name: null,

    /** @property {Oro.Datagrid.Grid} */
    datagrid: null,

    /** @property {Backbone.BootstrapModal} */
    confirmModal: undefined,

    /** @property {string} */
    route: null,

    /** @property {string} */
    identifierFieldName: 'id',

    /** @property {Object} */
    defaultMessages: {
        confirm_title: _.__('Mass Action Confirmation'),
        confirm_content: _.__('Are you sure you want to do this?'),
        confirm_ok: _.__('Yes, do it'),
        success: _.__('Mass action was successfully performed.'),
        error: _.__('Mass action was not performed.')
    },

    /**
     * Initialize view
     *
     * @param {Object} options
     * @param {Oro.Datagrid.Grid} options.datagrid
     * @throws {TypeError} If datagrid is undefined
     */
    initialize: function(options) {
        options = options || {};

        if (!options.datagrid) {
            throw new TypeError("'datagrid' is required");
        }
        this.datagrid = options.datagrid;

        _.defaults(this.messages, this.defaultMessages);

        Oro.Datagrid.Action.AbstractAction.prototype.initialize.apply(this, arguments);
    },

    /**
     * Ask a confirmation and execute mass action.
     */
    execute: function() {
        this.getConfirmDialog().open();
    },<commit_msg>BAP-158: Grid Mass/Bulk actions - added message if no items selected<commit_after>var Oro = Oro || {};
Oro.Datagrid = Oro.Datagrid || {};
Oro.Datagrid.Action = Oro.Datagrid.Action || {};

/**
 * Basic mass action class.
 *
 * @class   Oro.Datagrid.MassAction
 * @extends Oro.Datagrid.Action.AbstractAction
 */
Oro.Datagrid.Action.MassAction = Oro.Datagrid.Action.AbstractAction.extend({
    /** @property {String} */
    name: null,

    /** @property {Oro.Datagrid.Grid} */
    datagrid: null,

    /** @property {Backbone.BootstrapModal} */
    confirmModal: undefined,

    /** @property {string} */
    route: null,

    /** @property {string} */
    identifierFieldName: 'id',

    /** @property {Object} */
    defaultMessages: {
        confirm_title: _.__('Mass Action Confirmation'),
        confirm_content: _.__('Are you sure you want to do this?'),
        confirm_ok: _.__('Yes, do it'),
        success: _.__('Mass action was successfully performed.'),
        error: _.__('Mass action was not performed.'),
        empty_selection: _.__('Please, select items to perform mass action.')
    },

    /**
     * Initialize view
     *
     * @param {Object} options
     * @param {Oro.Datagrid.Grid} options.datagrid
     * @throws {TypeError} If datagrid is undefined
     */
    initialize: function(options) {
        options = options || {};

        if (!options.datagrid) {
            throw new TypeError("'datagrid' is required");
        }
        this.datagrid = options.datagrid;

        _.defaults(this.messages, this.defaultMessages);

        Oro.Datagrid.Action.AbstractAction.prototype.initialize.apply(this, arguments);
    },

    /**
     * Ask a confirmation and execute mass action.
     */
    execute: function() {
        var selectionState = this.datagrid.getSelectionState();
        if (_.isEmpty(selectionState.selectedModels)) {
            Oro.NotificationFlashMessage('warning', this.messages.empty_selection);
        } else {
            this.getConfirmDialog().open();
        }
    },
{'fraction_non_alphanumeric': 0.14405632277281344, 'fraction_numerical': 0.0008123476848090983, 'mean_word_length': 2.5794573643410854, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2896087', 'n_tokens_mistral': 1127, 'n_tokens_neox': 1103, 'n_words': 245}