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

Add KV compatibility #198

Merged
merged 1 commit into from
Oct 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ReactDOM.render((
<Route path="/login" component={Login} onEnter={checkVaultUiServer} />
<Route path="/unwrap" component={SecretUnwrapper} />
<Route path="/" component={App} onEnter={checkAccessToken}>
<Route path="/secrets/generic/:namespace(/**)" component={SecretsGeneric} />
<Route path="/secrets/:namespace(/**)" component={SecretsGeneric} />
<Route path="/auth/token/:namespace" component={TokenAuthBackend} />
<Route path="/auth/aws/:namespace(/**)" component={AwsAuthBackend} />
<Route path="/auth/aws-ec2/:namespace(/**)" component={AwsEc2AuthBackend} />
Expand Down
20 changes: 12 additions & 8 deletions app/components/Secrets/Generic/Generic.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export default class GenericSecretBackend extends React.Component {
constructor(props) {
super(props);

this.baseUrl = `/secrets/generic/${this.props.params.namespace}/`;
this.baseVaultPath = `${this.props.params.namespace}`;
this.baseUrl = `/secrets/${this.props.params.namespace}/`;
this.baseVaultPath = `${this.props.params.splat}`;

this.state = {
newSecretBtnDisabled: true,
secretContent: {},
newSecretName: '',
currentLogicalPath: `${this.props.params.namespace}/${this.props.params.splat}`,
currentLogicalPath: `${this.props.params.splat}`,
disableSubmit: true,
openNewObjectModal: false,
openEditObjectModal: false,
Expand Down Expand Up @@ -130,10 +130,13 @@ export default class GenericSecretBackend extends React.Component {
}

componentWillReceiveProps(nextProps) {
if (!_.isEqual(`${nextProps.params.namespace}/${nextProps.params.splat}`, this.state.currentLogicalPath)) {
this.setState({ currentLogicalPath: `${nextProps.params.namespace}/${nextProps.params.splat}` })
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}/`;
}
if (!_.isEqual(this.props.params.splat, nextProps.params.splat)) {
// Reset
this.setState({
secretList: []
Expand Down Expand Up @@ -323,7 +326,7 @@ export default class GenericSecretBackend extends React.Component {
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={`/secrets/generic/${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 Down Expand Up @@ -393,7 +396,8 @@ export default class GenericSecretBackend extends React.Component {
this.setState({ newSecretName: '', currentLogicalPath: `${this.state.currentLogicalPath}${key}` });
tokenHasCapabilities([this.isPathDirectory(key) ? 'list' : 'read'], `${this.state.currentLogicalPath}${key}`)
.then(() => {
history.push(`/secrets/generic/${this.state.currentLogicalPath}`);
console.log(`${this.baseUrl}${this.state.currentLogicalPath}`);
history.push(`${this.baseUrl}${this.state.currentLogicalPath}`);
}).catch(() => {
snackBarMessage(new Error("Access denied"));
})
Expand Down
3 changes: 2 additions & 1 deletion app/components/shared/Menu/Menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { tokenHasCapabilities, callVaultApi, history } from '../VaultUtils.jsx'
const SelectableList = makeSelectable(List);

const supported_secret_backend_types = [
'generic'
'generic',
'kv'
]

const supported_auth_backend_types = [
Expand Down