xy 7 年之前
父節點
當前提交
edc5ee8628

+ 22 - 11
src/app/common/deploy/tencent/APIGroupCard.js

@@ -31,6 +31,16 @@ const toolTipTitle = {
     'region': 'its region',
 };
 
+const youMustFill = {
+    'groupName': true,
+    'environmentName': true,
+    'defaultDomain': true,
+    'frontType': true,
+    'userDomain': true,
+    'userStatus': true,
+    'region': true,
+};
+
 const removePrefix = (prefix, value) => {
     let r = new RegExp(prefix);
     return value.replace(r, '');
@@ -44,8 +54,8 @@ const shiftPrefix = (prefix, value) => {
 class APIGroupCard extends Component {
     constructor(props) {
         super(props);
-        let {groupName, environmentName, defaultDomain, frontType, userDomain, userStatus, region} = props.group;
-        props.group !== '' ?
+        if(props.group !== '' && props.group !== null) {
+            let {groupName, environmentName, defaultDomain, frontType, userDomain, userStatus, region} = props.group;
             this.state = {
                 showOK: false,
                 groupName,
@@ -56,7 +66,7 @@ class APIGroupCard extends Component {
                 userStatus,
                 groupRegion: region
             }
-            :
+        } else {
             this.state = {
                 showOK: false,
                 groupName: 'graphql_endpoint',
@@ -67,10 +77,11 @@ class APIGroupCard extends Component {
                 userStatus: 'open',
                 groupRegion: props.region === '' ? 'ap-beijing' : props.region,
             };
+        }
     }
 
     componentWillReceiveProps(next) {
-        if(next.group !== '') {
+        if(next.group !== '' && next.group !== null) {
             let {groupName, environmentName, defaultDomain, frontType, userDomain, userStatus, region} = next.group;
             this.setState( {
                 groupName,
@@ -179,7 +190,7 @@ class APIGroupCard extends Component {
             <div>
                 <div style={{marginBottom: 10}}>
                             <span className='vice-title'>{valueToKey['groupName']}
-                                <span> </span>
+                                &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['groupName']}>
                                     <Icon type="question-circle"/>
                                 </Tooltip>
@@ -190,7 +201,7 @@ class APIGroupCard extends Component {
 
                 <div style={{marginBottom: 10}}>
                             <span className='vice-title'>{valueToKey['region']}
-                                <span> </span>
+                                &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['region']}>
                                     <Icon type="question-circle"/>
                                 </Tooltip>
@@ -209,7 +220,7 @@ class APIGroupCard extends Component {
 
                 <div style={{marginBottom: 10}}>
                             <span className='vice-title'>{valueToKey['environmentName']}
-                                <span> </span>
+                                &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['environmentName']}>
                                     <Icon type="question-circle"/>
                                 </Tooltip>
@@ -226,7 +237,7 @@ class APIGroupCard extends Component {
 
                         <div style={{marginBottom: 10}}>
                             <span className='vice-title'>{valueToKey['frontType']}
-                                <span> </span>
+                                &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['frontType']}>
                                     <Icon type="question-circle"/>
                                 </Tooltip>
@@ -240,7 +251,7 @@ class APIGroupCard extends Component {
                         </div>
                         {/*<div style={{marginBottom: 10}}>*/}
                             {/*<span className='vice-title'>{valueToKey['defaultDomain']}*/}
-                                {/*<span> </span>*/}
+                                {/*&nbsp;*/}
                                 {/*<Tooltip placement="top" title={toolTipTitle['defaultDomain']}>*/}
                                     {/*<Icon type="question-circle"/>*/}
                                 {/*</Tooltip>*/}
@@ -250,7 +261,7 @@ class APIGroupCard extends Component {
 
                         <div style={{marginBottom: 10}}>
                             <span className='vice-title'>{valueToKey['userDomain']}
-                                <span> </span>
+                                &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['userDomain']}>
                                     <Icon type="question-circle"/>
                                 </Tooltip>
@@ -260,7 +271,7 @@ class APIGroupCard extends Component {
                         </div>
                         {/*<div style={{marginBottom: 10}}>*/}
                             {/*<span className='vice-title'>{valueToKey['userStatus']}*/}
-                                {/*<span> </span>*/}
+                                {/*&nbsp;*/}
                                 {/*<Tooltip placement="top" title={toolTipTitle['userStatus']}>*/}
                                     {/*<Icon type="question-circle"/>*/}
                                 {/*</Tooltip>*/}

+ 14 - 7
src/app/common/deploy/tencent/APIPathCard.js

@@ -23,11 +23,17 @@ const toolTipTitle = {
     'requestMethod': 'its requestMethod'
 };
 
+const youMustFill = {
+    'apiGWName': true,
+    'apiGWDesc': true,
+    'requestMethod': true
+};
+
 class APIPathCard extends Component {
     constructor(props) {
         super(props);
-        let {apiGWName, apiGWDesc, requestMethod} = props.path;
-        props.path !== '' ?
+        if(props.path !== '' && props.path !== null) {
+            let {apiGWName, apiGWDesc, requestMethod} = props.path;
             this.state = {
                 configs: ['apiGWName', 'apiGWDesc'],
                 showOK: false,
@@ -35,7 +41,7 @@ class APIPathCard extends Component {
                 apiGWDesc,
                 requestMethod: requestMethod
             }
-            :
+        } else {
             this.state = {
                 configs: ['apiGWName', 'apiGWDesc'],
                 showOK: false,
@@ -43,11 +49,12 @@ class APIPathCard extends Component {
                 apiGWDesc: '',
                 requestMethod: 'GET'
             };
+        }
     }
 
 
     componentWillReceiveProps(next) {
-        if (next.path !== '') {
+        if (next.path !== '' && next.path !== null) {
             let {apiGWName, apiGWDesc, requestMethod} = next.path;
             this.setState({
                 apiGWName,
@@ -89,7 +96,7 @@ class APIPathCard extends Component {
             updatedAt: ''
         };
         if (this.props.path === '') {
-            if(this.props.deployID !== '' && this.props.groupID!=='') {
+            if(this.props.deployID !== '' && this.props.groupID!=='' && this.props.deployID !== null && this.props.groupID!==null) {
                 request(graphqlUrl, ADD_APIGWPATH, varObj).then(
                     data => {
                         if (data.create_apiGWPath !== null) {
@@ -148,7 +155,7 @@ class APIPathCard extends Component {
                             this.state.configs.map(config => (
                                 <div key={config} style={{marginBottom: 10}}>
                                     <span className='vice-title'>{valueToKey[config]}
-                                        <span> </span>
+                                        &nbsp;
                                         <Tooltip placement="top" title={toolTipTitle[config]}>
                                             <Icon type="question-circle"/>
                                         </Tooltip>
@@ -160,7 +167,7 @@ class APIPathCard extends Component {
                         }
                         <div style={{marginBottom: 10}}>
                             <span className='vice-title'>{valueToKey['requestMethod']}
-                                <span> </span>
+                                &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['requestMethod']}>
                                     <Icon type="question-circle"/>
                                 </Tooltip>

+ 21 - 8
src/app/common/deploy/tencent/DeployCard.js

@@ -35,6 +35,18 @@ const toolTipTitle = {
     'description': 'its description',
 };
 
+const youMustFill = {
+    'functionName': true,
+    'cosBucketName': true,
+    'cosObjectName': true,
+    'cosBucketRegion': true,
+    'serviceName': true,
+    'subnetId': false,
+    'vpcId': false,
+    'region': true,
+    'description': false,
+};
+
 const removePrefix = (prefix, value) => {
     let r = new RegExp(prefix);
     return value.replace(r, '');
@@ -48,8 +60,8 @@ const shiftPrefix = (prefix, value) => {
 class DeployCard extends Component {
     constructor(props) {
         super(props);
-        let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId, region, description} = props.deploy;
-        props.deploy !== '' ?
+        if(props.deploy !== '' && props.deploy !== null) {
+            let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId, region, description} = props.deploy;
             this.state = {
                 configs: ['cosBucketName', 'cosObjectName', 'description', 'vpcId', 'subnetId'],
                 description,
@@ -63,7 +75,7 @@ class DeployCard extends Component {
                 vpcId,
                 subnetId
             }
-            :
+        } else {
             this.state = {
                 configs: ['cosBucketName', 'cosObjectName', 'description', 'vpcId', 'subnetId'],
                 description: '',
@@ -77,10 +89,11 @@ class DeployCard extends Component {
                 vpcId: '',
                 subnetId: '',
             };
+        }
     }
 
     componentWillReceiveProps(next) {
-        if (next.deploy !== '') {
+        if (next.deploy !== '' && next.deploy !== null) {
             let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId, region, description} = next.deploy;
             this.setState({
                 description,
@@ -207,7 +220,7 @@ class DeployCard extends Component {
             <div>
                 <div style={{marginBottom: 10}}>
                     <span className='vice-title'>{valueToKey['functionName']}
-                        <span> </span>
+                        &nbsp;
                         <Tooltip placement="top" title={toolTipTitle['functionName']}>
                             <Icon type="question-circle"/>
                         </Tooltip>
@@ -217,7 +230,7 @@ class DeployCard extends Component {
                 </div>
                 <div style={{marginBottom: 10}}>
                     <span className='vice-title'>{valueToKey['region']}
-                        <span> </span>
+                        &nbsp;
                         <Tooltip placement="top" title={toolTipTitle['region']}>
                             <Icon type="question-circle"/>
                         </Tooltip>
@@ -236,7 +249,7 @@ class DeployCard extends Component {
                     <Panel header="Want more options?" style={customPanelStyle}>
                         <div style={{marginBottom: 10}}>
                             <span className='vice-title'>{valueToKey['cosBucketRegion']}
-                                <span> </span>
+                                &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['cosBucketRegion']}>
                                     <Icon type="question-circle"/>
                                 </Tooltip>
@@ -268,7 +281,7 @@ class DeployCard extends Component {
                             this.state.configs.map(config => (
                                 <div key={config} style={{marginBottom: 10}}>
                                     <span className='vice-title'>{valueToKey[config]}
-                                        <span> </span>
+                                        &nbsp;
                                         <Tooltip placement="top" title={toolTipTitle[config]}>
                                             <Icon type="question-circle"/>
                                         </Tooltip>

+ 2 - 2
src/app/graphqlService/component/graphql/Graphql.jsx

@@ -13,7 +13,7 @@ class Graphql extends Component {
             // api: 'http://service-4i9xdoqo-1254337200.ap-guangzhou.apigateway.myqcloud.com/release/graphql',
             // api: 'http://service-ci2tk8iu-1254337200.ap-guangzhou.apigateway.myqcloud.com/release/graphql',
             // 便于开发调试,请删除并换成上面
-            api: props.api ? props.api : 'http://service-7po2y2xb-1254337200.ap-beijing.apigateway.myqcloud.com/test/graphql'
+            api: props.api ? props.api : 'http://service-cbcf74bl-1254337200.ap-shanghai.apigateway.myqcloud.com/test/graphql'
             // api: 'http://service-28dm054z-1254337200.ap-shanghai.apigateway.myqcloud.com/release/graphql'
             // api: 'http://service-acb8p44v-1254337200.ap-beijing.apigateway.myqcloud.com/release/graphql'
 
@@ -22,7 +22,7 @@ class Graphql extends Component {
 
     componentWillReceiveProps(next) {
         this.setState({
-            api: next.api ? next.api : 'http://service-7po2y2xb-1254337200.ap-beijing.apigateway.myqcloud.com/test/graphql'
+            api: next.api ? next.api : 'http://service-cbcf74bl-1254337200.ap-shanghai.apigateway.myqcloud.com/test/graphql'
         })
     }