-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from SubstraFoundation/handle_403
Handle 403 errors in descriptions and openers
- Loading branch information
Showing
14 changed files
with
147 additions
and
67 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/app/business/common/components/detail/components/forbiddenResource.js
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,39 @@ | ||
import React, {Component} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from '@emotion/styled'; | ||
import {RoundedButton} from '@substrafoundation/substra-ui'; | ||
import {spacingNormal} from '../../../../../../../assets/css/variables/spacing'; | ||
|
||
const Span = styled('span')` | ||
margin-right: ${spacingNormal}; | ||
`; | ||
|
||
class ForbiddenResource extends Component { | ||
handleClick = () => { | ||
const {setTabIndex, permissionsTabIndex} = this.props; | ||
setTabIndex(permissionsTabIndex); | ||
} | ||
|
||
render() { | ||
const {model, resource} = this.props; | ||
return ( | ||
<> | ||
<Span> | ||
{`You do not have enough permissions to see this ${model}'s ${resource}.`} | ||
</Span> | ||
<RoundedButton onClick={this.handleClick}> | ||
Learn more | ||
</RoundedButton> | ||
</> | ||
); | ||
} | ||
} | ||
|
||
ForbiddenResource.propTypes = { | ||
resource: PropTypes.string.isRequired, | ||
model: PropTypes.string.isRequired, | ||
setTabIndex: PropTypes.func.isRequired, | ||
permissionsTabIndex: PropTypes.number.isRequired, | ||
}; | ||
|
||
export default ForbiddenResource; |
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
Oops, something went wrong.