|
|
@@ -1,6 +1,6 @@
|
|
|
import React, {Component} from 'react';
|
|
|
|
|
|
-import {Row, Col, Input, Icon, Button} from 'antd';
|
|
|
+import {Row, Col, Input, Icon, Button, Spin} from 'antd';
|
|
|
import './index.css';
|
|
|
import Change from './change';
|
|
|
import gql from "graphql-tag";
|
|
|
@@ -279,7 +279,7 @@ class Schema extends Component {
|
|
|
<Col span={4}>
|
|
|
<Button onClick={() => this.setState({currentTable: 'add'})} type="primary"
|
|
|
shape="circle" icon="plus" size='small'/>
|
|
|
- <DeleteSchemaButton shcemaName={schema.name} deleteSchema={this.deleteSchema}/>
|
|
|
+ <DeleteSchemaButton schemaName={schema.name} deleteSchema={this.deleteSchema}/>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
|
|
|
@@ -347,8 +347,12 @@ class AddSchemaInput extends Component {
|
|
|
|
|
|
return (
|
|
|
<Mutation mutation={ADD_SCHEMA}>
|
|
|
- {(create_schema, {data}) => {
|
|
|
+ {(create_schema, {loading, error}) => {
|
|
|
// console.log(data);
|
|
|
+ if (loading)
|
|
|
+ return <Spin style={{marginLeft: 30, marginTop: 10}}/>
|
|
|
+ if (error)
|
|
|
+ return 'error';
|
|
|
return (
|
|
|
<div>
|
|
|
<Search
|
|
|
@@ -386,20 +390,19 @@ class DeleteSchemaButton extends Component {
|
|
|
const DELETE_SCHEMA = gql`
|
|
|
mutation SCHEMA($schemaName: String) {
|
|
|
delete_schema(schemaName: $schemaName)
|
|
|
- {
|
|
|
- id,
|
|
|
- schemaName
|
|
|
- }
|
|
|
}
|
|
|
`;
|
|
|
return (
|
|
|
<Mutation mutation={DELETE_SCHEMA}>
|
|
|
- {(delete_schema, {data}) => {
|
|
|
+ {(delete_schema, {loading, error}) => {
|
|
|
+ if (error)
|
|
|
+ return 'error';
|
|
|
+ if (loading)
|
|
|
+ return <Spin style={{marginLeft: 3}}/>;
|
|
|
return (
|
|
|
<Button onClick={(e) => {
|
|
|
this.props.deleteSchema(e, this.props.schemaName);
|
|
|
delete_schema({variables: {schemaName: this.props.schemaName}});
|
|
|
- console.log(data);
|
|
|
}} type="danger" shape="circle" icon="delete" size='small' style={{marginLeft: 3}}/>
|
|
|
)
|
|
|
}}
|