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

function manageGroupsDirectiveController($filter, $location, $log,
    $stateParams, $compile, $state, $scope, Rest, Alert, GroupForm,
    GenerateForm, Prompt, ProcessErrors, GetBasePath, SetNodeName,
    ParseTypeChange, GetSourceTypeOptions, InventoryUpdate, LookUpInit, Empty,
    Wait, GetChoices, UpdateGroup, SourceChange, Find, ParseVariableString,
    ToJSON, GroupsScheduleListInit, SetSchedulesInnerDialogSize,
    CreateSelect2, ToggleNotification, NotificationsListInit,
    RelatedSearchInit, RelatedPaginateInit) {

    var vm = this;

    var group_id = $stateParams.group_id,
        mode = $state.current.data.mode,
        inventory_id = $stateParams.inventory_id,
        generator = GenerateForm,
        group_created = false,
        defaultUrl,
        master = {},
        form = GroupForm(),
        relatedSets = {},
        choicesReady, group;

    if (mode === 'edit') {
        defaultUrl = GetBasePath('groups') + group_id + '/';
    } else {
        defaultUrl = (group_id !== undefined) ? GetBasePath('groups') + group_id + '/children/' :
            GetBasePath('inventory') + inventory_id + '/groups/';
    }

    Rest.setUrl(defaultUrl);
    Rest.get()
        .success(function(data) {
            group = data;
            for (var fld in form.fields) {
                if (data[fld]) {
                    $scope[fld] = data[fld];
                    master[fld] = $scope[fld];
                }
            }
            if(mode === 'edit') {
                // schedules_url = data.related.inventory_source + 'schedules/';
                $scope.variable_url = data.related.variable_data;
                $scope.source_url = data.related.inventory_source;
                $scope.source_id = $scope.source_url.split('/')[4];
                $scope.$emit('LoadSourceData');
            }
        })
        .error(function(data, status) {
            ProcessErrors($scope, data, status, {
                hdr: 'Error!',
                msg: 'Failed to retrieve group: ' + defaultUrl + '. GET status: ' + status
            });
        });


    $scope.parseType = 'yaml';

    generator.inject(form, {
        mode: mode,
        id: 'group-manage-panel',
        tabs: true,
        scope: $scope
    });

    generator.reset();

    GetSourceTypeOptions({
        scope: $scope,
        variable: 'source_type_options'
    });

<commit_msg>Fix for notification lookup on inv_sources<commit_after>/*************************************************
 * Copyright (c) 2016 Ansible, Inc.
 *
 * All Rights Reserved
 *************************************************/

function manageGroupsDirectiveController($filter, $location, $log,
    $stateParams, $compile, $state, $scope, Rest, Alert, GroupForm,
    GenerateForm, Prompt, ProcessErrors, GetBasePath, SetNodeName,
    ParseTypeChange, GetSourceTypeOptions, InventoryUpdate, LookUpInit, Empty,
    Wait, GetChoices, UpdateGroup, SourceChange, Find, ParseVariableString,
    ToJSON, GroupsScheduleListInit, SetSchedulesInnerDialogSize,
    CreateSelect2, ToggleNotification, NotificationsListInit,
    RelatedSearchInit, RelatedPaginateInit) {

    var vm = this;

    var group_id = $stateParams.group_id,
        mode = $state.current.data.mode,
        inventory_id = $stateParams.inventory_id,
        generator = GenerateForm,
        group_created = false,
        defaultUrl,
        master = {},
        form = GroupForm(),
        relatedSets = {},
        choicesReady, group;

    if (mode === 'edit') {
        defaultUrl = GetBasePath('groups') + group_id + '/';
    } else {
        defaultUrl = (group_id !== undefined) ? GetBasePath('groups') + group_id + '/children/' :
            GetBasePath('inventory') + inventory_id + '/groups/';
    }

    Rest.setUrl(defaultUrl);
    Rest.get()
        .success(function(data) {
            group = data;
            $scope.source_id = data.related.inventory_source.split('/')[4];
            for (var fld in form.fields) {
                if (data[fld]) {
                    $scope[fld] = data[fld];
                    master[fld] = $scope[fld];
                }
            }
            if(mode === 'edit') {
                $scope.variable_url = data.related.variable_data;
                $scope.source_url = data.related.inventory_source;
                $scope.$emit('LoadSourceData');
            }
        })
        .error(function(data, status) {
            ProcessErrors($scope, data, status, {
                hdr: 'Error!',
                msg: 'Failed to retrieve group: ' + defaultUrl + '. GET status: ' + status
            });
        });


    $scope.parseType = 'yaml';

    generator.inject(form, {
        mode: mode,
        id: 'group-manage-panel',
        tabs: true,
        scope: $scope
    });

    generator.reset();

    GetSourceTypeOptions({
        scope: $scope,
        variable: 'source_type_options'
    });


{'fraction_non_alphanumeric': 0.15820543093270367, 'fraction_numerical': 0.0023612750885478157, 'mean_word_length': 2.2667095115681235, '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': '4560699', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1385, 'n_words': 286}