<commit_before>/*******************************************************************************************************
 * File: conflicts.js
 * Project: hootenanny-ui
 * @author <NAME> - <EMAIL> on 5/8/18
 *******************************************************************************************************/

import API                 from './api';
import ConflictInfo        from './conflicts/conflictInfo';
import ConflictMap         from './conflicts/conflictMap';
import ConflictTraverse    from './conflicts/conflictTraverse';
import ConflictGraphSync   from './conflicts/conflictGraphSync';
import ConflictMerge       from './conflicts/conflictMerge';
import ConflictResolve     from './conflicts/conflictResolve';
import { conflictButtons } from '../config/domElements';
import { d3keybinding }    from '../../lib/d3.keybinding';
import { t }               from '../../util/locale';
import { tooltip }         from '../../util/tooltip';

import {
    getOS,
    tooltipHtml
} from './utilities';

export default class Conflicts {
    constructor( context, contentContainer, layer ) {
        this.context          = context;
        this.contentContainer = contentContainer;

        this.data = {
            layer: layer,
            mapId: layer.id,
            reviewStats: null,
            currentReviewItem: null,
            currentRelation: null,
            mergedItems: []
        };

        this.buttonEnabled = true;
    }

    async init() {
        let modules = await Promise.all( [
            new ConflictInfo( this ),
            new ConflictMap( this ),
            new ConflictTraverse( this ),
            new ConflictGraphSync( this ),
            new ConflictMerge( this ),
            new ConflictResolve( this )
        ] );

        this.info      = modules[ 0 ];
        this.map       = modules[ 1 ];
        this.traverse  = modules[ 2 ];
        this.graphSync = modules[ 3 ];
        this.merge     = modules[ 4 ];
        this.resolve   = modules[ 5 ];

        this.render();

        this.data.reviewStats = await API.getReviewStatistics( this.data.mapId );

        this.traverse.jumpTo( 'forward' );
    }

    render() {
        this.buttons = conflictButtons.call( this );<commit_msg>Deactivate review container if there are no conflicts<commit_after>/*******************************************************************************************************
 * File: conflicts.js
 * Project: hootenanny-ui
 * @author <NAME> - <EMAIL> on 5/8/18
 *******************************************************************************************************/

import API                 from './api';
import ConflictInfo        from './conflicts/conflictInfo';
import ConflictMap         from './conflicts/conflictMap';
import ConflictTraverse    from './conflicts/conflictTraverse';
import ConflictGraphSync   from './conflicts/conflictGraphSync';
import ConflictMerge       from './conflicts/conflictMerge';
import ConflictResolve     from './conflicts/conflictResolve';
import { conflictButtons } from '../config/domElements';
import { d3keybinding }    from '../../lib/d3.keybinding';
import { t }               from '../../util/locale';
import { tooltip }         from '../../util/tooltip';

import {
    getOS,
    tooltipHtml
} from './utilities';

export default class Conflicts {
    constructor( context, contentContainer, layer ) {
        this.context          = context;
        this.contentContainer = contentContainer;

        this.data = {
            layer: layer,
            mapId: layer.id,
            reviewStats: null,
            currentReviewItem: null,
            currentRelation: null,
            mergedItems: []
        };

        this.buttonEnabled = true;
    }

    async init() {
        let modules = await Promise.all( [
            new ConflictInfo( this ),
            new ConflictMap( this ),
            new ConflictTraverse( this ),
            new ConflictGraphSync( this ),
            new ConflictMerge( this ),
            new ConflictResolve( this )
        ] );

        this.info      = modules[ 0 ];
        this.map       = modules[ 1 ];
        this.traverse  = modules[ 2 ];
        this.graphSync = modules[ 3 ];
        this.merge     = modules[ 4 ];
        this.resolve   = modules[ 5 ];

        try {
            this.data.reviewStats = await API.getReviewStatistics( this.data.mapId );

            if ( this.data.reviewStats && this.data.reviewStats.totalCount > 0 ) {
                this.render();
                this.traverse.jumpTo( 'forward' );
            }
        } catch ( e ) {
            console.log( e );
        }
    }

    render() {
        this.buttons = conflictButtons.call( this );
{'fraction_non_alphanumeric': 0.19294517637059075, 'fraction_numerical': 0.0053123671908202295, 'mean_word_length': 2.1442885771543088, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, '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': '7038013', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1142, 'n_words': 292}