<commit_before>import React from 'react'
import PropTypes from 'prop-types'
import TickscriptType from 'src/kapacitor/components/TickscriptType'
import MultiSelectDBDropdown from 'shared/components/MultiSelectDBDropdown'
import TickscriptID, {
  TickscriptStaticID,
} from 'src/kapacitor/components/TickscriptID'

const addName = list => list.map(l => ({...l, name: `${l.db}.${l.rp}`}))

const TickscriptEditorControls = ({
  isNewTickscript,
  onSelectDbrps,
  onChangeType,
  onChangeID,
  task,
}) => (
  <div className="tickscript-controls">
    {isNewTickscript ? (
      <TickscriptID onChangeID={onChangeID} id={task.id} />
    ) : (
      <TickscriptStaticID id={task.id} />
    )}
    <div className="tickscript-controls--right">
      <TickscriptType type={task.type} onChangeType={onChangeType} />
      <MultiSelectDBDropdown
        selectedItems={addName(task.dbrps)}
        onApply={onSelectDbrps}
      />
    </div>
  </div>
)

const {arrayOf, bool, func, shape, string} = PropTypes

TickscriptEditorControls.propTypes = {
  isNewTickscript: bool.isRequired,
  onSelectDbrps: func.isRequired,
  onChangeType: func.isRequired,<commit_msg>Render TICKscript name instead of ID<commit_after>import React from 'react'
import PropTypes from 'prop-types'
import TickscriptType from 'src/kapacitor/components/TickscriptType'
import MultiSelectDBDropdown from 'shared/components/MultiSelectDBDropdown'
import TickscriptID, {
  TickscriptStaticID,
} from 'src/kapacitor/components/TickscriptID'

const addName = list => list.map(l => ({...l, name: `${l.db}.${l.rp}`}))

const TickscriptEditorControls = ({
  isNewTickscript,
  onSelectDbrps,
  onChangeType,
  onChangeID,
  task,
}) => (
  <div className="tickscript-controls">
    {isNewTickscript ? (
      <TickscriptID onChangeID={onChangeID} id={task.id} />
    ) : (
      <TickscriptStaticID id={task.name ? task.name : task.id} />
    )}
    <div className="tickscript-controls--right">
      <TickscriptType type={task.type} onChangeType={onChangeType} />
      <MultiSelectDBDropdown
        selectedItems={addName(task.dbrps)}
        onApply={onSelectDbrps}
      />
    </div>
  </div>
)

const {arrayOf, bool, func, shape, string} = PropTypes

TickscriptEditorControls.propTypes = {
  isNewTickscript: bool.isRequired,
  onSelectDbrps: func.isRequired,
  onChangeType: func.isRequired,
{'fraction_non_alphanumeric': 0.13237165888841748, 'fraction_numerical': 0.0, 'mean_word_length': 4.3108108108108105, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, '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': '3311409', 'n_tokens_mistral': 766, 'n_tokens_neox': 809, 'n_words': 140}