-
Notifications
You must be signed in to change notification settings - Fork 14k
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
Enable "Run Query in New Tab" in SQL Lab #1343
Merged
mistercrunch
merged 6 commits into
apache:master
from
nickbarnwell:nickbarnwell/fix-1147-sqlab-run-query-in-new-tab
Oct 18, 2016
+52
−4
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b37caad
Enable "Clone to New Tab" btn in QueryHistoryTable
1ec1033
Move Clone Logic to Action
a4f9aee
Implement PR feedback
d73974b
Clean up reducer action; fix bug
0413a77
Tests for Reducer Action
6ccc2b4
Fix CodeClimate feedback
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import * as r from '../../../javascripts/SqlLab/reducers'; | ||
import * as actions from '../../../javascripts/SqlLab/actions'; | ||
import { describe, it } from 'mocha'; | ||
import { expect } from 'chai'; | ||
|
||
describe('sqlLabReducer', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldn't find anything to model these tests off of, let me know how you'd prefer them to be structured. |
||
describe('CLONE_QUERY_TO_NEW_TAB', () => { | ||
const testQuery = { sql: 'SELECT * FROM...', dbId: 1, id: 1 }; | ||
const state = Object.assign(r.initialState, { queries: [testQuery] }); | ||
const newState = r.sqlLabReducer(state, actions.cloneQueryToNewTab(testQuery)); | ||
|
||
it('should have at most one more tab', () => { | ||
expect(newState.queryEditors).have.length(2); | ||
}); | ||
|
||
it('should have the same SQL as the cloned query', () => { | ||
expect(newState.queryEditors[1].sql).to.equal(testQuery.sql); | ||
}); | ||
|
||
it('should prefix the new tab title with "Copy of"', () => { | ||
expect(newState.queryEditors[1].title).to.include('Copy of'); | ||
}); | ||
|
||
it('should push the cloned tab onto tab history stack', () => { | ||
expect(newState.tabHistory[1]).to.eq(newState.queryEditors[1].id); | ||
}); | ||
}); | ||
}); |
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.
Wasn't super DRY essentially copying addQueryEditor into this action. This seems better, but not terribly clean either…suggestions for improvement welcome!