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

/**
 * @ngdoc function
 * @name controllers.function:Access
 * @description
 * Controller for handling permissions adding
 */

export default ['$rootScope', '$scope', 'GetBasePath', 'Rest', '$q', 'Wait', 'ProcessErrors', function (rootScope, scope, GetBasePath, Rest, $q, Wait, ProcessErrors) {
    var manuallyUpdateChecklists = function(list, id, isSelected) {
        var elemScope = angular
            .element("#" +
                list + "s_table #" + id + ".List-tableRow input")
            .scope();
        if (elemScope) {
            elemScope.isSelected = !!isSelected;
        }
    };

    scope.allSelected = [];

    // the object permissions are being added to
    scope.object = scope[scope.$parent.list
        .iterator + "_obj"];

    // array for all possible roles for the object
    scope.roles = Object
        .keys(scope.object.summary_fields.roles)
        .map(function(key) {
            return {
                value: scope.object.summary_fields
                    .roles[key].id,
                label: scope.object.summary_fields
                    .roles[key].name };
        });

    // TODO: get working with api
    // array w roles and descriptions for key
    scope.roleKey = Object
        .keys(scope.object.summary_fields.roles)
        .map(function(key) {
            return {
                name: scope.object.summary_fields
                    .roles[key].name,
                description: scope.object.summary_fields
                    .roles[key].description };
        });

    scope.showKeyPane = false;

    scope.toggleKeyPane = function() {
        scope.showKeyPane = !scope.showKeyPane;
    };

    // handle form tab changes<commit_msg>Updated UI to account for object_roles changes<commit_after>/*************************************************
 * Copyright (c) 2015 Ansible, Inc.
 *
 * All Rights Reserved
 *************************************************/

/**
 * @ngdoc function
 * @name controllers.function:Access
 * @description
 * Controller for handling permissions adding
 */

export default ['$rootScope', '$scope', 'GetBasePath', 'Rest', '$q', 'Wait', 'ProcessErrors', function (rootScope, scope, GetBasePath, Rest, $q, Wait, ProcessErrors) {
    var manuallyUpdateChecklists = function(list, id, isSelected) {
        var elemScope = angular
            .element("#" +
                list + "s_table #" + id + ".List-tableRow input")
            .scope();
        if (elemScope) {
            elemScope.isSelected = !!isSelected;
        }
    };

    scope.allSelected = [];

    // the object permissions are being added to
    scope.object = scope[scope.$parent.list
        .iterator + "_obj"];

    // array for all possible roles for the object
    scope.roles = Object
        .keys(scope.object.summary_fields.object_roles)
        .map(function(key) {
            return {
                value: scope.object.summary_fields
                    .object_roles[key].id,
                label: scope.object.summary_fields
                    .object_roles[key].name };
        });

    // TODO: get working with api
    // array w roles and descriptions for key
    scope.roleKey = Object
        .keys(scope.object.summary_fields.object_roles)
        .map(function(key) {
            return {
                name: scope.object.summary_fields
                    .object_roles[key].name,
                description: scope.object.summary_fields
                    .object_roles[key].description };
        });

    scope.showKeyPane = false;

    scope.toggleKeyPane = function() {
        scope.showKeyPane = !scope.showKeyPane;
    };

    // handle form tab changes
{'fraction_non_alphanumeric': 0.16106333072713058, 'fraction_numerical': 0.0020849622100599426, 'mean_word_length': 2.153656532456861, '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': '6346651', 'n_tokens_mistral': 1034, 'n_tokens_neox': 983, 'n_words': 243}