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


import { templateUrl } from '../../shared/template-url/template-url.factory';
import controller from '../../scheduler/schedulerList.controller';
import addController from '../../scheduler/schedulerAdd.controller';
import editController from '../../scheduler/schedulerEdit.controller';

export default
angular.module('managementJobScheduler', [])
    .controller('managementJobController', controller)
    .controller('managementJobAddController', addController)
    .controller('managementJobEditController', editController)
    .run(['$stateExtender', function($stateExtender) {
        $stateExtender.addState({
            searchPrefix: 'schedule',
            name: 'managementJobSchedules',
            route: '/management_jobs/:id/schedules',
            ncyBreadcrumb: {
                parent: 'managementJobsList',
                label: 'SCHEDULES'
            },
            views: {
                '@': {
                    templateProvider: function(SchedulesList, generateList, ParentObject) {
                        // include name of parent resource in listTitle
                        SchedulesList.listTitle = `${ParentObject.name}<div class='List-titleLockup'></div>Schedules`;
                        let html = generateList.build({
                            list: SchedulesList,
                            mode: 'edit'
                        });
                        html = generateList.wrapPanel(html);
                        return generateList.insertFormView() + html;
                    },
                    controller: 'managementJobController',
                }
            },
            resolve: {
                Dataset: ['SchedulesList', 'QuerySet', '$stateParams', 'GetBasePath',
                    function(list, qs, $stateParams, GetBasePath) {
                        let path = `${GetBasePath('system_job_templates')}${$stateParams.id}/schedules`;
                        return qs.search(path, $stateParams[`${list.iterator}_search`]);
                    }
                ],
                ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath) {
                    let path = `${GetBasePath('system_job_templates')}${$stateParams.id}`;
                    Rest.setUrl(path);
                    return Rest.get(path).then((res) => res.data);
                }]
            }
        });
        $stateExtender.addState({
            name: 'managementJobSchedules.add',
            route: '/add',
            ncyBreadcrumb: {
                parent: 'managementJobSchedules',
                label: 'CREATE SCHEDULED JOB'
            },
            views: {
                'form': {
                    templateUrl: templateUrl('management-jobs/scheduler/schedulerForm'),
                    controller: 'managementJobAddController',<commit_msg>missed dependency<commit_after>/*************************************************
 * Copyright (c) 2016 Ansible, Inc.
 *
 * All Rights Reserved
 *************************************************/


import { templateUrl } from '../../shared/template-url/template-url.factory';
import controller from '../../scheduler/schedulerList.controller';
import addController from '../../scheduler/schedulerAdd.controller';
import editController from '../../scheduler/schedulerEdit.controller';

export default
angular.module('managementJobScheduler', [])
    .controller('managementJobController', controller)
    .controller('managementJobAddController', addController)
    .controller('managementJobEditController', editController)
    .run(['$stateExtender', function($stateExtender) {
        $stateExtender.addState({
            searchPrefix: 'schedule',
            name: 'managementJobSchedules',
            route: '/management_jobs/:id/schedules',
            ncyBreadcrumb: {
                parent: 'managementJobsList',
                label: 'SCHEDULES'
            },
            views: {
                '@': {
                    templateProvider: function(SchedulesList, generateList, ParentObject) {
                        // include name of parent resource in listTitle
                        SchedulesList.listTitle = `${ParentObject.name}<div class='List-titleLockup'></div>Schedules`;
                        let html = generateList.build({
                            list: SchedulesList,
                            mode: 'edit'
                        });
                        html = generateList.wrapPanel(html);
                        return generateList.insertFormView() + html;
                    },
                    controller: 'managementJobController',
                }
            },
            resolve: {
                Dataset: ['SchedulesList', 'QuerySet', '$stateParams', 'GetBasePath',
                    function(list, qs, $stateParams, GetBasePath) {
                        let path = `${GetBasePath('system_job_templates')}${$stateParams.id}/schedules`;
                        return qs.search(path, $stateParams[`${list.iterator}_search`]);
                    }
                ],
                ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath) {
                    let path = `${GetBasePath('system_job_templates')}${$stateParams.id}`;
                    Rest.setUrl(path);
                    return Rest.get(path).then((res) => res.data);
                }],
                UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q',
                    function(Rest, GetBasePath, $stateParams, $q) {
                        Rest.setUrl(GetBasePath('unified_jobs'));
                        var val = $q.defer();
                        Rest.options()
                            .then(function(data) {
                                val.resolve(data.data);
                            }, function(data) {
                                val.reject(data);
                            });
                        return val.promise;
                    }]
            }
        });
        $stateExtender.addState({
            name: 'managementJobSchedules.add',
            route: '/add',
            ncyBreadcrumb: {
                parent: 'managementJobSchedules',
                label: 'CREATE SCHEDULED JOB'
            },
            views: {
                'form': {
                    templateUrl: templateUrl('management-jobs/scheduler/schedulerForm'),
                    controller: 'managementJobAddController',
{'fraction_non_alphanumeric': 0.14491449144914492, 'fraction_numerical': 0.0012001200120012002, 'mean_word_length': 1.6872228939943572, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '5521027', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1521, 'n_words': 270}