Skip to content

Commit

Permalink
Fix #1171: Display camera error message in UI when testing connection (
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Gilles authored Apr 27, 2021
1 parent ff21500 commit dcc2cd6
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ class RtspCameraBox extends Component {
try {
await this.props.testConnection(this.props.cameraIndex);
this.setState({
testConnectionError: null
testConnectionError: null,
testConnectionErrorMessage: null
});
} catch (e) {
this.setState({
testConnectionError: RequestStatus.Error
testConnectionError: RequestStatus.Error,
testConnectionErrorMessage: get(e, 'response.data.error')
});
}
this.setState({
Expand All @@ -72,7 +74,7 @@ class RtspCameraBox extends Component {
};
componentWillMount() {}

render(props, { loading, saveError, testConnectionError }) {
render(props, { loading, saveError, testConnectionError, testConnectionErrorMessage }) {
return (
<div class="col-md-4">
<div class="card">
Expand All @@ -97,6 +99,7 @@ class RtspCameraBox extends Component {
<Text id="integration.rtspCamera.testConnectionError" />
</div>
)}
{testConnectionErrorMessage && <div class="alert alert-danger">{testConnectionErrorMessage}</div>}
<div class="form-group">
<label>
<Text id="integration.rtspCamera.nameLabel" />
Expand Down

0 comments on commit dcc2cd6

Please sign in to comment.