|
|
@@ -20,13 +20,26 @@ class TencentConfig extends Component {
|
|
|
paths: [],
|
|
|
currentPath: '',
|
|
|
deployIdPassToPath: '',
|
|
|
- groupIdPassToPath: ''
|
|
|
+ groupIdPassToPath: '',
|
|
|
+ cloudID: props.cloudID,
|
|
|
+ fc: props.fc
|
|
|
};
|
|
|
+ this.fetch();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ componentWillReceiveProps(next) {
|
|
|
+ this.setState({
|
|
|
+ fc: next.fc,
|
|
|
+ cloudID: next.cloudID
|
|
|
+ }, this.fetch);
|
|
|
+ }
|
|
|
|
|
|
+ fetch = () => {
|
|
|
// todo: 没做每个 deploy 和 apigroup 和 apipath 的切换
|
|
|
// todo: 换成 apollo 会更好
|
|
|
- if (props.fc === true) {
|
|
|
- request('http://123.206.193.98:3000/graphql', SHOW_DEPLOY, {cloud_id: props.cloudID}).then(
|
|
|
+ if (this.state.fc === true) {
|
|
|
+ request('http://123.206.193.98:3000/graphql', SHOW_DEPLOY, {cloud_id: this.state.cloudID}).then(
|
|
|
data => {
|
|
|
this.setState({
|
|
|
deploys: data.deploy_by_props,
|
|
|
@@ -34,7 +47,7 @@ class TencentConfig extends Component {
|
|
|
})
|
|
|
}
|
|
|
);
|
|
|
- request('http://123.206.193.98:3000/graphql', SHOW_APIGWGROUP, {cloud_id: props.cloudID}).then(
|
|
|
+ request('http://123.206.193.98:3000/graphql', SHOW_APIGWGROUP, {cloud_id: this.state.cloudID}).then(
|
|
|
data => {
|
|
|
this.setState({
|
|
|
groups: data.apiGWGroup_by_props,
|
|
|
@@ -51,8 +64,14 @@ class TencentConfig extends Component {
|
|
|
});
|
|
|
}
|
|
|
);
|
|
|
+ } else {
|
|
|
+ this.setState({
|
|
|
+ currentDeploy: '',
|
|
|
+ currentGroup: '',
|
|
|
+ currentPath: '',
|
|
|
+ })
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
pass = (value, kind) => {
|
|
|
if(kind === 'deploy')
|