<commit_before>import {map} from "ramda";
import React, {Component, PropTypes} from "react";
import {Button, Input} from "react-bootstrap";
import {reduxForm} from "redux-form";

import AWSRegionSelect from "components/aws-region-select";
import CollapsibleParagraph from "components/collapsible-paragraph";

function validate (values) {
    return map(value => (
        typeof value === "string" && value.length > 0 ? null : "Required"
    ), values);
}

class SettingsForm extends Component {

    static propTypes = {
        fields: PropTypes.object.isRequired,
        handleSubmit: PropTypes.func.isRequired
    }

    getFieldBsStyle (field) {
        return (field.touched && field.error ? "error" : null);
    }

    render () {
        const {fields, handleSubmit} = this.props;
        return (
            <form onSubmit={handleSubmit}>
                <Input
                    bsStyle={this.getFieldBsStyle(fields.awsAccessKeyId)}
                    help={fields.awsAccessKeyId.error}
                    label="AWS Access Key Id"
                    placeholder="AWS_ACCESS_KEY_ID"
                    type="text"
                    {...fields.awsAccessKeyId}
                />
                <Input
                    bsStyle={this.getFieldBsStyle(fields.awsSecretAccessKey)}
                    help={fields.awsSecretAccessKey.error}
                    label="AWS Secret Access Key"
                    placeholder="AWS_SECRET_ACCESS_KEY"
                    type="text"
                    {...fields.awsSecretAccessKey}
                />
                <AWSRegionSelect
                    bsStyle={this.getFieldBsStyle(fields.awsRegion)}
                    help={fields.awsRegion.error}
                    {...fields.awsRegion}
                />
                <Input
                    bsStyle={this.getFieldBsStyle(fields.backendEndpoint)}
                    help={fields.backendEndpoint.error}
                    label="Backend endpoint"
                    placeholder="https://api.lk-architecture.org"
                    type="text"
                    {...fields.backendEndpoint}
                />
                <CollapsibleParagraph title="Advanced">
                    <Input
                        bsStyle={this.getFieldBsStyle(fields.dynamodbEndpoint)}
                        help={fields.dynamodbEndpoint.error}
                        label="DynamoDB Endpoint"
                        placeholder="localhost:8000"
                        type="text"
                        {...fields.dynamodbEndpoint}
                    />
                    <Input
                        bsStyle={this.getFieldBsStyle(fields.kinesisEndpoint)}
                        help={fields.kinesisEndpoint.error}
                        label="Kinesis Endpoint"
                        placeholder="localhost:4567"
                        type="text"
                        {...fields.kinesisEndpoint}
                    />
                    <Input
                        bsStyle={this.getFieldBsStyle(fields.s3Endpoint)}
                        help={fields.s3Endpoint.error}
                        label="S3 Endpoint"
                        placeholder="AWS S3 Endpoint"
                        type="text"
                        {...fields.s3Endpoint}
                    />
                </CollapsibleParagraph>
                <Button type="submit">
                    {"Save"}
                </Button>
            </form>
        );
    }

}

export default reduxForm({
    form: "settings",
    fields: [
        "awsAccessKeyId",
        "awsSecretAccessKey",
        "awsRegion",
        "useLocalServices",
        "backendEndpoint",<commit_msg>Removed unused field in settings form component<commit_after>import {map} from "ramda";
import React, {Component, PropTypes} from "react";
import {Button, Input} from "react-bootstrap";
import {reduxForm} from "redux-form";

import AWSRegionSelect from "components/aws-region-select";
import CollapsibleParagraph from "components/collapsible-paragraph";

function validate (values) {
    return map(value => (
        typeof value === "string" && value.length > 0 ? null : "Required"
    ), values);
}

class SettingsForm extends Component {

    static propTypes = {
        fields: PropTypes.object.isRequired,
        handleSubmit: PropTypes.func.isRequired
    }

    getFieldBsStyle (field) {
        return (field.touched && field.error ? "error" : null);
    }

    render () {
        const {fields, handleSubmit} = this.props;
        return (
            <form onSubmit={handleSubmit}>
                <Input
                    bsStyle={this.getFieldBsStyle(fields.awsAccessKeyId)}
                    help={fields.awsAccessKeyId.error}
                    label="AWS Access Key Id"
                    placeholder="AWS_ACCESS_KEY_ID"
                    type="text"
                    {...fields.awsAccessKeyId}
                />
                <Input
                    bsStyle={this.getFieldBsStyle(fields.awsSecretAccessKey)}
                    help={fields.awsSecretAccessKey.error}
                    label="AWS Secret Access Key"
                    placeholder="AWS_SECRET_ACCESS_KEY"
                    type="text"
                    {...fields.awsSecretAccessKey}
                />
                <AWSRegionSelect
                    bsStyle={this.getFieldBsStyle(fields.awsRegion)}
                    help={fields.awsRegion.error}
                    {...fields.awsRegion}
                />
                <Input
                    bsStyle={this.getFieldBsStyle(fields.backendEndpoint)}
                    help={fields.backendEndpoint.error}
                    label="Backend endpoint"
                    placeholder="https://api.lk-architecture.org"
                    type="text"
                    {...fields.backendEndpoint}
                />
                <CollapsibleParagraph title="Advanced">
                    <Input
                        bsStyle={this.getFieldBsStyle(fields.dynamodbEndpoint)}
                        help={fields.dynamodbEndpoint.error}
                        label="DynamoDB Endpoint"
                        placeholder="localhost:8000"
                        type="text"
                        {...fields.dynamodbEndpoint}
                    />
                    <Input
                        bsStyle={this.getFieldBsStyle(fields.kinesisEndpoint)}
                        help={fields.kinesisEndpoint.error}
                        label="Kinesis Endpoint"
                        placeholder="localhost:4567"
                        type="text"
                        {...fields.kinesisEndpoint}
                    />
                    <Input
                        bsStyle={this.getFieldBsStyle(fields.s3Endpoint)}
                        help={fields.s3Endpoint.error}
                        label="S3 Endpoint"
                        placeholder="AWS S3 Endpoint"
                        type="text"
                        {...fields.s3Endpoint}
                    />
                </CollapsibleParagraph>
                <Button type="submit">
                    {"Save"}
                </Button>
            </form>
        );
    }

}

export default reduxForm({
    form: "settings",
    fields: [
        "awsAccessKeyId",
        "awsSecretAccessKey",
        "awsRegion",
        "backendEndpoint",
{'fraction_non_alphanumeric': 0.09784075573549257, 'fraction_numerical': 0.003778677462887989, 'mean_word_length': 1.298697270471464, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 33, 'https://': 2, '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': '7566501', 'n_tokens_mistral': 1875, 'n_tokens_neox': 1704, 'n_words': 288}