-
-
Notifications
You must be signed in to change notification settings - Fork 254
Add changelog preview when a new update is available #1792
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
Conversation
📝 WalkthroughWalkthroughAdds a collapsible, markdown-rendered "Changelog" section (collapsed by default, hidden label) to the admin UpdateWidget and a new SoftwareVersionService::latestPanelVersionChangelog() method that fetches and caches the latest GitHub release body; also adds a localization string for the changelog button. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Admin as Admin User
participant UI as UpdateWidget
participant SV as SoftwareVersionService
participant Cache as Cache Store
participant GH as GitHub API
Admin->>UI: Open Update Widget
UI->>SV: latestPanelVersion()
SV->>Cache: get/remember latest_version
alt Cache miss or 'error'
SV->>GH: GET /repos/pelican-dev/panel/releases/latest
GH-->>SV: tag_name or error
SV->>Cache: set latest_version or 'error'
end
UI->>SV: latestPanelVersionChangelog()
SV->>Cache: get/remember panel:latest_version_changelog
alt Cache miss or 'error'
SV->>GH: GET /repos/pelican-dev/panel/releases/latest
GH-->>SV: body or error
SV->>Cache: set panel:latest_version_changelog or 'error'
end
SV-->>UI: changelog markdown or 'error'
UI-->>Admin: Render version info and collapsible changelog (markdown)
Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/Filament/Admin/Widgets/UpdateWidget.php(1 hunks)app/Services/Helpers/SoftwareVersionService.php(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/Filament/Admin/Widgets/UpdateWidget.php (1)
app/Services/Helpers/SoftwareVersionService.php (1)
latestPanelVersionChangelog(10-26)
Boy132
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
Could you change the changelog to be a header action with a modal instead? Otherwise the page might get very long.
Something like this: (pseudo code)
->headerActions([
.....
Action::make('changelog')
->label('What\'s New')
->icon('tabler-icon')
->schema([
TextEntry::make('changelog')
->hiddenLabel()
->state($this->softwareVersionService->latestPanelVersionChangelog())
->markdown(),
]),
]),There was a problem hiding this 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
♻️ Duplicate comments (1)
app/Filament/Admin/Widgets/UpdateWidget.php (1)
53-56: Error state still not handled.The previous major concern about error handling remains unaddressed. When
latestPanelVersionChangelog()returns'error'(on API failure), it will be rendered as markdown text "error" and displayed to users, degrading UX.Apply one of the previously suggested solutions:
Option 1: Hide the field when an error occurs
TextEntry::make('Changelog') ->hiddenLabel() ->state($this->softwareVersionService->latestPanelVersionChangelog()) ->markdown() + ->hidden(fn ($state) => $state === 'error')Option 2: Display a fallback message
TextEntry::make('Changelog') ->hiddenLabel() - ->state($this->softwareVersionService->latestPanelVersionChangelog()) + ->state(function () { + $changelog = $this->softwareVersionService->latestPanelVersionChangelog(); + return $changelog === 'error' ? 'Changelog unavailable.' : $changelog; + }) ->markdown()
🧹 Nitpick comments (1)
app/Filament/Admin/Widgets/UpdateWidget.php (1)
48-48: Use a more specific icon.
'tabler-icon'appears to be a generic placeholder name rather than an actual icon identifier. Consider a more descriptive icon.Apply this diff:
- ->icon('tabler-icon') + ->icon('tabler-list')Alternative icons:
'tabler-file-text','tabler-notes', or'tabler-list-details'.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/Filament/Admin/Widgets/UpdateWidget.php(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/Filament/Admin/Widgets/UpdateWidget.php (1)
app/Services/Helpers/SoftwareVersionService.php (1)
latestPanelVersionChangelog(10-26)
|
This looks great @LetterN - can you quick add the translation key and it's good to go! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
app/Filament/Admin/Widgets/UpdateWidget.php (1)
53-57: Handle ‘error’ state from latestPanelVersionChangelog().Avoid rendering the sentinel value to users. Hide the field when it errors.
Apply:
- TextEntry::make('changelog') - ->hiddenLabel() - ->state($this->softwareVersionService->latestPanelVersionChangelog()) - ->markdown(), + TextEntry::make('changelog') + ->hiddenLabel() + ->state($this->softwareVersionService->latestPanelVersionChangelog()) + ->markdown() + ->hidden(fn ($state) => $state === 'error'),
🧹 Nitpick comments (2)
app/Filament/Admin/Widgets/UpdateWidget.php (2)
45-47: Guard the update text when latest version lookup fails.If latestPanelVersion() returns 'error', hide this entry to avoid “error is now available!” UI.
Apply:
TextEntry::make('info') ->hiddenLabel() - ->state(trans('admin/dashboard.sections.intro-update-available.content', ['latestVersion' => $this->softwareVersionService->latestPanelVersion()])), + ->state(trans('admin/dashboard.sections.intro-update-available.content', [ + 'latestVersion' => $this->softwareVersionService->latestPanelVersion(), + ])) + ->hidden(fn () => $this->softwareVersionService->latestPanelVersion() === 'error'),
55-56: Confirm Markdown sanitization (strip HTML, block unsafe links).Rendering remote Markdown can include raw HTML. Ensure TextEntry::markdown() strips HTML and disallows unsafe links; otherwise pre-sanitize.
If needed:
- ->state($this->softwareVersionService->latestPanelVersionChangelog()) - ->markdown() + ->state(fn () => \Illuminate\Support\Str::markdown( + (string) $this->softwareVersionService->latestPanelVersionChangelog(), + ['html_input' => 'strip', 'allow_unsafe_links' => false] + )) + ->html()
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
app/Filament/Admin/Widgets/UpdateWidget.php(1 hunks)app/Services/Helpers/SoftwareVersionService.php(1 hunks)lang/en/admin/dashboard.php(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- app/Services/Helpers/SoftwareVersionService.php
🧰 Additional context used
🧬 Code graph analysis (1)
app/Filament/Admin/Widgets/UpdateWidget.php (1)
app/Services/Helpers/SoftwareVersionService.php (2)
latestPanelVersion(28-44)latestPanelVersionChangelog(10-26)
🔇 Additional comments (2)
lang/en/admin/dashboard.php (1)
20-21: Translation key added correctly.Key matches usage in UpdateWidget. Thanks for keeping i18n consistent.
Please ensure this key is added to other locales before merge.
app/Filament/Admin/Widgets/UpdateWidget.php (1)
46-46: LGTM on hiddenLabel usage.Improves accessibility and visual cleanliness.

implements #1744