diff options
author | 2020-02-12 11:36:35 +0100 | |
---|---|---|
committer | 2020-02-12 11:36:35 +0100 | |
commit | 489056db04d98a9bad32cd0e0347bf6348fbb7b7 (patch) | |
tree | c1b15135d2db12a58d4e722f733f2a50e630c735 /src/features/publishDebugInfo/Component.js | |
parent | Update debugger URL to production API (diff) | |
download | ferdium-app-489056db04d98a9bad32cd0e0347bf6348fbb7b7.tar.gz ferdium-app-489056db04d98a9bad32cd0e0347bf6348fbb7b7.tar.zst ferdium-app-489056db04d98a9bad32cd0e0347bf6348fbb7b7.zip |
Add error state to debug publisher
Diffstat (limited to 'src/features/publishDebugInfo/Component.js')
-rw-r--r-- | src/features/publishDebugInfo/Component.js | 30 |
1 files changed, 22 insertions, 8 deletions
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({ | |||
22 | id: 'feature.publishDebugInfo.info', | 22 | id: 'feature.publishDebugInfo.info', |
23 | 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', | 23 | 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', |
24 | }, | 24 | }, |
25 | error: { | ||
26 | id: 'feature.publishDebugInfo.error', | ||
27 | defaultMessage: '!!!There was an error while trying to publish the debug information. Please try again later or view the console for more information.', | ||
28 | }, | ||
25 | privacy: { | 29 | privacy: { |
26 | id: 'feature.publishDebugInfo.privacy', | 30 | id: 'feature.publishDebugInfo.privacy', |
27 | defaultMessage: '!!!Privacy policy', | 31 | defaultMessage: '!!!Privacy policy', |
@@ -86,6 +90,7 @@ export default @injectSheet(styles) @inject('stores') @observer class PublishDeb | |||
86 | 90 | ||
87 | state = { | 91 | state = { |
88 | log: null, | 92 | log: null, |
93 | error: false, | ||
89 | isSendingLog: false, | 94 | isSendingLog: false, |
90 | } | 95 | } |
91 | 96 | ||
@@ -114,8 +119,9 @@ export default @injectSheet(styles) @inject('stores') @observer class PublishDeb | |||
114 | log: response.id, | 119 | log: response.id, |
115 | }); | 120 | }); |
116 | } else { | 121 | } else { |
117 | // TODO: Show error message | 122 | this.setState({ |
118 | this.close(); | 123 | error: true, |
124 | }); | ||
119 | } | 125 | } |
120 | } | 126 | } |
121 | 127 | ||
@@ -128,6 +134,8 @@ export default @injectSheet(styles) @inject('stores') @observer class PublishDeb | |||
128 | 134 | ||
129 | const { | 135 | const { |
130 | log, | 136 | log, |
137 | error, | ||
138 | isSendingLog, | ||
131 | } = this.state; | 139 | } = this.state; |
132 | 140 | ||
133 | const { intl } = this.context; | 141 | const { intl } = this.context; |
@@ -136,13 +144,13 @@ export default @injectSheet(styles) @inject('stores') @observer class PublishDeb | |||
136 | <Modal | 144 | <Modal |
137 | isOpen={isModalVisible} | 145 | isOpen={isModalVisible} |
138 | shouldCloseOnOverlayClick | 146 | shouldCloseOnOverlayClick |
139 | close={this.close.bind(this)} | 147 | close={() => this.close()} |
140 | > | 148 | > |
141 | <div className={classes.container}> | 149 | <div className={classes.container}> |
142 | <H1> | 150 | <H1> |
143 | {intl.formatMessage(messages.title)} | 151 | {intl.formatMessage(messages.title)} |
144 | </H1> | 152 | </H1> |
145 | { log ? ( | 153 | { log && ( |
146 | <> | 154 | <> |
147 | <p className={classes.info}>{intl.formatMessage(messages.published)}</p> | 155 | <p className={classes.info}>{intl.formatMessage(messages.published)}</p> |
148 | <Input | 156 | <Input |
@@ -156,7 +164,13 @@ export default @injectSheet(styles) @inject('stores') @observer class PublishDeb | |||
156 | readonly | 164 | readonly |
157 | /> | 165 | /> |
158 | </> | 166 | </> |
159 | ) : ( | 167 | )} |
168 | |||
169 | {error && ( | ||
170 | <p className={classes.info}>{intl.formatMessage(messages.error)}</p> | ||
171 | )} | ||
172 | |||
173 | {!log && !error && ( | ||
160 | <> | 174 | <> |
161 | <p className={classes.info}>{intl.formatMessage(messages.info)}</p> | 175 | <p className={classes.info}>{intl.formatMessage(messages.info)}</p> |
162 | 176 | ||
@@ -171,11 +185,11 @@ export default @injectSheet(styles) @inject('stores') @observer class PublishDeb | |||
171 | type="button" | 185 | type="button" |
172 | label={intl.formatMessage(messages.publish)} | 186 | label={intl.formatMessage(messages.publish)} |
173 | className={classes.button} | 187 | className={classes.button} |
174 | onClick={this.publishDebugInfo.bind(this)} | 188 | onClick={() => this.publishDebugInfo()} |
175 | disabled={this.state.isSendingLog} | 189 | disabled={isSendingLog} |
176 | /> | 190 | /> |
177 | </> | 191 | </> |
178 | ) } | 192 | )} |
179 | </div> | 193 | </div> |
180 | </Modal> | 194 | </Modal> |
181 | ); | 195 | ); |