Skip to content

Commit

Permalink
[explore-v2] add edit link below datasource select (apache#1919)
Browse files Browse the repository at this point in the history
* add edit link below datasource select

* add default prop
  • Loading branch information
Alanna Scott authored Jan 11, 2017
1 parent 7323f4c commit 5d94d70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -18,6 +18,7 @@ const defaultProps = {
choices: [],
clearable: true,
description: null,
editUrl: null,
freeForm: false,
label: null,
multi: false,
Expand Down Expand Up @@ -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>
);
}
Expand Down
1 change: 1 addition & 0 deletions superset/assets/javascripts/explorev2/stores/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const fields = {
label: 'Datasource',
clearable: false,
default: null,
editUrl: '/tablemodelview/edit',
mapStateToProps: (state) => ({
choices: state.datasources || [],
}),
Expand Down

0 comments on commit 5d94d70

Please sign in to comment.