Skip to content

Conversation

@notAreYouScared
Copy link
Member

Requires wings/#123

Allows the user to pick an archive type,

image

@notAreYouScared notAreYouScared self-assigned this Oct 23, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 23, 2025

📝 Walkthrough

Walkthrough

Archive creation now accepts a selected compression extension. The extension value is added to the UI form, validated by the request, passed through the API controller, and forwarded to the daemon repository's compressFiles call and daemon payload.

Changes

Cohort / File(s) Summary
UI / Filament page
app/Filament/Server/Resources/Files/Pages/ListFiles.php
Replaced single TextInput with a 3-column Grid: 2-column TextInput for name and 1-column Select for extension (options: tar.gz, zip, tar.bz2, tar.xz). Updated single and bulk archive actions to pass selected extension to compressFiles. Added Select and Grid imports.
API Controller & Request
app/Http/Controllers/Api/Client/Servers/FileController.php, app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php
Controller compress() now forwards an extension argument to repository compressFiles. Request rules() adds optional extension validation allowing: zip, tgz, tar.gz, txz, tar.xz, tbz2, tar.bz2.
Daemon repository
app/Repositories/Daemon/DaemonFileRepository.php
compressFiles signature changed to accept optional ?string $extension. HTTP request body to daemon now includes 'extension' => $extension ?? ''.
Localization
lang/en/server/file.php
Added 'extension' => 'Extension' entry under the archive action translations.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as Filament UI
  participant API as FileController (API)
  participant Req as CompressFilesRequest
  participant Repo as DaemonFileRepository
  participant Daemon as File Daemon

  Note over UI: User selects files, enters name + extension
  UI->>API: POST /compress { files, name, extension }
  API->>Req: validate request (includes extension rule)
  Req-->>API: validation result
  API->>Repo: compressFiles(root, files, name, extension)
  Repo->>Daemon: HTTP POST /compress { files, name, extension }
  Daemon-->>Repo: 200 OK / job info
  Repo-->>API: result
  API-->>UI: 200 OK / activity log
Loading

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Add archive extension selection" directly and accurately describes the main change in this pull request. All modifications across the five affected files—including UI schema changes in ListFiles.php, validation rules in CompressFilesRequest, method signature updates in DaemonFileRepository, and translation entries—work together to implement archive extension selection functionality. The title is concise, specific, and avoids vague terminology, clearly communicating what developers will understand as the primary objective of this changeset.
Description Check ✅ Passed The description is directly related to the changeset, communicating that the PR allows users to pick an archive type and includes a dependency reference to wings/#123. While brief, the description is sufficiently informative and not vague—it clearly indicates the purpose of the changes and includes a visual example of the UI modification. Since this is a lenient check that should pass as long as the description is not completely off-topic, and the description demonstrates clear relevance to the implemented functionality, the check passes.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 92fb20e and 3c5d379.

📒 Files selected for processing (1)
  • app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php (1 hunks)
🔇 Additional comments (1)
app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php (1)

25-25: Critical validation fix correctly applied.

The validation rule now uses unquoted extension values, resolving the previous issue where quoted strings like "tar.xz" would fail to match values sent from the UI. The field is properly marked as sometimes (optional), and the downstream compressFiles() method accepts a nullable string parameter, ensuring backwards compatibility with existing API clients that may not send this parameter.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
app/Filament/Server/Resources/Files/Pages/ListFiles.php (2)

302-319: Add a default value to the extension Select.

The Select component uses selectablePlaceholder(false) but doesn't specify a default value. While this forces the user to make a selection, adding a default would provide better UX and ensure robustness in case of unexpected behavior.

Apply this diff to add a sensible default:

                                    Select::make('extension')
                                        ->label(trans('server/file.actions.archive.extension'))
+                                       ->default('tar.gz')
                                        ->selectablePlaceholder(false)
                                        ->native(false)
                                        ->options([
                                            'tar.gz' => 'tar.gz',
                                            'zip' => 'zip',
                                            'tar.bz2' => 'tar.bz2',
                                            'tar.xz' => 'tar.xz',
                                        ])
                                        ->columnSpan(1),

411-428: Add a default value to the extension Select for bulk actions.

Same as the single-file archive action, the bulk action's Select component should have a default value for consistency and robustness.

Apply this diff:

                                    Select::make('extension')
                                        ->label(trans('server/file.actions.archive.extension'))
+                                       ->default('tar.gz')
                                        ->selectablePlaceholder(false)
                                        ->native(false)
                                        ->options([
                                            'tar.gz' => 'tar.gz',
                                            'zip' => 'zip',
                                            'tar.bz2' => 'tar.bz2',
                                            'tar.xz' => 'tar.xz',
                                        ])
                                        ->columnSpan(1),
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e006ac and 92fb20e.

📒 Files selected for processing (5)
  • app/Filament/Server/Resources/Files/Pages/ListFiles.php (3 hunks)
  • app/Http/Controllers/Api/Client/Servers/FileController.php (1 hunks)
  • app/Http/Requests/Api/Client/Servers/Files/CompressFilesRequest.php (1 hunks)
  • app/Repositories/Daemon/DaemonFileRepository.php (2 hunks)
  • lang/en/server/file.php (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-15T11:55:53.461Z
Learnt from: rmartinoscar
PR: pelican-dev/panel#1801
File: app/Extensions/OAuth/Schemas/AuthentikSchema.php:7-10
Timestamp: 2025-10-15T11:55:53.461Z
Learning: In Filament v4, Wizard Step components use the Filament\Schemas namespace (Filament\Schemas\Components\Wizard\Step), not Filament\Forms.

Applied to files:

  • app/Filament/Server/Resources/Files/Pages/ListFiles.php
🧬 Code graph analysis (1)
app/Filament/Server/Resources/Files/Pages/ListFiles.php (2)
app/Filament/Server/Resources/Files/Pages/EditFiles.php (1)
  • getDaemonFileRepository (270-277)
app/Repositories/Daemon/DaemonFileRepository.php (1)
  • compressFiles (156-170)
🔇 Additional comments (7)
app/Http/Controllers/Api/Client/Servers/FileController.php (1)

215-216: LGTM! Extension parameter correctly passed to repository.

The extension parameter is properly extracted from the validated request and passed to the compression routine.

lang/en/server/file.php (1)

49-49: LGTM! Translation key correctly added.

The extension label is properly placed under the archive actions section.

app/Repositories/Daemon/DaemonFileRepository.php (2)

156-156: LGTM! Method signature correctly updated.

The optional extension parameter is properly typed and aligns with the updated compression flow.


167-167: LGTM! Extension correctly included in payload.

The null coalescing to empty string is consistent with the name parameter handling on line 166.

app/Filament/Server/Resources/Files/Pages/ListFiles.php (3)

29-29: LGTM! Correct imports added.

The Select and Grid components are properly imported for the archive UI enhancements.

Also applies to: 36-36


322-322: LGTM! Extension parameter correctly passed.

The extension from the form data is properly passed to the compression routine.


433-433: LGTM! Extension parameter correctly passed for bulk actions.

The extension is properly passed to the compression routine for bulk file operations.

@notAreYouScared notAreYouScared merged commit e6bd6e4 into main Oct 24, 2025
25 checks passed
@notAreYouScared notAreYouScared deleted the charles/add-compress-exts branch October 24, 2025 16:39
@github-actions github-actions bot locked and limited conversation to collaborators Oct 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants