-
Notifications
You must be signed in to change notification settings - Fork 1.9k
IGNITE-11035 Updates in queries page. #6021
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
Conversation
| * @param {Boolean} [lazy] query flag. | ||
| * @param {Boolean} [collocated] Collocated query. | ||
| * @returns {Promise} | ||
| * @returns {Promise<VisorQueryResult>} |
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.
@vsisko I couldn't find where VisorQueryResult is defined.
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.
VisorQueryResult is a Java class and doesn't has analog in JS.
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.
That's not how types in JSDoc or TS work. You are supposed to describe the data structure so tooling and fellow developers are aware what's inside. This concerns all data received from backend.
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.
The returned type description has been added.
| this.agentMgr.switchCluster(this.cluster); | ||
| change(item) { | ||
| this.agentMgr.switchCluster(this.cluster) | ||
| .then(() => this.cluster = item) |
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.
Updated AgentManager.switchCluster returns true if cluster was successful switched, did you check that assigning true to this.cluster doesn't break cluster-selector?
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.
We set to a cluster value of change function argument. Not result of switchCluster.
Removed true result on resolve of switchCluster function
| } | ||
|
|
||
| toJSON() { | ||
| return { |
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.
👍
|
|
||
| $window.addEventListener('beforeunload', () => { | ||
| this._closeOpenedQueries(this.$scope.notebook.paragraphs); | ||
| const offTransitions = $transitions.onBefore({from: 'base.sql.notebook'}, ($transition$) => { |
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.
Did you mean this.offTransitions = ?
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.
Changed to this.offTransitions
| const offTransitions = $transitions.onBefore({from: 'base.sql.notebook'}, ($transition$) => { | ||
| const options = $transition$.options(); | ||
|
|
||
| if (options.custom.justIDUpdate || options.redirectedFrom) |
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.
What's the point of this check? Looks like a copy/paste to me.
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.
Removed unused check.
| await this.Confirm.confirm('Are you sure you want to remove query: "' + paragraph.name + '"?'); | ||
| this.$scope.stopRefresh(paragraph); | ||
| const msg = (this._hasRunningQueries([paragraph]) | ||
| ? 'Query is being executed. Are you sure you want cancel and remove query: "' |
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.
"you want to cancel"
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.
Typo is fixed.
| } | ||
| } | ||
|
|
||
| async removeParagraph(paragraph: Paragraph) { |
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.
When removing instances of Paragraph, you might want to dispose of Subjects by calling Subject.complete.
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.
Added closing of the subjects.
| this.clusterIsAvailable = (!!cluster && cluster.active === true) || agentMgr.isDemoMode(); | ||
| }) | ||
| ); | ||
|
|
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.
Please add comment as to why redirectedFrom matters.
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.
Added comment.
|
|
||
| this.connectionSbj.next(state); | ||
|
|
||
| this.saveToStorage(cluster); |
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.
- You can reuse type definitions using @typedef or import from TS file. Ask me how to.
- Surely there's no
Listin parsed JSON. Please use correct types.
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.
Fixed jsdock.
| onQueryStarted(res); | ||
| $scope.$applyAsync(); | ||
| }), | ||
| expand((res) => { |
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.
I think that an expand, filter is not really needed and can be replaced with something like this:
exhaustMap((res) => {
if (!_.isNil(res.rows))
return from(res);
return merge(fetchFirstPageTask, pingQueryTask);
})
@Klaster1 what do you think about this?
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.
Yeah, I'm not sure recursion is even require here. The exhaust block basically polls first page results and pings to keep the polling alive. If I understand the query API correctly, res.queryId - the only value received from previous recursion call - does not change ever.
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.
Recursion is removed by changing of exexpand to exhaustMap.
| if (debug) | ||
| log(ignite.log(), "Ping of query finished: " + qryId, getClass(), start); | ||
|
|
||
| return new VisorEither<>(new VisorQueryPingTaskResult(true)); |
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.
The inProgress flag is always true, I think it should be removed
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.
Removed unused task result property.
| onQueryStarted(res); | ||
| $scope.$applyAsync(); | ||
| }), | ||
| expand((res) => { |
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.
Yeah, I'm not sure recursion is even require here. The exhaust block basically polls first page results and pings to keep the polling alive. If I understand the query API correctly, res.queryId - the only value received from previous recursion call - does not change ever.
|
|
||
| _showLoading(paragraph, false); | ||
| delete paragraph.subscription; | ||
| first() |
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.
@vsisko given that first and take(1) are slightly different, do you really intend to throw if no results arrive upon observable completion? If user cancels the query by leaving the screen, wouldn't it throw?
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.
I'm just curious here.
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.
On cancel of the query no error is thrown.
(cherry picked from commit c2da3d5)
(cherry picked from commit c2da3d5)
…Fixes apache#6021. (cherry picked from commit c2da3d5)
No description provided.