<commit_before>import React from 'react'
import PropTypes from 'prop-types'
import extensions from 'gen/extensions'
import BaseLayout from '../components/layout/BaseLayout'
import {Typography, ExpansionPanel, Button, SimpleSwitch} from 'ui/admin'
import {withApollo} from 'react-apollo'
import {CACHE_KEY} from 'client/middleware/cache'
import ApolloClient from 'apollo-client'

class SystemContainer extends React.Component {


    render() {
        return <BaseLayout>
            <Typography variant="display2" gutterBottom>System</Typography>
            <Typography variant="display1" component="h2" gutterBottom>Extensions</Typography>
            {
                Object.keys(extensions).map(k => {
                    const extension = extensions[k]
                    console.log(extension)
                    return <ExpansionPanel heading={<Typography variant="title"><SimpleSwitch color="primary"
                                                                                              checked={true}
                                                                                              onChange={()=>{}}
                                                                                              contrast/>{extension.name}</Typography>} key={k}>
                        <div>

                        <Typography variant="body1" gutterBottom>{extension.description}</Typography>
                            { extension.options && extension.options.types &&
                            <ul>
                                {extension.options.types.map(type => {
                                    return <li key={type.name}>{type.name} {type.fields && type.fields.length && <ul>{type.fields.map(field=>{
                                        return <li key={field.name}>{field.name}</li>
                                    })}</ul>}</li><commit_msg>Small improvments<commit_after>import React from 'react'
import PropTypes from 'prop-types'
import extensions from 'gen/extensions'
import BaseLayout from '../components/layout/BaseLayout'
import {Typography, ExpansionPanel, Button, SimpleSwitch} from 'ui/admin'
import {withApollo} from 'react-apollo'
import {CACHE_KEY} from 'client/middleware/cache'
import ApolloClient from 'apollo-client'

class SystemContainer extends React.Component {

    constructor(props) {
        super(props)
        const extensionStates = {}
        Object.keys(extensions).map(k => {
            extensionStates[k] = {enabled: true}
        })
        this.state = {extensionStates}
    }

    setExtensionState(k,e){
        console.log(k,e.target.value)
    }
    render() {
        const {extensionStates} = this.state

        return <BaseLayout>
            <Typography variant="display2" gutterBottom>System</Typography>
            <Typography variant="display1" component="h2" gutterBottom>Extensions</Typography>
            {
                Object.keys(extensions).map(k => {
                    const extension = extensions[k]
                    return <ExpansionPanel heading={<Typography variant="title"><SimpleSwitch color="primary"
                                                                                              checked={extensionStates[k].enabled}
                                                                                              onChange={this.setExtensionState.bind(this,k)}
                                                                                              contrast/>{extension.name}
                    </Typography>} key={k}>
                        <div>

                            <Typography variant="body1" gutterBottom>{extension.description}</Typography>
                            { extension.options && extension.options.types &&
                            <ul>
                                {extension.options.types.map(type => {
                                    return <li key={type.name}>{type.name} {type.fields && type.fields.length &&
                                    <ul>{type.fields.map(field => {
                                        return <li key={field.name}>{field.name}</li>
                                    })}</ul>}</li>
{'fraction_non_alphanumeric': 0.10429594272076373, 'fraction_numerical': 0.0019093078758949881, 'mean_word_length': 1.3975972540045767, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 31, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '653562', 'n_tokens_mistral': 913, 'n_tokens_neox': 882, 'n_words': 177}