Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Commit

Permalink
Fix navigation bug when access is denied (#203)
Browse files Browse the repository at this point in the history
* Fix path navigation when access is denied

* Cleanup fix
  • Loading branch information
djenriquez authored Oct 2, 2017
1 parent 8787ec1 commit 6b700e2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions app/components/Secrets/Generic/Generic.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default class GenericSecretBackend extends React.Component {
if (!_.isEqual(`${nextProps.params.splat}`, this.state.currentLogicalPath)) {
this.setState({ currentLogicalPath: `${nextProps.params.splat}` })
}
if(!_.isEqual(this.props.params.namespace, nextProps.params.namespace)){
if (!_.isEqual(this.props.params.namespace, nextProps.params.namespace)) {
this.baseUrl = `/secrets/${nextProps.params.namespace}/`;
}
}
Expand Down Expand Up @@ -315,13 +315,13 @@ export default class GenericSecretBackend extends React.Component {
var relativelink = [].concat(components).slice(0, index + 1).join('/') + '/';
if (index === 0) {
// no left padding for first item
var stepLabelStyle = { paddingLeft: '0'}
var stepLabelStyle = { paddingLeft: '0' }
var iconContainerStyle = { padding: '0' }
} else {
var stepLabelStyle = { paddingLeft: '10px'}
var stepLabelStyle = { paddingLeft: '10px' }
var iconContainerStyle = {}
}
return (<Step key={index}><StepLabel style={Object.assign({paddingRight: '10px', fontSize: '16px', whiteSpace: 'nowrap'}, stepLabelStyle)} iconContainerStyle={iconContainerStyle} icon={<span />}><Link to={`${this.baseUrl}${relativelink}`}>{dir}</Link></StepLabel></Step>)
return (<Step key={index}><StepLabel style={Object.assign({ paddingRight: '10px', fontSize: '16px', whiteSpace: 'nowrap' }, stepLabelStyle)} iconContainerStyle={iconContainerStyle} icon={<span />}><Link to={`${this.baseUrl}${relativelink}`}>{dir}</Link></StepLabel></Step>)
});
}

Expand All @@ -339,7 +339,7 @@ export default class GenericSecretBackend extends React.Component {
<Toolbar style={{ alignItems: 'flex-start' }}>
<ToolbarGroup>
<Subheader style={{ paddingLeft: "0" }} inset={false}>
<IconButton style={{paddingTop: "20px"}} tooltip="Copy Path" onTouchTap={() => { copy(this.state.currentLogicalPath) }} >
<IconButton style={{ paddingTop: "20px" }} tooltip="Copy Path" onTouchTap={() => { copy(this.state.currentLogicalPath) }} >
<ContentContentCopy />
</IconButton>
</Subheader>
Expand Down Expand Up @@ -388,14 +388,13 @@ export default class GenericSecretBackend extends React.Component {
snackBarMessage(`Secret ${deletedItem} deleted`);
}}
onTouchTap={(key) => {
this.setState({ newSecretName: '', currentLogicalPath: `${this.state.currentLogicalPath}${key}` });
tokenHasCapabilities([this.isPathDirectory(key) ? 'list' : 'read'], `${this.state.currentLogicalPath}${key}`)
.then(() => {
this.setState({ newSecretName: '', currentLogicalPath: `${this.state.currentLogicalPath}${key}` });
history.push(`${this.baseUrl}${this.state.currentLogicalPath}`);
}).catch(() => {
snackBarMessage(new Error("Access denied"));
})

}}
/>
</Paper>
Expand Down

0 comments on commit 6b700e2

Please sign in to comment.