|
@@ -0,0 +1,148 @@
|
|
|
|
|
+import React, {Component} from 'react';
|
|
|
|
|
+import {FormattedMessage} from 'react-intl';
|
|
|
|
|
+import {Alert, Icon, Spin, Row, Col, message, Button} from 'antd';
|
|
|
|
|
+import {
|
|
|
|
|
+ SHOW_APIGROUP
|
|
|
|
|
+} from "../../../gql";
|
|
|
|
|
+import {request} from 'graphql-request'
|
|
|
|
|
+import copy from 'copy-to-clipboard';
|
|
|
|
|
+import axios from 'axios';
|
|
|
|
|
+import {graphqlUrl} from "../../../config";
|
|
|
|
|
+
|
|
|
|
|
+axios.defaults.withCredentials = true;
|
|
|
|
|
+
|
|
|
|
|
+class TencentDeploy extends Component {
|
|
|
|
|
+ constructor(props) {
|
|
|
|
|
+ super(props);
|
|
|
|
|
+ this.state = {
|
|
|
|
|
+ userID: props.userID,
|
|
|
|
|
+ url: props.url,
|
|
|
|
|
+ show: false,
|
|
|
|
|
+ deployed: []
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ componentWillMount() {
|
|
|
|
|
+ let {userID} = this.state;
|
|
|
|
|
+ if (userID !== 'demo') {
|
|
|
|
|
+ request(graphqlUrl, SHOW_APIGROUP, {userID}).then(res => {
|
|
|
|
|
+ console.log(res);
|
|
|
|
|
+ let allDeployed = res.apiGWGroupbyprops;
|
|
|
|
|
+ let deployed = allDeployed.filter(deployed =>
|
|
|
|
|
+ deployed.cloud_id.cloudName === 'tencent'
|
|
|
|
|
+ );
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ deployed,
|
|
|
|
|
+ show: true
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ render() {
|
|
|
|
|
+ let {userID, url, deployed, show} = this.state;
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div>
|
|
|
|
|
+ {
|
|
|
|
|
+ userID === 'demo' && !!url ?
|
|
|
|
|
+ <Alert
|
|
|
|
|
+ message="WARNING"
|
|
|
|
|
+ description="it will be deleted soon, please login to deploy in your owm account"
|
|
|
|
|
+ type="warning"
|
|
|
|
|
+ />
|
|
|
|
|
+ : ''
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ {
|
|
|
|
|
+ !!url ?
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <div className={'schema-name'}><FormattedMessage id='new'/></div>
|
|
|
|
|
+ <div className={'schema-table-list-title'}>
|
|
|
|
|
+ <Row>
|
|
|
|
|
+ <Col span={15}><span className={'schema-table-title'}><FormattedMessage
|
|
|
|
|
+ id='defaultDomain'/></span></Col>
|
|
|
|
|
+ </Row>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className={'schema-table-list-content'}>
|
|
|
|
|
+ <Row>
|
|
|
|
|
+ <Col span={15}>
|
|
|
|
|
+ <span className={'schema-table-content'}>{`http://${url}/test/graphql`} </span>
|
|
|
|
|
+ <Icon type="copy" theme="twoTone" onClick={() => {
|
|
|
|
|
+ copy(url);
|
|
|
|
|
+ message.success('复制成功.');
|
|
|
|
|
+ }}/>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ </Row>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ :
|
|
|
|
|
+ ''
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ userID === 'demo' ?
|
|
|
|
|
+ <div style={{marginTop: 50}}>
|
|
|
|
|
+ <FormattedMessage id='go to deploy,then see more'/>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ :
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <div className={'schema-name'}><FormattedMessage id='service manage'/></div>
|
|
|
|
|
+ <div className={'schema-table-list-title'}>
|
|
|
|
|
+ <Row>
|
|
|
|
|
+ <Col span={5}><span className={'schema-table-title'}><FormattedMessage
|
|
|
|
|
+ id='groupName'/></span></Col>
|
|
|
|
|
+ <Col span={15}><span className={'schema-table-title'}><FormattedMessage
|
|
|
|
|
+ id='defaultDomain'/></span></Col>
|
|
|
|
|
+ <Col span={4}><span className={'schema-table-title'}><FormattedMessage
|
|
|
|
|
+ id='operation'/></span></Col>
|
|
|
|
|
+ </Row>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ {
|
|
|
|
|
+ show ?
|
|
|
|
|
+ <div className={'schema-table-list-content'}>
|
|
|
|
|
+ {
|
|
|
|
|
+ deployed.map(deploy => (
|
|
|
|
|
+ <Row key={deploy.id}>
|
|
|
|
|
+ <Col span={5}>
|
|
|
|
|
+ <span
|
|
|
|
|
+ className={'schema-table-content'}>{deploy.serviceId}</span>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ <Col span={15}>
|
|
|
|
|
+ <span
|
|
|
|
|
+ className={'schema-table-content'}>{`http://${deploy.defaultDomain}/test/graphql`} </span>
|
|
|
|
|
+ <Icon type="copy" theme="twoTone" onClick={() => {
|
|
|
|
|
+ copy(url);
|
|
|
|
|
+ message.success('复制成功.');
|
|
|
|
|
+ }}/>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ <Col span={4}>
|
|
|
|
|
+ <Button type={'danger'} size={'small'}
|
|
|
|
|
+ style={{marginTop: 10}}><FormattedMessage id='delete'/></Button>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ </Row>
|
|
|
|
|
+ ))
|
|
|
|
|
+ }
|
|
|
|
|
+ {
|
|
|
|
|
+ deployed.length === 0 ?
|
|
|
|
|
+ <Row>
|
|
|
|
|
+ <Col span={15} offset={5}>
|
|
|
|
|
+ <span className={'schema-table-content'}><FormattedMessage
|
|
|
|
|
+ id='nothing'/> </span>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ </Row> :
|
|
|
|
|
+ ''
|
|
|
|
|
+ }
|
|
|
|
|
+ </div>
|
|
|
|
|
+ :
|
|
|
|
|
+ <Spin/>
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export default TencentDeploy;
|