<commit_before>define([
    'jquery',
    'underscore',
    'orotranslation/js/translator',
    'oroui/js/modal',
    'oronavigation/js/navigation',
    'oroui/js/messenger'
],
function($, _, __, Modal, Navigation, Messenger) {
    'use strict';

    var navigation = Navigation.getInstance();
    /**
     * Reset button click handler
     *
     * @export  oroworkflow/js/delete-handler
     * @class   oroworkflow.WorkflowDeleteHandler
     */
    return function() {
        var element = $(this);
        if (element.data('_in-progress')) {
            return;
        }

        element.data('_in-progress', true);
        var resetInProgress = function() {
            element.data('_in-progress', false);
        };

        var confirmReset = new Modal({
            title:   __('Workflow reset'),
            content: __('Attention: This action will reset workflow data for this record.'),
            okText:  __('Yes, Reset')
        });

        confirmReset.on('ok', function() {
            $.ajax({
                url:  element.data('url'),
                type: 'DELETE',
                success: function(responce) {
                    if (navigation) {
                        navigation.loadPage(true);
                    } else {
                        window.location.reload();
                    }

                    element.trigger('reset_success', [responce]);
                },
                error: function() {
                    Messenger.notificationFlashMessage('error', __('Cannot reset workflow item data.'));
                    resetInProgress();
                }
            })
        });

        confirmReset.on('cancel', function() {
            resetInProgress();
        });

        confirmReset.open();
    }
});<commit_msg>CRM-1051: Add a Reset workflow button that will erase the relation from specific entity view page  - removed not used event triggering<commit_after>define([
    'jquery',
    'underscore',
    'orotranslation/js/translator',
    'oroui/js/modal',
    'oronavigation/js/navigation',
    'oroui/js/messenger'
],
function($, _, __, Modal, Navigation, Messenger) {
    'use strict';

    var navigation = Navigation.getInstance();
    /**
     * Reset button click handler
     *
     * @export  oroworkflow/js/delete-handler
     * @class   oroworkflow.WorkflowDeleteHandler
     */
    return function() {
        var element = $(this);
        if (element.data('_in-progress')) {
            return;
        }

        element.data('_in-progress', true);
        var resetInProgress = function() {
            element.data('_in-progress', false);
        };

        var confirmReset = new Modal({
            title:   __('Workflow reset'),
            content: __('Attention: This action will reset workflow data for this record.'),
            okText:  __('Yes, Reset')
        });

        confirmReset.on('ok', function() {
            $.ajax({
                url:  element.data('url'),
                type: 'DELETE',
                success: function(responce) {
                    if (navigation) {
                        navigation.loadPage(true);
                    } else {
                        window.location.reload();
                    }
                },
                error: function() {
                    Messenger.notificationFlashMessage('error', __('Cannot reset workflow item data.'));
                    resetInProgress();
                }
            })
        });

        confirmReset.on('cancel', function() {
            resetInProgress();
        });

        confirmReset.open();
    }
});
{'fraction_non_alphanumeric': 0.12624584717607973, 'fraction_numerical': 0.0011074197120708748, 'mean_word_length': 1.5678749111584933, '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': '3633498', 'n_tokens_mistral': 971, 'n_tokens_neox': 905, 'n_words': 198}