<commit_before>
InternalDestinationsFactory.$inject = ['api'];
function InternalDestinationsFactory(api) {
    class InternalDestinationsService {
        query(params) {
            let queryParams = params || {};

            queryParams.max_results = 200;
            return api.query('internal_destinations', params)
                .then((response) => response._items);
        }

        save(item) {
            return api.save('internal_destinations', item);
        }

        remove(item) {
            return api.remove(item);
        }
    }

    return new InternalDestinationsService();
}

InternalDestinationsController.$inject = ['internalDestinations'];
function InternalDestinationsController(internalDestinations) {
    this.create = () => {
        this.active = {is_active: false};
    };

    this.edit = (dest) => {
        this.active = angular.extend({}, dest);
    };

    this.remove = (dest) => {
        internalDestinations.remove(dest).then(this.load);
    };

    this.stopEdit = () => {
        this.active = null;
    };

    this.save = (dest) => {
        internalDestinations.save(dest).then(this.load);
        this.stopEdit();
    };

    this.load = () => {
        internalDestinations.query().then((destinations) => {
            this.destinations = destinations;
        });
    };

    // init
    this.load();
}
<commit_msg>fix(internal destinations): Add a confirmation when deleting internal destination<commit_after>
InternalDestinationsFactory.$inject = ['api'];
function InternalDestinationsFactory(api) {
    class InternalDestinationsService {
        query(params) {
            let queryParams = params || {};

            queryParams.max_results = 200;
            return api.query('internal_destinations', params)
                .then((response) => response._items);
        }

        save(item) {
            return api.save('internal_destinations', item);
        }

        remove(item) {
            return api.remove(item);
        }
    }

    return new InternalDestinationsService();
}

InternalDestinationsController.$inject = ['internalDestinations', 'modal'];
function InternalDestinationsController(internalDestinations, modal) {
    this.create = () => {
        this.active = {is_active: false};
    };

    this.edit = (dest) => {
        this.active = angular.extend({}, dest);
    };

    this.remove = (dest) => {
        modal.confirm(gettext('Please confirm you want to delete internal destination.')).then(
            function runConfirmed() {
                internalDestinations.remove(dest).then(this.load);
            }
        );
    };

    this.stopEdit = () => {
        this.active = null;
    };

    this.save = (dest) => {
        internalDestinations.save(dest).then(this.load);
        this.stopEdit();
    };

    this.load = () => {
        internalDestinations.query().then((destinations) => {
            this.destinations = destinations;
        });
    };

    // init
    this.load();
}

{'fraction_non_alphanumeric': 0.13683506189360992, 'fraction_numerical': 0.0020073603211776514, 'mean_word_length': 2.260632497273719, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '2968816', 'n_tokens_mistral': 821, 'n_tokens_neox': 787, 'n_words': 134}