xy 7 年 前
コミット
e7c33e5cca

+ 22 - 27
src/app/common/deploy/tencent/TencentConfig.js

@@ -45,7 +45,7 @@ class TencentConfig extends Component {
                             this.setState({
                                 currentStep: 5,
                                 stepAllShow: true,
-                                deploying: 'finished'
+                                deploying: 'deployed'
                             });
                             break;
                         case 'notificationed':
@@ -77,6 +77,7 @@ class TencentConfig extends Component {
                             this.setState({
                                 stepUpdated: true,
                                 stepAllShow: true,
+                                deploying: 'updated'
                             });
                             break;
                         case 'deploying':
@@ -122,7 +123,7 @@ class TencentConfig extends Component {
                     switch (dataProject.projectStatus) {
                         case 'deployed':
                             this.setState({
-                                deploying: 'finished',
+                                deploying: 'deployed',
                                 currentStep: 5,
                                 stepAllShow: true
                             });
@@ -156,6 +157,7 @@ class TencentConfig extends Component {
                             this.setState({
                                 stepUpdated: true,
                                 stepAllShow: true,
+                                deploying: 'updated'
                             });
                             break;
                         case 'deploying':
@@ -227,7 +229,7 @@ class TencentConfig extends Component {
                                         .then((res) => {
                                             console.log('deploy res', res);
                                             this.setState({
-                                                deploying: 'finished'
+                                                deploying: 'deployed'
                                             });
 
                                             // 给 project 加 deployed 状态
@@ -300,19 +302,6 @@ class TencentConfig extends Component {
                         :
                         ''
                 }
-                {
-                    this.state.stepUpdated ?
-
-                            this.props.trialcase ?
-                                ''
-                                :
-                                <div style={{marginBottom: 10}}>
-                                    <Alert message="进行了一次修改,未能确认是否完成" type="warning"
-                                           banner closable/>
-                                </div>
-                        :
-                        ''
-                }
                 <div style={{padding: '30px'}}>
                     <Row gutter={16}>
                         <Col span={14}>
@@ -443,20 +432,26 @@ class TencentConfig extends Component {
                         }
 
                         {
-                            this.state.deploying === 'deploying' ?
-                                <div>
-                                    <Spin size="large"/>
-                                    <div><b>大约需要等待 30s</b></div>
-                                </div>
+                            this.props.trialcase ?
+                                <Progress type="circle" percent={100}/>
                                 :
-                                this.state.deploying === 'finished' ?
-                                    <Progress type="circle" percent={100}/>
+                                this.state.deploying === 'deploying' ?
+                                    <div>
+                                        <Spin size="large"/>
+                                        &nbsp;&nbsp;
+                                        <span><b>大约需要等待 30s</b></span>
+                                    </div>
                                     :
-                                    this.state.deploying === 'error' ?
-                                        <Progress type="circle" percent={99}
-                                                  status="exception"/>
+                                    this.state.deploying === 'deployed' ?
+                                        <Progress type="circle" percent={100}/>
                                         :
-                                        ''
+                                        this.state.deploying === 'error' ?
+                                            <Progress type="circle" percent={99} status="exception"/>
+                                            :
+                                            this.state.deploying === 'updated' ?
+                                                <Button type='primary' onClick={this.deployFC}><FormattedMessage id="redeploy"/>!</Button>
+                                                :
+                                                ''
                         }
 
                     </Row>

+ 2 - 1
src/app/common/deploy/tencent/apiGroupCard/APIGroupCardFetch.js

@@ -30,7 +30,7 @@ class APIGroupCardFetch extends Component {
                             cloudID = 'tencent_CloudID';
 
                         let dataProject = data.project_by_id;
-                        let {cloud_id, apiGWGroup_id, projectName} = dataProject;
+                        let {cloud_id, apiGWGroup_id, projectName, projectStatus} = dataProject;
 
                         if (cloud_id !== null && cloud_id.cloudName === 'tencent') {
                             group = apiGWGroup_id;
@@ -56,6 +56,7 @@ class APIGroupCardFetch extends Component {
                                 defalutName={removeSpace(projectName)}
                                 group={group}
                                 cloudID={cloudID}
+                                projectStatus={projectStatus}
                             />
                         )
                     }

+ 4 - 4
src/app/common/deploy/tencent/apiGroupCard/APIGroupCardRender.js

@@ -104,7 +104,7 @@ class APIGroupCardRender extends Component {
         };
     };
 
-    ok = (id, userID, projectID, cloudID, group) => {
+    ok = (id, userID, projectID, cloudID, group, projectStatus) => {
         let {userStatus, userDomain, groupName, groupRegion, frontType, environmentName} = this.state;
         let region = shiftPrefix('ap-', groupRegion);
         let varObj = {
@@ -170,7 +170,7 @@ class APIGroupCardRender extends Component {
                         request(graphqlUrl, UPDATE_PROJECT_ONLY_STATUS, {
                             id: projectID,
                             updatedAt: new Date().getTime(),
-                            projectStatus: 'updated'
+                            projectStatus: projectStatus === 'deployed' ? 'updated': 'grouped'
                         }).then(data => {
                             if(data.update_project !== null)
                                 this.props.stepByStep(2);
@@ -351,7 +351,7 @@ class APIGroupCardRender extends Component {
                                 }
                                 <Button onClick={() => {
                                     const id = idGen('group');
-                                    this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.group);
+                                    this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.group, this.props.projectStatus);
                                 }} type='primary'><FormattedMessage id="save"/></Button>
                             </div>
                             {
@@ -376,7 +376,7 @@ class APIGroupCardRender extends Component {
                                     }
                                     <Button onClick={() => {
                                         const id = idGen('group');
-                                        this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.group);
+                                        this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.group, this.props.projectStatus);
                                     }} type='primary'><FormattedMessage id="save"/></Button>
                                 </div>
                                 {

+ 2 - 1
src/app/common/deploy/tencent/apiPathCard/APIPathCardFetch.js

@@ -31,7 +31,7 @@ class APIPathCardFetch extends Component {
                             path = '';
 
                         let dataProject = data.project_by_id;
-                        let {cloud_id, apiGWGroup_id, deploy_id, projectName} = dataProject;
+                        let {cloud_id, apiGWGroup_id, deploy_id, projectName, projectStatus} = dataProject;
 
                         if (cloud_id !== null && cloud_id.cloudName === 'tencent') {
                             group = apiGWGroup_id;
@@ -68,6 +68,7 @@ class APIPathCardFetch extends Component {
                                                 // query2
                                                 defalutName={removeSpace(projectName)}
                                                 path={path}
+                                                projectStatus={projectStatus}
                                             />
                                         )
                                     }

+ 4 - 4
src/app/common/deploy/tencent/apiPathCard/APIPathCardRender.js

@@ -78,7 +78,7 @@ class APIPathCardRender extends Component {
         };
     };
 
-    ok = (id, userID, projectID, groupID, deployID, path) => {
+    ok = (id, userID, projectID, groupID, deployID, path, projectStatus) => {
         let {apiGWName, apiGWDesc, requestMethod} = this.state;
         let varObj = {
             id,
@@ -140,7 +140,7 @@ class APIPathCardRender extends Component {
                         request(graphqlUrl, UPDATE_PROJECT_ONLY_STATUS, {
                             id: projectID,
                             updatedAt: new Date().getTime(),
-                            projectStatus: 'updated'
+                            projectStatus: projectStatus === 'deployed' ? 'updated': 'pathed'
                         }).then(data => {
                             if(data.update_project !== null)
                                 this.props.stepByStep(3);
@@ -243,7 +243,7 @@ class APIPathCardRender extends Component {
                                 }
                                 <Button onClick={()=>{
                                     const id = idGen('path');
-                                    this.ok(id, this.props.userID, this.props.projectID, this.props.groupID, this.props.deployID, this.props.path);
+                                    this.ok(id, this.props.userID, this.props.projectID, this.props.groupID, this.props.deployID, this.props.path, this.props.projectStatus);
                                 }} type='primary'><FormattedMessage id="save"/></Button>
                             </div>
                             {
@@ -267,7 +267,7 @@ class APIPathCardRender extends Component {
                                     }
                                     <Button onClick={()=>{
                                         const id = idGen('path');
-                                        this.ok(id, this.props.userID, this.props.projectID, this.props.groupID, this.props.deployID, this.props.path);
+                                        this.ok(id, this.props.userID, this.props.projectID, this.props.groupID, this.props.deployID, this.props.path, this.props.projectStatus);
                                     }} type='primary'><FormattedMessage id="save"/></Button>
                                 </div>
                                 {

+ 2 - 1
src/app/common/deploy/tencent/deployCard/DeployCardFetch.js

@@ -40,7 +40,7 @@ class DeployCardFetch extends Component {
                             cloudID = 'tencent_CloudID';
 
                         let dataProject = data.project_by_id;
-                        let {cloud_id, deploy_id, projectName} = dataProject;
+                        let {cloud_id, deploy_id, projectName, projectStatus} = dataProject;
 
                         if (cloud_id !== null && cloud_id.cloudName === 'tencent') {
                             deploy = deploy_id;
@@ -61,6 +61,7 @@ class DeployCardFetch extends Component {
                                 defalutName={removeSpace(projectName)}
                                 deploy={deploy}
                                 cloudID={cloudID}
+                                projectStatus={projectStatus}
                             />
                         )
                     }

+ 4 - 4
src/app/common/deploy/tencent/deployCard/DeployCardRender.js

@@ -124,7 +124,7 @@ class DeployCardRender extends Component {
         };
     };
 
-    ok = (id, userID, projectID, cloudID, deploy) => {
+    ok = (id, userID, projectID, cloudID, deploy, projectStatus) => {
         let {description, cosBucketName, subnetId, cosObjectName, region, vpcId, cosBucketRegion, functionName} = this.state;
         let varObj = {
             id,
@@ -195,7 +195,7 @@ class DeployCardRender extends Component {
                         request(graphqlUrl, UPDATE_PROJECT_ONLY_STATUS, {
                             id: projectID,
                             updatedAt: new Date().getTime(),
-                            projectStatus: 'updated'
+                            projectStatus: projectStatus === 'deployed' ? 'updated': 'functioned'
                         }).then(data => {
                             if(data.update_project !== null)
                                 this.props.stepByStep(1);
@@ -376,7 +376,7 @@ class DeployCardRender extends Component {
                             <div>
                                 <Button onClick={() => {
                                     const id = idGen('deploy');
-                                    this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.deploy);
+                                    this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.deploy, this.props.projectStatus);
                                 }} type='primary'><FormattedMessage id="save"/></Button>
                                 {
                                     this.state.showOK === true ?
@@ -392,7 +392,7 @@ class DeployCardRender extends Component {
                                 <div>
                                     <Button onClick={() => {
                                         const id = idGen('deploy');
-                                        this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.deploy);
+                                        this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.deploy, this.props.projectStatus);
                                     }} type='primary'><FormattedMessage id="save"/></Button>
                                     {
                                         this.state.showOK === true ?

+ 3 - 1
src/app/common/deploy/tencent/notificationCard/NotificationCardFetch.js

@@ -5,6 +5,7 @@ import {Query} from "react-apollo";
 import gql from "graphql-tag";
 import {removeSpace} from "../../../../../func";
 import NotificationCardRender from './NotificationCardRender';
+import DeployCardRender from "../deployCard/DeployCardRender";
 
 class NotificationCardFetch extends Component {
     render() {
@@ -21,7 +22,7 @@ class NotificationCardFetch extends Component {
 
 
                         let dataProject = data.project_by_id;
-                        let {projectName} = dataProject;
+                        let {projectName, projectStatus} = dataProject;
 
                         let notification = dataProject.notification_id || '';
 
@@ -37,6 +38,7 @@ class NotificationCardFetch extends Component {
                                 // query
                                 notification={notification}
                                 defaultName={removeSpace(projectName)}
+                                projectStatus={projectStatus}
                             />
                         )
                     }

+ 4 - 4
src/app/common/deploy/tencent/notificationCard/NotificationCardRender.js

@@ -58,7 +58,7 @@ class NotificationCardFetch extends Component {
         }
     }
 
-    ok = (id, userID, projectID, notification) => {
+    ok = (id, userID, projectID, notification, projectStatus) => {
         let {type, webhook, name} = this.state;
         let varObj = {
             id,
@@ -112,7 +112,7 @@ class NotificationCardFetch extends Component {
                         request(graphqlUrl, UPDATE_PROJECT_ONLY_STATUS, {
                             id: projectID,
                             updatedAt: new Date().getTime(),
-                            projectStatus: 'updated'
+                            projectStatus: projectStatus === 'deployed' ? 'updated': 'notificationed'
                         }).then(data => {
                             if (data.update_project !== null)
                                 this.props.stepByStep(4);
@@ -211,7 +211,7 @@ class NotificationCardFetch extends Component {
                                 }
                                 <Button type="primary" onClick={() => {
                                     const id = idGen('notification');
-                                    this.ok(id, this.props.userID, this.props.projectID, this.props.notification);
+                                    this.ok(id, this.props.userID, this.props.projectID, this.props.notification, this.props.projectStatus);
                                 }}><FormattedMessage id="save"/></Button>
                             </div>
 
@@ -228,7 +228,7 @@ class NotificationCardFetch extends Component {
                                     }
                                     <Button type="primary" onClick={() => {
                                         const id = idGen('notification');
-                                        this.ok(id, this.props.userID, this.props.projectID, this.props.notification);
+                                        this.ok(id, this.props.userID, this.props.projectID, this.props.notification, this.props.projectStatus);
                                     }}><FormattedMessage id="save1"/></Button>
                                 </div>
                     }

+ 4 - 1
src/language/en_US.js

@@ -8,6 +8,7 @@ const en_US = {
     "Monitor Notification":"Monitor Notification",
     "schema":"schema",
     "deploy":"deploy",
+    "redeploy":"re-deploy",
     "graphql IDE":"graphql IDE",
     "template":"template",
     "preview":"preview",
@@ -92,6 +93,7 @@ const en_US = {
     "cloud setting":"cloud setting",
     "save":"save",
     "save1":"complete",
+    "save2":"next",
     "cancel":"cancel",
     "modify":"modify",
     "exit":"exit",
@@ -145,6 +147,7 @@ const en_US = {
     'spbill_create_ip': 'spbill_create ip',
     'notify_url': 'notify url',
 
-    'previous-step': 'previous'
+    'previous-step': 'previous',
+    "next-step":"next",
 };
 export default en_US;

+ 4 - 1
src/language/zh_CN.js

@@ -8,6 +8,7 @@ const zh_CN = {
     "Monitor Notification":"监控通知",
     "schema":"表结构",
     "deploy":"一键部署",
+    "redeploy":"重新部署",
     "graphql IDE":"编辑器",
     "template":"模板语句",
     "preview":"展示",
@@ -92,6 +93,7 @@ const zh_CN = {
     "cloud setting":"云授权设置",
     "save":"保存",
     "save1":"完成",
+    "save2":"下一步",
     "cancel":"取消",
     "modify":"修改",
     "exit":"退出",
@@ -150,6 +152,7 @@ const zh_CN = {
     'appointment template': '预约模板',
     'account template': '记账模板',
 
-    'previous-step': '上一步'
+    'previous-step': '上一步',
+    "next-step":"下一步",
 };
 export default zh_CN;