From cdd305b68e1cd5d113489bfffed1a9750f094a6a Mon Sep 17 00:00:00 2001 From: KimQ Date: Tue, 24 Jul 2018 11:16:36 -0700 Subject: [PATCH] fixed some bugs 1. fixed webServiceUrl problem in TokenPage 2. removed the warning message dialog of no rules 3. added determine statement of "no spacy rules" error message --- src/components/RulePage.js | 32 +++++++++++++++----------------- src/components/TokenPage.js | 2 +- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/components/RulePage.js b/src/components/RulePage.js index 3b559cb0..4a21096d 100755 --- a/src/components/RulePage.js +++ b/src/components/RulePage.js @@ -138,18 +138,6 @@ class Rule extends Component { if (json.rules !== undefined) { console.log('Received 200 ok'); console.log(json); - if (json.rules.length < 1) { - this.setState({ - error_display: true, - error_message: 'Project Warning', - error_detail: - 'There are NO rules from this project/field combination' - }); - console.log( - 'There are NO rules from this project/field combination' - ); - return; - } // I overwrite the rules identifier with our own naming. Sometimes these rules // *are created on the server and no identifier is provided. @@ -179,11 +167,21 @@ class Rule extends Component { output_loc: temp_output_loc }); } else { - this.setState({ - error_display: true, - error_message: 'Error code ' + json.status_code + 'received', - error_detail: json.error_message - }); + if (json.error_message === 'no spacy rules') { + this.setState({ + error_display: true, + error_message: 'Error code ' + json.status_code + ' received', + error_detail: + json.error_message + + '! If it is a new field, please ignore this message' + }); + } else { + this.setState({ + error_display: true, + error_message: 'Error code ' + json.status_code + ' received', + error_detail: json.error_message + }); + } console.log('Error code ' + json.status_code + 'received'); console.log('Error msg = ' + json.error_message); } diff --git a/src/components/TokenPage.js b/src/components/TokenPage.js index c9f3e415..5393bd5a 100755 --- a/src/components/TokenPage.js +++ b/src/components/TokenPage.js @@ -43,7 +43,7 @@ class TokenPage extends Component { orignal_active: this.props.location.state.rule.is_active, output_loc: {}, autoRefresh_TP: true, - webServiceUrl: this.props.webServiceUrl, + webServiceUrl: this.props.location.state.webServiceUrl, path: { pathname: this.props.location.state.relative_url, state: {