feat(documents): add export formats - #486
Conversation
388d7dc to
eed80ff
Compare
WalkthroughAdds a new standalone DocumentActionsComponent providing an "Export to…" panel that lists export formats and generates export URLs based on record pid and API base. Integrates this component into DetailComponent's template and imports. Extends AppStore's settings type with a new DocumentSerializer type and document_serializers field, and updates the store's load() method to merge settings rather than overwrite them. Includes new unit tests for the component and the store. Estimated code review effort: 2 (Simple) | ~15 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
projects/sonar/src/app/record/document/document-actions/document-actions.component.html (1)
5-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider hiding the panel when no export formats are available.
When
exportFormats()returns an empty array (e.g., settings not loaded or no serializers configured), the panel renders with a header but an empty body. Consider wrapping the panel in@if (exportFormats().length)or adding an@emptyblock to avoid showing an empty panel to users.♻️ Suggested refactor: conditionally render the panel
+@if (exportFormats().length) { <p-panel [header]="'Export to…'|translate" [dt]="{ root: { background: 'white' }, header: { background: '{surface.100}' } }"> <div class="ui:flex ui:flex-wrap ui:gap-2 ui:items-start ui:p-2"> `@for`(format of exportFormats(); track format.format) { <a pButton [href]="exportUrl(format.format)" target="_blank" class="ui:p-2 ui:flex ui:flex-col ui:items-center ui:justify-center ui:w-26 ui:border-none ui:bg-transparent ui:cursor-pointer ui:no-underline"> <i class="fa fa-2x ui:text-muted-color" [class]="format.icon" aria-hidden="true"></i> <span class="ui:text-center ui:text-xs ui:text-muted-color">{{ format.label | translate }}</span> </a> } </div> </p-panel> +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@projects/sonar/src/app/record/document/document-actions/document-actions.component.html` around lines 5 - 15, The export panel in document-actions.component.html should not render when exportFormats() is empty, since it currently shows an empty header/body state. Update the template around p-panel and the `@for` loop to conditionally render only when exportFormats().length is non-zero, or add an `@empty` fallback so the UI stays clean when no serializers/settings are available.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@projects/sonar/src/app/record/document/document-actions/document-actions.component.html`:
- Around line 5-15: The export panel in document-actions.component.html should
not render when exportFormats() is empty, since it currently shows an empty
header/body state. Update the template around p-panel and the `@for` loop to
conditionally render only when exportFormats().length is non-zero, or add an
`@empty` fallback so the UI stays clean when no serializers/settings are
available.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 188f3968-c93d-48a3-bd06-d18abf1f2cb3
📒 Files selected for processing (7)
projects/sonar/src/app/record/document/detail/detail.component.htmlprojects/sonar/src/app/record/document/detail/detail.component.tsprojects/sonar/src/app/record/document/document-actions/document-actions.component.htmlprojects/sonar/src/app/record/document/document-actions/document-actions.component.spec.tsprojects/sonar/src/app/record/document/document-actions/document-actions.component.tsprojects/sonar/src/app/store/app.store.spec.tsprojects/sonar/src/app/store/app.store.ts
eed80ff to
ebf2b6a
Compare
ebf2b6a to
45eb32b
Compare
* Add DocumentActionsComponent to export documents to bibliographic formats from the detail page * Type document_serializers (format, icon, label) in AppSettings * Merge settings on load() instead of overwriting them, so fields missing from the backend response keep their default value Co-Authored-By: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
45eb32b to
322f436
Compare
formats from the detail page
missing from the backend response keep their default value