|
@@ -31,22 +31,30 @@ class Deploy extends Component {
|
|
|
tencentCloudID: '',
|
|
tencentCloudID: '',
|
|
|
aliyunCloudID: '',
|
|
aliyunCloudID: '',
|
|
|
amazonCloudID: '',
|
|
amazonCloudID: '',
|
|
|
- // todo: 该schema应该由props传入,无论是哪一层,反正不是这一层。(路由传入吧)
|
|
|
|
|
- // 有fc的schema -- 测试数据
|
|
|
|
|
- // schemaID: 'schema_1542243424669_92094965',
|
|
|
|
|
- // 无fc的schema -- 测试数据
|
|
|
|
|
- schemaID: 'schema_1542967129456_05958413',
|
|
|
|
|
schemaName: '',
|
|
schemaName: '',
|
|
|
tencentFC: '',
|
|
tencentFC: '',
|
|
|
aliyunFC: '',
|
|
aliyunFC: '',
|
|
|
- amazonFC: ''
|
|
|
|
|
|
|
+ amazonFC: '',
|
|
|
|
|
+ schemaID: props.schemaID
|
|
|
};
|
|
};
|
|
|
|
|
+ this.hello();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ componentWillReceiveProps(next) {
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ schemaID: next.schemaID
|
|
|
|
|
+ }, this.hello)
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- request('http://123.206.193.98:3000/graphql', SHOW_FC, {schema_id: this.props.schemaID || this.state.schemaID}).then(
|
|
|
|
|
|
|
+ hello = () => {
|
|
|
|
|
+ request('http://123.206.193.98:3000/graphql', SHOW_FC, {schema_id: this.state.schemaID}).then(
|
|
|
|
|
+ // 根据 schemaID 查询 fc 是否成功
|
|
|
data => {
|
|
data => {
|
|
|
- request('http://123.206.193.98:3000/graphql', SEARCH_SCHEMA, {id: this.props.schemaID || this.state.schemaID}).then(
|
|
|
|
|
|
|
+ request('http://123.206.193.98:3000/graphql', SEARCH_SCHEMA, {id: this.state.schemaID}).then(
|
|
|
|
|
+ // 根据 schemaID 查询 schemaName
|
|
|
_data => {
|
|
_data => {
|
|
|
if (data.fc_by_props.length === 0) {
|
|
if (data.fc_by_props.length === 0) {
|
|
|
|
|
+ // 如果没有 fc,根据 userID 查 cloudId
|
|
|
request('http://123.206.193.98:3000/graphql', SHOW_CLOUD, {user_id: this.props.userID}).then(
|
|
request('http://123.206.193.98:3000/graphql', SHOW_CLOUD, {user_id: this.props.userID}).then(
|
|
|
__data => {
|
|
__data => {
|
|
|
__data.cloud_by_props.forEach(cloud => {
|
|
__data.cloud_by_props.forEach(cloud => {
|
|
@@ -82,6 +90,7 @@ class Deploy extends Component {
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ // 如果有 fc, 则获取 cloudID
|
|
|
data.fc_by_props.forEach(cloud => {
|
|
data.fc_by_props.forEach(cloud => {
|
|
|
switch (cloud.cloud_id.cloudName) {
|
|
switch (cloud.cloud_id.cloudName) {
|
|
|
case 'tencent':
|
|
case 'tencent':
|
|
@@ -114,18 +123,15 @@ class Deploy extends Component {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
const contentListNoTitle = {
|
|
const contentListNoTitle = {
|
|
|
tencent: <TencentConfig cloudID={this.state.tencentCloudID} fc={this.tencentFC}
|
|
tencent: <TencentConfig cloudID={this.state.tencentCloudID} fc={this.tencentFC}
|
|
|
schemaName={this.state.schemaName} userID={this.props.userID}/>,
|
|
schemaName={this.state.schemaName} userID={this.props.userID}/>,
|
|
|
- aliyun: <AliConfig cloudID={this.state.aliyunCloudID} fc={this.aliyunFC} schemaName={this.state.schemaName}
|
|
|
|
|
- userID={this.props.userID}/>,
|
|
|
|
|
- amazon: <AmazonConfig cloudID={this.state.amazonCloudID} fc={this.amazonFC}
|
|
|
|
|
- schemaName={this.state.schemaName} userID={this.props.userID}/>,
|
|
|
|
|
|
|
+ aliyun: <AliConfig/>,
|
|
|
|
|
+ amazon: <AmazonConfig/>,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
return (
|