-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
Time Series Annotation Layers #3521
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8ed1f4b
Adding annotations to backend
mistercrunch e83c0e4
Auto fetching Annotations on the backend
mistercrunch 6aaa4bc
Closing the loop
mistercrunch 3aba1f2
Adding missing files
mistercrunch cc29e51
annotation layers UI
1313151
a few fixes per code review.
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
53 changes: 53 additions & 0 deletions
53
superset/assets/javascripts/explore/components/controls/SelectAsyncControl.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,53 @@ | ||
/* global notify */ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Select from '../../../components/AsyncSelect'; | ||
import { t } from '../../../locales'; | ||
|
||
const propTypes = { | ||
dataEndpoint: PropTypes.string.isRequired, | ||
multi: PropTypes.bool, | ||
mutator: PropTypes.func, | ||
onAsyncErrorMessage: PropTypes.string, | ||
onChange: PropTypes.func, | ||
placeholder: PropTypes.string, | ||
value: PropTypes.oneOfType([ | ||
PropTypes.string, | ||
PropTypes.number, | ||
PropTypes.arrayOf(PropTypes.string), | ||
PropTypes.arrayOf(PropTypes.number), | ||
]), | ||
}; | ||
|
||
const defaultProps = { | ||
multi: true, | ||
onAsyncErrorMessage: t('Error while fetching data'), | ||
onChange: () => {}, | ||
placeholder: t('Select ...'), | ||
}; | ||
|
||
const SelectAsyncControl = ({ value, onChange, dataEndpoint, | ||
multi, mutator, placeholder, onAsyncErrorMessage }) => { | ||
const onSelectionChange = (options) => { | ||
const optionValues = options.map(option => option.value); | ||
onChange(optionValues); | ||
}; | ||
|
||
return ( | ||
<Select | ||
dataEndpoint={dataEndpoint} | ||
onChange={onSelectionChange} | ||
onAsyncError={() => notify.error(onAsyncErrorMessage)} | ||
mutator={mutator} | ||
multi={multi} | ||
value={value} | ||
placeholder={placeholder} | ||
valueRenderer={v => (<div>{v.label}</div>)} | ||
/> | ||
); | ||
}; | ||
|
||
SelectAsyncControl.propTypes = propTypes; | ||
SelectAsyncControl.defaultProps = defaultProps; | ||
|
||
export default SelectAsyncControl; |
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
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,22 @@ | ||
"""empty message | ||
|
||
Revision ID: d39b1e37131d | ||
Revises: ('a9c47e2c1547', 'ddd6ebdd853b') | ||
Create Date: 2017-09-19 15:09:14.292633 | ||
|
||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'd39b1e37131d' | ||
down_revision = ('a9c47e2c1547', 'ddd6ebdd853b') | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
def upgrade(): | ||
pass | ||
|
||
|
||
def downgrade(): | ||
pass |
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,56 @@ | ||
"""annotations | ||
|
||
Revision ID: ddd6ebdd853b | ||
Revises: ca69c70ec99b | ||
Create Date: 2017-09-13 16:36:39.144489 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'ddd6ebdd853b' | ||
down_revision = 'ca69c70ec99b' | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
'annotation_layer', | ||
sa.Column('created_on', sa.DateTime(), nullable=True), | ||
sa.Column('changed_on', sa.DateTime(), nullable=True), | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('name', sa.String(length=250), nullable=True), | ||
sa.Column('descr', sa.Text(), nullable=True), | ||
sa.Column('changed_by_fk', sa.Integer(), nullable=True), | ||
sa.Column('created_by_fk', sa.Integer(), nullable=True), | ||
sa.ForeignKeyConstraint(['changed_by_fk'], ['ab_user.id'], ), | ||
sa.ForeignKeyConstraint(['created_by_fk'], ['ab_user.id'], ), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_table( | ||
'annotation', | ||
sa.Column('created_on', sa.DateTime(), nullable=True), | ||
sa.Column('changed_on', sa.DateTime(), nullable=True), | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('start_dttm', sa.DateTime(), nullable=True), | ||
sa.Column('end_dttm', sa.DateTime(), nullable=True), | ||
sa.Column('layer_id', sa.Integer(), nullable=True), | ||
sa.Column('short_descr', sa.String(length=500), nullable=True), | ||
sa.Column('long_descr', sa.Text(), nullable=True), | ||
sa.Column('changed_by_fk', sa.Integer(), nullable=True), | ||
sa.Column('created_by_fk', sa.Integer(), nullable=True), | ||
sa.ForeignKeyConstraint(['changed_by_fk'], ['ab_user.id'], ), | ||
sa.ForeignKeyConstraint(['created_by_fk'], ['ab_user.id'], ), | ||
sa.ForeignKeyConstraint(['layer_id'], [u'annotation_layer.id'], ), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_index( | ||
'ti_dag_state', | ||
'annotation', ['layer_id', 'start_dttm', 'end_dttm'], unique=False) | ||
|
||
|
||
def downgrade(): | ||
op.drop_index('ti_dag_state', table_name='annotation') | ||
op.drop_table('annotation') | ||
op.drop_table('annotation_layer') |
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.
Bigint?
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.
hoping we never go above 2,147,483,647 annotations, saving some bytes
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.
If you have automated processes writing to this table (airflow) we should change this to BIGINT. The disk space you save is only relevant in cases when you have a lot of rows, which is also when you want to have BIGINTs as your IDs.