<commit_before>import React from 'react';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {addBreadcrumb} from './actions/actions.js';
import {removeBreadcrumb} from './actions/actions.js';
import {updateUserGroups} from './actions/actions.js';
import {updateTargetGroup} from './actions/actions.js';
import {updateTargetGroupMembers} from './actions/actions.js';
import {updateTargetGroupPendingMembers} from './actions/actions.js';

class GroupPane extends React.Component
{
        constructor(props)
        {
                super(props);
                this.state = { active:1 };
                this.showCreateGroupPane = this.showCreateGroupPane.bind(this);
                this.showViewGroupPane = this.showViewGroupPane.bind(this);
                this.activateCreateGroupForm = this.activateCreateGroupForm.bind(this);
                this.showGroupIDPane = this.showGroupIDPane.bind(this);
                this.showAddMemberForm = this.showAddMemberForm.bind(this);
                this.activateDeleteGroupButton = this.activateDeleteGroupButton.bind(this);
                this.activateViewMemberButtons = this.activateViewMemberButtons.bind(this);
                this.showViewMemberPane = this.showViewMemberPane.bind(this);
                this.showDeleteConfirmationModal = this.showDeleteConfirmationModal.bind(this);
                this.hideDeleteConfirmationModal = this.hideDeleteConfirmationModal.bind(this);
        }

        componentDidMount()
        {
                /*this.props.updateUserGroups(["group1","group2","group3"]);*/
                /*$('.viewgrouppane').transition('hide');*/
                $('.creategrouppane').transition('hide');
                $('.groupidpane').each(function() { $(this).transition('hide'); })
                $('.inviteusers').dropdown({
                        allowAdditions: true
                });
                $('addmemberform input').on('keypress', function(e) {
                    return e.which !== 13;
                });
                $('.inviteusers').dropdown('refresh');
                this.activateAddMemberForm();
                $('#dcmodal').modal();
                this.activateDeleteGroupButton();
        }

        showCreateGroupPane()
        {
                //hide all other panes, at least under the group menu
                //$('.pane').each(() => { if($(this).transition('is visible')) { $(this).transition('hide'); console.log($this);} })
                if($('.viewgrouppane').transition('is visible'))
                {
                        $('.viewgrouppane').transition('hide');
                }
                //show create group pane
                if($('.creategrouppane').transition('is visible')==false)
                {
                        $('.creategrouppane').transition('show');
                }
                this.props.addBreadcrumb("Create Group");
        }

        showViewGroupPane()
        {
                //retrieve latest usergroups by simulating a click on group button
                $('#groupbutton').trigger('click');
                //hide all other panes, at least under the group menu
                //$('.pane').each(() => { if($(this).transition('is visible')) { $(this).transition('hide'); console.log($this);} })
                //show view group pane
                $('.viewgrouppane').transition('show');
                this.props.removeBreadcrumb(2);
        }

        showDeleteConfirmationModal(groupname)
        {
                console.log("dctrigger "+groupname);
                this.props.updateTargetGroup(groupname);
                $('#dcmodal').modal('show');
        }

        hideDeleteConfirmationModal()
        {
                this.props.updateTargetGroup(null);
                $('#dcmodal').modal('hide');
        }

        activateCreateGroupForm()
        {
                $('.creategroupform')
                .api({
                    url: window.location.origin+"/groupcreate",
                    method: 'POST',
                    serializeForm: true,
                    beforeSend: function(settings)
                    {
                      console.log(settings.data);
                      return settings;<commit_msg>Potential fix for groups sometimes not showing up immediately when created.<commit_after>import React from 'react';
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {addBreadcrumb} from './actions/actions.js';
import {removeBreadcrumb} from './actions/actions.js';
import {updateUserGroups} from './actions/actions.js';
import {updateTargetGroup} from './actions/actions.js';
import {updateTargetGroupMembers} from './actions/actions.js';
import {updateTargetGroupPendingMembers} from './actions/actions.js';

class GroupPane extends React.Component
{
        constructor(props)
        {
                super(props);
                this.state = { active:1 };
                this.showCreateGroupPane = this.showCreateGroupPane.bind(this);
                this.showViewGroupPane = this.showViewGroupPane.bind(this);
                this.activateCreateGroupForm = this.activateCreateGroupForm.bind(this);
                this.showGroupIDPane = this.showGroupIDPane.bind(this);
                this.showAddMemberForm = this.showAddMemberForm.bind(this);
                this.activateDeleteGroupButton = this.activateDeleteGroupButton.bind(this);
                this.activateViewMemberButtons = this.activateViewMemberButtons.bind(this);
                this.showViewMemberPane = this.showViewMemberPane.bind(this);
                this.showDeleteConfirmationModal = this.showDeleteConfirmationModal.bind(this);
                this.hideDeleteConfirmationModal = this.hideDeleteConfirmationModal.bind(this);
        }

        componentDidMount()
        {
                /*this.props.updateUserGroups(["group1","group2","group3"]);*/
                /*$('.viewgrouppane').transition('hide');*/
                $('.creategrouppane').transition('hide');
                $('.groupidpane').each(function() { $(this).transition('hide'); })
                $('.inviteusers').dropdown({
                        allowAdditions: true
                });
                $('addmemberform input').on('keypress', function(e) {
                    return e.which !== 13;
                });
                $('.inviteusers').dropdown('refresh');
                this.activateAddMemberForm();
                $('#dcmodal').modal();
                this.activateDeleteGroupButton();
        }

        showCreateGroupPane()
        {
                //hide all other panes, at least under the group menu
                //$('.pane').each(() => { if($(this).transition('is visible')) { $(this).transition('hide'); console.log($this);} })
                if($('.viewgrouppane').transition('is visible'))
                {
                        $('.viewgrouppane').transition('hide');
                }
                //show create group pane
                if($('.creategrouppane').transition('is visible')==false)
                {
                        $('.creategrouppane').transition('show');
                }
                this.props.addBreadcrumb("Create Group");
        }

        showViewGroupPane()
        {
                //retrieve latest usergroups by simulating a click on group button
                $('#groupbutton').api('query');
                //hide all other panes, at least under the group menu
                //$('.pane').each(() => { if($(this).transition('is visible')) { $(this).transition('hide'); console.log($this);} })
                //show view group pane
                $('.viewgrouppane').transition('show');
                this.props.removeBreadcrumb(2);
        }

        showDeleteConfirmationModal(groupname)
        {
                console.log("dctrigger "+groupname);
                this.props.updateTargetGroup(groupname);
                $('#dcmodal').modal('show');
        }

        hideDeleteConfirmationModal()
        {
                this.props.updateTargetGroup(null);
                $('#dcmodal').modal('hide');
        }

        activateCreateGroupForm()
        {
                $('.creategroupform')
                .api({
                    url: window.location.origin+"/groupcreate",
                    method: 'POST',
                    serializeForm: true,
                    beforeSend: function(settings)
                    {
                      console.log(settings.data);
                      return settings;
{'fraction_non_alphanumeric': 0.13422584400465656, 'fraction_numerical': 0.001629802095459837, 'mean_word_length': 1.8259868421052632, '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': '3575098', 'n_tokens_mistral': 2181, 'n_tokens_neox': 2052, 'n_words': 341}