Skip to content

Conversation

Anemy
Copy link
Member

@Anemy Anemy commented Jul 17, 2020

https://jira.mongodb.org/browse/VSCODE-56

This PR adds a document count in the tree view. The count is shown in the document lists' description. When the document count is a large number it's abbreviated using numeral js (Compass also uses this). Chatted with Claudia and Max and we were preferring uppercase abbreviations over lowercase (k vs K, m vs M), so they're shown in uppercase, any thoughts?

When the document list is hovered, the tooltip shows the full document count.

Also added a Refresh right-click action to the document list to reset it in the tree view.


doc count gif

@Anemy Anemy requested a review from mcasimir July 17, 2020 11:40
@Anemy Anemy requested a review from alenakhineika July 21, 2020 08:45
Copy link
Contributor

@alenakhineika alenakhineika left a comment

Choose a reason for hiding this comment

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

Tested locally and everything works as expected. Nice! Also well tested 👏

};

export const formatDocCount = (count: number): string => {
return `${numeral(count).format('0a')}`.toUpperCase();
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you pls add a comment with an example here to make it move visible what the expected format should be.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call

`Expected a tree item child with the label "show more..." found ${documents[10].label}`
);
})
.then(done, done);
Copy link
Contributor

Choose a reason for hiding this comment

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

Always happy to see that done done disappears 😀

);
// Here we stub the showInformationMessage process because it is too much
// for the render process and leads to crashes while testing.
sinon.replace(vscode.window, 'showInformationMessage', sinon.stub());
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! 👏

@Anemy Anemy merged commit 8846c94 into master Jul 21, 2020
@Anemy Anemy deleted the VSCODE-56/display-document-count-in-tree-view branch July 21, 2020 18:01
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