-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added time filter to query search page (#1329)
* Added time filter to query search page * Added start date * Updated python endpoint test * changed spec * Added specs and tests * Modified python/js tests and some function/file names based on code review comments * Resolved conflicts in DashboardSelect_spec and QuerySearch_spec * Break python tests for separate functions, Move sql queries to setUp() * Get around eslint error for spec * Small changes based on comments
- Loading branch information
Showing
11 changed files
with
300 additions
and
55 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,24 @@ | ||
export const STATE_BSSTYLE_MAP = { | ||
failed: 'danger', | ||
pending: 'info', | ||
fetching: 'info', | ||
running: 'warning', | ||
stopped: 'danger', | ||
success: 'success', | ||
}; | ||
|
||
export const STATUS_OPTIONS = [ | ||
'success', | ||
'failed', | ||
'running', | ||
]; | ||
|
||
export const TIME_OPTIONS = [ | ||
'now', | ||
'1 hour ago', | ||
'1 day ago', | ||
'7 days ago', | ||
'28 days ago', | ||
'90 days ago', | ||
'1 year ago', | ||
]; |
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
34 changes: 34 additions & 0 deletions
34
caravel/assets/spec/javascripts/sqllab/DatabaseSelect_spec.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,34 @@ | ||
import React from 'react'; | ||
import Select from 'react-select'; | ||
import DatabaseSelect from '../../../javascripts/SqlLab/components/DatabaseSelect'; | ||
import { shallow } from 'enzyme'; | ||
import { describe, it } from 'mocha'; | ||
import { expect } from 'chai'; | ||
import sinon from 'sinon'; | ||
|
||
describe('DatabaseSelect', () => { | ||
const mockedProps = { | ||
actions: {}, | ||
}; | ||
it('is valid element', () => { | ||
expect( | ||
React.isValidElement(<DatabaseSelect {...mockedProps} />) | ||
).to.equal(true); | ||
}); | ||
|
||
it('has one select', () => { | ||
const wrapper = shallow( | ||
<DatabaseSelect {...mockedProps} /> | ||
); | ||
expect(wrapper.find(Select)).to.have.length(1); | ||
}); | ||
|
||
it('calls onChange on select change', () => { | ||
const onChange = sinon.spy(); | ||
const wrapper = shallow( | ||
<DatabaseSelect onChange={onChange} /> | ||
); | ||
wrapper.find(Select).simulate('change', { value: 1 }); | ||
expect(onChange).to.have.property('callCount', 1); | ||
}); | ||
}); |
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
Oops, something went wrong.