fix: actually adding join nodule
This commit is contained in:
		
							parent
							
								
									e1e4e7f011
								
							
						
					
					
						commit
						de587febdd
					
				@ -24,7 +24,7 @@ class CreateNoduleController {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  addNewJoinNodule = props => {
 | 
			
		||||
    const { label, tablesToImportByLabel, baseTableLabel, joinParams } = props
 | 
			
		||||
    const { label, tablesToImportByLabel, joinBy} = props
 | 
			
		||||
    const tables = tablesToImportByLabel.map(label => {
 | 
			
		||||
      return this.tables.getTableByLabel(label)
 | 
			
		||||
    })
 | 
			
		||||
@ -32,11 +32,10 @@ class CreateNoduleController {
 | 
			
		||||
    this.nodules.addNewJoinNodule({
 | 
			
		||||
      label,
 | 
			
		||||
      tables,
 | 
			
		||||
      joinBy: {
 | 
			
		||||
        baseTableLabel,
 | 
			
		||||
        joinParams
 | 
			
		||||
      }
 | 
			
		||||
      joinBy
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    console.log(this.nodules)
 | 
			
		||||
    document.dispatchEvent(this.updatedNodulesEvent)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -10,7 +10,7 @@ class CreateJoinNoduleForm extends Component {
 | 
			
		||||
    this.tables = new Tables()
 | 
			
		||||
 | 
			
		||||
    this.state = {
 | 
			
		||||
      bastTableLabel: '',
 | 
			
		||||
      baseTableLabel: '',
 | 
			
		||||
      joinParams: [],
 | 
			
		||||
      tables: this.tables.getCollectionProps()
 | 
			
		||||
    }
 | 
			
		||||
@ -35,7 +35,7 @@ class CreateJoinNoduleForm extends Component {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleChange = (e, value) => {
 | 
			
		||||
    this.setState({ bastTableLabel: value.value })
 | 
			
		||||
    this.setState({ baseTableLabel: value.value })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getBaseTableDropDownOptions = () => {
 | 
			
		||||
@ -48,6 +48,11 @@ class CreateJoinNoduleForm extends Component {
 | 
			
		||||
    return options
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getJoinProperties = () => {
 | 
			
		||||
    const { baseTableLabel, joinParams } = this.state
 | 
			
		||||
    return { baseTableLabel, joinParams }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateTableList = () => {
 | 
			
		||||
    this.setState({tables: this.tables.getCollectionProps()})
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -5,8 +5,9 @@ import './CreateNodule.css'
 | 
			
		||||
 | 
			
		||||
import Tables from '../../Collections/Tables'
 | 
			
		||||
import CreateNoduleController from '../../Controllers/CreateNoduleController'
 | 
			
		||||
import TableSelect from './TableSelect'
 | 
			
		||||
import CreateJoinNoduleForm from './CreateJoinNoduleForm'
 | 
			
		||||
import CreateTransformNoduleForm from './CreateTransformNoduleForm'
 | 
			
		||||
import TableSelect from './TableSelect'
 | 
			
		||||
 | 
			
		||||
class CreateNodule extends Component {
 | 
			
		||||
  constructor () {
 | 
			
		||||
@ -47,6 +48,14 @@ class CreateNodule extends Component {
 | 
			
		||||
        filterParams: filterProperties.filterParams
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
    else if (noduleType === 'join') {
 | 
			
		||||
      const joinProperties = this.joinNoduleForm.current.getJoinProperties()
 | 
			
		||||
      this.controller.addNewJoinNodule({
 | 
			
		||||
        label: noduleLabel,
 | 
			
		||||
        tablesToImportByLabel: selectedTableLabels,
 | 
			
		||||
        joinBy: joinProperties
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateTableList = () => {
 | 
			
		||||
@ -58,6 +67,7 @@ class CreateNodule extends Component {
 | 
			
		||||
 | 
			
		||||
    if (noduleType === 'filter') return <CreateFilterNoduleForm ref={this.filterNoduleForm} />
 | 
			
		||||
    else if (noduleType === 'join') return <CreateJoinNoduleForm ref={this.joinNoduleForm} tables={tablesToImportByLabel || []}/>
 | 
			
		||||
    else if (noduleType === 'transform') return <CreateTransformNoduleForm ref={this.joinNoduleForm} tables={tablesToImportByLabel || []}/>
 | 
			
		||||
    else return ''
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user