<commit_before>angular.module('ot.view.buildSearch', [
    'ui.router',
    'ot.service.core',
    'ot.service.form',
    'ot.service.structure'
])
    .config(function ($stateProvider) {
        $stateProvider.state('build-search', {
            url: '/build-search/{projectId}',
            templateUrl: 'app/view/view.buildSearch.tpl.html',
            controller: 'BuildSearchCtrl'
        });
    })
    .controller('BuildSearchCtrl', function ($location, $scope, $stateParams, $state, $http, ot, otStructureService, otFormService, otNotificationService) {
        var view = ot.view();
        // Project's id
        var projectId = $stateParams.projectId;

        // Loading the project
        function loadProject() {
            otStructureService.getProject(projectId).then(function (projectResource) {
                $scope.project = projectResource;
                // View settings
                view.breadcrumbs = ot.projectBreadcrumbs(projectResource);
                view.title = "Build search";
                // View commands
                view.commands = [
                    ot.viewApiCommand(projectResource._buildSearch),
                    ot.viewCloseCommand('/project/' + projectResource.id)
                ];
                return ot.pageCall($http.get(projectResource._buildDiffActions));
            }).then(function (diffActionResources) {
                $scope.buildDiffActions = diffActionResources.resources;
                return ot.pageCall($http.get($scope.project._buildSearch));
            }).then(function (searchForm) {
                $scope.searchForm = searchForm;

                // Extracts the list of properties
                $scope.propertyField = otFormService.getField(searchForm, "property");

                $scope.data = {
                    maximumCount: 10
                };
                try {
                    // Permalink
                    var jsonLink = $location.hash();
                    if (jsonLink) {
                        // Parsing the JSON
                        $scope.data = JSON.parse(jsonLink);
                        // Removes the hash after use
                        $location.hash('');
                    } else {
                        // Locally saved criteria
                        var json = localStorage.getItem('build_search_' + projectId);
                        if (json) {
                            $scope.data = JSON.parse(json);
                        }
                    }
                } catch (e) {
                    otNotificationService.error("Cannot get the filter from the permalink.");
                }
            });
        }

        // Initialization
        loadProject();

        // Selected builds
        $scope.selectedBuilds = [];
        $scope.selectedBuild = {
            from: '',
            to: ''
        };

        // Search
        $scope.searched = false;
        $scope.searching = false;
        $scope.submitSearch = function () {<commit_msg>#524 If a permalink is specified, launches the search automatically<commit_after>angular.module('ot.view.buildSearch', [
    'ui.router',
    'ot.service.core',
    'ot.service.form',
    'ot.service.structure'
])
    .config(function ($stateProvider) {
        $stateProvider.state('build-search', {
            url: '/build-search/{projectId}',
            templateUrl: 'app/view/view.buildSearch.tpl.html',
            controller: 'BuildSearchCtrl'
        });
    })
    .controller('BuildSearchCtrl', function ($location, $scope, $stateParams, $state, $http, ot, otStructureService, otFormService, otNotificationService) {
        var view = ot.view();
        // Project's id
        var projectId = $stateParams.projectId;

        // Loading the project
        function loadProject() {
            otStructureService.getProject(projectId).then(function (projectResource) {
                $scope.project = projectResource;
                // View settings
                view.breadcrumbs = ot.projectBreadcrumbs(projectResource);
                view.title = "Build search";
                // View commands
                view.commands = [
                    ot.viewApiCommand(projectResource._buildSearch),
                    ot.viewCloseCommand('/project/' + projectResource.id)
                ];
                return ot.pageCall($http.get(projectResource._buildDiffActions));
            }).then(function (diffActionResources) {
                $scope.buildDiffActions = diffActionResources.resources;
                return ot.pageCall($http.get($scope.project._buildSearch));
            }).then(function (searchForm) {
                $scope.searchForm = searchForm;

                // Extracts the list of properties
                $scope.propertyField = otFormService.getField(searchForm, "property");

                $scope.data = {
                    maximumCount: 10
                };
                try {
                    // Permalink
                    var jsonLink = $location.hash();
                    if (jsonLink) {
                        // Parsing the JSON
                        $scope.data = JSON.parse(jsonLink);
                        // Removes the hash after use
                        $location.hash('');
                        // Launches the search automatically
                        $scope.submitSearch();
                    } else {
                        // Locally saved criteria
                        var json = localStorage.getItem('build_search_' + projectId);
                        if (json) {
                            $scope.data = JSON.parse(json);
                        }
                    }
                } catch (e) {
                    otNotificationService.error("Cannot get the filter from the permalink.");
                }
            });
        }

        // Initialization
        loadProject();

        // Selected builds
        $scope.selectedBuilds = [];
        $scope.selectedBuild = {
            from: '',
            to: ''
        };

        // Search
        $scope.searched = false;
        $scope.searching = false;
        $scope.submitSearch = function () {
{'fraction_non_alphanumeric': 0.10771963824289406, 'fraction_numerical': 0.0011304909560723513, 'mean_word_length': 1.390196835198765, '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': '1359740', 'n_tokens_mistral': 1517, 'n_tokens_neox': 1428, 'n_words': 278}