<commit_before>"use strict";

const React = require('react');
const { Card, CardActions, CardText } = require('material-ui/Card');
const IconButton = require('material-ui/IconButton').default;
const IconClose = require('material-ui/svg-icons/navigation/close').default;
const IconDelete = require('material-ui/svg-icons/action/delete').default;
const IconMenu = require('material-ui/IconMenu').default;
const IconMore = require('material-ui/svg-icons/navigation/more-vert').default;
const IconSave = require('material-ui/svg-icons/content/save').default;
const MenuItem = require('material-ui/MenuItem').default;
const TextField = require('material-ui/TextField').default;

const ColorPicker = require('../../Common/ColorPicker');


class DatasetInfo extends React.Component {

    shouldComponentUpdate(nextProps) {
        return this.props.dataset !== nextProps.dataset
            || this.props.included !== nextProps.included;
    }

    render() {
        const {
            dataset,
            included,
            single,
            onSaveClick,
            onDeleteClick,
            onCloseClick,
            onDatasetChange,
            onLoadClick,
            onIncludeChange
        } = this.props;

        let extraAction = null;
        if (!single) {
            if (included) {
                extraAction = (
                    <MenuItem
                        primaryText="Exclude"
                        onTouchTap={() => onIncludeChange(false)}/>
                );
            } else {
                extraAction = (
                    <MenuItem
                        primaryText="Include"
                        onTouchTap={() => onIncludeChange(true)}/>
                );
            }
        }

        return (
            <Card>
                <CardActions>
                    <ColorPicker
                        key={`editable-dataset-avatar-${dataset.id}`}
                        value={dataset.color}
                        letter={dataset.name.substr(0, 1)}
                        onChange={(newValue) => {
                            onDatasetChange('color', newValue);
                        }}/>

                    <TextField
                        style={{
                            width: '300px'
                        }}
                        key={`editable-dataset-name-${dataset.id}`}
                        floatingLabelText={"Name"}
                        defaultValue={dataset.name}
                        onChange={(event, newValue) => {
                            onDatasetChange('name', newValue);
                        }}/>
                </CardActions>

                <CardText>
                    <TextField
                        key={`editable-dataset-desc-${dataset.id}`}
                        floatingLabelText={"Description"}
                        defaultValue={dataset.desc}
                        multiLine={true}
                        underlineShow={true}
                        fullWidth={true}
                        onChange={(event, newValue) => {
                            onDatasetChange('desc', newValue);
                        }}/>
                </CardText>

                <CardActions
                    style={{
                        position: 'relative',
                        width: (single) ? '170px' : '230px',
                        right: 0,
                        margin: '0 0 0 auto',
                    }}>

                    <IconButton
                        tooltip="Save"
                        onTouchTap={onSaveClick}>
                        <IconSave/>
                    </IconButton>

                    <IconButton
                        tooltip="Delete"
                        onTouchTap={onDeleteClick}>
                        <IconDelete color={'#ae0000'}/>
                    </IconButton>

                    {
                        !single ? (
                            <IconButton
                                tooltip="Close"
                                onTouchTap={onCloseClick}>
                                <IconClose/><commit_msg>Do not show delete option in dataset detail for Online PCA<commit_after>"use strict";

const React = require('react');
const { Card, CardActions, CardText } = require('material-ui/Card');
const IconButton = require('material-ui/IconButton').default;
const IconClose = require('material-ui/svg-icons/navigation/close').default;
const IconDelete = require('material-ui/svg-icons/action/delete').default;
const IconMenu = require('material-ui/IconMenu').default;
const IconMore = require('material-ui/svg-icons/navigation/more-vert').default;
const IconSave = require('material-ui/svg-icons/content/save').default;
const MenuItem = require('material-ui/MenuItem').default;
const TextField = require('material-ui/TextField').default;

const ColorPicker = require('../../Common/ColorPicker');


class DatasetInfo extends React.Component {

    shouldComponentUpdate(nextProps) {
        return this.props.dataset !== nextProps.dataset
            || this.props.included !== nextProps.included;
    }

    render() {
        const {
            dataset,
            included,
            single,
            onSaveClick,
            onDeleteClick,
            onCloseClick,
            onDatasetChange,
            onLoadClick,
            onIncludeChange
        } = this.props;

        let extraAction = null;
        if (!single) {
            if (included) {
                extraAction = (
                    <MenuItem
                        primaryText="Exclude"
                        onTouchTap={() => onIncludeChange(false)}/>
                );
            } else {
                extraAction = (
                    <MenuItem
                        primaryText="Include"
                        onTouchTap={() => onIncludeChange(true)}/>
                );
            }
        }

        return (
            <Card>
                <CardActions>
                    <ColorPicker
                        key={`editable-dataset-avatar-${dataset.id}`}
                        value={dataset.color}
                        letter={dataset.name.substr(0, 1)}
                        onChange={(newValue) => {
                            onDatasetChange('color', newValue);
                        }}/>

                    <TextField
                        style={{
                            width: '300px'
                        }}
                        key={`editable-dataset-name-${dataset.id}`}
                        floatingLabelText={"Name"}
                        defaultValue={dataset.name}
                        onChange={(event, newValue) => {
                            onDatasetChange('name', newValue);
                        }}/>
                </CardActions>

                <CardText>
                    <TextField
                        key={`editable-dataset-desc-${dataset.id}`}
                        floatingLabelText={"Description"}
                        defaultValue={dataset.desc}
                        multiLine={true}
                        underlineShow={true}
                        fullWidth={true}
                        onChange={(event, newValue) => {
                            onDatasetChange('desc', newValue);
                        }}/>
                </CardText>

                <CardActions
                    style={{
                        position: 'relative',
                        width: (single) ? '120px' : '230px',
                        right: 0,
                        margin: '0 0 0 auto',
                    }}>

                    <IconButton
                        tooltip="Save"
                        onTouchTap={onSaveClick}>
                        <IconSave/>
                    </IconButton>

                    {
                        !single ? (
                            <IconButton
                                tooltip="Delete"
                                onTouchTap={onDeleteClick}>
                                <IconDelete color={'#ae0000'}/>
                            </IconButton>
                        ): null
                    }

                    {
                        !single ? (
                            <IconButton
                                tooltip="Close"
                                onTouchTap={onCloseClick}>
                                <IconClose/>
{'fraction_non_alphanumeric': 0.10465805381059619, 'fraction_numerical': 0.004503970605665521, 'mean_word_length': 1.0440891472868217, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 51, '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': '6886362', 'n_tokens_mistral': 1949, 'n_tokens_neox': 1799, 'n_words': 299}