<commit_before>import {Form} from 'widget/form/form'
import {compose} from 'compose'
import {connect, select} from 'store'
import {getRecipeType} from 'app/home/body/process/recipeTypes'
import {map, switchMap} from 'rxjs'
import {msg} from 'translate'
import {recipeAccess} from 'app/home/body/process/recipeAccess'
import PropTypes from 'prop-types'
import React from 'react'
import api from 'api'

const mapStateToProps = () => {
    return {
        recipes: select('process.recipes')
    }
}

class _RecipeSection extends React.Component {
    render() {
        const {stream, recipes, input} = this.props
        const options = recipes.map(recipe => ({
            value: recipe.id,
            label: recipe.name
        }))
        return (
            <Form.Combo
                label={msg('process.indexChange.panel.inputImage.asset.label')}
                input={input}
                placeholder={msg('process.indexChange.panel.inputImage.asset.placeholder')}
                options={options}
                autoFocus
                onChange={({value}) => this.loadBands(value)}
                errorMessage
                busyMessage={stream('LOAD_RECIPE_BANDS').active}
            />
        )
    }

    loadBands(recipeId) {
        const {stream, onLoading, onLoaded, loadRecipe$} = this.props
        if (recipeId) {
            onLoading(recipeId)
            stream('LOAD_RECIPE_BANDS',
                loadRecipe$(recipeId).pipe(
                    switchMap(recipe =>
                        api.gee.bands$({recipe}).pipe(
                            map(bands => ({
                                bands,
                                visualizations: getRecipeType(recipe.type).getPreSetVisualizations(recipe)<commit_msg>Corrected recipe selection label.<commit_after>import {Form} from 'widget/form/form'
import {compose} from 'compose'
import {connect, select} from 'store'
import {getRecipeType} from 'app/home/body/process/recipeTypes'
import {map, switchMap} from 'rxjs'
import {msg} from 'translate'
import {recipeAccess} from 'app/home/body/process/recipeAccess'
import PropTypes from 'prop-types'
import React from 'react'
import api from 'api'

const mapStateToProps = () => {
    return {
        recipes: select('process.recipes')
    }
}

class _RecipeSection extends React.Component {
    render() {
        const {stream, recipes, input} = this.props
        const options = recipes.map(recipe => ({
            value: recipe.id,
            label: recipe.name
        }))
        return (
            <Form.Combo
                label={msg('process.indexChange.panel.inputImage.recipe.label')}
                input={input}
                placeholder={msg('process.indexChange.panel.inputImage.recipe.placeholder')}
                options={options}
                autoFocus
                onChange={({value}) => this.loadBands(value)}
                errorMessage
                busyMessage={stream('LOAD_RECIPE_BANDS').active}
            />
        )
    }

    loadBands(recipeId) {
        const {stream, onLoading, onLoaded, loadRecipe$} = this.props
        if (recipeId) {
            onLoading(recipeId)
            stream('LOAD_RECIPE_BANDS',
                loadRecipe$(recipeId).pipe(
                    switchMap(recipe =>
                        api.gee.bands$({recipe}).pipe(
                            map(bands => ({
                                bands,
                                visualizations: getRecipeType(recipe.type).getPreSetVisualizations(recipe)
{'fraction_non_alphanumeric': 0.1122737556561086, 'fraction_numerical': 0.0, 'mean_word_length': 1.9647946353730092, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '5533135', 'n_tokens_mistral': 988, 'n_tokens_neox': 961, 'n_words': 188}