<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { ProgressBar } from 'react-mdl';
import StrategiesList from './strategies-list';
import AddStrategy from './strategies-add';
import { HeaderTitle } from '../../common';

class StrategiesSectionComponent extends React.Component {
    static propTypes = {
        strategies: PropTypes.array.isRequired,
        addStrategy: PropTypes.func,
        removeStrategy: PropTypes.func,
        updateStrategy: PropTypes.func,
        fetchStrategies: PropTypes.func.isRequired,
    };

    componentWillMount() {
        this.props.fetchStrategies();
    }

    render() {
        if (!this.props.strategies || this.props.strategies.length === 0) {
            return <ProgressBar indeterminate />;
        }

        return (
            <div>
                <HeaderTitle title="Activation strategies" actions={<AddStrategy {...this.props} />} />
                <StrategiesList {...this.props} />
            </div>
        );
    }
}

export default StrategiesSectionComponent;<commit_msg>fix(archive): do not disaply add strategy in read-only mode<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import { ProgressBar } from 'react-mdl';
import StrategiesList from './strategies-list';
import AddStrategy from './strategies-add';
import { HeaderTitle } from '../../common';

class StrategiesSectionComponent extends React.Component {
    static propTypes = {
        strategies: PropTypes.array.isRequired,
        addStrategy: PropTypes.func,
        removeStrategy: PropTypes.func,
        updateStrategy: PropTypes.func,
        fetchStrategies: PropTypes.func.isRequired,
    };

    componentWillMount() {
        this.props.fetchStrategies();
    }

    render() {
        if (!this.props.strategies || this.props.strategies.length === 0) {
            return <ProgressBar indeterminate />;
        }

        return (
            <div>
                {this.props.addStrategy ? (
                    <HeaderTitle title="Activation strategies" actions={<AddStrategy {...this.props} />} />
                ) : (
                    <span />
                )}
                <StrategiesList {...this.props} />
            </div>
        );
    }
}

export default StrategiesSectionComponent;
{'fraction_non_alphanumeric': 0.12088388214904679, 'fraction_numerical': 0.0008665511265164644, 'mean_word_length': 2.2891737891737893, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '4733557', 'n_tokens_mistral': 619, 'n_tokens_neox': 614, 'n_words': 135}