<commit_before>import React, {Component} from 'react'
import ApiTabs from '../Components/ApiTabs'
import NavHeader from '../Components/NavHeader'
import {
  SIDE_BAR_WIDTH,
  YAML_CONTENT_TYPE,
  RESPONSE_FORMATS
} from '../Constant'
import {
  postApiRequest,
  getApiRequest,
  objectToYaml,
  saveBlobToFile,
  saveYamlOnServer,
  getEmptyApiDefinition,
  exportFile,
  getDefaultApiDefinition,
  parseObjectAsYamlConfig,
  getEmptyTestData,
  setDataInLocalStorage,
  getDataFromLocalStorage,
  googleChartLoader
} from '../Utils'


//API URL host name. For testing only. later user will define this in setup configuration.
export const apiUriHostName = 'http://localhost:8000'

export class MainContainer extends Component {
  constructor(props) {
    super(props)
    this.state = {
      apiDefinition: [],
      testData: [],
      selectedApiIndex: 0,
      openAPIs: []
    }
  }

  initializeStates = () => {
    if (!this.state.apiDefinition.length) {
      let tempApiDef = [getEmptyApiDefinition()]
      this.setState({apiDefinition: tempApiDef})
    }

    if (!this.state.testData.length) {
      let tempTestData = []
      for(let index in this.state.apiDefinition) {
        tempTestData.push(getEmptyTestData())
      }
      
      this.setState({testData: tempTestData})
    }

    if (!this.state.openAPIs.length) {
      this.setState({openAPIs: [0]})
    }
    this.setState({selectedApiIndex: this.state.selectedApiIndex || 0})
  }

  componentWillMount() {<commit_msg>Fixed apiParams not defined error<commit_after>import React, {Component} from 'react'
import ApiTabs from '../Components/ApiTabs'
import NavHeader from '../Components/NavHeader'
import {
  SIDE_BAR_WIDTH,
  YAML_CONTENT_TYPE,
  RESPONSE_FORMATS
} from '../Constant'
import {
  postApiRequest,
  getApiRequest,
  objectToYaml,
  saveBlobToFile,
  saveYamlOnServer,
  getEmptyApiDefinition,
  exportFile,
  getDefaultApiDefinition,
  parseObjectAsYamlConfig,
  getEmptyTestData,
  setDataInLocalStorage,
  getDataFromLocalStorage,
  googleChartLoader
} from '../Utils'


//API URL host name. For testing only. later user will define this in setup configuration.
export const apiUriHostName = 'http://localhost:8000'

export class MainContainer extends Component {
  constructor(props) {
    super(props)
    this.state = {
      apiDefinition: [],
      testData: [],
      selectedApiIndex: 0,
      openAPIs: []
    }
  }

  initializeStates = () => {
    if (!this.state.apiDefinition.length) {
      let tempApiDef = [getEmptyApiDefinition()]
      let testData = [getEmptyTestData()]
      this.setState({apiDefinition: tempApiDef,testData: testData})
    }

    if (!this.state.testData.length) {

      let tempTestData = []
      this.state.apiDefinition.map(()=>{
        tempTestData.push(getEmptyTestData())
      })
      this.setState({testData: tempTestData})
    }

    if (!this.state.openAPIs.length) {
      this.setState({openAPIs: [0]})
    }
    this.setState({selectedApiIndex: this.state.selectedApiIndex || 0})
  }

  componentWillMount() {
{'fraction_non_alphanumeric': 0.1131458469587966, 'fraction_numerical': 0.004578155657292348, 'mean_word_length': 3.518463810930576, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '3395966', 'n_tokens_mistral': 965, 'n_tokens_neox': 952, 'n_words': 193}