From 489056db04d98a9bad32cd0e0347bf6348fbb7b7 Mon Sep 17 00:00:00 2001 From: vantezzen Date: Wed, 12 Feb 2020 11:36:35 +0100 Subject: Add error state to debug publisher --- recipes | 2 +- src/features/publishDebugInfo/Component.js | 30 ++++++++++++++++------ src/i18n/locales/defaultMessages.json | 29 +++++++++++++++------ src/i18n/locales/en-US.json | 1 + .../src/features/publishDebugInfo/Component.json | 29 +++++++++++++++------ 5 files changed, 66 insertions(+), 25 deletions(-) diff --git a/recipes b/recipes index f47c638a3..f6da5d542 160000 --- a/recipes +++ b/recipes @@ -1 +1 @@ -Subproject commit f47c638a38baad7a978baf8e204743227f4005e2 +Subproject commit f6da5d54280e5156c46c295ad48d6cdcd5e10bb8 diff --git a/src/features/publishDebugInfo/Component.js b/src/features/publishDebugInfo/Component.js index fbaa88a43..be90a1f99 100644 --- a/src/features/publishDebugInfo/Component.js +++ b/src/features/publishDebugInfo/Component.js @@ -22,6 +22,10 @@ const messages = defineMessages({ id: 'feature.publishDebugInfo.info', defaultMessage: '!!!Publishing your debug information helps us find issues and errors in Ferdi. By publishing your debug information you accept Ferdi Debugger\'s privacy policy and terms of service', }, + error: { + id: 'feature.publishDebugInfo.error', + defaultMessage: '!!!There was an error while trying to publish the debug information. Please try again later or view the console for more information.', + }, privacy: { id: 'feature.publishDebugInfo.privacy', defaultMessage: '!!!Privacy policy', @@ -86,6 +90,7 @@ export default @injectSheet(styles) @inject('stores') @observer class PublishDeb state = { log: null, + error: false, isSendingLog: false, } @@ -114,8 +119,9 @@ export default @injectSheet(styles) @inject('stores') @observer class PublishDeb log: response.id, }); } else { - // TODO: Show error message - this.close(); + this.setState({ + error: true, + }); } } @@ -128,6 +134,8 @@ export default @injectSheet(styles) @inject('stores') @observer class PublishDeb const { log, + error, + isSendingLog, } = this.state; const { intl } = this.context; @@ -136,13 +144,13 @@ export default @injectSheet(styles) @inject('stores') @observer class PublishDeb this.close()} >

{intl.formatMessage(messages.title)}

- { log ? ( + { log && ( <>

{intl.formatMessage(messages.published)}

- ) : ( + )} + + {error && ( +

{intl.formatMessage(messages.error)}

+ )} + + {!log && !error && ( <>

{intl.formatMessage(messages.info)}

@@ -171,11 +185,11 @@ export default @injectSheet(styles) @inject('stores') @observer class PublishDeb type="button" label={intl.formatMessage(messages.publish)} className={classes.button} - onClick={this.publishDebugInfo.bind(this)} - disabled={this.state.isSendingLog} + onClick={() => this.publishDebugInfo()} + disabled={isSendingLog} /> - ) } + )}
); diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json index 8d5a6b9c4..6ac9153a4 100644 --- a/src/i18n/locales/defaultMessages.json +++ b/src/i18n/locales/defaultMessages.json @@ -5052,55 +5052,68 @@ } }, { - "defaultMessage": "!!!Privacy policy", + "defaultMessage": "!!!There was an error while trying to publish the debug information. Please try again later or view the console for more information.", "end": { "column": 3, "line": 28 }, "file": "src/features/publishDebugInfo/Component.js", + "id": "feature.publishDebugInfo.error", + "start": { + "column": 9, + "line": 25 + } + }, + { + "defaultMessage": "!!!Privacy policy", + "end": { + "column": 3, + "line": 32 + }, + "file": "src/features/publishDebugInfo/Component.js", "id": "feature.publishDebugInfo.privacy", "start": { "column": 11, - "line": 25 + "line": 29 } }, { "defaultMessage": "!!!Terms of service", "end": { "column": 3, - "line": 32 + "line": 36 }, "file": "src/features/publishDebugInfo/Component.js", "id": "feature.publishDebugInfo.terms", "start": { "column": 9, - "line": 29 + "line": 33 } }, { "defaultMessage": "!!!Accept and publish", "end": { "column": 3, - "line": 36 + "line": 40 }, "file": "src/features/publishDebugInfo/Component.js", "id": "feature.publishDebugInfo.publish", "start": { "column": 11, - "line": 33 + "line": 37 } }, { "defaultMessage": "!!!Your debug log was published and is now availible at", "end": { "column": 3, - "line": 40 + "line": 44 }, "file": "src/features/publishDebugInfo/Component.js", "id": "feature.publishDebugInfo.published", "start": { "column": 13, - "line": 37 + "line": 41 } } ], diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index f523bc380..ce41bb9ce 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -26,6 +26,7 @@ "feature.planSelection.personal.text": "More services, no waiting - ideal for personal use.", "feature.planSelection.pricesBasedOnAnnualPayment": "All prices based on yearly payment", "feature.planSelection.pro.text": "Unlimited services and professional features for you - and your team.", + "feature.publishDebugInfo.error": "There was an error while trying to publish the debug information. Please try again later or view the console for more information.", "feature.publishDebugInfo.info": "Publishing your debug information helps us find issues and errors in Ferdi. By publishing your debug information you accept Ferdi Debugger's privacy policy and terms of service", "feature.publishDebugInfo.privacy": "Privacy policy", "feature.publishDebugInfo.publish": "Accept and publish", diff --git a/src/i18n/messages/src/features/publishDebugInfo/Component.json b/src/i18n/messages/src/features/publishDebugInfo/Component.json index 500f2c01b..25048ace6 100644 --- a/src/i18n/messages/src/features/publishDebugInfo/Component.json +++ b/src/i18n/messages/src/features/publishDebugInfo/Component.json @@ -25,16 +25,29 @@ "column": 3 } }, + { + "id": "feature.publishDebugInfo.error", + "defaultMessage": "!!!There was an error while trying to publish the debug information. Please try again later or view the console for more information.", + "file": "src/features/publishDebugInfo/Component.js", + "start": { + "line": 25, + "column": 9 + }, + "end": { + "line": 28, + "column": 3 + } + }, { "id": "feature.publishDebugInfo.privacy", "defaultMessage": "!!!Privacy policy", "file": "src/features/publishDebugInfo/Component.js", "start": { - "line": 25, + "line": 29, "column": 11 }, "end": { - "line": 28, + "line": 32, "column": 3 } }, @@ -43,11 +56,11 @@ "defaultMessage": "!!!Terms of service", "file": "src/features/publishDebugInfo/Component.js", "start": { - "line": 29, + "line": 33, "column": 9 }, "end": { - "line": 32, + "line": 36, "column": 3 } }, @@ -56,11 +69,11 @@ "defaultMessage": "!!!Accept and publish", "file": "src/features/publishDebugInfo/Component.js", "start": { - "line": 33, + "line": 37, "column": 11 }, "end": { - "line": 36, + "line": 40, "column": 3 } }, @@ -69,11 +82,11 @@ "defaultMessage": "!!!Your debug log was published and is now availible at", "file": "src/features/publishDebugInfo/Component.js", "start": { - "line": 37, + "line": 41, "column": 13 }, "end": { - "line": 40, + "line": 44, "column": 3 } } -- cgit v1.2.3-70-g09d2