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

Simple File Manager #2046

Merged
merged 65 commits into from
Apr 1, 2024
Merged

Simple File Manager #2046

merged 65 commits into from
Apr 1, 2024

Conversation

KesterTan
Copy link
Contributor

@KesterTan KesterTan commented Jan 9, 2024

Created a simple file manager that allows an instructor to manage the files and assessments in a course based on the simple file manager found here.

How Has This Been Tested?

  • Tried adding a file, deleting a file and renaming
  • Checked that paths and methods are only callable when you are an instructor of the course
  • Check that the path changes whenever clicking a file or folder and it downloads/open the files when you opened
  • Check that select all checkbox works as expected, creating folder works, upload multiple files works and deleting/renaming files work
  • You should not be able to rename a file, upload a file, create a folder in the root directory
  • Adding a file adds it to the courses directory and it actually appears
  • Downloading a directory converts it to a tar file and recursively downloads everything in the directory
  • Downloading a file downloads it

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have run rubocop and erblint for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting
  • My change requires a change to the documentation, which is located at Autolab Docs
  • I have updated the documentation accordingly, included in this PR

@reviewpad reviewpad bot added the medium Pull request is medium label Jan 9, 2024
@damianhxy damianhxy linked an issue Jan 11, 2024 that may be closed by this pull request
@reviewpad reviewpad bot added large Pull request is large and removed medium Pull request is medium labels Jan 15, 2024
@KesterTan KesterTan marked this pull request as ready for review January 18, 2024 18:49
Copy link
Contributor

coderabbitai bot commented Jan 18, 2024

Note

Reviews Paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Walkthrough

The update introduces a comprehensive FileManager feature to a Rails application, enhancing the user interface with capabilities for managing files and folders. This includes browsing, uploading, downloading, renaming, and deleting files, along with secure permission handling based on user roles. The changes span across controller logic, views, stylesheets, JavaScript functionality, routing, and documentation, integrating a fully functional file manager into the application's interface and improving usability with a styled and interactive file management system.

Changes

File Path Change Summary
app/controllers/file_manager_controller.rb Added FileManagerController for file operations with permissions.
app/views/file_manager/index.html.erb Introduced file manager interface for file operations.
app/views/file_manager/file.html.erb Added view template for displaying file content.
app/assets/stylesheets/file_manager.scss Added styles for the file manager interface.
app/assets/javascripts/file_manager.js Introduced JavaScript functions for file management actions.
config/routes.rb Added routes for file management actions.
spec/controllers/file_manager_controller_spec.rb Added specs for FileManagerController.
app/views/layouts/_navbar.html.erb Updated navbar links and syntax for readability and added "File Manager" link.
docs/instructors.md Added "File Manager" section describing the feature's functionality.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@KesterTan KesterTan removed the request for review from 20wildmanj January 18, 2024 19:31
@KesterTan
Copy link
Contributor Author

Can't think of a way to work around the codeQL issues. I feel like it has been addressed by checking if the path exists within the instructor paths but let me know what you think.

@KesterTan KesterTan marked this pull request as draft February 5, 2024 06:24
@KesterTan KesterTan marked this pull request as ready for review February 26, 2024 21:43
@KesterTan
Copy link
Contributor Author

@coderabbitai pause

@KesterTan KesterTan requested a review from damianhxy March 27, 2024 17:49
Copy link
Member

@damianhxy damianhxy left a comment

Choose a reason for hiding this comment

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

LGTM other than several nits

Copy link
Member

@damianhxy damianhxy left a comment

Choose a reason for hiding this comment

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

LGTM

@KesterTan KesterTan added this pull request to the merge queue Apr 1, 2024
Merged via the queue into master with commit 7cf47d7 Apr 1, 2024
4 of 5 checks passed
@KesterTan KesterTan deleted the file_manager branch April 1, 2024 05:19
NicholasMy pushed a commit to UB-CSE-IT/Autolab that referenced this pull request Jan 10, 2025
* Created File Manager

Changed navbar code

* Added docs

* Changed paths to resource

* Sanitized absolute paths

* Updated path sanitization

* Edited permissions for instructors

* Restored path sanitization

* Fixed linting issues

* More linting

* Erblint

* Added logic for uploading files with duplicate names

* Added routes for base dir

* Sanitize path in JS

* Removed extra code

* Added selected option and uploading multiple files

* Upload multiple, create folder, delete selected, checkboxes

* Styling and scroll-in-view

* Added some tests and added download all

* Changed equality check

* Removed download of ../ and at top level

* Select all checkbox

* Select all checkbox and some tests

* Instructor check for download

* Rebased and added back button for files

* Added docs

* Changed paths to resource

* Sanitized absolute paths

* Updated path sanitization

* Edited permissions for instructors

* Restored path sanitization

* Fixed linting issues

* More linting

* Added logic for uploading files with duplicate names

* Added routes for base dir

* Removed extra code

* Added selected option and uploading multiple files

* Upload multiple, create folder, delete selected, checkboxes

* Styling and scroll-in-view

* Added some tests and added download all

* Changed equality check

* Removed download of ../ and at top level

* Select all checkbox

* Select all checkbox and some tests

* Instructor check for download

* Rebased and added back button for files

* Removed whitespace

* Addressed null and checkall bugs

* Changed permissions for root path

* Removed dead code

* Fixed rename

* Disallow upload of files greater than 1 gb

* Added title indexing and updated documentation

* Comments about docs and unused code

* Fixed expand path

* Breadcrumbs and removed routes

* Error messages and breadcrumbs

* Rubocop fix

* erblint

* Addressed nits and tests

* New name regex

* Changed Pathname to str and breadcrumbs

* Removed myescape

(cherry picked from commit 7cf47d7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
large Pull request is large waiting-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File system browser
3 participants