|
|
@@ -3,6 +3,7 @@ import {FormattedMessage} from 'react-intl';
|
|
|
import {Switch, Input, Icon, Spin, Row, Col, message} from 'antd';
|
|
|
import {
|
|
|
DELETE_APIGWPATH,
|
|
|
+ DELETE_APIGROUP,
|
|
|
GET_PROJECT,
|
|
|
SHOW_APIGWPATH,
|
|
|
UPDATE_APIGROUP,
|
|
|
@@ -13,7 +14,7 @@ import gql from "graphql-tag";
|
|
|
import {Query, Mutation} from "react-apollo";
|
|
|
import copy from 'copy-to-clipboard';
|
|
|
import axios from 'axios';
|
|
|
-import {removeFC, removeAPI, graphqlUrl} from "../../../config";
|
|
|
+import {removeAPI, graphqlUrl} from "../../../config";
|
|
|
|
|
|
axios.defaults.withCredentials = true;
|
|
|
|
|
|
@@ -80,7 +81,18 @@ class TencentResult extends Component {
|
|
|
:
|
|
|
<SwitchStatus group={group}/>
|
|
|
}
|
|
|
- {/*<span className={'schema-table-content name'}>删除</span>*/}
|
|
|
+
|
|
|
+ {
|
|
|
+ this.props.trialcase ?
|
|
|
+ ''
|
|
|
+ :
|
|
|
+ <DeleteGroupSpan
|
|
|
+ cloudID={cloudID}
|
|
|
+ groupID={group.id}
|
|
|
+ projectID={projectID}
|
|
|
+ userID={this.props.userID}
|
|
|
+ />
|
|
|
+ }
|
|
|
</span>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
@@ -94,6 +106,7 @@ class TencentResult extends Component {
|
|
|
cloudID={cloudID}
|
|
|
projectID={projectID}
|
|
|
userID={this.props.userID}
|
|
|
+ trialcase={this.props.trialcase}
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -221,14 +234,6 @@ class APIGWPathResult extends Component {
|
|
|
<span className={'schema-table-content'}>{path.apiGWDesc}</span>
|
|
|
</Col>
|
|
|
<Col span={3}>
|
|
|
- <DeletePathSpan
|
|
|
- cloudID={this.props.cloudID}
|
|
|
- groupID={id}
|
|
|
- path={path}
|
|
|
- projectID={this.props.projectID}
|
|
|
- userID={this.props.userID}
|
|
|
- />
|
|
|
-
|
|
|
{
|
|
|
projectType === 'graphql'?
|
|
|
<span className={'schema-table-content name'}
|
|
|
@@ -240,6 +245,19 @@ class APIGWPathResult extends Component {
|
|
|
:
|
|
|
''
|
|
|
}
|
|
|
+
|
|
|
+ {
|
|
|
+ this.props.trialcase?
|
|
|
+ ''
|
|
|
+ :
|
|
|
+ <DeletePathSpan
|
|
|
+ cloudID={this.props.cloudID}
|
|
|
+ groupID={id}
|
|
|
+ path={path}
|
|
|
+ projectID={this.props.projectID}
|
|
|
+ userID={this.props.userID}
|
|
|
+ />
|
|
|
+ }
|
|
|
|
|
|
</Col>
|
|
|
</Row>
|
|
|
@@ -322,4 +340,64 @@ class DeletePathSpan extends Component {
|
|
|
</Mutation>
|
|
|
)
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+class DeleteGroupSpan extends Component {
|
|
|
+ constructor(props) {
|
|
|
+ super(props);
|
|
|
+ this.state = {
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ render() {
|
|
|
+ let {projectID, cloudID, groupID, userID} = this.props;
|
|
|
+ return (
|
|
|
+ <Mutation
|
|
|
+ mutation={gql(DELETE_APIGROUP)}
|
|
|
+ refetchQueries={[{query: gql(GET_PROJECT), variables: {id: projectID}}]}
|
|
|
+ >
|
|
|
+ {(delete_apiGWGroup, {loading, error}) => {
|
|
|
+ if (error)
|
|
|
+ return 'error';
|
|
|
+ if (loading)
|
|
|
+ return <Spin style={{marginLeft: 3}}/>;
|
|
|
+
|
|
|
+ return (
|
|
|
+ <span className={'schema-table-content name'} onClick={() => {
|
|
|
+ axios.get(`${removeAPI}`, {
|
|
|
+ params: {
|
|
|
+ 'cloud-id': `${cloudID}`,
|
|
|
+ 'group-id': `${groupID}`,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ console.log('delete service');
|
|
|
+ if (res.data !== '') {
|
|
|
+
|
|
|
+ delete_apiGWGroup({variables: {id: groupID, user_id: userID}});
|
|
|
+
|
|
|
+ // 写回 project 状态
|
|
|
+ request(graphqlUrl, UPDATE_PROJECT_ONLY_STATUS, {
|
|
|
+ id: projectID,
|
|
|
+ updatedAt: new Date().getTime(),
|
|
|
+ projectStatus: 'functioned'
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(res.data);
|
|
|
+ } else {
|
|
|
+ console.log('error');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </span>
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ </Mutation>
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|