|
|
@@ -22,6 +22,7 @@ class TencentConfig extends Component {
|
|
|
couldDeploy: false,
|
|
|
deployIdPassToPath: '',
|
|
|
groupIdPassToPath: '',
|
|
|
+ pathIdPassToConfig: '',
|
|
|
currentStep: 0
|
|
|
};
|
|
|
}
|
|
|
@@ -48,24 +49,40 @@ class TencentConfig extends Component {
|
|
|
this.setState({
|
|
|
deployIdPassToPath: value
|
|
|
});
|
|
|
- else
|
|
|
+ else if (kind === 'group')
|
|
|
this.setState({
|
|
|
groupIdPassToPath: value
|
|
|
+ });
|
|
|
+ else {
|
|
|
+ this.setState({
|
|
|
+ pathIdPassToConfig: value
|
|
|
})
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
deployFC = (schema, deploy, api, group) => {
|
|
|
-
|
|
|
+ console.log('schema', schema);
|
|
|
+ console.log('deploy', deploy);
|
|
|
+ console.log('api', api);
|
|
|
+ console.log('group', group);
|
|
|
if (schema && deploy && api && group) {
|
|
|
+ console.log('deploying');
|
|
|
axios.get(`${deployUrl}`,
|
|
|
// axios.get(`http://localhost:8999/graphql/deployall`,
|
|
|
{
|
|
|
+ // params: {
|
|
|
+ // 'cloud-name': 'tencent',
|
|
|
+ // schema: "ecommerce_schemaID",
|
|
|
+ // deploy: "deploy_1544504304478_57468453",
|
|
|
+ // api: "path_1544504334478_82625598",
|
|
|
+ // group: "group_1544504325443_46750115"
|
|
|
+ // }
|
|
|
params: {
|
|
|
'cloud-name': 'tencent',
|
|
|
- schema: "ecommerce_schemaID",
|
|
|
- deploy: "deploy_1544504304478_57468453",
|
|
|
- api: "path_1544504334478_82625598",
|
|
|
- group: "group_1544504325443_46750115"
|
|
|
+ schema,
|
|
|
+ deploy,
|
|
|
+ api,
|
|
|
+ group
|
|
|
}
|
|
|
})
|
|
|
.then((res) => {
|
|
|
@@ -81,7 +98,6 @@ class TencentConfig extends Component {
|
|
|
};
|
|
|
|
|
|
stepByStep = (stepNum) => {
|
|
|
- console.log(2);
|
|
|
this.setState({
|
|
|
currentStep: stepNum
|
|
|
})
|
|
|
@@ -118,21 +134,23 @@ class TencentConfig extends Component {
|
|
|
api = '',
|
|
|
cloudID = 'tencent_CloudID';
|
|
|
|
|
|
-
|
|
|
let dataProject = data.project_by_id;
|
|
|
let {cloud_id, apiGWGroup_id, deploy_id, projectType, schema_id, wxConfig_id, projectName} = dataProject;
|
|
|
|
|
|
let defaultName = projectName;
|
|
|
|
|
|
- console.log('ccc', cloud_id);
|
|
|
+ if (projectType === 'graphql')
|
|
|
+ schemaID = schema_id.id;
|
|
|
+ else
|
|
|
+ configID = wxConfig_id.id;
|
|
|
+
|
|
|
+ // 如果 cloud_id 没有存储,说明尚未部署,即新的 project,使用 '视图 2'
|
|
|
+ // 旧的 project 使用 '视图 1'
|
|
|
+
|
|
|
if (cloud_id !== null && cloud_id.cloudName === 'tencent') {
|
|
|
group = apiGWGroup_id;
|
|
|
deploy = deploy_id;
|
|
|
cloudID = cloud_id.id;
|
|
|
- if (projectType === 'graphql')
|
|
|
- schemaID = schema_id.id;
|
|
|
- else
|
|
|
- configID = wxConfig_id.id;
|
|
|
|
|
|
return (
|
|
|
<div>
|
|
|
@@ -212,6 +230,7 @@ class TencentConfig extends Component {
|
|
|
trialcase={this.props.trialcase}
|
|
|
deployID={deploy ? deploy.id : this.state.deployIdPassToPath}
|
|
|
groupID={group ? group.id : this.state.groupIdPassToPath}
|
|
|
+ pass={this.pass}
|
|
|
/>
|
|
|
</Card>
|
|
|
}
|
|
|
@@ -241,7 +260,7 @@ class TencentConfig extends Component {
|
|
|
projectType === 'graphql' ?
|
|
|
schema_id.schemaState === 'ok' ?
|
|
|
<Button type='primary'
|
|
|
- onClick={() => this.deployFC(schemaID, deploy, api, group)}><FormattedMessage
|
|
|
+ onClick={() => this.deployFC(schemaID, deploy ? deploy.id : this.state.deployIdPassToPath, this.state.pathIdPassToConfig, group ? group.id : this.state.groupIdPassToPath)}><FormattedMessage
|
|
|
id="deploy"/>!</Button>
|
|
|
:
|
|
|
<Button type='primary' disabled><FormattedMessage
|
|
|
@@ -360,6 +379,7 @@ class TencentConfig extends Component {
|
|
|
trialcase={this.props.trialcase}
|
|
|
deployID={deploy ? deploy.id : this.state.deployIdPassToPath}
|
|
|
groupID={group ? group.id : this.state.groupIdPassToPath}
|
|
|
+ pass={this.pass}
|
|
|
stepByStep={this.stepByStep}
|
|
|
/>
|
|
|
</Card>
|
|
|
@@ -404,7 +424,7 @@ class TencentConfig extends Component {
|
|
|
projectType === 'graphql' ?
|
|
|
schema_id.schemaState === 'ok' ?
|
|
|
<Button type='primary'
|
|
|
- onClick={() => this.deployFC(schemaID, deploy, api, group)}><FormattedMessage
|
|
|
+ onClick={() => this.deployFC(schemaID, deploy ? deploy.id : this.state.deployIdPassToPath, this.state.pathIdPassToConfig, group ? group.id : this.state.groupIdPassToPath)}><FormattedMessage
|
|
|
id="deploy"/>!</Button>
|
|
|
:
|
|
|
<Button type='primary'
|