Skip to content

feat(documents): add export formats - #486

Open
Garfield-fr wants to merge 1 commit into
rero:stagingfrom
Garfield-fr:zub-document-export
Open

feat(documents): add export formats#486
Garfield-fr wants to merge 1 commit into
rero:stagingfrom
Garfield-fr:zub-document-export

Conversation

@Garfield-fr

@Garfield-fr Garfield-fr commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
  • 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

@Garfield-fr Garfield-fr self-assigned this Jul 8, 2026
@Garfield-fr
Garfield-fr force-pushed the zub-document-export branch 2 times, most recently from 388d7dc to eed80ff Compare July 8, 2026 12:08
@Garfield-fr
Garfield-fr marked this pull request as ready for review July 8, 2026 13:09
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds 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)
Check name Status Explanation
Title check ✅ Passed It succinctly summarizes the main change: adding document export formats.
Description check ✅ Passed It describes the new export component, settings typing, and load() merge behavior reflected in the changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

@Garfield-fr

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
projects/sonar/src/app/record/document/document-actions/document-actions.component.html (1)

5-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider 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 @empty block 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5fc8042 and eed80ff.

📒 Files selected for processing (7)
  • projects/sonar/src/app/record/document/detail/detail.component.html
  • projects/sonar/src/app/record/document/detail/detail.component.ts
  • projects/sonar/src/app/record/document/document-actions/document-actions.component.html
  • projects/sonar/src/app/record/document/document-actions/document-actions.component.spec.ts
  • projects/sonar/src/app/record/document/document-actions/document-actions.component.ts
  • projects/sonar/src/app/store/app.store.spec.ts
  • projects/sonar/src/app/store/app.store.ts

* 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>
@Garfield-fr
Garfield-fr force-pushed the zub-document-export branch from 45eb32b to 322f436 Compare August 3, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant