diff --git a/src/Collections/Nodules.js b/src/Collections/Nodules.js
index 534f7b0..84d5c80 100644
--- a/src/Collections/Nodules.js
+++ b/src/Collections/Nodules.js
@@ -39,6 +39,20 @@ class Nodules {
}
}
+ addNewTransformNodule = props => {
+ try {
+ const newJoinNodule = new TransformNodule({
+ id: props.id || uuid(),
+ label: props.label,
+ tables: props.tables,
+ structure: props.structure
+ })
+ this.collection.push(newJoinNodule)
+ } catch (err) {
+ console.error(err)
+ }
+ }
+
removeById = id => {
const indexToRemove = this.collection.findIndex(n => n.id === id)
if (indexToRemove > -1) this.collection.splice(indexToRemove, 1)
diff --git a/src/Controllers/CreateNoduleController.js b/src/Controllers/CreateNoduleController.js
index 968cc75..97da646 100644
--- a/src/Controllers/CreateNoduleController.js
+++ b/src/Controllers/CreateNoduleController.js
@@ -35,6 +35,20 @@ class CreateNoduleController {
joinBy
})
+ document.dispatchEvent(this.updatedNodulesEvent)
+ }
+
+ addNewTransformNodule = props => {
+ const { label, tablesToImportByLabel, structure} = props
+ const tables = tablesToImportByLabel.map(label => {
+ return this.tables.getTableByLabel(label)
+ })
+
+ this.nodules.addNewTransformNodule({
+ label,
+ tables,
+ structure
+ })
console.log(this.nodules)
document.dispatchEvent(this.updatedNodulesEvent)
}
diff --git a/src/Controllers/NoduleListController.js b/src/Controllers/NoduleListController.js
index f0c5cca..322de51 100644
--- a/src/Controllers/NoduleListController.js
+++ b/src/Controllers/NoduleListController.js
@@ -6,7 +6,7 @@ class NoduleistController {
this.updatedNodulesEvent = new Event('updateNodules')
}
- deleteTable = id => {
+ deleteNodule = id => {
this.nodules.removeById(id)
document.dispatchEvent(this.updatedNodulesEvent)
}
diff --git a/src/views/CreateNodule/CreateFilterNoduleForm.js b/src/views/CreateNodule/CreateFilterNoduleForm.js
index b0e5cea..1e7d6d2 100644
--- a/src/views/CreateNodule/CreateFilterNoduleForm.js
+++ b/src/views/CreateNodule/CreateFilterNoduleForm.js
@@ -28,6 +28,11 @@ class CreateFilterNoduleForm extends Component {
this.setState({ filterType: value.value })
}
+ getFilterProperties = () => {
+ const { filterType, filterParams } = this.state
+ return { filterType, filterParams }
+ }
+
renderFilterParams = () => {
const { filterParams } = this.state
diff --git a/src/views/CreateNodule/CreateNodule.js b/src/views/CreateNodule/CreateNodule.js
index 19ddbe5..b9ab26c 100644
--- a/src/views/CreateNodule/CreateNodule.js
+++ b/src/views/CreateNodule/CreateNodule.js
@@ -23,6 +23,7 @@ class CreateNodule extends Component {
this.filterNoduleForm = React.createRef()
this.joinNoduleForm = React.createRef()
+ this.transformNoduleForm = React.createRef()
this.tableSelect = React.createRef()
this.noduleLabelInput = React.createRef()
@@ -56,6 +57,14 @@ class CreateNodule extends Component {
joinBy: joinProperties
})
}
+ else if (noduleType === 'transform') {
+ const structureProperties = this.transformNoduleForm.current.getStructureProperties()
+ this.controller.addNewJoinNodule({
+ label: noduleLabel,
+ tablesToImportByLabel: selectedTableLabels,
+ structure: structureProperties
+ })
+ }
}
updateTableList = () => {
@@ -67,7 +76,7 @@ class CreateNodule extends Component {
if (noduleType === 'filter') return