Repository navigation
Added Extension Sorting capability according to downloads and last published date - #13080
Conversation
petetnt
left a comment
There was a problem hiding this comment.
Mostly LGTM, needs tests 👍
|
|
||
| ExtensionManagerViewModel.prototype._setSortedExtensionList = function (extensions, isTheme) { | ||
| this.filterSet = this.sortedFullSet = registry_utils.sortRegistry(extensions, "registryInfo") | ||
| .filter(function (entry) { |
There was a problem hiding this comment.
There seems to be some redundancy here, seems like same could be achieved with:
return entry.registryInfo && entry.registryInfo.metadata;Do correct me if I am wrong 👍
There was a problem hiding this comment.
yeah that can be changed :)
|
Nice! I think @zaggino and @dnbard could have some opinions on this. I have two doubts:
|
|
@ficristo the installed tab is treated differently as we do not have the download count of the installed extensions in the installInfo, and also currently the sorting of installed extensions is done according to the update available. |
|
Great stuff @saurabh95! Some issues I spotted:
|
petetnt
left a comment
There was a problem hiding this comment.
Reviewed again, couple of small issues, otherwise LGTM 👍
| PreferencesManager.set("extensions.sort", "downloadCount"); | ||
| model._setSortedExtensionList(ExtensionManager.extensions, true); | ||
| expect(model.filterSet).toEqual(["theme-2", "theme-1"]); | ||
| }); |
There was a problem hiding this comment.
A simple check could be added that Brackets actually renders the totalDownloads to the UI 👍
| sortedEntries.sort(function (entry1, entry2) { | ||
| return getPublishTime((subkey && entry2[subkey]) || entry2) - | ||
| getPublishTime((subkey && entry1[subkey]) || entry1); | ||
| if (sortBy !== "publishedDate") { |
There was a problem hiding this comment.
Not a big deal, but in general I prefer if you spell out all cases:
if (sortBy === "downloadCount") {
} else if (sortBy === "publishedDate") {
} else {
console.error("Unknown sortBy " + sortBy ". Defaults to....")
}Or something like this.
|
@petetnt I have added a test for checking downloadCount in view and also added a check for active tab on launch of Extension Manager to hide/show the sort option, regarding the download icon, I will replace it with an image. |
swmitra
left a comment
There was a problem hiding this comment.
Good stuff @saurabh95 👍
|
Merging Now with the new Icon. |



Now on opening the Extension Manager, a drop-down is shown on the left side of the search bar, which indicates the sorting of extensions according to the selected criteria(currently sort methods available are Last Updated and Download Count), on change of the selection we store the the changed selection in the preferences and if the Extension Manager is invoked again, then we use the same sorting criteria which was selected by user earlier. The sorting is available for Available and Theme Extensions.
I have attached a snapshot of the feature in use where the sort order and the download count has been highlighted for illustration.