-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closes #3192: Add data source config options. #3292
Closed
+1,108
−80
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
8aec262
Process extra column metadata for a few sql-based data sources.
32901d1
Add Table and Column metadata tables.
b5ee122
Periodically update table and column schema tables in a celery task.
41c9225
Fetching schema returns data from table and column metadata tables.
280876b
Add tests for backend changes.
a541d81
Front-end shows extra table metadata and uses new schema response.
01fc553
Delete datasource schema data when deleting a data source.
3a098d1
Process and store data source schema when a data source is first crea…
7114b81
Tables should have a unique name per datasource.
f072e64
Add schemas queue to docker files.
f501d3f
Closes #3192: Add data source config options.
221af53
Add migration for new metadata.
9fc9d7f
Table display improvements.
0c36b48
Move TableVisibilityCheckbox component to separate file.
04b11c5
Linting proptypes.js
953e906
Linting SchemaTable.jsx
c344d0f
Linting EditableTable.jsx
51bb7af
Move schema table components to new folder.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,10 @@ body { | |
} | ||
} | ||
|
||
.admin-schema-editor { | ||
padding: 50px 0; | ||
} | ||
|
||
.creation-container { | ||
h5 { | ||
color: #a7a7a7; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { react2angular } from 'react2angular'; | ||
import Drawer from 'antd/lib/drawer'; | ||
import Table from 'antd/lib/table'; | ||
|
||
import { DataSourceMetadata } from '@/components/proptypes'; | ||
|
||
class SchemaData extends React.PureComponent { | ||
static propTypes = { | ||
show: PropTypes.bool.isRequired, | ||
onClose: PropTypes.func.isRequired, | ||
tableName: PropTypes.string, | ||
tableDescription: PropTypes.string, | ||
tableMetadata: PropTypes.arrayOf(DataSourceMetadata), | ||
}; | ||
|
||
static defaultProps = { | ||
tableName: '', | ||
tableDescription: '', | ||
tableMetadata: [], | ||
}; | ||
|
||
render() { | ||
const columns = [{ | ||
title: 'Column Name', | ||
dataIndex: 'name', | ||
width: 400, | ||
key: 'name', | ||
}, { | ||
title: 'Column Type', | ||
dataIndex: 'type', | ||
width: 400, | ||
key: 'type', | ||
}, { | ||
title: 'Example', | ||
dataIndex: 'example', | ||
width: 400, | ||
key: 'example', | ||
}, { | ||
title: 'Description', | ||
dataIndex: 'column_description', | ||
width: 400, | ||
key: 'column_description', | ||
}]; | ||
|
||
return ( | ||
<Drawer | ||
title={this.props.tableName} | ||
closable={false} | ||
placement="bottom" | ||
height={500} | ||
onClose={this.props.onClose} | ||
visible={this.props.show} | ||
> | ||
<h5 className="table-description"> | ||
{this.props.tableDescription} | ||
</h5> | ||
<Table | ||
dataSource={this.props.tableMetadata} | ||
pagination={false} | ||
scroll={{ y: 350 }} | ||
size="small" | ||
columns={columns} | ||
/> | ||
</Drawer> | ||
); | ||
} | ||
} | ||
|
||
export default function init(ngModule) { | ||
ngModule.component('schemaData', react2angular(SchemaData, null, [])); | ||
} | ||
|
||
init.init = true; |
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
86 changes: 86 additions & 0 deletions
86
client/app/pages/data-sources/schema-table-components/EditableTable.jsx
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,86 @@ | ||
import React from 'react'; | ||
import Form from 'antd/lib/form'; | ||
import Input from 'antd/lib/input'; | ||
import PropTypes from 'prop-types'; | ||
import { TableMetadata } from '@/components/proptypes'; | ||
import TableVisibilityCheckbox from './TableVisibilityCheckbox'; | ||
import './schema-table.css'; | ||
|
||
const FormItem = Form.Item; | ||
const { TextArea } = Input; | ||
export const EditableContext = React.createContext(); | ||
|
||
// eslint-disable-next-line react/prop-types | ||
const EditableRow = ({ form, index, ...props }) => ( | ||
<EditableContext.Provider value={form}> | ||
<tr {...props} /> | ||
</EditableContext.Provider> | ||
); | ||
|
||
export const EditableFormRow = Form.create()(EditableRow); | ||
|
||
export class EditableCell extends React.Component { | ||
static propTypes = { | ||
dataIndex: PropTypes.string, | ||
input_type: PropTypes.string, | ||
editing: PropTypes.bool, | ||
record: TableMetadata, | ||
}; | ||
|
||
static defaultProps = { | ||
dataIndex: undefined, | ||
input_type: undefined, | ||
editing: false, | ||
record: {}, | ||
}; | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
visible: this.props.record ? this.props.record.table_visible : false, | ||
}; | ||
} | ||
|
||
onChange = () => { | ||
this.setState({ visible: !this.state.visible }); | ||
} | ||
|
||
getInput = () => { | ||
if (this.props.input_type === 'table_visible') { | ||
return ( | ||
<TableVisibilityCheckbox | ||
visible={this.state.visible} | ||
onChange={this.onChange} | ||
/>); | ||
} | ||
return <TextArea className="table-textarea" placeholder="Enter table description..." style={{ resize: 'vertical' }} />; | ||
}; | ||
|
||
render() { | ||
const { | ||
editing, | ||
dataIndex, | ||
record, | ||
...restProps | ||
} = this.props; | ||
|
||
return ( | ||
<EditableContext.Consumer> | ||
{(form) => { | ||
const { getFieldDecorator } = form; | ||
return ( | ||
<td {...restProps}> | ||
{editing ? ( | ||
<FormItem style={{ margin: 0 }}> | ||
{getFieldDecorator(dataIndex, { | ||
initialValue: record[dataIndex], | ||
})(this.getInput()) } | ||
</FormItem> | ||
) : restProps.children} | ||
</td> | ||
); | ||
}} | ||
</EditableContext.Consumer> | ||
); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
render
has 42 lines of code (exceeds 25 allowed). Consider refactoring.