Skip to content

Conversation

@vsisko
Copy link
Contributor

@vsisko vsisko commented Feb 5, 2019

No description provided.

* @param {Boolean} [lazy] query flag.
* @param {Boolean} [collocated] Collocated query.
* @returns {Promise}
* @returns {Promise<VisorQueryResult>}
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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 {
Copy link
Contributor

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$) => {
Copy link
Contributor

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 = ?

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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: "'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"you want to cancel"

Copy link
Contributor Author

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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();
})
);

Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. You can reuse type definitions using @typedef or import from TS file. Ask me how to.
  2. Surely there's no List in parsed JSON. Please use correct types.

Copy link
Contributor Author

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) => {
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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));
Copy link
Contributor

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

Copy link
Contributor Author

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) => {
Copy link
Contributor

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()
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@asfgit asfgit closed this in c2da3d5 Mar 11, 2019
nva pushed a commit to gridgain/apache-ignite that referenced this pull request Mar 12, 2019
nva pushed a commit to gridgain/apache-ignite that referenced this pull request Mar 12, 2019
@akuznetsov-gridgain akuznetsov-gridgain deleted the ignite-11035 branch March 19, 2019 15:02
akuznetsov-gridgain pushed a commit to gridgain/apache-ignite that referenced this pull request Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants