Răsfoiți Sursa

save temporary

xy 7 ani în urmă
părinte
comite
f65e064240

+ 7 - 3
src/components/common/deploy/Deploy.jsx

@@ -7,6 +7,7 @@ import AmazonConfig from './amazon/AmazonConfig';
 import HuaweiConfig from './huawei/HuaweiConfig';
 
 import './index.css';
+import {SHOW_FC} from "../../gql";
 
 const tabListNoTitle = [{
     key: 'tencent',
@@ -20,9 +21,9 @@ const tabListNoTitle = [{
 }];
 
 const contentListNoTitle = {
-    tencent: <TencentConfig/>,
-    aliyun: <AliConfig/>,
-    amazon: <AmazonConfig/>,
+    tencent: <TencentConfig schemaID={this.state.schemaID}/>,
+    aliyun: <AliConfig schemaID={this.state.schemaID}/>,
+    amazon: <AmazonConfig schemaID={this.state.schemaID}/>,
 };
 
 
@@ -31,6 +32,9 @@ class Deploy extends Component {
         super(props);
         this.state = {
             cloud: 'tencent',
+            // 该schema应该由props传入,无论是哪一层,反正不是这一层。
+            // 路由传入吧,还没搞
+            schemaID: ''
         };
     }
 

+ 3 - 2
src/components/common/deploy/tencent/TencentConfig.js

@@ -9,7 +9,8 @@ class TencentConfig extends Component {
     constructor(props) {
         super(props);
         this.state = {
-            region: 'beijing'
+            region: 'beijing',
+            schemaID: props.schemaID
         };
     }
 
@@ -27,7 +28,7 @@ class TencentConfig extends Component {
                         <Col span={12}>
                             <Card title="Deploy" style={{marginBottom: 10}}><DeployCard switchRegion={this.switchRegion} region={this.state.region}/></Card>
                             <Card title="API Group" style={{marginBottom: 10}}><APIGroupCard switchRegion={this.switchRegion} region={this.state.region}/></Card>
-                            <Card title="API Path" ><APIPathCard/></Card>
+                            <Card title="API Path" ><APIPathCard /></Card>
                         </Col>
                         <Col offset={2} span={8}>
                             <Button type='primary'>deploy it</Button>

+ 10 - 1
src/components/gql.js

@@ -3,6 +3,14 @@
 // graphql-request 不需要使用 gql
 // import gql from "graphql-tag";
 
+const SHOW_FC = `
+            query FC($schema_id: ID!) {
+                fc_by_props(schema_id: $schema_id) {
+                    cloud_id
+                }
+            }
+        `;
+
 const GET_USER = `
             query USER($id: ID!) {
                 user_by_id(id: $id) {
@@ -209,5 +217,6 @@ export {
     SHOW_APIGWPATH,
     ADD_USER,
     GET_USER,
-    SEARCH_USER
+    SEARCH_USER,
+    SHOW_FC
 }

+ 14 - 1
src/components/login/login.js

@@ -27,6 +27,7 @@ class Login extends Component {
             avatar: '',
             register_username: '',
             register_password: '',
+            register_nickname: '',
             login_username: '',
             login_password: '',
             login_url: 'http://123.206.193.98:8999/login',
@@ -109,6 +110,18 @@ class Login extends Component {
                                     style={{width: 200}}
                                 />
                             </div>
+                            <div style={{marginTop: 10}}>
+                                <span>nickname: </span>
+                                <Input
+                                    placeholder=""
+                                    onChange={(e) => {
+                                        // antd 获取不到 target,百度来的下面这句代码
+                                        e.persist();
+                                        this.setState({register_nickname: e.target.value});
+                                    }}
+                                    style={{width: 200}}
+                                />
+                            </div>
                             <Button type='primary' onClick={() => {
                                 request('http://123.206.193.98:3000/graphql', SEARCH_USER, {username: this.state.register_username}).then(data => {
                                     if (data.user_by_props.length === 0) {
@@ -121,7 +134,7 @@ class Login extends Component {
                                                 updatedAt: '',
                                                 password: '',
                                                 telephone: '',
-                                                nickname: '',
+                                                nickname: this.state.register_nickname,
                                                 username: this.state.register_username,
                                                 createdAt: new Date().getTime(),
                                                 openid: '',