<commit_before>'use strict';

/* global app:true kongConfig:true appConfig:true */
(function (angular, app, kongConfig, appConfig) {

    if (typeof app === 'undefined') throw 'app-index.js: app is undefined';

    /**
     * Holds current page title, current host URL and
     * URL of the previous page.
     */
    app.factory('viewFrame', () => ({title: '', prevUrl: '', host: kongConfig.host, actionButtons: []}));

    /**
     * Configures route provider and ajax provider.
     */
    app.config(['$routeProvider', 'ajaxProvider' , function ($routeProvider, ajaxProvider) {
        ajaxProvider.setHost(kongConfig.host);
        ajaxProvider.contentType('application/json; charset=utf-8');
        ajaxProvider.accept('application/json');

        /* Add a basic authorization header
         if username and password are provided in the settings. */
        if (typeof kongConfig.username === 'string' && kongConfig.username) {
            ajaxProvider.basicAuth(kongConfig.username, kongConfig.password || '');
        }

        /* Configure routes. */
        $routeProvider
            .when('/', {
                templateUrl: 'views/dashboard.html',
                controller: 'DashboardController'
            })
            .when('/services', {
                templateUrl: 'views/service-list.html',
                controller: 'ServiceListController'
            })
            .when('/services/:serviceId', {
                templateUrl: 'views/service-edit.html',
                controller: 'ServiceEditController'
            })
            .when('/services/:serviceId/plugins', {
                templateUrl: 'views/plugin-edit.html',
                controller: 'PluginEditController'
            })
            .when('/plugins', {
                templateUrl: 'views/plugin-list.html',
                controller: 'PluginListController'
            })
            .when('/plugins/:pluginId', {
                templateUrl: 'views/plugin-edit.html',
                controller: 'PluginEditController'
            })
            .when('/consumers', {
                templateUrl: 'views/consumer-list.html',
                controller: 'ConsumerListController'
            })
            .when('/consumers/:consumerId', {
                templateUrl: 'views/consumer-edit.html',
                controller: 'ConsumerEditController'
            })
            .when('/consumers/:consumerId/plugins', {
                templateUrl: 'views/plugin-list.html',
                controller: 'PluginListController'
            })
            .when('/certificates', {
                templateUrl: 'views/certificate-list.html',
                controller: 'CertificateListController'
            })
            .when('/certificates/:certificateId', {
                templateUrl: 'views/certificate-edit.html',
                controller: 'CertificateEditController'
            })
            .when('/upstreams', {
                templateUrl: 'views/upstream-list.html',
                controller: 'UpstreamListController'
            })
            .when('/upstreams/:upstreamId', {
                templateUrl: 'views/upstream-edit.html',
                controller: 'UpstreamEditController'
            })
            .when('/settings', {
                templateUrl: 'views/settings.html',
                controller: 'SettingsController'
            })
            .otherwise({
                templateUrl: 'views/dashboard.html',
                controller: 'DashboardController'
            });
    }]);

    /**
     * Detects and highlights the correct
     * sidebar link upon location change.
     */
    app.run(['$rootScope', 'viewFrame', function ($rootScope, viewFrame) {
        $rootScope.ngViewAnimation = appConfig.enableAnimation ? 'fade' : '';

        $rootScope.$on('$locationChangeStart', (event, next, current) => {
            viewFrame.deleteAction = null;<commit_msg>add: Template path for editing CAs<commit_after>'use strict';

/**
 * @typedef {Object} ViewFrameFactory
 * @property {string} prevUrl - previous template URL for navigation
 * @property {string} title - current template title
 * @property {string} host - current Kong API host
 * @property {[Object]} actionButtons - array of action button objects
 */

/* global app:true kongConfig:true appConfig:true */
(function (angular, app, kongConfig, appConfig) {

    if (typeof app === 'undefined') throw 'app-index.js: app is undefined';

    /**
     * Holds current page title, current host URL and
     * URL of the previous page.
     */
    app.factory('viewFrame', () => ({title: '', prevUrl: '', host: kongConfig.host, actionButtons: []}));

    /**
     * Configures route provider and ajax provider.
     */
    app.config(['$routeProvider', 'ajaxProvider' , function ($routeProvider, ajaxProvider) {
        ajaxProvider.setHost(kongConfig.host);
        ajaxProvider.contentType('application/json; charset=utf-8');
        ajaxProvider.accept('application/json');

        /* Add a basic authorization header
         if username and password are provided in the settings. */
        if (typeof kongConfig.username === 'string' && kongConfig.username) {
            ajaxProvider.basicAuth(kongConfig.username, kongConfig.password || '');
        }

        /* Configure routes. */
        $routeProvider
            .when('/', {
                templateUrl: 'views/dashboard.html',
                controller: 'DashboardController'
            })
            .when('/services', {
                templateUrl: 'views/service-list.html',
                controller: 'ServiceListController'
            })
            .when('/services/:serviceId', {
                templateUrl: 'views/service-edit.html',
                controller: 'ServiceEditController'
            })
            .when('/services/:serviceId/plugins', {
                templateUrl: 'views/plugin-edit.html',
                controller: 'PluginEditController'
            })
            .when('/plugins', {
                templateUrl: 'views/plugin-list.html',
                controller: 'PluginListController'
            })
            .when('/plugins/:pluginId', {
                templateUrl: 'views/plugin-edit.html',
                controller: 'PluginEditController'
            })
            .when('/consumers', {
                templateUrl: 'views/consumer-list.html',
                controller: 'ConsumerListController'
            })
            .when('/consumers/:consumerId', {
                templateUrl: 'views/consumer-edit.html',
                controller: 'ConsumerEditController'
            })
            .when('/consumers/:consumerId/plugins', {
                templateUrl: 'views/plugin-list.html',
                controller: 'PluginListController'
            })
            .when('/certificates', {
                templateUrl: 'views/certificate-list.html',
                controller: 'CertificateListController'
            })
            .when('/certificates/:certificateId', {
                templateUrl: 'views/certificate-edit.html',
                controller: 'CertificateEditController'
            })
            .when('/trusted-cas/:caId', {
                templateUrl: 'views/ca-edit.html',
                controller: 'TrustedCAEditController'
            })
            .when('/upstreams', {
                templateUrl: 'views/upstream-list.html',
                controller: 'UpstreamListController'
            })
            .when('/upstreams/:upstreamId', {
                templateUrl: 'views/upstream-edit.html',
                controller: 'UpstreamEditController'
            })
            .when('/settings', {
                templateUrl: 'views/settings.html',
                controller: 'SettingsController'
            })
            .otherwise({
                templateUrl: 'views/dashboard.html',
                controller: 'DashboardController'
            });
    }]);

    /**
     * Detects and highlights the correct
     * sidebar link upon location change.
     */
    app.run(['$rootScope', 'viewFrame', function ($rootScope, viewFrame) {
        $rootScope.ngViewAnimation = appConfig.enableAnimation ? 'fade' : '';

        $rootScope.$on('$locationChangeStart', (event, next, current) => {
            viewFrame.deleteAction = null;
{'fraction_non_alphanumeric': 0.127198265478198, 'fraction_numerical': 0.0002409058058299205, 'mean_word_length': 1.835724043715847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5867353', 'n_tokens_mistral': 2103, 'n_tokens_neox': 2019, 'n_words': 395}