import React, {Component} from 'react'; import {FormattedMessage} from 'react-intl'; import {Alert, Icon, Spin, Row, Col, message, Button} from 'antd'; import { SHOW_APIGROUP, UPDATE_APIGROUP } from "../../../gql"; import copy from 'copy-to-clipboard'; import axios from 'axios'; import QRCode from 'qrcode.react'; import {Query, Mutation} from "react-apollo"; import gql from "graphql-tag"; axios.defaults.withCredentials = true; class TencentDeploy extends Component { constructor(props) { super(props); this.state = { userID: props.userID, url: props.url } } render() { let {userID, url} = this.state; return ( { ({loading, error, data}) => { if (loading) { return } if (error) { return 'error!'; } let allDeployed = data.apiGWGroupbyprops; let deployed = allDeployed.filter(deployed => deployed.cloud_id.cloudName === 'tencent' ); return ( ) } } ) } } class TencentDeployRender extends Component { constructor(props) { super(props); this.state = { userID: props.userID, url: props.url } } render() { let {userID, url} = this.state; let {deployed} = this.props; let regexp = new RegExp(userID + '_'); return (
{ userID === '' && !!url ? : '' } { !!url ?
{url} { copy(url); message.success('复制成功.'); }}/>
: '' } { userID === '' ?
:
{ deployed.map(deploy => ( {deploy.groupName.replace(regexp, '')} {`http://${deploy.defaultDomain}/test/`} { copy(`http://${deploy.defaultDomain}/test/`); message.success('复制成功.'); }}/> )) } { deployed.length === 0 ? : '' }
}
) } } export default TencentDeploy; class DeleteButton extends Component { constructor(props) { super(props); this.state = {} } render() { let {groupID, userID} = this.props; return ( {(update_apiGWGroup, {loading, error}) => { if (loading) return ; if (error) return 'error'; let varObj = { id: groupID, status: 'deleted', updatedAt: new Date().getTime() }; console.log(varObj); return ( ) }} ) } }