|
@@ -108,10 +108,11 @@ class Schema extends Component {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
request('http://123.206.193.98:3000/graphql', SEARCH_SCHEMA, {id: referenceID}).then(
|
|
request('http://123.206.193.98:3000/graphql', SEARCH_SCHEMA, {id: referenceID}).then(
|
|
|
data => {
|
|
data => {
|
|
|
|
|
+ console.log(data);
|
|
|
if (data.schema_by_id !== null) {
|
|
if (data.schema_by_id !== null) {
|
|
|
- localStorage.setItem('ecommerce', data.caseSchema[2].schemaData);
|
|
|
|
|
- localStorage.setItem('subscribe', data.caseSchema[0].schemaData);
|
|
|
|
|
- localStorage.setItem('bills', data.caseSchema[1].schemaData);
|
|
|
|
|
|
|
+ localStorage.setItem('ecommerce', data.caseSchema.find(obj=>obj.schemaName==='ecommerce').schemaData);
|
|
|
|
|
+ localStorage.setItem('subscribe', data.caseSchema.find(obj=>obj.schemaName==='subscribe').schemaData);
|
|
|
|
|
+ localStorage.setItem('bills', data.caseSchema.find(obj=>obj.schemaName==='bills').schemaData);
|
|
|
resolve(data.schema_by_id.schemaData);
|
|
resolve(data.schema_by_id.schemaData);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -332,6 +333,7 @@ class Schema extends Component {
|
|
|
<DeleteSchemaButton
|
|
<DeleteSchemaButton
|
|
|
userID={userID}
|
|
userID={userID}
|
|
|
schemaName={this.state.schemaName}
|
|
schemaName={this.state.schemaName}
|
|
|
|
|
+ history={this.props.history}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
}
|
|
}
|
|
@@ -357,6 +359,7 @@ class Schema extends Component {
|
|
|
this.state.currentTable === 'add' ?
|
|
this.state.currentTable === 'add' ?
|
|
|
<Table
|
|
<Table
|
|
|
currentTable={''}
|
|
currentTable={''}
|
|
|
|
|
+ schemaData={data}
|
|
|
columns={[]}
|
|
columns={[]}
|
|
|
remark=''
|
|
remark=''
|
|
|
schemaID={this.state.schemaID}
|
|
schemaID={this.state.schemaID}
|
|
@@ -364,6 +367,11 @@ class Schema extends Component {
|
|
|
userID={userID}
|
|
userID={userID}
|
|
|
goBack={this.goBack}
|
|
goBack={this.goBack}
|
|
|
trialcase={trialcase}
|
|
trialcase={trialcase}
|
|
|
|
|
+ fetchData={this.fetchData}
|
|
|
|
|
+ showTablePagination={this.showTablePagination}
|
|
|
|
|
+ page={this.state.page}
|
|
|
|
|
+ pageSize={this.state.pageSize}
|
|
|
|
|
+ history={this.props.history}
|
|
|
/> :
|
|
/> :
|
|
|
<Table
|
|
<Table
|
|
|
currentTable={this.state.currentTable}
|
|
currentTable={this.state.currentTable}
|
|
@@ -379,6 +387,7 @@ class Schema extends Component {
|
|
|
showTablePagination={this.showTablePagination}
|
|
showTablePagination={this.showTablePagination}
|
|
|
page={this.state.page}
|
|
page={this.state.page}
|
|
|
pageSize={this.state.pageSize}
|
|
pageSize={this.state.pageSize}
|
|
|
|
|
+ history={this.props.history}
|
|
|
/>
|
|
/>
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -461,12 +470,16 @@ class DeleteSchemaButton extends Component {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- showConfirm = (delete_schema, schemaName) => {
|
|
|
|
|
|
|
+ showConfirm = (delete_schema, schemaName, userID) => {
|
|
|
|
|
+ let _this = this;
|
|
|
confirm({
|
|
confirm({
|
|
|
title: 'Do you want to delete this schema?',
|
|
title: 'Do you want to delete this schema?',
|
|
|
content: 'It cannot be found back!',
|
|
content: 'It cannot be found back!',
|
|
|
onOk() {
|
|
onOk() {
|
|
|
- delete_schema({variables: {schemaName}});
|
|
|
|
|
|
|
+ delete_schema({variables: {schemaName, user_id: userID}});
|
|
|
|
|
+ _this.props.history.push({
|
|
|
|
|
+ pathname: '/graphql-service',
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
onCancel() {
|
|
onCancel() {
|
|
|
},
|
|
},
|