<commit_before>React = require 'react'
createReactClass = require 'create-react-class'
counterpart = require 'counterpart'

WorkflowCreateForm = createReactClass
  getDefaultProps: ->
    onCancel: ->
    onSubmit: ->
    onSuccess: ->
    project: null
    workflowToClone: null
    workflowActiveStatus: false

  getInitialState: ->
    busy: false
    error: null

  handleSubmit: (e) ->
    e.preventDefault()

    @setState
      busy: true
      error: null

    workflowToClone = @props.workflowToClone

    newWorkflow =
      id: workflowToClone?.id
      display_name: @refs.newDisplayName.value

    awaitSubmission = @props.onSubmit(@props.project, newWorkflow)

    Promise.resolve(awaitSubmission)
      .then (result) =>
        @setState busy: false
        @props.onSuccess result<commit_msg>Add required or not null properties for new workflow creation (#6217)<commit_after>React = require 'react'
createReactClass = require 'create-react-class'
counterpart = require 'counterpart'

WorkflowCreateForm = createReactClass
  getDefaultProps: ->
    onCancel: ->
    onSubmit: ->
    onSuccess: ->
    project: null
    workflowToClone: null
    workflowActiveStatus: false

  getInitialState: ->
    busy: false
    error: null

  handleSubmit: (e) ->
    e.preventDefault()

    @setState
      busy: true
      error: null

    workflowToClone = @props.workflowToClone

    newWorkflow =
      id: workflowToClone?.id
      display_name: @refs.newDisplayName.value
      first_task: ''
      primary_language: @props.project.primary_language
      tasks: {}

    awaitSubmission = @props.onSubmit(@props.project, newWorkflow)

    Promise.resolve(awaitSubmission)
      .then (result) =>
        @setState busy: false
        @props.onSuccess result
{'fraction_non_alphanumeric': 0.09451046972269384, 'fraction_numerical': 0.0022637238256932655, 'mean_word_length': 3.064367816091954, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '4611956', 'n_tokens_mistral': 530, 'n_tokens_neox': 534, 'n_words': 117}