<commit_before>define(['app/models/key'],
    /**
     * Keys Controller
     *
     * @returns Class
     */
    function(Key) {
        return Ember.ArrayController.extend({

            /**
             * 
             *  Properties
             * 
             */

            content: [],
            loading: false,
            keyRequest: false,
            keyResponse: false,
            creatingKey: false,
            gettingPublicKey: false,
            gettingPrivateKey: false,



            /**
             * 
             *  Initialization
             * 
             */

            load: function() {
                var that = this;
                this.set('loading', true);
                $.getJSON('/keys', function(keys) {
                    that.setContent(keys);
                    that.sendKeyResponse();
                }).error(function() {
                    that.reload();
                }).complete(function() {
                    that.set('loading', false);
                });
            }.on('init'),


            reload: function() {
                Ember.run.later(this, function() {
                    this.load();
                }, 5000);
            },



            /**
             * 
             *  Observers
             * 
             */

            keyRequestObserver: function() {
                if (this.keyRequest && !this.loading) {
                    this.sendKeyResponse();
                }
            }.observes('keyRequest'),



            /**
             * 
             *  Methods
             * 
             */

            renameKey: function(name, newName, callback) {
                this.set('renamingKey', true);
                $.ajax({
                    url: '/keys/' + name,
                    type: 'PUT',
                    contentType: 'application/json',
                    data: JSON.stringify({'newName': newName}),
                    error: function(jqXHR) {
                        Mist.notificationController.notify('Failed to edit key: ' + jqXHR.responseText);
                    },
                    complete: function() {
                        this.set('renamingKey', false);
                        if (callback) { callback(); }
                    }
                });
            },


            deleteKey: function(name) {
                $.ajax({
                    url: '/keys/' + name,
                    type: 'DELETE',
                    success: function(data) {
                        info('Successfully deleted key: ', name);
                        Mist.keysController.updateKeysList(data);
                    },
                    error: function(jqXHR) {
                        Mist.notificationController.notify('Error while deleting key: ' + jqXHR.responseText);
                    }
                });
            },
           
            
            setDefaultKey: function(name) {
                $.ajax({
                    url: '/keys/' + name,
                    type: 'POST',<commit_msg>Change renameKey method<commit_after>define(['app/models/key'],
    /**
     * Keys Controller
     *
     * @returns Class
     */
    function(Key) {
        return Ember.ArrayController.extend({

            /**
             * 
             *  Properties
             * 
             */

            content: [],
            loading: false,
            keyRequest: false,
            keyResponse: false,
            creatingKey: false,
            renamingKey: false,
            gettingPublicKey: false,
            gettingPrivateKey: false,



            /**
             * 
             *  Initialization
             * 
             */

            load: function() {
                var that = this;
                this.set('loading', true);
                $.getJSON('/keys', function(keys) {
                    that.setContent(keys);
                    that.sendKeyResponse();
                }).error(function() {
                    that.reload();
                }).complete(function() {
                    that.set('loading', false);
                });
            }.on('init'),


            reload: function() {
                Ember.run.later(this, function() {
                    this.load();
                }, 5000);
            },



            /**
             * 
             *  Observers
             * 
             */

            keyRequestObserver: function() {
                if (this.keyRequest && !this.loading) {
                    this.sendKeyResponse();
                }
            }.observes('keyRequest'),



            /**
             * 
             *  Methods
             * 
             */

            renameKey: function(name, newName, callback) {
                this.set('renamingKey', true);
                $.ajax({
                    url: '/keys/' + name,
                    type: 'PUT',
                    contentType: 'application/json',
                    data: JSON.stringify({'newName': newName}),
                    success: function() {
                        if (callback) callback();
                    },
                    error: function() {
                        Mist.notificationController.notify('Failed to rename key');
                    },
                    complete: function() {
                        this.set('renamingKey', false);
                    }
                });
            },


            deleteKey: function(name, callback) {
                $.ajax({
                    url: '/keys/' + name,
                    type: 'DELETE',
                    success: function() {
                        Mist.keysController.updateKeysList(data);
                    },
                    error: function(jqXHR) {
                        Mist.notificationController.notify('Error while deleting key: ' + jqXHR.responseText);
                    }
                });
            },
           
            
            setDefaultKey: function(name) {
                $.ajax({
                    url: '/keys/' + name,
                    type: 'POST',
{'fraction_non_alphanumeric': 0.11275233874938453, 'fraction_numerical': 0.0013129821106187428, 'mean_word_length': 0.8472264322521976, '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': '5098919', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1299, 'n_words': 233}