TencentConfig.jsx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import React, {Component} from 'react';
  2. import {Input, Select, Button, Row, Col} from 'antd';
  3. const Option = Select.Option;
  4. class TencentConfig extends Component {
  5. constructor(props) {
  6. super(props);
  7. this.state = {
  8. configs: ['functionName', 'region', 'description', 'cosBucketName', 'cosObjectName', 'cosBucketRegion', 'vpcId', 'subnetId'],
  9. functionName: props.deploy.functionName,
  10. region: props.deploy.region,
  11. description: props.deploy.description,
  12. cosBucketName: props.deploy.cosBucketName,
  13. cosObjectName: props.deploy.cosObjectName,
  14. cosBucketRegion: props.deploy.cosBucketRegion,
  15. vpcId: props.deploy.vpcId,
  16. subnetId: props.deploy.subnetId
  17. };
  18. }
  19. switchCS = (value) => {
  20. this.setState({
  21. cloudServer: value
  22. })
  23. };
  24. switchConfig = (label) => {
  25. return (e) => {
  26. this.setState({
  27. [label]: e.target.value
  28. })
  29. };
  30. };
  31. switchDataBase = (value) => {
  32. this.setState({
  33. database: value
  34. })
  35. };
  36. componentWillReceiveProps(next) {
  37. this.setState({
  38. functionName: next.deploy.functionName,
  39. region: next.deploy.region,
  40. description: next.deploy.description,
  41. cosBucketName: next.deploy.cosBucketName,
  42. cosObjectName: next.deploy.cosObjectName,
  43. cosBucketRegion: next.deploy.cosBucketRegion,
  44. vpcId: next.deploy.vpcId,
  45. subnetId: next.deploy.subnetId
  46. });
  47. };
  48. render() {
  49. return (
  50. <div style={{margin: 20}}>
  51. <div onClick={this.props.reDisplayChoose} style={{marginBottom: 30}}> back to choose</div>
  52. <div>
  53. <span className='table-title'> Cloud Config</span>
  54. {/*<p><b>Other configs</b></p>*/}
  55. {
  56. this.state.configs.map(config => (
  57. <div key={config} style={{marginBottom: 10}}>
  58. <span className='vice-title'>{config}: </span>
  59. <Input value={this.state[config]} style={{width: 200}}
  60. onChange={this.switchConfig(config)}/>
  61. </div>
  62. ))
  63. }
  64. </div>
  65. </div>
  66. )
  67. }
  68. }
  69. export default TencentConfig;