<commit_before>devOpsHammer.controller('jsonController', ['$scope', '$http', function ($scope, $http) {

    $scope.firstAction = true;
    $scope.jsonInput = "";
    $scope.jsonValid = "false";

    $scope.jsonInputChange = function () {
        $scope.firstAction = false;

        // Simple POST request example (passing data) :
        $http.post('http://localhost:8080/json/pretty', $scope.jsonInput).
            success(function (data, status, headers, config) {
                // this callback will be called asynchronously
                // when the response is available
                $scope.jsonValid = data.valid;
                if (data.valid === "true") {
                    $scope.jsonInput = JSON.stringify(data.json, null, 4);
                }
            }).
            error(function (data, status, headers, config) {
                // called asynchronously if an error occurs
                // or server returns response with an error status.
                console.log("error while calling validation service");
            });
    };
}]);

devOpsHammer.controller('xmlController', ['$scope', '$http', function ($scope, $http) {

    $scope.firstAction = true;
    $scope.message = "";
    $scope.xmlInput = "";
    $scope.xmlValid = "false";
    $scope.editorOptions = {<commit_msg>Fix controller, some code disappeared while merging.<commit_after>devOpsHammer.controller('homeController', ['$scope', '$http', function ($scope, $http) {
}]);

devOpsHammer.controller('jsonController', ['$scope', '$http', function ($scope, $http) {

    $scope.firstAction = true;
    $scope.message = "";
    $scope.jsonInput = "";
    $scope.jsonValid = "false";
    $scope.editorOptions = {
        lineNumbers: true,
        mode: 'scheme'
    };

    $scope.hasNoContent = function () {
        return $scope.firstAction === true;
    };

    $scope.hasValidContent = function () {
        return $scope.firstAction === false && $scope.jsonValid === 'true';
    };

    $scope.hasInvalidContent = function () {
        return $scope.firstAction === false && $scope.jsonValid !== 'true';
    };

    $scope.jsonInputChange = function () {
        $scope.firstAction = false;

        // Simple POST request example (passing data) :
        $http.post('http://localhost:8080/json/pretty', $scope.jsonInput).
            success(function (data, status, headers, config) {
                // this callback will be called asynchronously
                // when the response is available
                $scope.jsonValid = data.valid;
                $scope.message = "- " + atob(data.message);
                if (data.valid === "true") {
                    $scope.jsonInput = atob(data.json);
                }
            }).
            error(function (data, status, headers, config) {
                // called asynchronously if an error occurs
                // or server returns response with an error status.
                console.log("error while calling validation service");
            });
    };
}]);

devOpsHammer.controller('xmlController', ['$scope', '$http', function ($scope, $http) {

    $scope.firstAction = true;
    $scope.message = "";
    $scope.xmlInput = "";
    $scope.xmlValid = "false";
    $scope.editorOptions = {
{'fraction_non_alphanumeric': 0.14552696078431374, 'fraction_numerical': 0.0027573529411764708, 'mean_word_length': 2.194716242661448, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '6802695', 'n_tokens_mistral': 904, 'n_tokens_neox': 851, 'n_words': 207}