|
@@ -5,7 +5,7 @@ import './index.css';
|
|
|
import {Mutation, Query} from "react-apollo";
|
|
import {Mutation, Query} from "react-apollo";
|
|
|
import gql from "graphql-tag";
|
|
import gql from "graphql-tag";
|
|
|
import {
|
|
import {
|
|
|
- DELETE_PROJECT_AND_SCHEMA,
|
|
|
|
|
|
|
+ DELETE_PROJECT,
|
|
|
SHOW_SCHEMA,
|
|
SHOW_SCHEMA,
|
|
|
SHOW_TABLE,
|
|
SHOW_TABLE,
|
|
|
UPDATE_SCHEMA,
|
|
UPDATE_SCHEMA,
|
|
@@ -33,6 +33,7 @@ class Schema extends Component {
|
|
|
// default schemaID and schemaName
|
|
// default schemaID and schemaName
|
|
|
schemaID: props.location.state === undefined ? props.schemaID : props.location.state.schemaID,
|
|
schemaID: props.location.state === undefined ? props.schemaID : props.location.state.schemaID,
|
|
|
schemaName: props.location.state === undefined ? props.schemaName : props.location.state.schemaName,
|
|
schemaName: props.location.state === undefined ? props.schemaName : props.location.state.schemaName,
|
|
|
|
|
+ projectID: props.location.state === undefined ? props.projectID : props.location.state.projectID,
|
|
|
editSchemaName: '',
|
|
editSchemaName: '',
|
|
|
allData: '',
|
|
allData: '',
|
|
|
data: '',
|
|
data: '',
|
|
@@ -391,20 +392,18 @@ class Schema extends Component {
|
|
|
</div>
|
|
</div>
|
|
|
<div style={{display: 'inline-block'}}
|
|
<div style={{display: 'inline-block'}}
|
|
|
className={'delete-schema'}>
|
|
className={'delete-schema'}>
|
|
|
- <DeleteSchemaButton
|
|
|
|
|
|
|
+ <DeleteProjectButton
|
|
|
userID={userID}
|
|
userID={userID}
|
|
|
- schemaID={this.state.schemaID}
|
|
|
|
|
- schemaName={this.state.schemaName}
|
|
|
|
|
|
|
+ projectID={this.state.projectID}
|
|
|
history={this.props.history}
|
|
history={this.props.history}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
:
|
|
:
|
|
|
<div className={'delete-schema'}>
|
|
<div className={'delete-schema'}>
|
|
|
- <DeleteSchemaButton
|
|
|
|
|
|
|
+ <DeleteProjectButton
|
|
|
userID={userID}
|
|
userID={userID}
|
|
|
- schemaID={this.state.schemaID}
|
|
|
|
|
- schemaName={this.state.schemaName}
|
|
|
|
|
|
|
+ projectID={this.state.projectID}
|
|
|
history={this.props.history}
|
|
history={this.props.history}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
@@ -420,10 +419,9 @@ class Schema extends Component {
|
|
|
</div>
|
|
</div>
|
|
|
:
|
|
:
|
|
|
<div className={'delete-schema'}>
|
|
<div className={'delete-schema'}>
|
|
|
- <DeleteSchemaButton
|
|
|
|
|
|
|
+ <DeleteProjectButton
|
|
|
userID={userID}
|
|
userID={userID}
|
|
|
- schemaID={this.state.schemaID}
|
|
|
|
|
- schemaName={this.state.schemaName}
|
|
|
|
|
|
|
+ projectID={this.state.projectID}
|
|
|
history={this.props.history}
|
|
history={this.props.history}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
@@ -585,22 +583,21 @@ class CopySchemaButton extends Component {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-class DeleteSchemaButton extends Component {
|
|
|
|
|
|
|
+class DeleteProjectButton extends Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
super(props);
|
|
super(props);
|
|
|
this.state = {
|
|
this.state = {
|
|
|
- schemaName: props.schemaName,
|
|
|
|
|
- schemaId:props.schemaID
|
|
|
|
|
|
|
+ projectID:props.projectID
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- showConfirm = (delete_project_and_schema, schemaId, userID) => {
|
|
|
|
|
|
|
+ showConfirm = (delete_project_and_schema, projectID, userID) => {
|
|
|
let _this = this;
|
|
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_project_and_schema({variables: {schemaId, user_id: userID}});
|
|
|
|
|
|
|
+ delete_project_and_schema({variables: {id:projectID, user_id: userID}});
|
|
|
_this.props.history.push({
|
|
_this.props.history.push({
|
|
|
pathname: '/graphql-service',
|
|
pathname: '/graphql-service',
|
|
|
});
|
|
});
|
|
@@ -612,11 +609,11 @@ class DeleteSchemaButton extends Component {
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
let userID = this.props.userID;
|
|
let userID = this.props.userID;
|
|
|
- let {schemaName,schemaId} = this.state;
|
|
|
|
|
|
|
+ let {projectID} = this.state;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<Mutation
|
|
<Mutation
|
|
|
- mutation={gql(DELETE_PROJECT_AND_SCHEMA)}
|
|
|
|
|
|
|
+ mutation={gql(DELETE_PROJECT)}
|
|
|
refetchQueries={[{query: gql(SHOW_PROJECT), variables: {projectType:'graphql',user_id: userID}}]}
|
|
refetchQueries={[{query: gql(SHOW_PROJECT), variables: {projectType:'graphql',user_id: userID}}]}
|
|
|
// update={(cache) => {
|
|
// update={(cache) => {
|
|
|
// let data = cache.readQuery({query: gql(SHOW_PROJECT), variables: {projectType:"graphql",user_id: userID}});
|
|
// let data = cache.readQuery({query: gql(SHOW_PROJECT), variables: {projectType:"graphql",user_id: userID}});
|
|
@@ -638,7 +635,7 @@ class DeleteSchemaButton extends Component {
|
|
|
<Button
|
|
<Button
|
|
|
type="danger"
|
|
type="danger"
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
|
- this.showConfirm(delete_project_and_schema, schemaId, userID);
|
|
|
|
|
|
|
+ this.showConfirm(delete_project_and_schema, projectID, userID);
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
<FormattedMessage id="delete"/>
|
|
<FormattedMessage id="delete"/>
|