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

Sort variables in variable explorer by column #5876

Closed
wants to merge 1 commit into from

Conversation

vandyliu
Copy link
Contributor

For #4585

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).

@vandyliu vandyliu marked this pull request as ready for review May 13, 2021 20:47
@vandyliu vandyliu requested a review from a team as a code owner May 13, 2021 20:47
this.setState({
containerHeight: nextProps.containerHeight,
gridHeight: nextProps.gridHeight,
variables: nextProps.variables
Copy link
Contributor

Choose a reason for hiding this comment

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

If this.props.variables changes while a sort is active on the variable explorer's contents, would this cause the variable order to reset to an unordered state? I believe the user would expect their existing sort order to be preserved as variables change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, I'll take a look into it

@@ -498,4 +516,22 @@ export class VariableExplorer extends React.Component<IVariableExplorerProps, IV
this.props.showDataExplorer(row.buttons.variable, row.buttons.numberOfColumns);
}
};

private sortRows(sortColumn: string, sortDirection: 'ASC' | 'DESC' | 'NONE') {
Copy link
Contributor

Choose a reason for hiding this comment

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

You should probably save the sortColumn/direction so that on refresh you can resort. Although that would mean sorting when set the state.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, maybe not. Sorting would require fetching all rows so if you resorted on variable refresh that would likely make all variable refreshes fetch every row.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, thinking about this more, it feels like the variables need to be sorted when requested from the kernel. This way you can still keep the paging algorithm

Copy link
Contributor

Choose a reason for hiding this comment

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

And then you could save the sort column/direction, but instead of sorting in the UI, you'd make a new variable request to the server.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, that makes sense. I'll try that. Thanks :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Something to keep in mind, the code you'll send to the kernel will likely be specific to python. Try to keep the python semantics out of the internal request as far down as you can go. This will make it easier to add support for say C#/Julia/R in the future.

For example, you wouldn't want the sort column message from the UI to have any python specific stuff in it.

@codecov-commenter
Copy link

Codecov Report

Merging #5876 (753e205) into main (c47b09b) will decrease coverage by 0%.
The diff coverage is n/a.

@@          Coverage Diff          @@
##            main   #5876   +/-   ##
=====================================
- Coverage     72%     72%   -1%     
=====================================
  Files        403     403           
  Lines      26971   26971           
  Branches    3941    3941           
=====================================
- Hits       19432   19427    -5     
+ Misses      5987    5911   -76     
- Partials    1552    1633   +81     
Impacted Files Coverage Δ
...client/datascience/kernel-launcher/kernelDaemon.ts 53% <0%> (-2%) ⬇️
...rc/client/datascience/jupyter/debuggerVariables.ts 75% <0%> (-2%) ⬇️
src/client/datascience/baseJupyterSession.ts 70% <0%> (-1%) ⬇️
src/client/datascience/jupyter/jupyterNotebook.ts 71% <0%> (-1%) ⬇️
...active-common/intellisense/intellisenseProvider.ts 74% <0%> (-1%) ⬇️
src/client/common/utils/async.ts 46% <0%> (ø)
src/client/common/cancellation.ts 72% <0%> (ø)
src/client/datascience/telemetry/telemetry.ts 81% <0%> (ø)
src/client/datascience/webviews/webviewHost.ts 86% <0%> (ø)
src/client/datascience/jupyter/kernels/kernel.ts 75% <0%> (ø)
... and 14 more

@vandyliu vandyliu closed this May 14, 2021
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.

4 participants