|
|
@@ -10,7 +10,7 @@ import {
|
|
|
UPDATE_PROJECT_ONLY_STATUS
|
|
|
} from "../../../../../gql";
|
|
|
import {request} from 'graphql-request'
|
|
|
-import {removePrefix, shiftPrefix} from "../../../../../func";
|
|
|
+import {removePrefix, shiftPrefix, pushPostfix} from "../../../../../func";
|
|
|
|
|
|
const Panel = Collapse.Panel;
|
|
|
|
|
|
@@ -59,13 +59,13 @@ 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,
|
|
|
region,
|
|
|
cosBucketName,
|
|
|
- cosObjectName,
|
|
|
+ cosObjectName: removePrefix('.jar', cosObjectName),
|
|
|
cosBucketRegion,
|
|
|
serviceName,
|
|
|
vpcId,
|
|
|
@@ -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,
|
|
|
@@ -96,7 +96,7 @@ class DeployCardRender extends Component {
|
|
|
functionName,
|
|
|
region: next.region === '' ? region : next.region,
|
|
|
cosBucketName,
|
|
|
- cosObjectName,
|
|
|
+ cosObjectName: removePrefix('.jar', cosObjectName),
|
|
|
cosBucketRegion: next.region === '' ? cosBucketRegion : next.region,
|
|
|
serviceName,
|
|
|
vpcId,
|
|
|
@@ -124,21 +124,19 @@ class DeployCardRender extends Component {
|
|
|
};
|
|
|
};
|
|
|
|
|
|
- ok = (id, userID, projectID, cloudID, deploy) => {
|
|
|
+ ok = (id, userID, projectID, cloudID, deploy, projectStatus) => {
|
|
|
let {description, cosBucketName, subnetId, cosObjectName, region, vpcId, cosBucketRegion, functionName} = this.state;
|
|
|
- region = shiftPrefix('ap-', region);
|
|
|
- cosBucketRegion = shiftPrefix('ap-', cosBucketRegion);
|
|
|
let varObj = {
|
|
|
id,
|
|
|
cloud_id: cloudID,
|
|
|
user_id: userID,
|
|
|
+ cosObjectName: pushPostfix('.jar', cosObjectName),
|
|
|
+ region: shiftPrefix('ap-', region),
|
|
|
+ cosBucketRegion: shiftPrefix('ap-', cosBucketRegion),
|
|
|
description,
|
|
|
cosBucketName,
|
|
|
- subnetId,
|
|
|
- cosObjectName,
|
|
|
- region,
|
|
|
vpcId,
|
|
|
- cosBucketRegion,
|
|
|
+ subnetId,
|
|
|
functionName,
|
|
|
memorySize: 512,
|
|
|
timeout: 300,
|
|
|
@@ -148,7 +146,7 @@ class DeployCardRender extends Component {
|
|
|
createdAt: new Date().getTime(),
|
|
|
updatedAt: ''
|
|
|
};
|
|
|
- if (deploy === '') {
|
|
|
+ if (deploy === '' || deploy === null) {
|
|
|
request(graphqlUrl, ADD_DEPLOY, varObj).then(
|
|
|
data => {
|
|
|
if (data.create_deploy !== null) {
|
|
|
@@ -176,17 +174,15 @@ class DeployCardRender extends Component {
|
|
|
)
|
|
|
} else {
|
|
|
let {description, cosBucketName, subnetId, cosObjectName, region, vpcId, cosBucketRegion, functionName} = this.state;
|
|
|
- region = shiftPrefix('ap-', region);
|
|
|
- cosBucketRegion = shiftPrefix('ap-', cosBucketRegion);
|
|
|
let varObj = {
|
|
|
id: deploy.id,
|
|
|
+ cosObjectName: pushPostfix('.jar', cosObjectName),
|
|
|
+ region: shiftPrefix('ap-', region),
|
|
|
+ cosBucketRegion: shiftPrefix('ap-', cosBucketRegion),
|
|
|
description,
|
|
|
subnetId,
|
|
|
cosBucketName,
|
|
|
- cosObjectName,
|
|
|
- region,
|
|
|
vpcId,
|
|
|
- cosBucketRegion,
|
|
|
functionName,
|
|
|
updatedAt: new Date().getTime()
|
|
|
};
|
|
|
@@ -199,7 +195,7 @@ class DeployCardRender extends Component {
|
|
|
request(graphqlUrl, UPDATE_PROJECT_ONLY_STATUS, {
|
|
|
id: projectID,
|
|
|
updatedAt: new Date().getTime(),
|
|
|
- projectStatus: 'updated'
|
|
|
+ projectStatus: projectStatus === 'deployed' ? 'updated': 'functioned'
|
|
|
}).then(data => {
|
|
|
if(data.update_project !== null)
|
|
|
this.props.stepByStep(1);
|
|
|
@@ -274,9 +270,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 +284,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']}/>
|
|
|
+
|
|
|
+ <Tooltip placement="top" title={toolTipTitle['cosBucketName']}>
|
|
|
+ <Icon type="question-circle"/>
|
|
|
+ </Tooltip>
|
|
|
+ </span>
|
|
|
+ <Input value={this.state.cosBucketName} style={{width: 400}}
|
|
|
+ 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']}/>
|
|
|
+
|
|
|
+ <Tooltip placement="top" title={toolTipTitle['cosObjectName']}>
|
|
|
+ <Icon type="question-circle"/>
|
|
|
+ </Tooltip>
|
|
|
+ </span>
|
|
|
+ <Input value={this.state.cosObjectName} style={{width: 400}}
|
|
|
+ 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']}*/}
|
|
|
@@ -310,7 +343,7 @@ class DeployCardRender extends Component {
|
|
|
{/*<Icon type="question-circle"/>*/}
|
|
|
{/*</Tooltip>*/}
|
|
|
{/*</span>*/}
|
|
|
- {/*<Input value={this.state.serviceName} style={{width: 200}} disabled*/}
|
|
|
+ {/*<Input value={this.state.serviceName} style={{width: 400}} disabled*/}
|
|
|
{/*onChange={this.switchConfig('serviceName')}/>*/}
|
|
|
{/*</div>*/}
|
|
|
{
|
|
|
@@ -329,7 +362,7 @@ class DeployCardRender extends Component {
|
|
|
<Icon type="question-circle"/>
|
|
|
</Tooltip>
|
|
|
</span>
|
|
|
- <Input value={this.state[config]} style={{width: 200}}
|
|
|
+ <Input value={this.state[config]} style={{width: 400}}
|
|
|
disabled={disable[config] === true}
|
|
|
onChange={this.switchConfig(config)}/>
|
|
|
</div>
|
|
|
@@ -343,7 +376,7 @@ class DeployCardRender extends Component {
|
|
|
<div>
|
|
|
<Button onClick={() => {
|
|
|
const id = idGen('deploy');
|
|
|
- this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.deploy);
|
|
|
+ this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.deploy, this.props.projectStatus);
|
|
|
}} type='primary'><FormattedMessage id="save"/></Button>
|
|
|
{
|
|
|
this.state.showOK === true ?
|
|
|
@@ -359,7 +392,7 @@ class DeployCardRender extends Component {
|
|
|
<div>
|
|
|
<Button onClick={() => {
|
|
|
const id = idGen('deploy');
|
|
|
- this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.deploy);
|
|
|
+ this.ok(id, this.props.userID, this.props.projectID, this.props.cloudID, this.props.deploy, this.props.projectStatus);
|
|
|
}} type='primary'><FormattedMessage id="save"/></Button>
|
|
|
{
|
|
|
this.state.showOK === true ?
|