<commit_before>
import React from "react";
import api from "api.io/api.io-client";
import Component from "ui-lib/component";

class Remove extends Component {
    constructor(props) {
        super(props);
    }

    async onRemove(type, id, options = {}) {
        this.log("remove", type, id);

        const result = await api.rest.remove(type, id);

        if (!options.noRedirect) {
            this.context.router.push({
                pathname: this.props.pathname.split("/").slice(0, -1).join("/")
            });
        }

        return result;
    }

    render() {
        this.log("render", this.props);

        const breadcrumbs = this.props.breadcrumbs.concat({
            label: "Remove",
            pathname: ""
        });

        const props = {
            theme: this.props.theme,
            parentItems: this.props.parentItems,
            item: this.props.item,
            breadcrumbs: breadcrumbs,
            controls: [],
            pathname: this.props.pathname,
            context: this.props.context,
            onRemove: (...args) => this.onRemove(...args),
            onCancel: () => this.context.router.goBack()
        };

        return (
            <this.props.route.Remove {...props} />
        );
    }
}

Remove.propTypes = {
    theme: React.PropTypes.object,
    pathname: React.PropTypes.string /* .isRequired */,
    breadcrumbs: React.PropTypes.array /* .isRequired */,
    item: React.PropTypes.object /* .isRequired */,
    parentItems: React.PropTypes.array /* .isRequired */,
    context: React.PropTypes.object
};

Remove.contextTypes = {<commit_msg>UI: Fix for Remove in TA_admin<commit_after>
import React from "react";
import api from "api.io/api.io-client";
import Component from "ui-lib/component";

class Remove extends Component {
    constructor(props) {
        super(props);
    }

    async onRemove(type, id, options = {}) {
        this.log("remove", type, id);

        const result = await api.rest.remove(type, id);

        if (!options.noRedirect) {
            this.context.router.push({
                pathname: this.props.pathname.split("/").slice(0, -1).join("/")
            });
        }

        return result;
    }

    render() {
        this.log("render", this.props);

        const breadcrumbs = this.props.breadcrumbs.concat({
            label: "Remove",
            pathname: ""
        });

        const props = {
            theme: this.props.theme,
            parentItems: this.props.parentItems,
            item: this.props.item,
            breadcrumbs: breadcrumbs,
            controls: [],
            pathname: this.props.pathname,
            context: this.props.context,
            onRemove: (...args) => this.onRemove(...args),
            onCancel: () => this.context.router.goBack()
        };

        if (this.props.item) {
            return (
                <this.props.route.Remove {...props} />
            );
        }

        return null;
    }
}

Remove.propTypes = {
    theme: React.PropTypes.object,
    pathname: React.PropTypes.string /* .isRequired */,
    breadcrumbs: React.PropTypes.array /* .isRequired */,
    item: React.PropTypes.object /* .isRequired */,
    parentItems: React.PropTypes.array /* .isRequired */,
    context: React.PropTypes.object
};

Remove.contextTypes = {
{'fraction_non_alphanumeric': 0.14354644149577805, 'fraction_numerical': 0.0012062726176115801, 'mean_word_length': 1.8619499568593616, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2645059', 'n_tokens_mistral': 963, 'n_tokens_neox': 953, 'n_words': 187}