<commit_before>angular.module('cloudoptingApp')
    .controller('FormGenerationController', function (SERVICE, localStorageService, $scope, $log, CustomizationService) {

        /*
    	$http.get("/api/application/1/getCustomizationForm").success(function(res){
    		console.log(res);
    		$scope.schema = res;});
        $scope.schema = {
            type: "object",
            properties: {
                name: { type: "string", minLength: 2, title: "Name", description: "Name or alias" },
                title: {
                    type: "string",
                    enum: ['dr','jr','sir','mrs','mr','NaN','dj']
                }
            }
        };
*/
        var currentApp = localStorageService.get(SERVICE.STORAGE.CURRENT_APP);

        var callback = function(data) {
            $log.info(data);
            $scope.schema = data;
        };

        var idApp = currentApp.id;
        //FIXME: Delete hardcoded value.
        if(idApp===undefined || idApp === null) {
            idApp = 1;
        }
        CustomizationService.getCustomizationForm(idApp, callback);

        $scope.form = [
            "*",
            {
                type: "submit",
                title: "Save"
            }
        ];

        $scope.model = {};

        $scope.onSubmit = function(form) {
            // First we broadcast an event so all fields validate themselves
            $scope.$broadcast('schemaFormValidate');

            // Then we check if the form is valid
            if (form.$valid) {
                // ... do whatever you need to do with your data.
                $log.info("The form is valid, let's send it: " + form.node_id.$modelValue + " " +  form.memory.$modelValue);
                var callback = function(data) {
                    $log.info("sendCustomForm succeeded with data: " + data);
                };
                CustomizationService.sendCustomizationForm(form, callback);
            }
        }
    }
);<commit_msg>Fixed sending only the model and not all the form.<commit_after>angular.module('cloudoptingApp')
    .controller('FormGenerationController', function (SERVICE, localStorageService, $scope, $log, CustomizationService) {

        /*
    	$http.get("/api/application/1/getCustomizationForm").success(function(res){
    		console.log(res);
    		$scope.schema = res;});
        $scope.schema = {
            type: "object",
            properties: {
                name: { type: "string", minLength: 2, title: "Name", description: "Name or alias" },
                title: {
                    type: "string",
                    enum: ['dr','jr','sir','mrs','mr','NaN','dj']
                }
            }
        };
*/
        var currentApp = localStorageService.get(SERVICE.STORAGE.CURRENT_APP);

        var callback = function(data) {
            $log.info(data);
            $scope.schema = data;
        };

        var idApp = currentApp.id;
        //FIXME: Delete hardcoded value.
        if(idApp===undefined || idApp === null) {
            idApp = 1;
        }
        CustomizationService.getCustomizationForm(idApp, callback);

        $scope.form = [
            "*",
            {
                type: "submit",
                title: "Save"
            }
        ];

        $scope.model = {};

        $scope.onSubmit = function(form) {
            // First we broadcast an event so all fields validate themselves
            $scope.$broadcast('schemaFormValidate');

            // Then we check if the form is valid
            if (form.$valid) {
                // ... do whatever you need to do with your data.
                $log.info("The form is valid, let's send it: " );
                var callback = function(data) {
                    $log.info("sendCustomForm succeeded with data: " + data);
                };
                CustomizationService.sendCustomizationForm($scope.model, callback);
            }
        }
    }
);
{'fraction_non_alphanumeric': 0.13001523616048755, 'fraction_numerical': 0.0015236160487557136, 'mean_word_length': 1.5931533903884134, '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': '6445256', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1029, 'n_words': 231}