<commit_before>﻿import * as React from 'react';
import Input from 'react-toolbox/lib/input';

interface IProjectProps {
    project: string;
    handleChange: Function;
}

export class Project extends React.Component<IProjectProps, any> {
    render() {
        return (
            <Input type='text' required={true} maxLength={256} value={this.props.project} onChange={this.props.handleChange.bind(this, 'project')} label='Project Id' />
    );
}
}<commit_msg>Validation on form for Project Id<commit_after>﻿import * as React from 'react';
import Input from 'react-toolbox/lib/input';

interface IProjectProps {
    project: string;
    handleChange: Function;
}

interface IProjectInputState {
    internalValue: string;
    error: string;
}

export class Project extends React.Component<IProjectProps, IProjectInputState> {

    constructor(props) {
        super(props);

        this.state = {
            internalValue: this.props.project,
            error: null
        };
    }

    onChange = (v: string) => {
        let error = null;
        if (v.trim() === "") {
            error = "The project id is required";
        }
        this.setState({ ...this.state, internalValue: v, error });
        
    }

    onBlur = () => {
        let error = null;
        let internalValue = this.state.internalValue;
        if (internalValue.trim() === "") {
            error = "The project id is required";
        }
        this.setState({ ...this.state, error });
        this.props.handleChange('project', internalValue);
    }
    render() {
        return (
            <Input type='text' onBlur={this.onBlur} error={this.state.error} required={true} maxLength={256} value={this.state.internalValue} onChange={this.onChange} label='Project Id' />
    );
}
}
{'fraction_non_alphanumeric': 0.13559322033898305, 'fraction_numerical': 0.003389830508474576, 'mean_word_length': 2.6440329218106995, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '353211', 'n_tokens_mistral': 510, 'n_tokens_neox': 505, 'n_words': 122}