-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frontend Error Handling #667
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
1cd775a
console: Extend error library
kschiffer 04582bb
console: Update error lib references
kschiffer feed3cc
console: Add anchor link option to navbar
kschiffer 7cd9788
console: Add anchor link option to profile dropdown
kschiffer 81a59fb
console: Add anchor link option to header
kschiffer 1ae39cd
console: Add header container component
kschiffer 16e2153
console: Add console error view
kschiffer a899300
console,oauth: Update error message component
kschiffer 2760ef1
console,oauth: Add error boundary component
kschiffer 547a773
console: Add error boundary to console app
kschiffer e7ba963
console: Handle error in application view
kschiffer e57ad7b
console: Refactor header styles
kschiffer 5317d1d
console: Extend error view styles
kschiffer 7faf442
console: Add sub-view error component
kschiffer 67b7cc6
console: Add error boundary to api key views
kschiffer 722bdda
console: Throw errors in application api key views
kschiffer c6f9f62
console: Add error boundary to collaborator views
kschiffer 48f83a8
console: Throw errors in collaborator views
kschiffer 8001ac1
console: Throw errors in entity views
kschiffer e2bcc7b
console: Add error boundary to gateway api key views
kschiffer 441059c
console: Move router context to header container
kschiffer cf8e062
console: Throw errors in gateway api key views
kschiffer 90727f5
console: Add not found route
kschiffer a3d1eb5
oauth: Add full view error
kschiffer ed082ae
oauth: Add topmost error boundary to oauth app
kschiffer 7b01c9f
console: Add handling of page data errors
kschiffer 3ba8f64
console: Fix api key selectors
kschiffer 7c9584b
dev: Update locales
kschiffer 852aa4e
oauth: Add not found route
kschiffer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ import Icon from '../../../components/icon' | |
import DateTime from '../../../lib/components/date-time' | ||
import Message from '../../../lib/components/message' | ||
import Button from '../../../components/button' | ||
import { isNotFoundError, isErrorTranslated } from '../../../lib/errors' | ||
import { isNotFoundError, isTranslated } from '../../../lib/errors/utils' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
import { | ||
statisticsSelector, | ||
|
@@ -66,7 +66,7 @@ class GatewayStatistic extends React.PureComponent { | |
} else if (fetching) { | ||
statusIndicator = 'mediocre' | ||
message = sharedMessages.connecting | ||
} else if (error && error.message && isErrorTranslated(error.message)) { | ||
} else if (error && error.message && isTranslated(error.message)) { | ||
statusIndicator = 'unknown' | ||
message = error.message | ||
} else if (statistics) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// Copyright © 2019 The Things Network Foundation, The Things Industries B.V. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import React, { Component } from 'react' | ||
import { connect } from 'react-redux' | ||
import { withRouter } from 'react-router-dom' | ||
import bind from 'autobind-decorator' | ||
|
||
import { logout } from '../../store/actions/user' | ||
import PropTypes from '../../../lib/prop-types' | ||
|
||
import HeaderComponent from '../../../components/header' | ||
|
||
@withRouter | ||
@connect(state => ({ | ||
user: state.user.user, | ||
})) | ||
@bind | ||
class Header extends Component { | ||
|
||
handleLogout () { | ||
const { dispatch } = this.props | ||
dispatch(logout()) | ||
} | ||
|
||
render () { | ||
const { | ||
user, | ||
dropdownItems, | ||
navigationEntries, | ||
anchored, | ||
handleSearchRequest, | ||
searchable, | ||
} = this.props | ||
|
||
return ( | ||
<HeaderComponent | ||
user={user} | ||
handleLogout={this.handleLogout} | ||
dropdownItems={dropdownItems} | ||
navigationEntries={navigationEntries} | ||
anchored={anchored} | ||
searchable={searchable} | ||
handleSearchRequest={handleSearchRequest} | ||
/> | ||
) | ||
} | ||
} | ||
|
||
Header.propTypes = { | ||
/** | ||
* A list of items for the dropdown | ||
* @param {(string|Object)} title - The title to be displayed | ||
* @param {string} icon - The icon name to be displayed next to the title | ||
* @param {string} path - The path for a navigation tab | ||
* @param {function} action - Alternatively, the function to be called on click | ||
*/ | ||
dropdownItems: PropTypes.arrayOf(PropTypes.shape({ | ||
title: PropTypes.message.isRequired, | ||
icon: PropTypes.string, | ||
path: PropTypes.string.isRequired, | ||
action: PropTypes.func, | ||
})), | ||
/** | ||
* A list of navigation bar entries. | ||
* @param {(string|Object)} title - The title to be displayed | ||
* @param {string} icon - The icon name to be displayed next to the title | ||
* @param {string} path - The path for a navigation tab | ||
* @param {boolean} exact - Flag identifying whether the path should be matched exactly | ||
*/ | ||
navigationEntries: PropTypes.arrayOf(PropTypes.shape({ | ||
path: PropTypes.string.isRequired, | ||
title: PropTypes.message.isRequired, | ||
action: PropTypes.func, | ||
icon: PropTypes.string, | ||
})), | ||
/** Flag identifying whether links should be rendered as plain anchor link */ | ||
anchored: PropTypes.bool, | ||
/** | ||
* A handler for when the user used the search input | ||
*/ | ||
handleSearchRequest: PropTypes.func, | ||
/** A flag identifying whether the header should display the search input */ | ||
searchable: PropTypes.bool, | ||
} | ||
|
||
export default Header |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,3 @@ | |
.content | ||
overflow: hidden | ||
flex: 1 | ||
|
||
.header, | ||
.footer | ||
flex: none | ||
+media-query($bp.s) | ||
background-color: white |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apparently, this breaks the header: