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

export default
    [   '$rootScope','Wait', 'generateList', 'NotificationTemplatesList',
        'GetBasePath' , 'SearchInit' , 'PaginateInit', 'Rest' ,
        'ProcessErrors', 'Prompt', '$state', 'GetChoices', 'Empty', 'Find',
        'ngToast', '$compile', '$filter',
        function(
            $rootScope,Wait, GenerateList, NotificationTemplatesList,
            GetBasePath, SearchInit, PaginateInit, Rest,
            ProcessErrors, Prompt, $state, GetChoices, Empty, Find, ngToast,
            $compile, $filter) {
            var scope = $rootScope.$new(),
                defaultUrl = GetBasePath('notification_templates'),
                list = NotificationTemplatesList,
                view = GenerateList;

            view.inject( list, {
                mode: 'edit',
                scope: scope
            });

            scope.removePostRefresh = scope.$on('PostRefresh', function () {
                Wait('stop');
                if (scope.notification_templates) {
                    scope.notification_templates.forEach(function(notification_template, i) {
                        scope.notification_type_options.forEach(function(type) {
                            if (type.value === notification_template.notification_type) {
                                scope.notification_templates[i].notification_type = type.label;
                                var recent_notifications = notification_template.summary_fields.recent_notifications;
                                scope.notification_templates[i].status = recent_notifications && recent_notifications.length > 0 ? recent_notifications[0].status : "none";
                            }
                        });
                    });
                }
            });

            if (scope.removeChoicesHere) {
                scope.removeChoicesHere();
            }
            scope.removeChoicesHere = scope.$on('choicesReadyNotifierList', function () {
                list.fields.notification_type.searchOptions = scope.notification_type_options;

                SearchInit({
                    scope: scope,
                    set: 'notification_templates',
                    list: list,
                    url: defaultUrl
                });

                if ($rootScope.addedItem) {
                    scope.addedItem = $rootScope.addedItem;
                    delete $rootScope.addedItem;
                }
                PaginateInit({
                    scope: scope,
                    list: list,
                    url: defaultUrl
                });

                scope.search(list.iterator);

            });

            GetChoices({
                scope: scope,
                url: defaultUrl,
                field: 'notification_type',
                variable: 'notification_type_options',
                callback: 'choicesReadyNotifierList'
            });

            function attachElem(event, html, title) {
                var elem = $(event.target).parent();
                try {
                    elem.tooltip('hide');
                    elem.popover('destroy');
                }
                catch(err) {
                    //ignore
                }

                $('.popover').each(function() {
                    // remove lingering popover <div>. Seems to be a bug in TB3 RC1
                    $(this).remove();
                });
                $('.tooltip').each( function() {
                    // close any lingering tool tipss
                    $(this).hide();
                });
                elem.attr({
                    "aw-pop-over": html,
                    "data-popover-title": title,
                    "data-placement": "right" });
                $compile(elem)(scope);
                elem.on('shown.bs.popover', function() {
                    $('.popover').each(function() {
                        $compile($(this))(scope);  //make nested directives work!
                    });
                    $('.popover-content, .popover-title').click(function() {
                        elem.popover('hide');
                    });
                });
                elem.popover('show');
            }

            scope.showSummary = function(event, id) {
                Wait('start');
                setTimeout(function(){
                    if (!Empty(id)) {
                        var recent_notifications,
                        html, title = "Recent Notifications";

                        scope.notification_templates.forEach(function(notification_template){
                            if(notification_template.id === id){
                                recent_notifications = notification_template.summary_fields.recent_notifications;
                            }
                        });
                        Wait('stop');
                        if (recent_notifications.length > 0) {
                            html = "<table class=\"table table-condensed flyout\" style=\"width: 100%\">\n";
                            html += "<thead>\n";
                            html += "<tr>";
                            html += "<th>Status</th>";
                            html += "<th>Time</th>";
                            html += "</tr>\n";
                            html += "</thead>\n";
                            html += "<tbody>\n";

                            recent_notifications.forEach(function(row) {
                                html += "<tr>\n";
                                html += "<td><i class=\"fa icon-job-" + row.status + "\"></i></td>\n";
                                html += "<td>" + ($filter('longDate')(row.created)).replace(/ /,'<br />') + "</td>\n";
                                html += "</tr>\n";
                            });<commit_msg>removing wait spinner on notification popover<commit_after> /*************************************************
 * Copyright (c) 2015 Ansible, Inc.
 *
 * All Rights Reserved
 *************************************************/

export default
    [   '$rootScope','Wait', 'generateList', 'NotificationTemplatesList',
        'GetBasePath' , 'SearchInit' , 'PaginateInit', 'Rest' ,
        'ProcessErrors', 'Prompt', '$state', 'GetChoices', 'Empty', 'Find',
        'ngToast', '$compile', '$filter',
        function(
            $rootScope,Wait, GenerateList, NotificationTemplatesList,
            GetBasePath, SearchInit, PaginateInit, Rest,
            ProcessErrors, Prompt, $state, GetChoices, Empty, Find, ngToast,
            $compile, $filter) {
            var scope = $rootScope.$new(),
                defaultUrl = GetBasePath('notification_templates'),
                list = NotificationTemplatesList,
                view = GenerateList;

            view.inject( list, {
                mode: 'edit',
                scope: scope
            });

            scope.removePostRefresh = scope.$on('PostRefresh', function () {
                Wait('stop');
                if (scope.notification_templates) {
                    scope.notification_templates.forEach(function(notification_template, i) {
                        scope.notification_type_options.forEach(function(type) {
                            if (type.value === notification_template.notification_type) {
                                scope.notification_templates[i].notification_type = type.label;
                                var recent_notifications = notification_template.summary_fields.recent_notifications;
                                scope.notification_templates[i].status = recent_notifications && recent_notifications.length > 0 ? recent_notifications[0].status : "none";
                            }
                        });
                    });
                }
            });

            if (scope.removeChoicesHere) {
                scope.removeChoicesHere();
            }
            scope.removeChoicesHere = scope.$on('choicesReadyNotifierList', function () {
                list.fields.notification_type.searchOptions = scope.notification_type_options;

                SearchInit({
                    scope: scope,
                    set: 'notification_templates',
                    list: list,
                    url: defaultUrl
                });

                if ($rootScope.addedItem) {
                    scope.addedItem = $rootScope.addedItem;
                    delete $rootScope.addedItem;
                }
                PaginateInit({
                    scope: scope,
                    list: list,
                    url: defaultUrl
                });

                scope.search(list.iterator);

            });

            GetChoices({
                scope: scope,
                url: defaultUrl,
                field: 'notification_type',
                variable: 'notification_type_options',
                callback: 'choicesReadyNotifierList'
            });

            function attachElem(event, html, title) {
                var elem = $(event.target).parent();
                try {
                    elem.tooltip('hide');
                    elem.popover('destroy');
                }
                catch(err) {
                    //ignore
                }

                $('.popover').each(function() {
                    // remove lingering popover <div>. Seems to be a bug in TB3 RC1
                    $(this).remove();
                });
                $('.tooltip').each( function() {
                    // close any lingering tool tipss
                    $(this).hide();
                });
                elem.attr({
                    "aw-pop-over": html,
                    "data-popover-title": title,
                    "data-placement": "right" });
                $compile(elem)(scope);
                elem.on('shown.bs.popover', function() {
                    $('.popover').each(function() {
                        $compile($(this))(scope);  //make nested directives work!
                    });
                    $('.popover-content, .popover-title').click(function() {
                        elem.popover('hide');
                    });
                });
                elem.popover('show');
            }

            scope.showSummary = function(event, id) {
                setTimeout(function(){
                    if (!Empty(id)) {
                        var recent_notifications,
                        html, title = "Recent Notifications";

                        scope.notification_templates.forEach(function(notification_template){
                            if(notification_template.id === id){
                                recent_notifications = notification_template.summary_fields.recent_notifications;
                            }
                        });
                        if (recent_notifications.length > 0) {
                            html = "<table class=\"table table-condensed flyout\" style=\"width: 100%\">\n";
                            html += "<thead>\n";
                            html += "<tr>";
                            html += "<th>Status</th>";
                            html += "<th>Time</th>";
                            html += "</tr>\n";
                            html += "</thead>\n";
                            html += "<tbody>\n";

                            recent_notifications.forEach(function(row) {
                                html += "<tr>\n";
                                html += "<td><i class=\"fa icon-job-" + row.status + "\"></i></td>\n";
                                html += "<td>" + ($filter('longDate')(row.created)).replace(/ /,'<br />') + "</td>\n";
                                html += "</tr>\n";
                            });
{'fraction_non_alphanumeric': 0.13347866185964619, 'fraction_numerical': 0.0020122411335625054, 'mean_word_length': 1.1934534755424788, 'pattern_counts': {'":': 6, '<': 43, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5530475', 'n_tokens_mistral': 2821, 'n_tokens_neox': 2566, 'n_words': 477}