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

Add sort options for UseDirectoryBrowser #20174

Closed
xboxeer opened this issue Mar 26, 2020 · 2 comments
Closed

Add sort options for UseDirectoryBrowser #20174

xboxeer opened this issue Mar 26, 2020 · 2 comments
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlesware

Comments

@xboxeer
Copy link

xboxeer commented Mar 26, 2020

Is your feature request related to a problem? Please describe.

Our customer in Stackoverflow is using UseDirectoryBrowser to list the files on his server, he'd like to sort the listed files by created date and modified date, but there is not any places that we can config this, seems UseDirectoryBrowser does not have an option for that

Describe the solution you'd like

DirectoryBrowserOptions class can have another enum property named SortBy, value of this propery could be CreatedDate, ModifiedDate, or a combination such as CreatedDate|ModifiedDate. In the meantime, UseDirectoryBrowser will check this propery and take the sort options into consideration while rendering the file list in frontend

Additional context

Original post in stackoverflow as below
https://stackoverflow.com/questions/60850477/asp-net-directorybrowser-feature-how-to-control-sort

@Tratcher
Copy link
Member

If we were to add such an option to DirectoryBrowserOptions then the sort would have to happen right before passing the data to the formatter here since there's no way to pass in options to the formatter:

return _formatter.GenerateContentAsync(context, contents);

Or maybe add it as an option directly on the HtmlDirectoryFormatter rather than DirectoryBrowserOptions and have you set the Formatter if you wanted to change it?

Your best bet in the short term is to replace DirectoryBrowserOptions.Formatter to customize the view. You can copy HtmlDirectoryFormatter and customize it to your liking.

public class HtmlDirectoryFormatter : IDirectoryFormatter

@shirhatti
Copy link
Contributor

Triage decision: The directory browser middleware is primarily intended for diagnostic scenarios. Unfortunately, we don't plan to do this. This is a great option to author a good third-party Directory Browser.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 26, 2020
@amcasey amcasey added area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlesware and removed area-runtime labels Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlesware
Projects
None yet
Development

No branches or pull requests

6 participants