<commit_before>/**
 * This file contains all necessary Angular controller definitions for 'frontend.admin.login-history' module.
 *
 * Note that this file should only contain controllers and nothing else.
 */
(function() {
    'use strict';

    angular.module('frontend.connections')
        .controller('CreateConnectionController', [
            '$scope','$rootScope','$log','NodeModel',
            'MessageService','SettingsService','$uibModalInstance',
            function controller($scope,$rootScope,$log,NodeModel,
                                MessageService,SettingsService,$uibModalInstance) {

                $scope.kong_versions = SettingsService.getKongVersions()

                $scope.node = {
                    type : 'default',
                    jwt_algorithm : 'HS256', // Initialize this anyway so that it can be preselected
                }

                $scope.close = function(){
                    $uibModalInstance.dismiss();
                }

                $scope.create = function() {
                    $scope.busy = true;
                    NodeModel
                        .create(angular.copy($scope.node))
                        .then(
                            function onSuccess(result) {
                                MessageService.success('New node created successfully');
                                $scope.busy = false;
                                $rootScope.$broadcast('kong.node.created',result.data);
                                $uibModalInstance.dismiss();
                            },function(err){
                                $scope.busy = false
                                NodeModel.handleError($scope,err);
                            }
                        )
                    ;
                };
            }
        ])
    ;
}());<commit_msg>Worked on 1.x error handling<commit_after>/**
 * This file contains all necessary Angular controller definitions for 'frontend.admin.login-history' module.
 *
 * Note that this file should only contain controllers and nothing else.
 */
(function() {
    'use strict';

    angular.module('frontend.connections')
        .controller('CreateConnectionController', [
            '$scope','$rootScope','$log','NodeModel',
            'MessageService','SettingsService','$uibModalInstance',
            function controller($scope,$rootScope,$log,NodeModel,
                                MessageService,SettingsService,$uibModalInstance) {

                $scope.kong_versions = SettingsService.getKongVersions()

                $scope.node = {
                    type : 'default',
                    jwt_algorithm : 'HS256', // Initialize this anyway so that it can be preselected
                }

                $scope.close = function(){
                    $uibModalInstance.dismiss();
                }

                $scope.create = function() {
                    $scope.busy = true;
                    console.log("Creating connection", angular.copy($scope.node))
                    NodeModel
                        .create(angular.copy($scope.node))
                        .then(
                            function onSuccess(result) {
                                MessageService.success('New node created successfully');
                                $scope.busy = false;
                                $rootScope.$broadcast('kong.node.created',result.data);
                                $uibModalInstance.dismiss();
                            },function(err){
                                $scope.busy = false
                                console.error(err);
                                NodeModel.handleError($scope,err);
                                MessageService.error(_.get(err, 'data.message', 'Something went wrong...'))
                            }
                        )
                    ;
                };
            }
        ])
    ;
}());
{'fraction_non_alphanumeric': 0.10225259427992914, 'fraction_numerical': 0.001771703366236396, 'mean_word_length': 1.2315076228119706, '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': '253536', 'n_tokens_mistral': 907, 'n_tokens_neox': 831, 'n_words': 159}