Browse Source

从 userID 变成 props.trialcase 判断案例显示

xy 7 years ago
parent
commit
04d633054d

+ 8 - 5
src/components/common/schema/Schema.jsx

@@ -81,6 +81,7 @@ class Schema extends Component {
 
     render() {
         let userID = this.props.userID;
+        let trialcase = this.props.trialcase;
         return (
             <Query query={gql(SHOW_TABLE)} variables={{schema_id: this.state.schemaID}}>
 
@@ -118,7 +119,7 @@ class Schema extends Component {
                                                     <div className={'schema'}>
                                                         <span className={'schema-name'}>{this.state.schemaName}</span>
                                                         {
-                                                            userID === 'ioobot' ?
+                                                            trialcase ?
                                                                 ''
                                                                 :
                                                                 <Icon style={{marginLeft: 15}}
@@ -142,7 +143,7 @@ class Schema extends Component {
                                                         className={'schema-table-title'}>Remark</span></Col>
                                                     <Col span={2} offset={2}>
                                                         {
-                                                            userID === 'ioobot' ?
+                                                            trialcase ?
                                                                 ''
                                                                 :
                                                                 <span
@@ -179,7 +180,7 @@ class Schema extends Component {
 
                                                                         <span className={'schema-table-content'}>
                                                                             {
-                                                                                userID === 'ioobot'?
+                                                                                trialcase?
                                                                                     ''
                                                                                     :
                                                                                     <DeleteTableButton
@@ -218,7 +219,7 @@ class Schema extends Component {
                                                                     <Col span={2} offset={2}>
                                                                 <span className={'schema-table-content'}>
                                                                     {
-                                                                        userID === 'ioobot'?
+                                                                        trialcase?
                                                                             ''
                                                                             :
                                                                             <DeleteTableButton
@@ -241,7 +242,7 @@ class Schema extends Component {
                                                 <Row>
                                                     <Col span={4}>
                                                         {
-                                                            userID === 'ioobot'?
+                                                            trialcase?
                                                                 <div className={'delete-schema'}>
                                                                     <Button
                                                                         type="primary"
@@ -287,6 +288,7 @@ class Schema extends Component {
                                                 schemaName={this.state.schemaName}
                                                 userID={userID}
                                                 goBack={this.goBack}
+                                                trialcase={trialcase}
                                             /> :
                                             <Table
                                                 currentTable={this.state.currentTable}
@@ -297,6 +299,7 @@ class Schema extends Component {
                                                 schemaName={this.state.schemaName}
                                                 userID={userID}
                                                 goBack={this.goBack}
+                                                trialcase={trialcase}
                                             />
                                 }
 

+ 3 - 2
src/components/common/schema/Table.js

@@ -108,6 +108,7 @@ class Table extends Component {
         // console.log('schemaID',schemaID,'schemaName',schemaName);
         let userID = this.props.userID || getCookie('user_id');
         // console.log('schemaID',schemaID,'userID',userID);
+        let trialcase = this.props.trialcase;
 
         return (
             <div>
@@ -174,7 +175,7 @@ class Table extends Component {
                                             }
                                         </Select>
                                         {
-                                            userID === 'ioobot'?
+                                            trialcase?
                                                 ''
                                                 :
                                                 <Icon type="delete" theme="twoTone" style={{cursor: 'pointer'}} onClick={this.handleColDelete(index)}/>
@@ -204,7 +205,7 @@ class Table extends Component {
                         </div>
 
                         {
-                            userID === 'ioobot'?
+                            trialcase?
                                 ''
                                 :
                                 <div style={{marginTop: 20}}>

+ 1 - 1
src/components/trialCase/TrialCase.jsx

@@ -57,7 +57,7 @@ class TrialCase extends Component {
                             (() => {
                                 switch (this.state.menuLevel2) {
                                     case 'schema':
-                                        return <Schema userID={this.state.userID} schemaName={schemaName} schemaID={schemaID} history={this.props.history} location={this.props.location}/>;
+                                        return <Schema trialcase={true} userID={this.state.userID} schemaName={schemaName} schemaID={schemaID} history={this.props.history} location={this.props.location}/>;
                                     case 'application':
                                         return <Application />;
                                     case 'deploy':