| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import React, {Component} from 'react';
- import {Spin} from 'antd';
- import {GET_PROJECT} from "../../../../../gql";
- import {Query} from "react-apollo";
- import gql from "graphql-tag";
- import DeployCardRender from "./DeployCardRender";
- import {removeSpace} from "../../../../../func";
- const removePrefix = (prefix, value) => {
- let r = new RegExp(prefix);
- return value.replace(r, '');
- };
- const shiftPrefix = (prefix, value) => {
- value = removePrefix(prefix, value);
- return prefix + value;
- };
- class DeployCardFetch extends Component {
- constructor(props) {
- super(props);
- this.state = {
- }
- }
- render() {
- return (
- <Query query={gql(GET_PROJECT)} variables={{id: this.props.projectID}}>
- {
- ({loading, error, data}) => {
- if (loading) {
- return <Spin style={{marginLeft: 3}}/>
- }
- if (error) {
- return 'error!';
- }
- let deploy = '',
- cloudID = 'tencent_CloudID';
- let dataProject = data.project_by_id;
- let {cloud_id, deploy_id, projectName, projectStatus} = dataProject;
- if (cloud_id !== null && cloud_id.cloudName === 'tencent') {
- deploy = deploy_id;
- cloudID = cloud_id.id;
- }
- return (
- <DeployCardRender
- // props
- switchRegion={this.props.switchRegion}
- region={this.props.region}
- trialcase={this.props.trialcase}
- stepByStep={this.props.stepByStep}
- userID={this.props.userID}
- projectID={this.props.projectID}
- // query
- defalutName={removeSpace(projectName)}
- deploy={deploy}
- cloudID={cloudID}
- projectStatus={projectStatus}
- />
- )
- }
- }
- </Query>
- )
- }
- }
- export default DeployCardFetch;
|