瀏覽代碼

增加上一步,移出必填项

xy 7 年之前
父節點
當前提交
1618d0e4f7

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

@@ -123,7 +123,7 @@ class APIGroupCardRender extends Component {
             createdAt: new Date().getTime(),
             updatedAt: ''
         };
-        if (group === '') {
+        if (group === '' || group === null) {
             request(graphqlUrl, ADD_APIGROUP, varObj).then(
                 data => {
                     if (data.create_apiGWGroup !== null) {
@@ -266,11 +266,7 @@ class APIGroupCardRender extends Component {
                         <Radio.Button value="release"><FormattedMessage id="release"/></Radio.Button>
                     </Radio.Group>
                 </div>
-                <Collapse bordered={false}>
-                    <Panel header={<FormattedMessage id="Want more options?"/>}
-                           style={customPanelStyle}>
-
-                        <div style={{marginBottom: 10}}>
+                <div style={{marginBottom: 10}}>
                             <span className='vice-title'>
                                 {
                                     youMustFill['frontType'] ?
@@ -288,14 +284,17 @@ class APIGroupCardRender extends Component {
                                     <Icon type="question-circle"/>
                                 </Tooltip>
                             </span>
-                            <Radio.Group onChange={this.switchConfig('frontType')}
-                                         defaultValue={this.state.frontType}
-                                         buttonStyle="solid">
-                                <Radio.Button value="http">http</Radio.Button>
-                                <Radio.Button value="https">https</Radio.Button>
-                                <Radio.Button value="http&https">http&https</Radio.Button>
-                            </Radio.Group>
-                        </div>
+                    <Radio.Group onChange={this.switchConfig('frontType')}
+                                 defaultValue={this.state.frontType}
+                                 buttonStyle="solid">
+                        <Radio.Button value="http">http</Radio.Button>
+                        <Radio.Button value="https">https</Radio.Button>
+                        <Radio.Button value="http&https">http&https</Radio.Button>
+                    </Radio.Group>
+                </div>
+                <Collapse bordered={false}>
+                    <Panel header={<FormattedMessage id="Want more options?"/>}
+                           style={customPanelStyle}>
                         {/*<div style={{marginBottom: 10}}>*/}
                         {/*<span className='vice-title'>{valueToKey['defaultDomain']}*/}
                         {/*&nbsp;*/}
@@ -341,6 +340,9 @@ class APIGroupCardRender extends Component {
                 {
                     manageUsers.includes(this.props.userID) ?
                         <div>
+                            <Button onClick={()=>{
+                                this.props.stepByStep(0)
+                            }}><FormattedMessage id="previous-step"/></Button>
                             <Button onClick={() => {
                                 const id = idGen('group');
                                 this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.group);
@@ -357,6 +359,9 @@ class APIGroupCardRender extends Component {
                             ''
                             :
                             <div>
+                                <Button onClick={()=>{
+                                    this.props.stepByStep(0)
+                                }}><FormattedMessage id="previous-step"/></Button>
                                 <Button onClick={() => {
                                     const id = idGen('group');
                                     this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.group);

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

@@ -35,7 +35,7 @@ class APIPathCardRender extends Component {
         if(props.path !== '' && props.path !== null) {
             let {apiGWName, apiGWDesc, requestMethod} = props.path;
             this.state = {
-                configs: ['apiGWName', 'apiGWDesc'],
+                configs: ['apiGWDesc'],
                 showOK: false,
                 apiGWName,
                 apiGWDesc,
@@ -43,7 +43,7 @@ class APIPathCardRender extends Component {
             }
         } else {
             this.state = {
-                configs: ['apiGWName', 'apiGWDesc'],
+                configs: ['apiGWDesc'],
                 showOK: false,
                 apiGWName: props.defalutName,
                 apiGWDesc: '',
@@ -95,7 +95,7 @@ class APIPathCardRender extends Component {
             createdAt: new Date().getTime(),
             updatedAt: ''
         };
-        if (path === '') {
+        if (path === '' || path === null) {
             if (deployID !== '' && groupID !== '' && deployID !== null && groupID !== null) {
                 request(graphqlUrl, ADD_APIGWPATH, varObj).then(
                     data => {
@@ -167,30 +167,24 @@ class APIPathCardRender extends Component {
 
         return (
             <div>
-                <Collapse bordered={false}>
-                    <Panel header={<FormattedMessage id="Want more options?"/>} style={customPanelStyle}>
-                        {
-                            this.state.configs.map(config => (
-                                <div key={config} style={{marginBottom: 10}}>
+                <div key={'apiGWName'} style={{marginBottom: 10}}>
                                     <span className='vice-title'>
                                         {
-                                            youMustFill[config]?
+                                            youMustFill['apiGWName']?
                                                 <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
                                                 :
                                                 ''
                                         }
-                                        <FormattedMessage id={valueToKey[config]}/>
+                                        <FormattedMessage id={valueToKey['apiGWName']}/>
                                         &nbsp;
-                                        <Tooltip placement="top" title={toolTipTitle[config]}>
+                                        <Tooltip placement="top" title={toolTipTitle['apiGWName']}>
                                             <Icon type="question-circle"/>
                                         </Tooltip>
                                     </span>
-                                    <Input value={this.state[config]} style={{width: 200}}
-                                           onChange={this.switchConfig(config)}/>
-                                </div>
-                            ))
-                        }
-                        <div style={{marginBottom: 10}}>
+                    <Input value={this.state.apiGWName} style={{width: 200}}
+                           onChange={this.switchConfig('apiGWName')}/>
+                </div>
+                <div style={{marginBottom: 10}}>
                             <span className='vice-title'>
                                 {
                                     youMustFill['requestMethod']?
@@ -204,18 +198,45 @@ class APIPathCardRender extends Component {
                                     <Icon type="question-circle"/>
                                 </Tooltip>
                             </span>
-                            <Radio.Group onChange={this.switchConfig('requestMethod')}
-                                         defaultValue={this.state.requestMethod}
-                                         buttonStyle="solid">
-                                <Radio.Button value="GET">get</Radio.Button>
-                                <Radio.Button value="POST">post</Radio.Button>
-                            </Radio.Group>
-                        </div>
+                    <Radio.Group onChange={this.switchConfig('requestMethod')}
+                                 defaultValue={this.state.requestMethod}
+                                 buttonStyle="solid">
+                        <Radio.Button value="GET">get</Radio.Button>
+                        <Radio.Button value="POST">post</Radio.Button>
+                    </Radio.Group>
+                </div>
+                <Collapse bordered={false}>
+                    <Panel header={<FormattedMessage id="Want more options?"/>} style={customPanelStyle}>
+                        {
+                            this.state.configs.map(config => (
+                                <div key={config} style={{marginBottom: 10}}>
+                                    <span className='vice-title'>
+                                        {
+                                            youMustFill[config]?
+                                                <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                                :
+                                                ''
+                                        }
+                                        <FormattedMessage id={valueToKey[config]}/>
+                                        &nbsp;
+                                        <Tooltip placement="top" title={toolTipTitle[config]}>
+                                            <Icon type="question-circle"/>
+                                        </Tooltip>
+                                    </span>
+                                    <Input value={this.state[config]} style={{width: 200}}
+                                           onChange={this.switchConfig(config)}/>
+                                </div>
+                            ))
+                        }
+
                     </Panel>
                 </Collapse>
                 {
                     manageUsers.includes(this.props.userID) ?
                         <div>
+                            <Button onClick={()=>{
+                                this.props.stepByStep(1)
+                            }}><FormattedMessage id="previous-step"/></Button>
                             <Button onClick={()=>{
                                 const id = idGen('path');
                                 this.ok(id, this.props.userID, this.props.projectID, this.props.groupID, this.props.deployID, this.props.path);
@@ -232,6 +253,9 @@ class APIPathCardRender extends Component {
                             ''
                             :
                             <div>
+                                <Button onClick={()=>{
+                                    this.props.stepByStep(1)
+                                }}><FormattedMessage id="previous-step"/></Button>
                                 <Button onClick={()=>{
                                     const id = idGen('path');
                                     this.ok(id, this.props.userID, this.props.projectID, this.props.groupID, this.props.deployID, this.props.path);

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

@@ -59,7 +59,7 @@ class DeployCardRender extends Component {
         if(props.deploy !== '' && props.deploy !== null) {
             let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId, region, description} = props.deploy;
             this.state = {
-                configs: ['cosBucketName', 'cosObjectName', 'description', 'vpcId', 'subnetId'],
+                configs: ['description', 'vpcId', 'subnetId'],
                 description,
                 showOK: false,
                 functionName,
@@ -73,7 +73,7 @@ class DeployCardRender extends Component {
             }
         } else {
             this.state = {
-                configs: ['cosBucketName', 'cosObjectName', 'description', 'vpcId', 'subnetId'],
+                configs: ['description', 'vpcId', 'subnetId'],
                 description: '',
                 showOK: false,
                 functionName: props.defalutName,
@@ -274,9 +274,7 @@ class DeployCardRender extends Component {
                         <Radio.Button value="chengdu"><FormattedMessage id="Chengdu"/></Radio.Button>
                     </Radio.Group>
                 </div>
-                <Collapse bordered={false}>
-                    <Panel header={<FormattedMessage id="Want more options?"/>} style={customPanelStyle}>
-                        <div style={{marginBottom: 10}}>
+                <div style={{marginBottom: 10}}>
                                     <span className='vice-title'>
                                 {
                                     youMustFill['cosBucketRegion']?
@@ -290,18 +288,57 @@ class DeployCardRender extends Component {
                                     <Icon type="question-circle"/>
                                 </Tooltip>
                             </span>
-                            <Radio.Group onChange={(e) => {
-                                // 如果不想一变所有都变,就将 onchange 改成
-                                // onChange={this.switchConfig('cosBucketRegion')}
-                                this.props.switchRegion(e);
-                            }} defaultValue={this.state.region}
-                                         value={removePrefix('ap-', this.state.cosBucketRegion)} buttonStyle="solid">
-                                <Radio.Button value="guangzhou"><FormattedMessage id="Guangzhou"/></Radio.Button>
-                                <Radio.Button value="shanghai"><FormattedMessage id="Shanghai"/></Radio.Button>
-                                <Radio.Button value="beijing"><FormattedMessage id="Beijing"/></Radio.Button>
-                                <Radio.Button value="chengdu"><FormattedMessage id="Chengdu"/></Radio.Button>
-                            </Radio.Group>
-                        </div>
+                    <Radio.Group onChange={(e) => {
+                        // 如果不想一变所有都变,就将 onchange 改成
+                        // onChange={this.switchConfig('cosBucketRegion')}
+                        this.props.switchRegion(e);
+                    }} defaultValue={this.state.region}
+                                 value={removePrefix('ap-', this.state.cosBucketRegion)} buttonStyle="solid">
+                        <Radio.Button value="guangzhou"><FormattedMessage id="Guangzhou"/></Radio.Button>
+                        <Radio.Button value="shanghai"><FormattedMessage id="Shanghai"/></Radio.Button>
+                        <Radio.Button value="beijing"><FormattedMessage id="Beijing"/></Radio.Button>
+                        <Radio.Button value="chengdu"><FormattedMessage id="Chengdu"/></Radio.Button>
+                    </Radio.Group>
+                </div>
+                <div key={'cosBucketName'} style={{marginBottom: 10}}>
+                                    <span className='vice-title'>
+                                        {
+                                            youMustFill['cosBucketName']?
+                                                <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                                :
+                                                ''
+                                        }
+                                        <FormattedMessage id={valueToKey['cosBucketName']}/>
+                                        &nbsp;
+                                        <Tooltip placement="top" title={toolTipTitle['cosBucketName']}>
+                                            <Icon type="question-circle"/>
+                                        </Tooltip>
+                                    </span>
+                    <Input value={this.state.cosBucketName} style={{width: 200}}
+                           disabled={disable['cosBucketName'] === true}
+                           onChange={this.switchConfig('cosBucketName')}/>
+                </div>
+                <div key={'cosObjectName'} style={{marginBottom: 10}}>
+                                    <span className='vice-title'>
+                                        {
+                                            youMustFill['cosObjectName']?
+                                                <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                                :
+                                                ''
+                                        }
+                                        <FormattedMessage id={valueToKey['cosObjectName']}/>
+                                        &nbsp;
+                                        <Tooltip placement="top" title={toolTipTitle['cosObjectName']}>
+                                            <Icon type="question-circle"/>
+                                        </Tooltip>
+                                    </span>
+                    <Input value={this.state.cosBucketName} style={{width: 200}}
+                           disabled={disable['cosObjectName'] === true} addonAfter=".jar"
+                           onChange={this.switchConfig('cosObjectName')}/>
+                </div>
+                <Collapse bordered={false}>
+                    <Panel header={<FormattedMessage id="Want more options?"/>} style={customPanelStyle}>
+
                         {/*腾讯云为空字符串,不显示,这里未作区分*/}
                         {/*<div style={{marginBottom: 10}}>*/}
                         {/*<span className='vice-title'>{valueToKey['serviceName']}*/}

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

@@ -69,7 +69,7 @@ class NotificationCardFetch extends Component {
             createdAt: new Date().getTime(),
             updatedAt: ''
         };
-        if (notification === '') {
+        if (notification === '' || notification === null) {
             request(graphqlUrl, ADD_NOTIFICATION, varObj).then(
                 data => {
                     if (data.create_notification !== null) {
@@ -206,18 +206,29 @@ class NotificationCardFetch extends Component {
                 <div>
                     {
                         manageUsers.includes(this.props.userID) ?
-                            <Button type="primary" onClick={() => {
-                                const id = idGen('notification');
-                                this.ok(id, this.props.userID, this.props.projectID, this.props.notification);
-                            }}><FormattedMessage id="save"/></Button>
-                            :
-                            this.props.trialcase ?
-                                ''
-                                :
+                            <div>
+                                <Button onClick={()=>{
+                                    this.props.stepByStep(2)
+                                }}><FormattedMessage id="previous-step"/></Button>
                                 <Button type="primary" onClick={() => {
                                     const id = idGen('notification');
                                     this.ok(id, this.props.userID, this.props.projectID, this.props.notification);
                                 }}><FormattedMessage id="save"/></Button>
+                            </div>
+
+                            :
+                            this.props.trialcase ?
+                                ''
+                                :
+                                <div>
+                                    <Button onClick={()=>{
+                                        this.props.stepByStep(2)
+                                    }}><FormattedMessage id="previous-step"/></Button>
+                                    <Button type="primary" onClick={() => {
+                                        const id = idGen('notification');
+                                        this.ok(id, this.props.userID, this.props.projectID, this.props.notification);
+                                    }}><FormattedMessage id="save"/></Button>
+                                </div>
                     }
                 </div>
             </div>

+ 2 - 0
src/language/en_US.js

@@ -143,5 +143,7 @@ const en_US = {
     'body': 'body',
     'spbill_create_ip': 'spbill_create ip',
     'notify_url': 'notify url',
+
+    'previous-step': 'previous'
 };
 export default en_US;

+ 2 - 0
src/language/zh_CN.js

@@ -148,5 +148,7 @@ const zh_CN = {
     'e-commerce': '标准电商',
     'appointment template': '预约模板',
     'account template': '记账模板',
+
+    'previous-step': '上一步'
 };
 export default zh_CN;