<commit_before>/************************************
 * Copyright (c) 2014 AnsibleWorks, Inc.
 *
 *
 *  Portal.js
 *
 *  Controller functions for portal mode
 *
 */


/**
 * @ngdoc function
 * @name controllers.function:Portal
 * @description This controller's for portal mode
*/
'use strict';

/**
 * @ngdoc method
 * @name controllers.function:Portal#Portal
 * @methodOf controllers.function:Portal
 * @description portal mode woohoo
 *
 *
*/
function PortalController($scope, $compile, $routeParams, $rootScope, $location, $log, Wait, ClearScope, Stream, Rest, GetBasePath, ProcessErrors,
    Button, PortalJobsWidget, GenerateList, PortalJobTemplateList, SearchInit, PaginateInit, PlaybookRun){

        ClearScope('portal');

        var html,
        e,
        // winHeight,
        // available_height,
        list = PortalJobTemplateList,
        view= GenerateList,
        defaultUrl = GetBasePath('job_templates'),
        buttons = {
            refresh: {
                mode: 'all',
                awToolTip: "Refresh the page",
                ngClick: "refresh()",
                ngShow:"socketStatus == 'error'"
            }
            // ,
            // stream: {
            //     ngClick: "showActivity()",
            //     awToolTip: "View Activity Stream",
            //     mode: 'all'
            // }
        };

        html = Button({
            btn: buttons.refresh,
            action: 'refresh',
            toolbar: true
        });

        // html += Button({
        //     btn: buttons.stream,
        //     action: 'stream',
        //     toolbar: true
        // });

        e = angular.element(document.getElementById('portal-list-actions'));
        e.html(html);
        $compile(e)($scope);

        if ($scope.removeLoadPortal) {
            $scope.removeLoadPortal();
        }
        $scope.removeLoadPortal = $scope.$on('LoadPortal', function () {
            // winHeight = $(window).height();
            // available_height = Math.floor(winHeight - $('#main-menu-container .navbar').outerHeight() - $('#refresh-row').outerHeight() - 30);
            // $('.portal-container').height(available_height);

            view.inject( list, {
                id : 'portal-job-template',
                mode: 'edit',
                scope: $scope,
                breadCrumbs: false,
                searchSize: 'col-lg-6 col-md-6'
            });

            $rootScope.flashMessage = null;

            SearchInit({
                scope: $scope,
                set: 'job_templates',
                list: list,
                url: defaultUrl
            });
            PaginateInit({
                scope: $scope,
                list: list,
                url: defaultUrl
            });

            // Called from Inventories tab, host failed events link:
            if ($routeParams.name) {
                $scope[list.iterator + 'SearchField'] = 'name';
                $scope[list.iterator + 'SearchValue'] = $routeParams.name;
                $scope[list.iterator + 'SearchFieldLabel'] = list.fields.name.label;
            }

            $scope.search(list.iterator);

            PortalJobsWidget({
                scope: $scope,
                target: 'portal-jobs',
                // dashboard: data
            });

        });
        $scope.submitJob = function (id) {
            PlaybookRun({ scope: $scope, id: id });
        };

        $scope.refresh = function () {
            $scope.$emit('LoadPortal');
            // Wait('start');
            // loadedCount = 0;
            // Rest.setUrl(GetBasePath('dashboard'));
            // Rest.get()
            //     .success(function (data) {
            //         $scope.$emit('dashboardReady', data);
            //     })
            //     .error(function (data, status) {
            //         ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard: ' + status });
            //     });
        };

        $scope.refresh();

    }

PortalController.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location', '$log','Wait', 'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors',
    'Button', 'PortalJobsWidget', 'GenerateList' , 'PortalJobTemplateList', 'SearchInit', 'PaginateInit', 'PlaybookRun'
];
<commit_msg>removed the resizing and added more styling<commit_after>/************************************
 * Copyright (c) 2014 AnsibleWorks, Inc.
 *
 *
 *  Portal.js
 *
 *  Controller functions for portal mode
 *
 */


/**
 * @ngdoc function
 * @name controllers.function:Portal
 * @description This controller's for portal mode
*/
'use strict';

/**
 * @ngdoc method
 * @name controllers.function:Portal#Portal
 * @methodOf controllers.function:Portal
 * @description portal mode woohoo
 *
 *
*/
function PortalController($scope, $compile, $routeParams, $rootScope, $location, $log, Wait, ClearScope, Stream, Rest, GetBasePath, ProcessErrors,
    Button, PortalJobsWidget, GenerateList, PortalJobTemplateList, SearchInit, PaginateInit, PlaybookRun){

        ClearScope('portal');

        var html,
        e,
        // winHeight,
        // available_height,
        list = PortalJobTemplateList,
        view= GenerateList,
        defaultUrl = GetBasePath('job_templates'),
        buttons = {
            refresh: {
                mode: 'all',
                awToolTip: "Refresh the page",
                ngClick: "refresh()",
                ngShow:"socketStatus == 'error'"
            }
            // ,
            // stream: {
            //     ngClick: "showActivity()",
            //     awToolTip: "View Activity Stream",
            //     mode: 'all'
            // }
        };

        html = Button({
            btn: buttons.refresh,
            action: 'refresh',
            toolbar: true
        });

        // html += Button({
        //     btn: buttons.stream,
        //     action: 'stream',
        //     toolbar: true
        // });

        e = angular.element(document.getElementById('portal-list-actions'));
        e.html(html);
        $compile(e)($scope);

        if ($scope.removeLoadPortal) {
            $scope.removeLoadPortal();
        }
        $scope.removeLoadPortal = $scope.$on('LoadPortal', function () {

            view.inject( list, {
                id : 'portal-job-template',
                mode: 'edit',
                scope: $scope,
                breadCrumbs: false,
                searchSize: 'col-lg-6 col-md-6'
            });

            $rootScope.flashMessage = null;

            SearchInit({
                scope: $scope,
                set: 'job_templates',
                list: list,
                url: defaultUrl
            });
            PaginateInit({
                scope: $scope,
                list: list,
                url: defaultUrl
            });

            // Called from Inventories tab, host failed events link:
            if ($routeParams.name) {
                $scope[list.iterator + 'SearchField'] = 'name';
                $scope[list.iterator + 'SearchValue'] = $routeParams.name;
                $scope[list.iterator + 'SearchFieldLabel'] = list.fields.name.label;
            }

            $scope.search(list.iterator);

            PortalJobsWidget({
                scope: $scope,
                target: 'portal-jobs',
                searchSize: 'col-lg-6 col-md-6'
            });
        });
        if ($scope.removeWidgetLoaded) {
            $scope.removeWidgetLoaded();
        }
        $scope.removeWidgetLoaded = $scope.$on('WidgetLoaded', function () {
            $('.actions-column:eq(0)').text('Launch');
            $('.actions-column:eq(1)').text('Details');
            $('.list-well:eq(1)').css('margin-top' , '0px');
        });

        $scope.submitJob = function (id) {
            PlaybookRun({ scope: $scope, id: id });
        };

        $scope.refresh = function () {
            $scope.$emit('LoadPortal');
            // Wait('start');
            // loadedCount = 0;
            // Rest.setUrl(GetBasePath('dashboard'));
            // Rest.get()
            //     .success(function (data) {
            //         $scope.$emit('dashboardReady', data);
            //     })
            //     .error(function (data, status) {
            //         ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to get dashboard: ' + status });
            //     });
        };

        $scope.refresh();

    }

PortalController.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location', '$log','Wait', 'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors',
    'Button', 'PortalJobsWidget', 'GenerateList' , 'PortalJobTemplateList', 'SearchInit', 'PaginateInit', 'PlaybookRun'
];

{'fraction_non_alphanumeric': 0.15276038702333522, 'fraction_numerical': 0.002504268639726807, 'mean_word_length': 1.642406015037594, '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': '395680', 'n_tokens_mistral': 2422, 'n_tokens_neox': 2321, 'n_words': 478}