TencentDeploy.jsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import React, {Component} from 'react';
  2. import {Input, Select, Button, Row, Col} from 'antd';
  3. const Option = Select.Option;
  4. class TencentDeploy 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. switchConfig = (label) => {
  20. return (e) => {
  21. this.setState({
  22. [label]: e.target.value
  23. })
  24. };
  25. };
  26. componentWillReceiveProps(next) {
  27. this.setState({
  28. functionName: next.deploy.functionName,
  29. region: next.deploy.region,
  30. description: next.deploy.description,
  31. cosBucketName: next.deploy.cosBucketName,
  32. cosObjectName: next.deploy.cosObjectName,
  33. cosBucketRegion: next.deploy.cosBucketRegion,
  34. vpcId: next.deploy.vpcId,
  35. subnetId: next.deploy.subnetId
  36. });
  37. };
  38. render() {
  39. return (
  40. <div style={{margin: 20}}>
  41. <div onClick={this.props.reDisplayChoose} style={{marginBottom: 30}}> back to choose</div>
  42. <div>
  43. <span className='table-title'> Deploy Config</span>
  44. {
  45. this.state.configs.map(config => (
  46. <div key={config} style={{marginBottom: 10}}>
  47. <span className='vice-title'>{config}: </span>
  48. <Input value={this.state[config]} style={{width: 200}}
  49. onChange={this.switchConfig(config)}/>
  50. </div>
  51. ))
  52. }
  53. </div>
  54. </div>
  55. )
  56. }
  57. }
  58. export default TencentDeploy;