|
|
@@ -7,16 +7,58 @@ const Panel = Collapse.Panel;
|
|
|
class DeployCard extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
- this.state = {
|
|
|
- configs: ['description', 'cosBucketName', 'cosObjectName', 'cosBucketRegion', 'serviceName', 'vpcId', 'subnetId'],
|
|
|
- functionName: 'defalut schema name',
|
|
|
- cosBucketName: 'graphqlfc',
|
|
|
- cosObjectName: 'default schema name',
|
|
|
- cosBucketRegion: 'beijing',
|
|
|
- serviceName: ''
|
|
|
- };
|
|
|
+ let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId} = props.deploy;
|
|
|
+ console.log(1111, props.deploy);
|
|
|
+
|
|
|
+ props.deploy !== '' ?
|
|
|
+ this.state = {
|
|
|
+ configs: ['description', 'cosBucketName', 'cosObjectName', 'cosBucketRegion', 'serviceName', 'vpcId', 'subnetId'],
|
|
|
+ functionName,
|
|
|
+ cosBucketName,
|
|
|
+ cosObjectName,
|
|
|
+ cosBucketRegion,
|
|
|
+ serviceName,
|
|
|
+ vpcId,
|
|
|
+ subnetId
|
|
|
+ }
|
|
|
+ :
|
|
|
+ this.state = {
|
|
|
+ configs: ['description', 'cosBucketName', 'cosObjectName', 'cosBucketRegion', 'serviceName', 'vpcId', 'subnetId'],
|
|
|
+ functionName: props.schemaName,
|
|
|
+ cosBucketName: 'graphqlfc',
|
|
|
+ cosObjectName: props.schemaName,
|
|
|
+ cosBucketRegion: props.region,
|
|
|
+ serviceName: '',
|
|
|
+ vpcId: '',
|
|
|
+ subnetId: ''
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ componentWillReceiveProps(next) {
|
|
|
+ console.log(2222, next.deploy);
|
|
|
+ if(next.deploy !== '') {
|
|
|
+ let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId} = next.deploy;
|
|
|
+ this.setState( {
|
|
|
+ functionName,
|
|
|
+ cosBucketName,
|
|
|
+ cosObjectName,
|
|
|
+ cosBucketRegion,
|
|
|
+ serviceName,
|
|
|
+ vpcId,
|
|
|
+ subnetId
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setState ( {
|
|
|
+ functionName: next.schemaName,
|
|
|
+ cosBucketName: 'graphqlfc',
|
|
|
+ cosObjectName: next.schemaName,
|
|
|
+ cosBucketRegion: next.region,
|
|
|
+ serviceName: '',
|
|
|
+ vpcId: '',
|
|
|
+ subnetId: ''
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
switchConfig = (label) => {
|
|
|
return (e) => {
|
|
|
@@ -26,13 +68,6 @@ class DeployCard extends Component {
|
|
|
};
|
|
|
};
|
|
|
|
|
|
- switchCosRegin = (e) => {
|
|
|
- this.setState({
|
|
|
- // 缺省跟region相同
|
|
|
- cosBucketRegion: e.target.value
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
render() {
|
|
|
const customPanelStyle = {
|
|
|
background: '#f7f7f7',
|
|
|
@@ -46,10 +81,7 @@ class DeployCard extends Component {
|
|
|
<div>
|
|
|
<div style={{marginBottom: 10}}>
|
|
|
<span className='vice-title'>region: </span>
|
|
|
- <Radio.Group onChange={(e) => {
|
|
|
- this.props.switchRegion();
|
|
|
- this.switchCosRegin(e)
|
|
|
- }} defaultValue="beijing" buttonStyle="solid">
|
|
|
+ <Radio.Group onChange={this.props.switchRegion} defaultValue={this.props.region} buttonStyle="solid">
|
|
|
<Radio.Button value="guangzhou">Guangzhou</Radio.Button>
|
|
|
<Radio.Button value="shanghai">Shanghai</Radio.Button>
|
|
|
<Radio.Button value="beijing">Beijing</Radio.Button>
|