|
@@ -8,10 +8,15 @@ class TencentConfig extends Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
super(props);
|
|
super(props);
|
|
|
this.state = {
|
|
this.state = {
|
|
|
- configs: ['region', 'bucket-name', 'cos-name', 'fn-name', 'vpc-id', 'subnet-id', 'handler', 'description', 'memory-size', 'timeout'],
|
|
|
|
|
- name: props.config.name,
|
|
|
|
|
- cloudServer: props.config.cloudServer,
|
|
|
|
|
- database: props.config.database,
|
|
|
|
|
|
|
+ configs: ['functionName', 'region', 'description', 'cosBucketName', 'cosObjectName', 'cosBucketRegion', 'vpcId', 'subnetId'],
|
|
|
|
|
+ functionName: props.deploy.functionName,
|
|
|
|
|
+ region: props.deploy.region,
|
|
|
|
|
+ description: props.deploy.description,
|
|
|
|
|
+ cosBucketName: props.deploy.cosBucketName,
|
|
|
|
|
+ cosObjectName: props.deploy.cosObjectName,
|
|
|
|
|
+ cosBucketRegion: props.deploy.cosBucketRegion,
|
|
|
|
|
+ vpcId: props.deploy.vpcId,
|
|
|
|
|
+ subnetId: props.deploy.subnetId
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -37,56 +42,28 @@ class TencentConfig extends Component {
|
|
|
|
|
|
|
|
componentWillReceiveProps(next) {
|
|
componentWillReceiveProps(next) {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
- name: next.config.name,
|
|
|
|
|
- cloudServer: next.config.cloudServer,
|
|
|
|
|
- database: next.config.database
|
|
|
|
|
|
|
+ functionName: next.deploy.functionName,
|
|
|
|
|
+ region: next.deploy.region,
|
|
|
|
|
+ description: next.deploy.description,
|
|
|
|
|
+ cosBucketName: next.deploy.cosBucketName,
|
|
|
|
|
+ cosObjectName: next.deploy.cosObjectName,
|
|
|
|
|
+ cosBucketRegion: next.deploy.cosBucketRegion,
|
|
|
|
|
+ vpcId: next.deploy.vpcId,
|
|
|
|
|
+ subnetId: next.deploy.subnetId
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
return (
|
|
return (
|
|
|
<div style={{margin: 20}}>
|
|
<div style={{margin: 20}}>
|
|
|
- <div style={{marginTop: 10}}>
|
|
|
|
|
- {
|
|
|
|
|
- this.state.name ? '' :
|
|
|
|
|
- <div style={{marginBottom: 30}}>
|
|
|
|
|
- <p><b>how about choose or create a new one</b></p>
|
|
|
|
|
- </div>
|
|
|
|
|
- }
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- <div style={{marginBottom: 20}}>
|
|
|
|
|
- <span className='table-title'> Name</span>
|
|
|
|
|
- <Input value={this.state.name} style={{width: 200}}
|
|
|
|
|
- onChange={this.switchConfig('name')}/>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <div style={{marginBottom: 30}}>
|
|
|
|
|
- <span className='table-title'> Database Config</span>
|
|
|
|
|
- <Select defaultValue="mongodb" value={this.state.database} style={{width: 120}}
|
|
|
|
|
- onChange={this.switchDataBase}>
|
|
|
|
|
- <Option value="mongodb">MongoDB</Option>
|
|
|
|
|
- <Option disabled value="mySQL">nedb</Option>
|
|
|
|
|
- <Option disabled value="postgres">postgres</Option>
|
|
|
|
|
- </Select>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ <div onClick={this.props.reDisplayChoose} style={{marginBottom: 30}}> back to choose</div>
|
|
|
<div>
|
|
<div>
|
|
|
<span className='table-title'> Cloud Config</span>
|
|
<span className='table-title'> Cloud Config</span>
|
|
|
|
|
|
|
|
- <div style={{marginBottom: 20}}>
|
|
|
|
|
- <p><b>Cloud Server providers</b></p>
|
|
|
|
|
- <Select defaultValue="tencent" value={this.state.cloudServer} style={{width: 120}}
|
|
|
|
|
- onChange={this.switchCS}>
|
|
|
|
|
- <Option value="tencent">Tencent</Option>
|
|
|
|
|
- <Option disabled value="aliyun">Aliyun</Option>
|
|
|
|
|
- <Option disabled value="huawei">Huawei</Option>
|
|
|
|
|
- </Select>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <p><b>Other configs</b></p>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ {/*<p><b>Other configs</b></p>*/}
|
|
|
{
|
|
{
|
|
|
this.state.configs.map(config => (
|
|
this.state.configs.map(config => (
|
|
|
<div key={config} style={{marginBottom: 10}}>
|
|
<div key={config} style={{marginBottom: 10}}>
|
|
@@ -100,12 +77,6 @@ class TencentConfig extends Component {
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
- <Button type="primary" onClick={() => {
|
|
|
|
|
- this.props.addConfig(this.state.config, this.state.config.name);
|
|
|
|
|
- }}>SUBMIT</Button>
|
|
|
|
|
- <Button style={{marginLeft: 10}} type="danger" onClick={() => {
|
|
|
|
|
- this.props.deleteConfig(this.state.config.name);
|
|
|
|
|
- }}>DELETE</Button>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|