-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
92 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, { Component } from "react"; | ||
import { fetchTableById } from "../../services/normalization"; | ||
import Form from "./Form"; | ||
import Navbar from "../Navbar"; | ||
import LoadingScreen from "../LoadingScreen"; | ||
|
||
class FormLoad extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
table: null, | ||
dependenciesFrom: null, | ||
dependenciesTo: null | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
const id = this.props.match.params.id; | ||
fetchTableById(id).then(response => { | ||
this.setState(() => { | ||
console.log(response.dependencies.map(element => element.to)) | ||
return { | ||
table: response, | ||
dependenciesFrom: response.dependencies.map(element => element.from), | ||
dependenciesTo: response.dependencies.map(element => [element.to]) | ||
}; | ||
}); | ||
}); | ||
} | ||
|
||
render() { | ||
if (!this.state.table) | ||
return ( | ||
<> | ||
<Navbar /> | ||
<LoadingScreen /> | ||
</> | ||
); | ||
return ( | ||
<Form | ||
tableName={this.state.table.name} | ||
attributes={this.state.table.attributes.join(", ")} | ||
keys={this.state.table.keys} | ||
dependenciesFrom={this.state.dependenciesFrom} | ||
dependenciesTo={this.state.dependenciesTo} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default FormLoad; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters