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 local directory listing feature #32166

Open
Bobulous opened this issue Apr 27, 2024 · 4 comments · May be fixed by #32167
Open

Add local directory listing feature #32166

Bobulous opened this issue Apr 27, 2024 · 4 comments · May be fixed by #32167
Labels
B-feature-tracking This issue tracks a particular high-level feature C-untriaged New issues that haven't been triaged yet

Comments

@Bobulous
Copy link

Describe the new feature:
A clear and concise description of the new feature with links to any relevant specifications.

Add a directory listing feature to Servo, so that when visiting a local directory path instead of a specific file, Servo will generate a table of contents which lists the files and sub-directories within the specified local directory.

As an example, in Mozilla Firefox visit a path such as file:///home/your_username/ and see how it lists the content of your home directory.

This feature will make it easier to move between Servo test directories and test files, and will make it useful for web developers to easily browse the content of their local development directories while creating and testing content.

@Bobulous Bobulous added B-feature-tracking This issue tracks a particular high-level feature C-untriaged New issues that haven't been triaged yet labels Apr 27, 2024
@Bobulous Bobulous linked a pull request Apr 27, 2024 that will close this issue
5 tasks
@Bobulous
Copy link
Author

I've submitted a pull request which adds this feature. Attached is a screenshot of how a local directory listing looks in Servo with this new feature.

Servo_local-directory-listing

@Bobulous
Copy link
Author

Bobulous commented Apr 28, 2024

To fix the unit test for the directory listing page, the directories and files have been grouped separately and sorted alphabetically. So the latest version of the code found in the pull request will generate a directory listing which looks like the attached image.

Servo_local-directory-listing_v2

Note, however, that there is still a technical problem when the address bar URL does not end with a forward-slash. See the comment in the pull request for information about this. (Update: I think the third commit added to the pull request has fixed this problem.)

@Bobulous
Copy link
Author

Revised the code based on review feedback. The latest proposed code causes Servo to render the directory listing like this:

Servo_local-directory-listing_v3

Still have not found a way to turn SystemTime (for the files' last-modified datetime) into something which can actually be displayed on the page.

@Bobulous
Copy link
Author

Bobulous commented May 4, 2024

The actual file last-modified datetimes are now being written into the page; file sizes are now shown in bytes, kibybytes, mebibytes, and so on depending on how large the file is; the HTML markup has been given more structure; and I opted for a bold stylesheet inspired by the colours of the Servo logo and website. The latest version of the code in the pull request will render a directory listing like this:

Servo_local-directory-listing_v4

Directories and files have different colours (and symlinks different again, though none are shown in this screenshot). The "Modified" date will not show the year if the file was last modified in the current year, or will simply show "today" if the file was last modified today, and all of this is handled by CSS, so it can be customised easily.

I'm not convinced the styling won't be completely rejected, but this is the look which has grown on me during development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-feature-tracking This issue tracks a particular high-level feature C-untriaged New issues that haven't been triaged yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant