<commit_before>USERS = new Lanes.Models.User.Collection
USERS.ensureLoaded()
IGNORED_PROPS = ['selected', 'mapped_user_id', 'customer_code']

class TextInput extends Lanes.React.Component
    setCode: (ev) -> @props.row.customer_code = ev.target.value
    render: ->
        <input value={@props.row.customer_code} onChange={@setCode} />

class UserSelect extends Lanes.React.Component
    dataObjects:
        user: -> new Lanes.Models.User

    getUser: ->
        if @props.row.mapped_user_id
            user = USERS.get(@props.row.mapped_user_id)
            label: user.login, id: user.id
        else null

    setUser: (val, user) ->
        @props.row.mapped_user_id = user.id

    render: ->
        <LC.SelectField
            editOnly unstyled
            model={this.user}
            name="user"
            labelField='login'
            getSelection={@getUser}
            setSelection={@setUser}
            collection={USERS}
            fetchWhenOpen={false}
        />

<commit_msg>Use new selectfield chooser<commit_after>USERS = new Lanes.Models.User.Collection
USERS.ensureLoaded()
IGNORED_PROPS = ['selected', 'mapped_user_id', 'customer_code']

class TextInput extends Lanes.React.Component
    setCode: (ev) -> @props.row.customer_code = ev.target.value
    render: ->
        <input value={@props.row.customer_code} onChange={@setCode} />

class UserSelect extends Lanes.React.Component
    dataObjects:
        user: -> new Lanes.Models.User

    getUser: ->
        if @props.row.mapped_user_id
            USERS.get(@props.row.mapped_user_id)
        else null

    setUser: (user) ->
        @props.row.mapped_user_id = user.id
        @forceUpdate()

    render: ->
        <LC.SelectField
            editOnly unstyled
            model={this.user}
            name="user"
            labelField='login'
            queryModel={Lanes.Models.User}
            getSelection={@getUser}
            setSelection={@setUser}
            choices={USERS.models}
        />


{'fraction_non_alphanumeric': 0.11755877938969485, 'fraction_numerical': 0.0, 'mean_word_length': 2.252032520325203, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '1788024', 'n_tokens_mistral': 617, 'n_tokens_neox': 616, 'n_words': 108}