<commit_before>'use strict';

define(['angular'], function(angular) {

    var app = angular.module('bugattiApp.controller.admin.projectModule', []);

    app.controller('ProjectCtrl', ['$scope', '$state', '$stateParams', '$modal', 'growl', 'ProjectService', 'VersionService', 'EnvService',
        function($scope, $state, $stateParams, $modal, growl, ProjectService, VersionService, EnvService) {
            $scope.app.breadcrumb='项目管理';
            $scope.currentPage = 1;
            $scope.pageSize = 20;

            // load env
            EnvService.getAll(function(data) {
                if (data == null || data.length == 0) {
                    return;
                }
                $scope.envId = data[0].id;
            });

            $scope.searchForm = function(projectName) {
                // count
                ProjectService.count(projectName, function(data) {
                    $scope.totalItems = data;
                });

                // list
                ProjectService.getPage(projectName, 0, $scope.pageSize, function(data) {
                    $scope.projects = data;
                });<commit_msg>code:  项目搜索保持结果状态<commit_after>'use strict';

define(['angular'], function(angular) {

    var app = angular.module('bugattiApp.controller.admin.projectModule', ['ngCookies']);

    app.controller('ProjectCtrl', ['$scope', '$state', '$stateParams', '$cookies', '$modal', 'growl', 'ProjectService', 'VersionService', 'EnvService',
        function($scope, $state, $stateParams, $cookies, $modal, growl, ProjectService, VersionService, EnvService) {
            $scope.app.breadcrumb='项目管理';
            $scope.currentPage = 1;
            $scope.pageSize = 20;

            // load env
            EnvService.getAll(function(data) {
                if (data == null || data.length == 0) {
                    return;
                }
                $scope.envId = data[0].id;
            });

            $scope.searchForm = function(projectName) {

                // 保持搜索状态
                if (angular.isDefined(projectName)) {
                    $cookies.search_project_name = projectName;
                } else {
                    if (angular.isDefined($cookies.search_project_name)) {
                        $scope.s_projectName = $cookies.search_project_name;
                        projectName = $cookies.search_project_name;
                    }
                }

                // count
                ProjectService.count(projectName, function(data) {
                    $scope.totalItems = data;
                });

                // list
                ProjectService.getPage(projectName, 0, $scope.pageSize, function(data) {
                    $scope.projects = data;
                });
{'fraction_non_alphanumeric': 0.1313314037626628, 'fraction_numerical': 0.004341534008683068, 'mean_word_length': 1.6689189189189189, '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': '5621655', 'n_tokens_mistral': 767, 'n_tokens_neox': 721, 'n_words': 124}