Просмотр исходного кода

修改 trialcase 的 deploy 为不能修改

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

+ 13 - 8
src/app/common/deploy/Deploy.jsx

@@ -8,20 +8,25 @@ 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 {manageUsers} from "../../../config";
 import {graphqlUrl} from "../../../config";
 
 const tabListNoTitle = [{
     key: 'tencent',
     tab: 'Tencent',
-}, {
-    key: 'aliyun',
-    tab: 'Aliyun',
-}, {
-    key: 'amazon',
-    tab: 'AWS',
 }];
 
+// [{
+//     key: 'tencent',
+//     tab: 'Tencent',
+// }, {
+//     key: 'aliyun',
+//     tab: 'Aliyun',
+// }, {
+//     key: 'amazon',
+//     tab: 'AWS',
+// }];
+
 
 class Deploy extends Component {
     constructor(props) {
@@ -248,7 +253,7 @@ class Deploy extends Component {
 
     render() {
         const contentListNoTitle = {
-            tencent: <TencentConfig cloudID={this.state.tencentCloudID} fc={this.state.tencentFC} defalutName={this.state.defalutName} userID={this.props.userID} kind={this.state.kind}/>,
+            tencent: <TencentConfig cloudID={this.state.tencentCloudID} fc={this.state.tencentFC} defalutName={this.state.defalutName} userID={this.props.userID} kind={this.state.kind} trialcase={this.props.trialcase}/>,
             aliyun: <AliConfig/>,
             amazon: <AmazonConfig/>,
         };

+ 31 - 8
src/app/common/deploy/tencent/APIGroupCard.js

@@ -4,6 +4,7 @@ import {ADD_APIGROUP, UPDATE_APIGROUP} from "../../../../gql";
 import {request} from 'graphql-request'
 import {idGen} from "../../../../func";
 import {graphqlUrl} from "../../../../config";
+import {manageUsers} from "../../../../config";
 
 const Panel = Collapse.Panel;
 
@@ -196,16 +197,38 @@ class APIGroupCard extends Component {
                         </div>
                     </Panel>
                 </Collapse>
-                <Button onClick={()=>{
-                    const id = idGen('group');
-                    this.ok(id);
-                    this.props.pass(id, 'group');
-                }} type='primary'>ok</Button>
                 {
-                    this.state.showOK === true?
-                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                    manageUsers.includes(this.props.userID)?
+                        <div>
+                            <Button onClick={()=>{
+                                const id = idGen('group');
+                                this.ok(id);
+                                this.props.pass(id, 'group');
+                            }} type='primary'>save</Button>
+                            {
+                                this.state.showOK === true?
+                                    <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                    :
+                                    ''
+                            }
+                        </div>
                         :
-                        ''
+                        this.props.trialcase?
+                            ''
+                            :
+                            <div>
+                                <Button onClick={()=>{
+                                    const id = idGen('group');
+                                    this.ok(id);
+                                    this.props.pass(id, 'group');
+                                }} type='primary'>save</Button>
+                                {
+                                    this.state.showOK === true?
+                                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                        :
+                                        ''
+                                }
+                            </div>
                 }
             </div>
         )

+ 24 - 4
src/app/common/deploy/tencent/APIPathCard.js

@@ -4,6 +4,7 @@ import {request} from 'graphql-request'
 import {ADD_APIGWPATH, UPDATE_APIGWPATH} from "../../../../gql";
 import {idGen} from "../../../../func";
 import {graphqlUrl} from "../../../../config";
+import {manageUsers} from "../../../../config";
 
 const Panel = Collapse.Panel;
 
@@ -150,13 +151,32 @@ class APIPathCard extends Component {
                         </div>
                     </Panel>
                 </Collapse>
-                <Button onClick={this.ok} type='primary'>ok</Button>
                 {
-                    this.state.showOK === true?
-                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                    manageUsers.includes(this.props.userID) ?
+                        <div>
+                            <Button onClick={this.ok} type='primary'>save</Button>
+                            {
+                                this.state.showOK === true?
+                                    <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                    :
+                                    ''
+                            }
+                        </div>
                         :
-                        ''
+                        this.props.trialcase?
+                            ''
+                            :
+                            <div>
+                                <Button onClick={this.ok} type='primary'>save</Button>
+                                {
+                                    this.state.showOK === true?
+                                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                        :
+                                        ''
+                                }
+                            </div>
                 }
+
             </div>
         )
     }

+ 33 - 11
src/app/common/deploy/tencent/DeployCard.js

@@ -4,11 +4,11 @@ import {ADD_DEPLOY, UPDATE_DEPLOY} from "../../../../gql";
 import {request} from 'graphql-request'
 import {idGen} from "../../../../func";
 import {graphqlUrl} from "../../../../config";
+import {manageUsers} from "../../../../config";
 
 const Panel = Collapse.Panel;
 
 
-
 class DeployCard extends Component {
     constructor(props) {
         super(props);
@@ -108,7 +108,7 @@ class DeployCard extends Component {
                             showOK: true
                         })
                     }
-                    setTimeout(()=>{
+                    setTimeout(() => {
                         this.setState({
                             showOK: false
                         })
@@ -136,7 +136,7 @@ class DeployCard extends Component {
                             showOK: true
                         })
                     }
-                    setTimeout(()=>{
+                    setTimeout(() => {
                         this.setState({
                             showOK: false
                         })
@@ -204,16 +204,38 @@ class DeployCard extends Component {
                         }
                     </Panel>
                 </Collapse>
-                <Button onClick={()=>{
-                    const id = idGen('deploy');
-                    this.ok(id);
-                    this.props.pass(id, 'deploy');
-                }} type='primary'>ok</Button>
                 {
-                    this.state.showOK === true?
-                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                    manageUsers.includes(this.props.userID) ?
+                        <div>
+                            <Button onClick={() => {
+                                const id = idGen('deploy');
+                                this.ok(id);
+                                this.props.pass(id, 'deploy');
+                            }} type='primary'>save</Button>
+                            {
+                                this.state.showOK === true ?
+                                    <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                    :
+                                    ''
+                            }
+                        </div>
                         :
-                        ''
+                        this.props.trialcase ?
+                            ''
+                            :
+                            <div>
+                                <Button onClick={() => {
+                                    const id = idGen('deploy');
+                                    this.ok(id);
+                                    this.props.pass(id, 'deploy');
+                                }} type='primary'>save</Button>
+                                {
+                                    this.state.showOK === true ?
+                                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                        :
+                                        ''
+                                }
+                            </div>
                 }
             </div>
         )

+ 15 - 3
src/app/common/deploy/tencent/NotificationCard.js

@@ -1,5 +1,6 @@
 import React, {Component} from 'react';
 import {Input, Tooltip, Icon, Button} from 'antd';
+import {manageUsers} from "../../../../config";
 
 class NotificationCard extends Component {
 
@@ -53,9 +54,20 @@ class NotificationCard extends Component {
                     {/*</div>*/}
                 {/*</div>*/}
 
-                <Button type="primary" onClick={() => {
-                    console.log('hello');
-                }}>save</Button>
+                {
+                    manageUsers.includes(this.props.userID) ?
+                        <Button type="primary" onClick={() => {
+                            console.log('hello');
+                        }}>save</Button>
+                        :
+                        this.props.trialcase?
+                            ''
+                            :
+                            <Button type="primary" onClick={() => {
+                                console.log('hello');
+                            }}>save</Button>
+                }
+
             </div>
         )
 

+ 5 - 5
src/app/common/deploy/tencent/TencentConfig.js

@@ -99,13 +99,13 @@ class TencentConfig extends Component {
                 <div style={{padding: '30px'}}>
                     <Row gutter={16}>
                         <Col span={14}>
-                            <Card title="Deploy" 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}/></Card>
-                            <Card title="API Group" 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}/></Card>
-                            <Card title="API Path" 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}/></Card>
-                            <Card title="Notification"><NotificationCard userID={this.props.userID}/></Card>
+                            <Card title="Deploy" 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>
+                            <Card title="API Group" 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>
+                            <Card title="API Path" 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>
+                            <Card title="Notification"><NotificationCard userID={this.props.userID} trialcase={this.props.trialcase}/></Card>
                         </Col>
                         <Col offset={2} span={6}>
-                            <Button type='primary'>deploy it</Button>
+                            <Button type='primary'>deploy!</Button>
                         </Col>
                     </Row>
                 </div>

+ 1 - 1
src/app/graphqlService/TrialCase.jsx

@@ -74,7 +74,7 @@ class TrialCase extends Component {
                                     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 userID={this.state.userID} schemaID={schemaID}/>;
+                                        return <Deploy trialcase={true} userID={this.state.userID} schemaID={schemaID}/>;
                                     case 'graphiql':
                                         return <Graphql/>;
                                     case 'templeate':

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

@@ -72,7 +72,7 @@ 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 userID={this.state.userID} schemaID={schemaID}/>;
+                                        return <Deploy trialcase={false} userID={this.state.userID} schemaID={schemaID}/>;
                                     case 'graphiql':
                                         return <Graphql/>;
                                     case 'template':

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

@@ -54,7 +54,7 @@ class WxTrialCase extends Component {
                                 case 'wechat-config':
                                     return <WxConfig defaultAppName={'ecommerce'} defaultConfigID={'ecommerce_wxConfigID'} trialcase={true} history={this.props.history} location={this.props.location}/>;
                                 case 'wechat-deploy':
-                                    return <WxDeploy userID={this.state.userID} configID={configID}/>;
+                                    return <WxDeploy trialcase={true} userID={this.state.userID} configID={configID}/>;
                                 case 'wechat-result':
                                     return <WxResult/>;
                                 default:

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

@@ -75,7 +75,7 @@ class WxUserCreate extends Component {
                                 case 'wechat-config':
                                     return <WxConfig history={this.props.history} location={this.props.location}/>;
                                 case 'wechat-deploy':
-                                    return <WxDeploy userID={this.state.userID} configID={configID}/>;
+                                    return <WxDeploy trialcase={false} userID={this.state.userID} configID={configID}/>;
                                 case 'wechat-result':
                                     return <WxResult/>;
                                 default: