|
@@ -1,6 +1,6 @@
|
|
|
import React, {Component} from 'react';
|
|
import React, {Component} from 'react';
|
|
|
|
|
|
|
|
-import {Layout, Select, Input, Icon, Button, notification, Spin} from 'antd';
|
|
|
|
|
|
|
+import {Layout, Select, Input, Icon, Button, notification, Spin, Modal} from 'antd';
|
|
|
import {UPDATE_SCHEMA, SHOW_SCHEMA, SHOW_TABLE} from "../../gql";
|
|
import {UPDATE_SCHEMA, SHOW_SCHEMA, SHOW_TABLE} from "../../gql";
|
|
|
import gql from "graphql-tag";
|
|
import gql from "graphql-tag";
|
|
|
|
|
|
|
@@ -9,6 +9,7 @@ import {getCookie} from "../../cookie";
|
|
|
|
|
|
|
|
const Option = Select.Option;
|
|
const Option = Select.Option;
|
|
|
const {Content} = Layout;
|
|
const {Content} = Layout;
|
|
|
|
|
+const confirm = Modal.confirm;
|
|
|
|
|
|
|
|
class Table extends Component {
|
|
class Table extends Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
@@ -261,8 +262,40 @@ class UpdateTableButton extends Component {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ showConfirm = (schemaName,schemaID) => {
|
|
|
|
|
+ let _this = this;
|
|
|
|
|
+
|
|
|
|
|
+ if(this.props.add !== 'add') {
|
|
|
|
|
+ this.props.history.push({
|
|
|
|
|
+ pathname: `/graphql-service/my-create/${schemaName}`,
|
|
|
|
|
+ state:{
|
|
|
|
|
+ schemaName,
|
|
|
|
|
+ schemaID
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ confirm({
|
|
|
|
|
+ title: '添加成功',
|
|
|
|
|
+ content: '继续添加数据表?',
|
|
|
|
|
+ onOk() {
|
|
|
|
|
+ console.log('继续添加');
|
|
|
|
|
+ },
|
|
|
|
|
+ onCancel() {
|
|
|
|
|
+ _this.props.history.push({
|
|
|
|
|
+ pathname: `/graphql-service/my-create/${schemaName}`,
|
|
|
|
|
+ state:{
|
|
|
|
|
+ schemaName,
|
|
|
|
|
+ schemaID
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
render() {
|
|
render() {
|
|
|
let schemaID = this.props.schemaID;
|
|
let schemaID = this.props.schemaID;
|
|
|
|
|
+ let schemaName = this.props.schemaName;
|
|
|
let userID = this.props.userID;
|
|
let userID = this.props.userID;
|
|
|
|
|
|
|
|
let varobj = {
|
|
let varobj = {
|
|
@@ -289,6 +322,7 @@ class UpdateTableButton extends Component {
|
|
|
return (
|
|
return (
|
|
|
<Mutation
|
|
<Mutation
|
|
|
mutation={gql(UPDATE_SCHEMA)}
|
|
mutation={gql(UPDATE_SCHEMA)}
|
|
|
|
|
+ onCompleted={()=>this.showConfirm(schemaName,schemaID)}
|
|
|
refetchQueries={[{query: gql(SHOW_TABLE), variables: {schema_id: schemaID}}]}
|
|
refetchQueries={[{query: gql(SHOW_TABLE), variables: {schema_id: schemaID}}]}
|
|
|
>
|
|
>
|
|
|
|
|
|
|
@@ -349,16 +383,16 @@ class UpdateTableButton extends Component {
|
|
|
schemaData: JSON.stringify(schemaCols)
|
|
schemaData: JSON.stringify(schemaCols)
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- this.props.showTablePagination(this.props.page, this.props.pageSize, schemaCols)
|
|
|
|
|
- if(this.props.add !== 'add') {
|
|
|
|
|
- this.props.history.push({
|
|
|
|
|
- pathname: `/graphql-service/my-create/${this.props.schemaName}`,
|
|
|
|
|
- state:{
|
|
|
|
|
- schemaName:this.props.schemaName,
|
|
|
|
|
- schemaID:this.props.schemaID
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.props.showTablePagination(this.props.page, this.props.pageSize, schemaCols);
|
|
|
|
|
+ // if(this.props.add !== 'add') {
|
|
|
|
|
+ // this.props.history.push({
|
|
|
|
|
+ // pathname: `/graphql-service/my-create/${this.props.schemaName}`,
|
|
|
|
|
+ // state:{
|
|
|
|
|
+ // schemaName:this.props.schemaName,
|
|
|
|
|
+ // schemaID:this.props.schemaID
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+ // }
|
|
|
}}>
|
|
}}>
|
|
|
save
|
|
save
|
|
|
</Button>
|
|
</Button>
|