Skip to content
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

Implement sorting of query history by name, date, and result count #777

Merged
merged 1 commit into from
Mar 15, 2021

Conversation

edoardopirovano
Copy link
Contributor

This pull request addresses #767 by introducing three ways of sorting the query history view - by a query's label, by the date the query was run, and by the number of results the query produced.

extensions/ql-vscode/src/query-history.ts Show resolved Hide resolved
@@ -400,6 +400,7 @@ export class InterfaceManager extends DisposableObject {
}
);
const resultSet = transformBqrsResultSet(schema, chunk);
results.setResultCount(resultSet.schema.rows);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a little confusing. The alerts table has 33 results in this example, but the #select table has 3906 results. I think people would expect that the result count matches the number of rows in the default table (in this case, it's alerts).

I'm not entirely sure why there is a difference here. I'm just running the example query from the starter repo:

/**
 * @name Empty block
 * @kind problem
 * @problem.severity warning
 * @id javascript/example/empty-block
 */

import javascript

from BlockStmt b
where b.getNumStmt() = 0
select b, "This is an empty block."

It would be nice if we could get the counts for the default table, but I'm not sure how easy this is without loading the sarif.

_Extension_Development_Host__-_CodeQL_Query_Results_—_vscode-codeql-starter__Workspace_

Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

Looks good. And is working for me.

@aeisenberg
Copy link
Contributor

Can you squash and rebase your commits?

Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

Sorry....a few more changes. Just noticed them. If a query has an error, the result count is -1. That should not be displayed in the UI.

_Extension_Development_Host__-_example2_ql_—_vscode-codeql-starter__Workspace_

Looks like -1 is being set in the code. Can you change this to 0?

extensions/ql-vscode/CHANGELOG.md Outdated Show resolved Hide resolved
extensions/ql-vscode/package.json Outdated Show resolved Hide resolved
Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

Thanks for the quick turnaround.

@aeisenberg aeisenberg merged commit e316dec into github:main Mar 15, 2021
@edoardopirovano edoardopirovano deleted the history-sorting branch March 15, 2021 18:27
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.

2 participants