[explore-v2] add edit link below datasource select (#1919)

* add edit link below datasource select

* add default prop
This commit is contained in:
Alanna Scott
2017-01-10 21:13:25 -08:00
committed by GitHub
parent 7323f4c2ab
commit 5d94d7067e
2 changed files with 6 additions and 1 deletions

View File

@@ -1,11 +1,11 @@
import React, { PropTypes } from 'react';
import Select, { Creatable } from 'react-select';
const propTypes = {
choices: PropTypes.array,
clearable: PropTypes.bool,
description: PropTypes.string,
editUrl: PropTypes.string,
freeForm: PropTypes.bool,
label: PropTypes.string,
multi: PropTypes.bool,
@@ -18,6 +18,7 @@ const defaultProps = {
choices: [],
clearable: true,
description: null,
editUrl: null,
freeForm: false,
label: null,
multi: false,
@@ -89,6 +90,9 @@ export default class SelectField extends React.Component {
return (
<div>
{selectWrap}
{this.props.editUrl &&
<a href={`${this.props.editUrl}/${this.props.value}`}>edit</a>
}
</div>
);
}

View File

@@ -31,6 +31,7 @@ export const fields = {
label: 'Datasource',
clearable: false,
default: null,
editUrl: '/tablemodelview/edit',
mapStateToProps: (state) => ({
choices: state.datasources || [],
}),