<commit_before>/*************************************************
 * Copyright (c) 2015 Ansible, Inc.
 *
 * All Rights Reserved
 *************************************************/

/**
 * @ngdoc function
 * @name controllers.function:Jobs
 * @description This controller's for the jobs page
*/


export function JobsListController ($rootScope, $log, $scope, $compile, $routeParams,
    ClearScope, Breadcrumbs, LoadBreadCrumbs, LoadSchedulesScope,
    LoadJobsScope, AllJobsList, ScheduledJobsList, GetChoices, GetBasePath, Wait) {

    ClearScope();

    var jobs_scope, scheduled_scope,
        choicesCount = 0,
        listCount = 0,
        api_complete = false,
        max_rows;

    LoadBreadCrumbs();



    if ($scope.removeListLoaded) {
        $scope.removeListLoaded();
    }
    $scope.removeListLoaded = $scope.$on('listLoaded', function() {
        listCount++;
        if (listCount === 2) {
            api_complete = true;
        }
    });

    // After all choices are ready, load up the lists and populate the page
    if ($scope.removeBuildJobsList) {
        $scope.removeBuildJobsList();
    }
    $scope.removeBuildJobsList = $scope.$on('buildJobsList', function() {
        var opt, search_params;

        if (AllJobsList.fields.type) {
            AllJobsList.fields.type.searchOptions = $scope.type_choices;
        }
        if ($routeParams.status) {
            search_params[AllJobsList.iterator + 'SearchField'] = 'status';
            search_params[AllJobsList.iterator + 'SelectShow'] = true;
            search_params[AllJobsList.iterator + 'SearchSelectOpts'] = AllJobsList.fields.status.searchOptions;
            search_params[AllJobsList.iterator + 'SearchFieldLabel'] = AllJobsList.fields.status.label.replace(/<br\>/g,' ');
            search_params[AllJobsList.iterator + 'SearchType'] = '';
            for (opt in AllJobsList.fields.status.searchOptions) {
                if (AllJobsList.fields.status.searchOptions[opt].value === $routeParams.status) {
                    search_params[AllJobsList.iterator + 'SearchSelectValue'] = AllJobsList.fields.status.searchOptions[opt];
                    break;
                }
            }
        }
        jobs_scope = $scope.$new(true);
        jobs_scope.showJobType = true;
        LoadJobsScope({
            parent_scope: $scope,
            scope: jobs_scope,
            list: AllJobsList,
            id: 'active-jobs',
            url: GetBasePath('unified_jobs') + '?status__in=pending,running,completed,failed,successful,error,canceled',
            pageSize: max_rows,
            spinner: false
        });
        scheduled_scope = $scope.$new(true);
        LoadSchedulesScope({
            parent_scope: $scope,
            scope: scheduled_scope,
            list: ScheduledJobsList,
            id: 'scheduled-jobs-tab',
            searchSize: 'col-lg-4 col-md-4 col-sm-4 col-xs-12',
            url: GetBasePath('schedules') + '?next_run__isnull=false',
            pageSize: max_rows
        });

        $scope.refreshJobs = function() {
            jobs_scope.search('queued_job');
            jobs_scope.search('running_job');
            jobs_scope.search('completed_job');
            scheduled_scope.search('schedule');
        };

        if ($rootScope.removeJobStatusChange) {
            $rootScope.removeJobStatusChange();
        }
        $rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange-jobs', function() {
            jobs_scope.refreshJobs();
        });

        if ($rootScope.removeScheduleStatusChange) {
            $rootScope.removeScheduleStatusChange();
        }
        $rootScope.removeScheduleStatusChange = $rootScope.$on('ScheduleStatusChange', function() {<commit_msg>fixing console error when running system jobs<commit_after>/*************************************************
 * Copyright (c) 2015 Ansible, Inc.
 *
 * All Rights Reserved
 *************************************************/

/**
 * @ngdoc function
 * @name controllers.function:Jobs
 * @description This controller's for the jobs page
*/


export function JobsListController ($rootScope, $log, $scope, $compile, $routeParams,
    ClearScope, Breadcrumbs, LoadBreadCrumbs, LoadSchedulesScope,
    LoadJobsScope, AllJobsList, ScheduledJobsList, GetChoices, GetBasePath, Wait) {

    ClearScope();

    var jobs_scope, scheduled_scope,
        choicesCount = 0,
        listCount = 0,
        api_complete = false,
        max_rows;

    LoadBreadCrumbs();



    if ($scope.removeListLoaded) {
        $scope.removeListLoaded();
    }
    $scope.removeListLoaded = $scope.$on('listLoaded', function() {
        listCount++;
        if (listCount === 2) {
            api_complete = true;
        }
    });

    // After all choices are ready, load up the lists and populate the page
    if ($scope.removeBuildJobsList) {
        $scope.removeBuildJobsList();
    }
    $scope.removeBuildJobsList = $scope.$on('buildJobsList', function() {
        var opt, search_params;

        if (AllJobsList.fields.type) {
            AllJobsList.fields.type.searchOptions = $scope.type_choices;
        }
        if ($routeParams.status) {
            search_params[AllJobsList.iterator + 'SearchField'] = 'status';
            search_params[AllJobsList.iterator + 'SelectShow'] = true;
            search_params[AllJobsList.iterator + 'SearchSelectOpts'] = AllJobsList.fields.status.searchOptions;
            search_params[AllJobsList.iterator + 'SearchFieldLabel'] = AllJobsList.fields.status.label.replace(/<br\>/g,' ');
            search_params[AllJobsList.iterator + 'SearchType'] = '';
            for (opt in AllJobsList.fields.status.searchOptions) {
                if (AllJobsList.fields.status.searchOptions[opt].value === $routeParams.status) {
                    search_params[AllJobsList.iterator + 'SearchSelectValue'] = AllJobsList.fields.status.searchOptions[opt];
                    break;
                }
            }
        }
        jobs_scope = $scope.$new(true);
        jobs_scope.showJobType = true;
        LoadJobsScope({
            parent_scope: $scope,
            scope: jobs_scope,
            list: AllJobsList,
            id: 'active-jobs',
            url: GetBasePath('unified_jobs') + '?status__in=pending,running,completed,failed,successful,error,canceled',
            pageSize: max_rows,
            spinner: false
        });
        scheduled_scope = $scope.$new(true);
        LoadSchedulesScope({
            parent_scope: $scope,
            scope: scheduled_scope,
            list: ScheduledJobsList,
            id: 'scheduled-jobs-tab',
            searchSize: 'col-lg-4 col-md-4 col-sm-4 col-xs-12',
            url: GetBasePath('schedules') + '?next_run__isnull=false',
            pageSize: max_rows
        });

        $scope.refreshJobs = function() {
            jobs_scope.search('queued_job');
            jobs_scope.search('running_job');
            jobs_scope.search('completed_job');
            scheduled_scope.search('schedule');
        };

        if ($rootScope.removeJobStatusChange) {
            $rootScope.removeJobStatusChange();
        }
        $rootScope.removeJobStatusChange = $rootScope.$on('JobStatusChange-jobs', function() {
            $scope.refreshJobs();
        });

        if ($rootScope.removeScheduleStatusChange) {
            $rootScope.removeScheduleStatusChange();
        }
        $rootScope.removeScheduleStatusChange = $rootScope.$on('ScheduleStatusChange', function() {
{'fraction_non_alphanumeric': 0.1411623567048787, 'fraction_numerical': 0.003199146894161557, 'mean_word_length': 2.501166588894074, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7302888', 'n_tokens_mistral': 2157, 'n_tokens_neox': 2088, 'n_words': 356}