|
|
@@ -4,9 +4,9 @@ import axios from 'axios';
|
|
|
import APIGroupCardFetch from './apiGroupCard/APIGroupCardFetch';
|
|
|
import APIPathCardFetch from './apiPathCard/APIPathCardFetch';
|
|
|
import DeployCardFetch from './deployCard/DeployCardFetch';
|
|
|
-import NotificationCard from './notificationCard/NotificationCard';
|
|
|
+import NotificationCardFetch from './notificationCard/NotificationCardFetch';
|
|
|
|
|
|
-import {GET_PROJECT, SHOW_APIGWPATH} from "../../../../gql";
|
|
|
+import {GET_PROJECT, SHOW_APIGWPATH, UPDATE_PROJECT_ONLY_STATUS} from "../../../../gql";
|
|
|
import {deployUrl, graphqlUrl} from "../../../../config";
|
|
|
import {FormattedMessage} from 'react-intl';
|
|
|
import {request} from 'graphql-request'
|
|
|
@@ -24,7 +24,8 @@ class TencentConfig extends Component {
|
|
|
pathIdPassToConfig: '',
|
|
|
currentStep: '',
|
|
|
stepAllShow: false,
|
|
|
- deploying: ''
|
|
|
+ deploying: '',
|
|
|
+ stepUpdated: false,
|
|
|
};
|
|
|
}
|
|
|
|
|
|
@@ -43,7 +44,8 @@ class TencentConfig extends Component {
|
|
|
case 'deployed':
|
|
|
this.setState({
|
|
|
currentStep: 5,
|
|
|
- stepAllShow: true
|
|
|
+ stepAllShow: true,
|
|
|
+ deploying: 'finished'
|
|
|
});
|
|
|
break;
|
|
|
case 'notificationed':
|
|
|
@@ -71,6 +73,17 @@ class TencentConfig extends Component {
|
|
|
currentStep: 0
|
|
|
});
|
|
|
break;
|
|
|
+ case 'updated':
|
|
|
+ this.setState({
|
|
|
+ stepUpdated: true,
|
|
|
+ stepAllShow: true,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 'deploying':
|
|
|
+ this.setState({
|
|
|
+ deploying: 'deploying'
|
|
|
+ });
|
|
|
+ break;
|
|
|
default:
|
|
|
this.setState({
|
|
|
currentStep: 0
|
|
|
@@ -78,7 +91,7 @@ class TencentConfig extends Component {
|
|
|
break;
|
|
|
}
|
|
|
} else {
|
|
|
- console.log('peoject 没存 status');
|
|
|
+ console.log('project 没存 status');
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
@@ -93,6 +106,7 @@ class TencentConfig extends Component {
|
|
|
currentStep: '',
|
|
|
deploying: '',
|
|
|
stepAllShow: false,
|
|
|
+ stepUpdated: false
|
|
|
});
|
|
|
|
|
|
let projectID = next.projectID ? next.projectID : 'ecommerce_projectID';
|
|
|
@@ -108,6 +122,7 @@ class TencentConfig extends Component {
|
|
|
switch (dataProject.projectStatus) {
|
|
|
case 'deployed':
|
|
|
this.setState({
|
|
|
+ deploying: 'finished',
|
|
|
currentStep: 5,
|
|
|
stepAllShow: true
|
|
|
});
|
|
|
@@ -137,6 +152,17 @@ class TencentConfig extends Component {
|
|
|
currentStep: 0
|
|
|
});
|
|
|
break;
|
|
|
+ case 'updated':
|
|
|
+ this.setState({
|
|
|
+ stepUpdated: true,
|
|
|
+ stepAllShow: true,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case 'deploying':
|
|
|
+ this.setState({
|
|
|
+ deploying: 'deploying'
|
|
|
+ });
|
|
|
+ break;
|
|
|
default:
|
|
|
this.setState({
|
|
|
currentStep: 0
|
|
|
@@ -157,22 +183,6 @@ class TencentConfig extends Component {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- pass = (value, kind) => {
|
|
|
- if (kind === 'deploy')
|
|
|
- this.setState({
|
|
|
- deployIdPassToPath: value
|
|
|
- });
|
|
|
- else if (kind === 'group')
|
|
|
- this.setState({
|
|
|
- groupIdPassToPath: value
|
|
|
- });
|
|
|
- else {
|
|
|
- this.setState({
|
|
|
- pathIdPassToConfig: value
|
|
|
- })
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
deployFC = () => {
|
|
|
request(graphqlUrl, GET_PROJECT, {id: this.props.projectID}).then(
|
|
|
data => {
|
|
|
@@ -184,6 +194,14 @@ class TencentConfig extends Component {
|
|
|
request(graphqlUrl, SHOW_APIGWPATH, {apiGWGroup_id: group}).then(
|
|
|
data => {
|
|
|
if(data.apiGWPath_by_props !== null) {
|
|
|
+
|
|
|
+ // 给 project 加 deploying 状态
|
|
|
+ request(graphqlUrl, UPDATE_PROJECT_ONLY_STATUS, {
|
|
|
+ id: this.props.projectID,
|
|
|
+ updatedAt: new Date().getTime(),
|
|
|
+ projectStatus: 'deploying'
|
|
|
+ });
|
|
|
+
|
|
|
console.log(data);
|
|
|
let api = data.apiGWPath_by_props[0].id;
|
|
|
console.log('schema', schema);
|
|
|
@@ -210,12 +228,27 @@ class TencentConfig extends Component {
|
|
|
console.log('deploy res', res);
|
|
|
this.setState({
|
|
|
deploying: 'finished'
|
|
|
+ });
|
|
|
+
|
|
|
+ // 给 project 加 deployed 状态
|
|
|
+ request(graphqlUrl, UPDATE_PROJECT_ONLY_STATUS, {
|
|
|
+ id: this.props.projectID,
|
|
|
+ updatedAt: new Date().getTime(),
|
|
|
+ projectStatus: 'deployed'
|
|
|
})
|
|
|
+
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
this.setState({
|
|
|
deploying: 'error'
|
|
|
});
|
|
|
+
|
|
|
+ // 给 project 加 error 状态
|
|
|
+ request(graphqlUrl, UPDATE_PROJECT_ONLY_STATUS, {
|
|
|
+ id: this.props.projectID,
|
|
|
+ updatedAt: new Date().getTime(),
|
|
|
+ projectStatus: 'error'
|
|
|
+ });
|
|
|
console.log('err', err);
|
|
|
console.log('err.response', err.response);
|
|
|
console.log('err.response.data', err.response.data);
|
|
|
@@ -267,6 +300,19 @@ class TencentConfig extends Component {
|
|
|
:
|
|
|
''
|
|
|
}
|
|
|
+ {
|
|
|
+ this.state.stepUpdated ?
|
|
|
+
|
|
|
+ this.props.trialcase ?
|
|
|
+ ''
|
|
|
+ :
|
|
|
+ <div style={{marginBottom: 10}}>
|
|
|
+ <Alert message="进行了一次修改,未能确认是否完成" type="warning"
|
|
|
+ banner closable/>
|
|
|
+ </div>
|
|
|
+ :
|
|
|
+ ''
|
|
|
+ }
|
|
|
<div style={{padding: '30px'}}>
|
|
|
<Row gutter={16}>
|
|
|
<Col span={14}>
|
|
|
@@ -293,7 +339,6 @@ class TencentConfig extends Component {
|
|
|
switchRegion={this.switchRegion}
|
|
|
region={this.state.region}
|
|
|
trialcase={this.props.trialcase}
|
|
|
- pass={this.pass}
|
|
|
stepByStep={this.stepByStep}
|
|
|
userID={this.props.userID}
|
|
|
projectID={projectID}
|
|
|
@@ -315,7 +360,6 @@ class TencentConfig extends Component {
|
|
|
switchRegion={this.switchRegion}
|
|
|
region={this.state.region}
|
|
|
trialcase={this.props.trialcase}
|
|
|
- pass={this.pass}
|
|
|
stepByStep={this.stepByStep}
|
|
|
userID={this.props.userID}
|
|
|
projectID={projectID}
|
|
|
@@ -334,7 +378,6 @@ class TencentConfig extends Component {
|
|
|
<Card title={msg} style={{marginBottom: 10}}>
|
|
|
<APIPathCardFetch
|
|
|
trialcase={this.props.trialcase}
|
|
|
- pass={this.pass}
|
|
|
stepByStep={this.stepByStep}
|
|
|
userID={this.props.userID}
|
|
|
projectID={projectID}
|
|
|
@@ -352,13 +395,11 @@ class TencentConfig extends Component {
|
|
|
{
|
|
|
msg =>
|
|
|
<Card title={msg}>
|
|
|
- <NotificationCard
|
|
|
+ <NotificationCardFetch
|
|
|
userID={this.props.userID}
|
|
|
trialcase={this.props.trialcase}
|
|
|
stepByStep={this.stepByStep}
|
|
|
projectID={projectID}
|
|
|
-
|
|
|
- // defalutName={defaultName}
|
|
|
/>
|
|
|
</Card>
|
|
|
}
|
|
|
@@ -406,7 +447,6 @@ class TencentConfig extends Component {
|
|
|
status="exception"/>
|
|
|
:
|
|
|
''
|
|
|
-
|
|
|
}
|
|
|
</Col>
|
|
|
:
|