xy 7 лет назад
Родитель
Сommit
095bb75f16

+ 18 - 236
src/app/common/deploy/Deploy.jsx

@@ -1,16 +1,12 @@
 import React, {Component} from 'react';
 import {FormattedMessage} from 'react-intl';
-import {Card, Spin} from 'antd';
+import {Card} from 'antd';
 
 import TencentConfig from './tencent/TencentConfig';
 import AliConfig from './ali/AliConfig';
 import AmazonConfig from './amazon/AmazonConfig';
 
 import './index.css';
-import {SHOW_FC_SCHEMA, SHOW_FC_CONFIG, SEARCH_SCHEMA, SHOW_CLOUD, SHOW_WXCONTENT} from "../../../gql";
-import {request} from 'graphql-request'
-import {graphqlUrl} from "../../../config";
-import DisplayTable from "./common/DisplayTable";
 
 const tabListNoTitle = [{
     key: 'tencent',
@@ -33,253 +29,39 @@ class Deploy extends Component {
     constructor(props) {
         super(props);
         this.state = {
-            show: true,
             cloud: 'tencent',
-            tencentCloudID: 'tencent_CloudID',
-            aliyunCloudID: 'aliyun_CloudID',
-            amazonCloudID: '',
-            defalutName: '',
-            tencentFC: '',
-            aliyunFC: '',
-            amazonFC: '',
-            schemaID: props.schemaID,
-            configID: props.configID,
-            kind: ''
+            projectIDOK: 'project_by_mxy_already_deploy',
+            projectIDNULL: 'project_by_mxy_not_deploy'
         };
-        this.fetch();
     }
 
     componentWillReceiveProps(next) {
         this.setState({
-            schemaID: next.schemaID,
-            configID: next.configID
-        }, this.fetch)
+            projectID: next.projectID
+        })
     }
 
-
-
-    fetch = () => {
-        // if (this.state.schemaID !== '' && this.state.schemaID !== undefined) {
-        //     request(graphqlUrl, SHOW_FC_SCHEMA, {schema_id: this.state.schemaID}).then(
-        //         // 根据 schemaID 查询 fc 是否成功
-        //         data => {
-        //             request(graphqlUrl, SEARCH_SCHEMA, {id: this.state.schemaID}).then(
-        //                 // 根据 schemaID 查询 schemaName
-        //                 _data => {
-        //                     if (data.fc_by_props.length === 0) {
-        //                         // 如果没有 fc,根据 userID 查 cloudId
-        //                         request(graphqlUrl, SHOW_CLOUD, {user_id: this.props.userID}).then(
-        //                             __data => {
-        //                                 // 如果 user 未设置 cloudID
-        //                                 if(__data.cloud_by_props.length === 0) {
-        //                                     this.setState({
-        //                                         tencentFC: false,
-        //                                         aliyunFC: false,
-        //                                         amazonFC: false,
-        //                                         defalutName: _data.schema_by_id.schemaName,
-        //                                         show: true,
-        //                                         kind: 'graphql'
-        //                                     });
-        //                                 } else {
-        //                                     __data.cloud_by_props.forEach(cloud => {
-        //                                         switch (cloud.cloudName) {
-        //                                             case 'tencent':
-        //                                                 this.setState({
-        //                                                     tencentFC: false,
-        //                                                     tencentCloudID: cloud.id,
-        //                                                     defalutName: _data.schema_by_id.schemaName,
-        //                                                     show: true,
-        //                                                     kind: 'graphql'
-        //                                                 });
-        //                                                 break;
-        //                                             case 'aliyun':
-        //                                                 this.setState({
-        //                                                     aliyunFC: false,
-        //                                                     aliyunCloudID: cloud.id,
-        //                                                     defalutName: _data.schema_by_id.schemaName,
-        //                                                     show: true,
-        //                                                     kind: 'graphql'
-        //                                                 });
-        //                                                 break;
-        //                                             case 'amazon':
-        //                                                 this.setState({
-        //                                                     amazonFC: false,
-        //                                                     amazonCloudID: cloud.id,
-        //                                                     defalutName: _data.schema_by_id.schemaName,
-        //                                                     show: true,
-        //                                                     kind: 'graphql'
-        //                                                 });
-        //                                                 break;
-        //                                             default:
-        //                                                 break;
-        //                                         }
-        //                                     })
-        //                                 }
-        //                             }
-        //                         );
-        //                     } else {
-        //                         // 如果有 fc, 则获取 cloudID
-        //                         data.fc_by_props.forEach(cloud => {
-        //                             switch (cloud.cloud_id.cloudName) {
-        //                                 case 'tencent':
-        //                                     this.setState({
-        //                                         tencentFC: true,
-        //                                         tencentCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'graphql'
-        //                                     });
-        //                                     break;
-        //                                 case 'aliyun':
-        //                                     this.setState({
-        //                                         aliyunFC: true,
-        //                                         aliyunCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'graphql'
-        //                                     });
-        //                                     break;
-        //                                 case 'amazon':
-        //                                     this.setState({
-        //                                         amazonFC: true,
-        //                                         amazonCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'graphql'
-        //                                     });
-        //                                     break;
-        //                                 default:
-        //                                     break;
-        //                             }
-        //                         })
-        //                     }
-        //                 }
-        //             );
-        //         }
-        //     );
-        // } else {
-        //     request(graphqlUrl, SHOW_FC_CONFIG, {wxConfig_id: this.state.configID}).then(
-        //         // 根据 configID 查询 fc 是否成功
-        //         data => {
-        //             request(graphqlUrl, SHOW_WXCONTENT, {id: this.state.configID}).then(
-        //                 // 根据 configID 查询 appName
-        //                 _data => {
-        //                     if (data.fc_by_props.length === 0) {
-        //                         // 如果没有 fc,根据 userID 查 cloudId
-        //                         request(graphqlUrl, SHOW_CLOUD, {user_id: this.props.userID}).then(
-        //                             __data => {
-        //                                 // 如果 user 未设置 cloudID
-        //                                 if(__data.cloud_by_props.length === 0) {
-        //                                     this.setState({
-        //                                         tencentFC: false,
-        //                                         aliyunFC: false,
-        //                                         amazonFC: false,
-        //                                         defalutName: _data.wxConfig_by_id.appName,
-        //                                         show: true,
-        //                                         kind: 'wx'
-        //                                     });
-        //                                 } else {
-        //                                     __data.cloud_by_props.forEach(cloud => {
-        //                                         switch (cloud.cloudName) {
-        //                                             case 'tencent':
-        //                                                 this.setState({
-        //                                                     tencentFC: false,
-        //                                                     tencentCloudID: cloud.id,
-        //                                                     defalutName: _data.wxConfig_by_id.appName,
-        //                                                     show: true,
-        //                                                     kind: 'wx'
-        //                                                 });
-        //                                                 break;
-        //                                             case 'aliyun':
-        //                                                 this.setState({
-        //                                                     aliyunFC: false,
-        //                                                     aliyunCloudID: cloud.id,
-        //                                                     defalutName: _data.wxConfig_by_id.appName,
-        //                                                     show: true,
-        //                                                     kind: 'wx'
-        //                                                 });
-        //                                                 break;
-        //                                             case 'amazon':
-        //                                                 this.setState({
-        //                                                     amazonFC: false,
-        //                                                     amazonCloudID: cloud.id,
-        //                                                     defalutName: _data.wxConfig_by_id.appName,
-        //                                                     show: true,
-        //                                                     kind: 'wx'
-        //                                                 });
-        //                                                 break;
-        //                                             default:
-        //                                                 break;
-        //                                         }
-        //                                     })
-        //                                 }
-        //                             }
-        //                         );
-        //                     } else {
-        //                         // 如果有 fc, 则获取 cloudID
-        //                         data.fc_by_props.forEach(cloud => {
-        //                             switch (cloud.cloud_id.cloudName) {
-        //                                 case 'tencent':
-        //                                     this.setState({
-        //                                         tencentFC: true,
-        //                                         tencentCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'wx'
-        //                                     });
-        //                                     break;
-        //                                 case 'aliyun':
-        //                                     this.setState({
-        //                                         aliyunFC: true,
-        //                                         aliyunCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'wx'
-        //                                     });
-        //                                     break;
-        //                                 case 'amazon':
-        //                                     this.setState({
-        //                                         amazonFC: true,
-        //                                         amazonCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'wx'
-        //                                     });
-        //                                     break;
-        //                                 default:
-        //                                     break;
-        //                             }
-        //                         })
-        //                     }
-        //                 }
-        //             );
-        //         }
-        //     );
-        // }
-    };
-
     render() {
         const contentListNoTitle = {
-            tencent: <DisplayTable configID={this.state.configID} schemaID={this.state.schemaID} cloudID={this.state.tencentCloudID} fc={this.state.tencentFC} defalutName={this.state.defalutName} userID={this.props.userID} kind={this.state.kind} trialcase={this.props.trialcase}/>,
+            tencent: <TencentConfig userID={this.props.userID} projectID={this.state.projectIDNULL} trialcase={this.props.trialcase}/>,
             aliyun: <AliConfig/>,
             amazon: <AmazonConfig/>,
         };
 
         return (
             <div>
-                <div>
-                    <Card
-                        style={{width: '100%'}}
-                        tabList={tabListNoTitle}
-                        activeTabKey={this.state.cloud}
-                        onTabChange={(cloud) => {
-                            this.setState({
-                                cloud
-                            })
-                        }}
-                    >
-                        {
-                            this.state.show ?
-                                contentListNoTitle[this.state.cloud]
-                                :
-                                <Spin/>
-                        }
-                    </Card>
-                </div>
+                <Card
+                    style={{width: '100%'}}
+                    tabList={tabListNoTitle}
+                    activeTabKey={this.state.cloud}
+                    onTabChange={(cloud) => {
+                        this.setState({
+                            cloud
+                        })
+                    }}
+                >
+                    {contentListNoTitle[this.state.cloud]}
+                </Card>
             </div>
         )
     }

+ 0 - 82
src/app/common/deploy/common/DisplayTable.js

@@ -1,82 +0,0 @@
-import React, {Component} from 'react';
-import {SHOW_APIGWGROUP} from "../../../../gql";
-import {Spin, Row, Col} from 'antd';
-import {Mutation, Query} from "react-apollo";
-import gql from "graphql-tag";
-import TencentConfig from "../tencent/TencentConfig";
-
-class DisplayTable extends Component {
-    constructor(props) {
-        super(props);
-        this.state = {
-            groupID: '',
-            groupName: ''
-        };
-    }
-
-
-    switchGroup = (groupID, groupName) => {
-        this.setState({
-            groupID,
-            groupName
-        })
-    };
-
-    render() {
-        let {schemaID} = this.props;
-        return (
-            <Query query={gql(SHOW_APIGWGROUP)} variables={{schema_id: schemaID}}>
-
-                {
-                    ({loading, error, data}) => {
-                        if (loading) {
-                            return <Spin style={{marginLeft: 3}}/>
-                        }
-                        if (error) {
-                            return 'error!';
-                        }
-                        return (
-                            <div>
-                                {
-                                    this.state.groupID === ''?
-                                        <div>
-                                            <div className={'schema-table-list-title'}>
-                                                <Row>
-                                                    <Col span={10}><span className={'schema-table-title'}>Name</span></Col>
-                                                    <Col span={10}><span className={'schema-table-title'}>District</span></Col>
-                                                    <Col span={2} offset={2}>
-                                                    </Col>
-                                                </Row>
-                                            </div>
-                                            {
-                                                data.apiGWGroup_by_props.map(group => (
-                                                    <div key={group.id} className={'schema-table-list-content'}>
-                                                        <Row>
-                                                            <Col
-                                                                span={10}
-                                                                onClick={() => this.switchGroup(group.id, group.groupName)}
-                                                            >
-                                                                <span className={'schema-table-content name'}>{group.groupName}</span>
-                                                            </Col>
-                                                            <Col span={10}>
-                                                                <span className={'schema-table-content'}>{group.region}</span>
-                                                            </Col>
-                                                        </Row>
-                                                    </div>
-                                                ))
-                                            }
-                                        </div>
-                                        :
-                                        <TencentConfig goBack={()=>{this.setState({groupID: ''})}} groupName={this.state.groupName} configID={this.props.configID} schemaID={this.props.schemaID} cloudID={this.props.tencentCloudID} fc={this.props.tencentFC} defalutName={this.props.defalutName} userID={this.props.userID} kind={this.props.kind} trialcase={this.props.trialcase}/>
-                                }
-
-                            </div>
-                        )
-                    }
-                }
-            </Query>
-        )
-    }
-}
-
-export default DisplayTable;

+ 137 - 106
src/app/common/deploy/tencent/TencentConfig.js

@@ -1,100 +1,42 @@
 import React, {Component} from 'react';
-import {Row, Col, Card, Button, Icon} from 'antd';
+import {Row, Col, Card, Button, Spin} from 'antd';
 import axios from 'axios';
 import APIGroupCard from './APIGroupCard';
 import APIPathCard from './APIPathCard';
 import DeployCard from './DeployCard';
 import NotificationCard from './NotificationCard';
 
-import {SHOW_DEPLOY, SHOW_APIGWGROUP, SHOW_APIGWPATH, SEARCH_SCHEMA} from "../../../../gql";
-import {request} from 'graphql-request'
-import {graphqlUrl,deployUrl} from "../../../../config";
+import {SHOW_APIGWPATH, GET_PROJECT} from "../../../../gql";
+import {deployUrl} from "../../../../config";
 import {FormattedMessage} from 'react-intl';
+import gql from "graphql-tag";
+import {Query} from "react-apollo";
 
 class TencentConfig extends Component {
     constructor(props) {
         super(props);
         this.state = {
             region: '',
-            deploys: [],
-            currentDeploy: '',
-            groups: [],
-            currentGroup: '',
-            paths: [],
-            currentPath: '',
+            couldDeploy: false,
             deployIdPassToPath: '',
-            groupIdPassToPath: '',
-            cloudID: props.cloudID,
-            fc: props.fc,
-            couldDeploy: false
+            groupIdPassToPath: ''
         };
     }
 
-    componentDidMount() {
-        this.fetch();
-    }
-
     componentWillReceiveProps(next) {
         this.setState({
-            fc: next.fc,
-            cloudID: next.cloudID,
             couldDeploy: false,
-            region: ''
-        }, this.fetch);
+            region: '',
+            deployIdPassToPath: '',
+            groupIdPassToPath: ''
+        });
     }
 
-    fetch = () => {
-        // todo: 没做每个 deploy 和 apigroup 和 apipath 的切换
-        // todo: 换成 apollo 会更好
-        if (this.state.fc === true) {
-            request(graphqlUrl, SHOW_DEPLOY, {cloud_id: this.state.cloudID}).then(
-                data => {
-                    this.setState({
-                        deploys: data.deploy_by_props,
-                        currentDeploy: data.deploy_by_props[0]
-                    })
-                }
-            );
-            request(graphqlUrl, SHOW_APIGWGROUP, {cloud_id: this.state.cloudID}).then(
-                data => {
-                    this.setState({
-                        groups: data.apiGWGroup_by_props,
-                        currentGroup: data.apiGWGroup_by_props[0]
-                    }, () => {
-                        request(graphqlUrl, SHOW_APIGWPATH, {apiGWGroup_id: this.state.currentGroup.id}).then(
-                            data => {
-                                this.setState({
-                                    paths: data.apiGWPath_by_props,
-                                    currentPath: data.apiGWPath_by_props[0]
-                                });
-                            }
-                        );
-                    });
-                }
-            );
-        } else {
-            this.setState({
-                currentDeploy: '',
-                currentGroup: '',
-                currentPath: '',
-            })
-        }
-
-        if(this.props.schemaID === '' || this.props.schemaID === undefined) {
-            this.setState({
-                couldDeploy: true
-            });
-        } else {
-            request(graphqlUrl, SEARCH_SCHEMA, {id: this.props.schemaID}).then(
-                data => {
-                    if(data.schema_by_id.schemaState === 'ok')
-                        this.setState({
-                            couldDeploy: true
-                        });
-                }
-            );
-        }
 
+    switchRegion = (e) => {
+        this.setState({
+            region: e.target.value
+        });
     };
 
     pass = (value, kind) => {
@@ -108,12 +50,6 @@ class TencentConfig extends Component {
             })
     };
 
-    switchRegion = (e) => {
-        this.setState({
-            region: e.target.value
-        });
-    };
-
     deployFC = () => {
         let _this = this;
 
@@ -139,34 +75,129 @@ class TencentConfig extends Component {
     };
 
     render() {
-        let {groupName, trialcase} = this.props;
+        let {userID, projectID, trialcase} = this.props;
         return (
-            <div>
-                <div className="column-menu" onClick={this.props.goBack}>
-                    <Icon type="left" style={{color: '#3187FA'}}/> {groupName}
-                </div>
-                <div style={{padding: '30px'}}>
-                    <Row gutter={16}>
-                        <Col span={14}>
-                            <FormattedMessage id="API Group">{msg => <Card title={msg} style={{marginBottom: 10}}><APIGroupCard group={this.state.currentGroup} switchRegion={this.switchRegion} region={this.state.region} userID={this.props.userID} cloudID={this.props.cloudID} pass={this.pass} kind={this.props.kind} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
-                            <FormattedMessage id="fc Deploy">{msg => <Card title={msg} style={{marginBottom: 10}}><DeployCard deploy={this.state.currentDeploy} switchRegion={this.switchRegion} region={this.state.region} defalutName={this.props.defalutName} userID={this.props.userID} cloudID={this.props.cloudID} pass={this.pass} kind={this.props.kind} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
-                            <FormattedMessage id="API Path">{msg => <Card title={msg} style={{marginBottom: 10}}><APIPathCard path={this.state.currentPath} defalutName={this.props.defalutName} userID={this.props.userID} deployID={this.state.currentDeploy? this.state.currentDeploy.id : this.state.deployIdPassToPath} groupID={this.state.currentGroup? this.state.currentGroup.id : this.state.groupIdPassToPath} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
-                            <FormattedMessage id="Notification">{msg => <Card title={msg}><NotificationCard userID={this.props.userID} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
-                        </Col>
-                        <Col offset={2} span={6}>
-                            <Button type='primary' disabled={this.state.couldDeploy? '': 'disabled'} onClick={()=>this.deployFC()}><FormattedMessage id="deploy"/>!</Button>
-                            {
-                                this.state.couldDeploy?
-                                    ''
-                                    :
-                                    <div>
-                                        <span>if button is disabled, check your schema</span>
-                                    </div>
-                            }
-                        </Col>
-                    </Row>
-                </div>
-            </div>
+            <Query query={gql(GET_PROJECT)} variables={{id: projectID}}>
+                {
+                    ({loading, error, data}) => {
+                        if (loading) {
+                            return <Spin style={{marginLeft: 3}}/>
+                        }
+                        if (error) {
+                            return 'error!';
+                        }
+
+                        let group = '',
+                            deploy = '',
+                            path = '',
+                            cloudID= 'tencent_CloudID';
+
+                        if(data.project_by_id.cloud_id !== null && data.project_by_id.cloud_id.cloudName === 'tencent') {
+                            group = data.project_by_id.apiGWGroup_id;
+                            deploy = data.project_by_id.deploy_id;
+                            cloudID = data.project_by_id.cloud_id.id;
+                        }
+                        let defaultName = data.project_by_id.projectName;
+                        return (
+                            <div>
+                                <div style={{padding: '30px'}}>
+                                    <Row gutter={16}>
+                                        <Col span={14}>
+                                            <FormattedMessage id="fc Deploy">
+                                                {
+                                                    msg =>
+                                                        <Card title={msg} style={{marginBottom: 10}}>
+                                                            <DeployCard
+                                                                deploy={deploy}
+                                                                switchRegion={this.switchRegion}
+                                                                region={this.state.region}
+                                                                defalutName={defaultName}
+                                                                userID={this.props.userID}
+                                                                cloudID={cloudID}
+                                                                trialcase={this.props.trialcase}
+                                                                pass={this.pass}
+                                                            />
+                                                        </Card>
+                                                }
+                                            </FormattedMessage>
+                                            <FormattedMessage id="API Group">
+                                                {
+                                                    msg =>
+                                                        <Card title={msg} style={{marginBottom: 10}}>
+                                                            <APIGroupCard
+                                                                group={group}
+                                                                userID={this.props.userID}
+                                                                switchRegion={this.switchRegion}
+                                                                region={this.state.region}
+                                                                cloudID={cloudID}
+                                                                trialcase={this.props.trialcase}
+                                                                pass={this.pass}
+                                                            />
+                                                        </Card>
+                                                }
+                                            </FormattedMessage>
+                                            <Query query={gql(SHOW_APIGWPATH)} variables={{apiGWGroup_id: data.project_by_id.apiGWGroup_id? data.project_by_id.apiGWGroup_id.id : ''}}>
+                                                {
+                                                    ({loading, error, data}) => {
+                                                        if (loading) {
+                                                            return <Spin style={{marginLeft: 3}}/>
+                                                        }
+                                                        if (error) {
+                                                            return 'error!';
+                                                        }
+                                                        if(data.apiGWPath_by_props.length>0)
+                                                            path = data.apiGWPath_by_props[0];
+                                                        return (
+                                                            <FormattedMessage id="API Path">
+                                                                {
+                                                                    msg =>
+                                                                        <Card title={msg} style={{marginBottom: 10}}>
+                                                                            <APIPathCard
+                                                                                path={path}
+                                                                                defalutName={defaultName}
+                                                                                userID={this.props.userID}
+                                                                                trialcase={this.props.trialcase}
+                                                                                deployID={deploy? deploy.id : this.state.deployIdPassToPath}
+                                                                                groupID={group? group.id : this.state.groupIdPassToPath}
+                                                                            />
+                                                                        </Card>
+                                                                }
+                                                                </FormattedMessage>
+                                                        )
+                                                    }
+                                                }
+                                            </Query>
+                                            <FormattedMessage id="Notification">
+                                                {
+                                                    msg =>
+                                                        <Card title={msg}>
+                                                            <NotificationCard
+                                                                userID={this.props.userID}
+                                                                trialcase={this.props.trialcase}
+                                                            />
+                                                        </Card>
+                                                }
+                                            </FormattedMessage>
+                                        </Col>
+                                        <Col offset={2} span={6}>
+                                            <Button type='primary' disabled={this.state.couldDeploy? '': 'disabled'} onClick={()=>this.deployFC()}><FormattedMessage id="deploy"/>!</Button>
+                                            {
+                                                this.state.couldDeploy?
+                                                    ''
+                                                    :
+                                                    <div>
+                                                        <span>if button is disabled, check your schema</span>
+                                                    </div>
+                                            }
+                                        </Col>
+                                    </Row>
+                                </div>
+                            </div>
+                        )
+                    }
+                }
+            </Query>
+
         )
     }
 }

+ 2 - 2
src/app/common/manage/Manage.jsx

@@ -1,7 +1,7 @@
 import React, {Component} from 'react';
 import {Switch, Input, Icon} from 'antd';
 
-class Result extends Component {
+class Manage extends Component {
     constructor(props) {
         super(props);
         this.state = {
@@ -34,4 +34,4 @@ class Result extends Component {
     }
 }
 
-export default Result;
+export default Manage;

+ 9 - 2
src/app/graphqlService/TrialCase.jsx

@@ -4,12 +4,14 @@ import {FormattedMessage} from 'react-intl';
 
 import GenerateJs from "./component/generateJs/GenerateJs";
 import Deploy from '../common/deploy/Deploy';
+import Manage from '../common/manage/Manage';
 import Schema from './component/schema/Schema';
 import Graphql from "./component/graphql/Graphql";
 import CaseMetabase from "./component/caseMetabase/CaseMetabase";
 import Application from "./component/application/Application";
 import axios from 'axios';
 import {getIdUrl} from "../../config";
+import classnames from 'classnames';
 
 axios.defaults.withCredentials = true;
 
@@ -22,6 +24,7 @@ class TrialCase extends Component {
             menuLevel2: "schema",
             // default user
             userID: "ioobot",
+            showPadding: true
         }
     }
 
@@ -49,6 +52,7 @@ class TrialCase extends Component {
     render() {
         let schemaID = this.props.history.location.state ? this.props.history.location.state.schemaID : "ecommerce_schemaID";
         let schemaName = this.props.history.location.state ? this.props.history.location.state.schemaName : "ecommerce";
+        let _this = this;
         return (
             <div>
                 <Menu
@@ -60,6 +64,7 @@ class TrialCase extends Component {
                 >
                     <Menu.Item key="schema"><FormattedMessage id="schema"/></Menu.Item>
                     <Menu.Item key="deploy"><FormattedMessage id="deploy"/></Menu.Item>
+                    <Menu.Item key="manage"><FormattedMessage id="manage"/></Menu.Item>
                     <Menu.Item key="graphiql"><FormattedMessage id="graphql IDE"/></Menu.Item>
                     <Menu.Item key="template"><FormattedMessage id="template"/></Menu.Item>
                     <Menu.Item key="preview"><FormattedMessage id="preview"/></Menu.Item>
@@ -68,14 +73,16 @@ class TrialCase extends Component {
 
 
                 <Layout style={{padding: '24px', zIndex: '0'}}>
-                    <Content style={{padding: '24px', minHeight: 280, background: '#fff', marginTop: '48px'}}>
+                    <Content className={classnames({'layout-content': this.state.showPadding})}>
                         {
                             (() => {
                                 switch (this.state.menuLevel2) {
                                     case 'schema':
                                         return <Schema trialcase={true} userID={this.state.userID} schemaName={schemaName} schemaID={schemaID} history={this.props.history} location={this.props.location}/>;
                                     case 'deploy':
-                                        return <Deploy trialcase={true} userID={this.state.userID} schemaID={schemaID}/>;
+                                        return <Deploy trialcase={true} userID={this.state.userID} projectID={'need fill, test use state'}/>;
+                                    case 'manage':
+                                        return <Manage/>;
                                     case 'graphiql':
                                         return <Graphql/>;
                                     case 'template':

+ 5 - 1
src/app/graphqlService/UserCreate.jsx

@@ -4,6 +4,7 @@ import {FormattedMessage} from 'react-intl';
 
 import GenerateJs from "./component/generateJs/GenerateJs";
 import Deploy from '../common/deploy/Deploy';
+import Manage from '../common/manage/Manage';
 import Schema from './component/schema/Schema';
 import Graphql from "./component/graphql/Graphql";
 import CaseMetabase from "./component/caseMetabase/CaseMetabase";
@@ -59,6 +60,7 @@ class UserCreate extends Component {
                 >
                     <Menu.Item key="schema"><FormattedMessage id="schema"/></Menu.Item>
                     <Menu.Item key="deploy"><FormattedMessage id="deploy"/></Menu.Item>
+                    <Menu.Item key="manage"><FormattedMessage id="manage"/></Menu.Item>
                     <Menu.Item key="graphiql"><FormattedMessage id="graphql IDE"/></Menu.Item>
                     <Menu.Item key="template"><FormattedMessage id="template"/></Menu.Item>
                     <Menu.Item key="metabase"><FormattedMessage id="metabase"/></Menu.Item>
@@ -73,7 +75,9 @@ class UserCreate extends Component {
                                     case 'schema':
                                         return <Schema trialcase={false} userID={this.state.userID} schemaName={schemaName} schemaID={schemaID} history={this.props.history} location={this.props.location}/>;
                                     case 'deploy':
-                                        return <Deploy trialcase={false} userID={this.state.userID} schemaID={schemaID}/>;
+                                        return <Deploy trialcase={false} userID={this.state.userID} projectID={'need fill, test use state'}/>;
+                                    case 'manage':
+                                        return <Manage/>;
                                     case 'graphiql':
                                         return <Graphql/>;
                                     case 'template':

+ 5 - 2
src/app/graphqlService/component/generateJs/GenerateJs.jsx

@@ -1,7 +1,7 @@
 import React, {Component} from 'react';
 import {FormattedMessage} from 'react-intl';
 import axios from 'axios';
-import {BackTop, Tabs, Button, Spin} from 'antd';
+import {BackTop, Tabs, Button, Spin, Alert} from 'antd';
 import saveAs from 'file-saver';
 import beautify from 'js-beautify';
 import {genJsUrl} from '../../../../config';
@@ -59,7 +59,8 @@ class GenerateJs extends Component {
         this._isMounted = true;
         let _this = this;
         let {schemaID} = this.state;
-        axios.get(`${genJsUrl}?schema=${schemaID}`)
+        axios.get(`${genJsUrl}?schema=${'schema_1544405636137_14283164'}`)
+        // axios.get(`${genJsUrl}?schema=${schemaID}`)
             .then((res) => {
                 if(this._isMounted){
                     if (res.data !== '') {
@@ -106,6 +107,8 @@ class GenerateJs extends Component {
         // console.log('mutationList',mutationList);
         return (
             <div>
+                <Alert message="online 数据库,非开发环境请移除"
+                       type="warning" banner closable style={{marginBottom: 10}}/>
                 <Tabs
                     defaultActiveKey="query"
                     tabPosition="left"

+ 1 - 1
src/app/graphqlService/component/graphql/Graphql.jsx

@@ -32,7 +32,7 @@ class Graphql extends Component {
   render() {
     return (
       <div>
-        <Alert message="下面的 graphql api 对应的是是 online 数据库"
+        <Alert message="online 数据库,非开发环境请移除"
                type="warning" banner closable/>
         <Input style={{marginTop: 10}} addonBefore="POST" defaultValue={this.state.api}
                onChange={(e) => {

+ 11 - 0
src/app/index.css

@@ -23,4 +23,15 @@
     top: 15px;
     right: 100px;
     float: right;
+}
+
+.layout-content {
+    padding: 24px;
+    min-height: 280px;
+    background: #fff;
+    margin-top: 48px;
+}
+
+.layout-content-deploy {
+    padding: 0;
 }

+ 4 - 4
src/app/wechatService/WxTrialCase.js

@@ -4,7 +4,7 @@ import {FormattedMessage} from 'react-intl';
 
 import WxConfig from "./wxConfig/WxConfig";
 import WxDeploy from "../common/deploy/Deploy";
-import WxResult from './wxResult/WxResult';
+import Manage from '../common/manage/Manage';
 
 const {Content} = Layout;
 
@@ -44,7 +44,7 @@ class WxTrialCase extends Component {
                 >
                     <Menu.Item key="wechat-config"><FormattedMessage id="config"/></Menu.Item>
                     <Menu.Item key="wechat-deploy"><FormattedMessage id="deploy"/></Menu.Item>
-                    <Menu.Item key="wechat-result"><FormattedMessage id="manage"/></Menu.Item>
+                    <Menu.Item key="wechat-manage"><FormattedMessage id="manage"/></Menu.Item>
                 </Menu>
 
                 <Layout style={{padding: '24px', zIndex: '0'}}>
@@ -55,8 +55,8 @@ class WxTrialCase extends Component {
                                     return <WxConfig defaultAppName={'ecommerce'} defaultConfigID={'ecommerce_wxConfigID'} trialcase={true} history={this.props.history} location={this.props.location}/>;
                                 case 'wechat-deploy':
                                     return <WxDeploy trialcase={true} userID={this.state.userID} configID={configID}/>;
-                                case 'wechat-result':
-                                    return <WxResult/>;
+                                case 'wechat-manage':
+                                    return <Manage/>;
                                 default:
                                     return <WxConfig/>
                             }

+ 4 - 4
src/app/wechatService/WxUserCreate.js

@@ -6,7 +6,7 @@ import {getIdUrl} from '../../config'
 
 import WxConfig from "./wxConfig/WxConfig";
 import WxDeploy from "../common/deploy/Deploy";
-import WxResult from './wxResult/WxResult';
+import Manage from '../common/manage/Manage';
 import axios from 'axios';
 import {FormattedMessage} from 'react-intl';
 axios.defaults.withCredentials = true;
@@ -65,7 +65,7 @@ class WxUserCreate extends Component {
                 >
                     <Menu.Item key="wechat-config"><FormattedMessage id="config"/></Menu.Item>
                     <Menu.Item key="wechat-deploy"><FormattedMessage id="deploy"/></Menu.Item>
-                    <Menu.Item key="wechat-result"><FormattedMessage id="result"/></Menu.Item>
+                    <Menu.Item key="wechat-manage"><FormattedMessage id="manage"/></Menu.Item>
                 </Menu>
 
                 <Layout style={{padding: '24px', zIndex: '0'}}>
@@ -76,8 +76,8 @@ class WxUserCreate extends Component {
                                     return <WxConfig history={this.props.history} location={this.props.location}/>;
                                 case 'wechat-deploy':
                                     return <WxDeploy trialcase={false} userID={this.state.userID} configID={configID}/>;
-                                case 'wechat-result':
-                                    return <WxResult/>;
+                                case 'wechat-manage':
+                                    return <Manage/>;
                                 default:
                                     return <WxConfig/>
                             }

+ 79 - 0
src/gql.js

@@ -599,6 +599,84 @@ const DELETE_WXCONFIG = `
             }
         `;
 
+const GET_PROJECT = `
+            query projectbyid($id: ID) {
+                project_by_id(id: $id) {
+                    updatedAt
+                    database_id {
+                        id
+                    }
+                    apiGWGroup_id {
+                        id
+                        groupName
+                        region
+                        frontType
+                        defaultDomain
+                        userStatus
+                        userDomain
+                    }
+                    projectName
+                    deploy_id {
+                      description
+                      updatedAt
+                      cosBucketName
+                      memorySize
+                      createdAt
+                      subnetId
+                      cosObjectName
+                      region
+                      vpcId
+                      cosBucketRegion
+                      id
+                      serviceName
+                      timeout
+                      handler
+                      functionName
+                    }
+                    id
+                    projectType
+                    cloud_id {
+                      id
+                      cloudName
+                      secretId
+                      secretKey
+                      appId
+                      createdAt
+                      updatedAt
+                    }
+                    user_id {
+                        id
+                    }
+                    wxConfig_id {
+                      updatedAt
+                      mch_id
+                      appName
+                      notify_url
+                      appSecret
+                      createdAt
+                      appID
+                      token
+                      spbill_create_ip
+                      enter_url
+                      id
+                      pay_api_key
+                      body
+                      welcome_words
+                      attach
+                    }
+                    schema_id {
+                      updatedAt
+                      schemaState
+                      createdAt
+                      schemaName
+                      reference
+                      id
+                      schemaData
+                    }
+                  }
+                }
+        `;
+
 export {
     ADD_USER,
     GET_USER,
@@ -632,4 +710,5 @@ export {
     SHOW_WXCONTENT,
     UPDATE_WXCONFIG,
     DELETE_WXCONFIG,
+    GET_PROJECT
 }