|
|
@@ -12,10 +12,10 @@ class Schema extends Component {
|
|
|
super(props);
|
|
|
console.log('Schema props',props);
|
|
|
this.state = {
|
|
|
- currentTable: '',
|
|
|
+ currentTable: props.schemaID ?'':'add',
|
|
|
// default schemaID and schemaName
|
|
|
- schemaID: props.schemaID,
|
|
|
- schemaName: props.schemaName
|
|
|
+ schemaID: props.schemaID || props.history.location.state.schemaID,
|
|
|
+ schemaName: props.schemaName || props.history.location.state.schemaName,
|
|
|
};
|
|
|
}
|
|
|
|
|
|
@@ -32,12 +32,14 @@ class Schema extends Component {
|
|
|
|
|
|
componentWillReceiveProps(next) {
|
|
|
this.setState({
|
|
|
- schemaID: next.schemaID
|
|
|
+ schemaID: next.schemaID,
|
|
|
+ schemaName: next.schemaName
|
|
|
});
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
let userID = this.props.userID;
|
|
|
+ console.log('this.state.currentTable',this.state.currentTable);
|
|
|
return (
|
|
|
<Query query={gql(SHOW_TABLE)} variables={{schema_id: this.state.schemaID}}>
|
|
|
|
|
|
@@ -50,7 +52,7 @@ class Schema extends Component {
|
|
|
return 'error!';
|
|
|
}
|
|
|
|
|
|
- let schemaName = data.schema_by_id.schemaName;
|
|
|
+ // let schemaName = data.schema_by_id.schemaName;
|
|
|
|
|
|
if (data.schema_by_id === null) data = [];
|
|
|
else data = JSON.parse(data.schema_by_id.schemaData);
|
|
|
@@ -58,16 +60,16 @@ class Schema extends Component {
|
|
|
|
|
|
return (
|
|
|
<div>
|
|
|
- <div onClick={() => {
|
|
|
- this.setState({
|
|
|
- currentTable: ''
|
|
|
- })
|
|
|
- }}>
|
|
|
- {schemaName || this.state.schemaName}
|
|
|
- </div>
|
|
|
{
|
|
|
this.state.currentTable === '' ?
|
|
|
<div>
|
|
|
+ <div onClick={() => {
|
|
|
+ this.setState({
|
|
|
+ currentTable: ''
|
|
|
+ })
|
|
|
+ }}>
|
|
|
+ {this.state.schemaName}
|
|
|
+ </div>
|
|
|
<div>
|
|
|
<Row>
|
|
|
<Col span={8}><span>Name</span></Col>
|