Skip to content

Conversation

@dbarzin
Copy link
Owner

@dbarzin dbarzin commented Nov 18, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Fixed HTML structure in the admin sidebar to ensure icons and text display correctly.
    • Corrected a translation key for the BPMN type field label.
  • New Features

    • Improved PDF export by adding broader font support for generated documents.
  • Chores

    • Updated frontend build assets mapping for the application entry.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

Warning

Rate limit exceeded

@dbarzin has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 26 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between fbfe405 and 8317f31.

📒 Files selected for processing (4)
  • app/Http/Controllers/Admin/BPMNController.php (5 hunks)
  • app/Models/Graph.php (0 hunks)
  • resources/js/app.js (1 hunks)
  • tests/Feature/Controller/GraphControllerTest.php (1 hunks)

Walkthrough

Adds return type hints to BPMNController methods, corrects a BPMN translation key, fixes mismatched icon HTML in the admin sidebar, updates the built asset mapping in the manifest, and registers pdfMake fonts in the frontend JS.

Changes

Cohort / File(s) Summary
Controller Type Hints & View Adjustments
app/Http/Controllers/Admin/BPMNController.php
Added return type declarations: index(): View, create(): View, clone(Request): View, store(Request): RedirectResponse. Imported View and RedirectResponse. Changed create() to initialize empty content string. Updated view reference from admin.bpmn.show to admin.bpmns.show.
Translation Key Correction
resources/lang/en/cruds.php
Renamed BPMN field translation key from 'types_helper' to 'type_helper'.
Sidebar HTML Fixes
resources/views/partials/sidebar.blade.php
Removed stray </i> tags and corrected icon markup and logout link HTML to properly close icon elements and surrounding text spans.
Frontend PDF Font Support
resources/js/app.js
Imported pdfMake and pdfFonts and configured pdfMake.vfs (using pdfFonts.vfs or pdfFonts.default?.vfs) to enable embedded fonts for PDF generation.
Build Manifest Update
public/build/manifest.json
Updated resources/js/app.js mapping to reference new built asset filename (assets/app-C7hDpB8e.js replacing previous hash).

Sequence Diagram(s)

(No sequence diagram provided — changes are structural and small adjustments to signatures, assets, translations, and markup rather than new control-flow.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review hotspots:
    • app/Http/Controllers/Admin/BPMNController.php: ensure declared return types match actual return values and imported types are correct.
    • resources/js/app.js: verify pdfMake/font import syntax and that pdfMake.vfs assignment is compatible with build tools.
    • resources/views/partials/sidebar.blade.php: confirm all icon tags and surrounding markup are valid Blade/HTML and accessible.
    • resources/lang/en/cruds.php: search codebase for any remaining references to the old types_helper key.
    • public/build/manifest.json: ensure asset hash update matches the deployed build pipeline.

Poem

🐰 I hopped through code with careful paws,

Typed returns and fixed the flawed tags' laws,
Fonts for PDFs tucked into the kit,
A manifest path given its new writ,
Hooray — the repo hums without a pause! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'work on BPMN' is vague and generic, using non-descriptive language that fails to convey the specific nature of the changes. Use a more descriptive title that captures the main changes, such as 'Add return type hints to BPMNController and fix sidebar HTML structure' or 'Refactor BPMN controller with type hints and translation key updates'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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
Contributor

@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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 3d211f2 and fbfe405.

📒 Files selected for processing (2)
  • public/build/manifest.json (1 hunks)
  • resources/js/app.js (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • public/build/manifest.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)

Comment on lines 37 to 39
// Import fonts
import pdfMake from 'pdfmake/build/pdfmake';
import pdfFonts from 'pdfmake/build/vfs_fonts';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Critical: Duplicate pdfmake import creates ambiguity.

Line 9 already imports pdfmake from the package root, but line 38 imports pdfMake (with different casing) from a specific build path. This creates confusion about which import is authoritative and may lead to unexpected behavior.

Recommended fix: Remove the duplicate import and use a consistent naming approach. Based on common pdfmake usage patterns, consolidate to a single import:

-// Import fonts
-import pdfMake from 'pdfmake/build/pdfmake';
-import pdfFonts from 'pdfmake/build/vfs_fonts';
+// Import fonts for pdfMake
+import pdfFonts from 'pdfmake/build/vfs_fonts';

Then update line 45 to use the existing pdfmake import:

-pdfMake.vfs = pdfFonts.vfs ?? pdfFonts.default?.vfs;
+pdfmake.vfs = pdfFonts.vfs ?? pdfFonts.default?.vfs;

However, verify the correct import pattern for pdfmake 0.2.18 first, as the package structure may have specific requirements.


🏁 Script executed:

#!/bin/bash
# Verify the correct import pattern and font setup for pdfmake 0.2.18

# Check package.json for pdfmake version
cat package.json | jq '.dependencies.pdfmake, .devDependencies.pdfmake'

# Look for other usages of pdfmake/pdfMake in the codebase
rg -n "import.*pdfmake" --type=js

# Check if there are any configuration files or documentation about pdfmake setup
fd -e js -e md -e txt README pdfmake

Length of output: 93759



Based on my verification of the correct pdfMake import pattern for browser/ES6 modules, which requires `import pdfMake from "pdfmake/build/pdfmake"` and `pdfMake.vfs = pdfFonts.pdfMake.vfs`, the review comment identifies a real issue but requires refinement:

**Remove duplicate pdfmake import and correct font vfs assignment.**

Line 9's `import pdfmake from 'pdfmake'` is incorrect for browser usage—it's the server-side Node.js entry point, not for ES6 browser modules. Line 38's import from `'pdfmake/build/pdfmake'` is correct. Additionally, line 45's font assignment should use `pdfFonts.pdfMake.vfs` not `pdfFonts.vfs`, as confirmed in the pdfmake-font-generator documentation pattern.

**Fix required at line 9:** Remove the entire import statement.

**Fix required at line 45:** Change `pdfMake.vfs = pdfFonts.vfs ?? pdfFonts.default?.vfs;` to `pdfMake.vfs = pdfFonts.pdfMake.vfs;`

---

🌐 Web query:

```web
pdfmake 0.2.18 correct import and fonts setup

💡 Result:

Use the pdfmake 0.2.x docs approach. Minimal working examples:

Client (browser / ES module)

  • import pdfMake and the built vfs fonts, then attach the vfs:
    import pdfMake from 'pdfmake/build/pdfmake';
    import pdfFonts from 'pdfmake/build/vfs_fonts';
    pdfMake.vfs = pdfFonts.pdfMake.vfs;
  • register custom font metadata (optional) before createPdf:
    pdfMake.addFonts({
    MyFont: {
    normal: 'MyFont-Regular.ttf',
    bold: 'MyFont-Bold.ttf',
    italics: 'MyFont-Italic.ttf',
    bolditalics: 'MyFont-BoldItalic.ttf'
    }
    });
  • use in docDefinition: defaultStyle: { font: 'MyFont' } then pdfMake.createPdf(docDefinition).download();

Alternate client import (TypeScript / older examples)
import * as pdfMake from 'pdfmake/build/pdfmake';
import * as pdfFonts from 'pdfmake/build/vfs_fonts';
(pdfMake as any).addVirtualFileSystem(pdfFonts);

Server (Node)

  • Use the PdfPrinter constructor and point to real font file paths:
    import PdfPrinter from 'pdfmake';
    const printer = new PdfPrinter({
    Roboto: {
    normal: './fonts/Roboto-Regular.ttf',
    bold: './fonts/Roboto-Medium.ttf',
    italics: './fonts/Roboto-Italic.ttf',
    bolditalics: './fonts/Roboto-MediumItalic.ttf'
    }
    });

Notes

  • For client-side custom fonts generate a vfs bundle (build-vfs.js) and include it (or use tools like pdfmake-font-generator).
  • If using bundlers you may instead import 'pdfmake/build/vfs_fonts' (it will set pdfMake.vfs globally) — see docs for rollup/webpack caveats.

Sources: pdfmake docs (client-side imports, vfs and addFonts) and vfs/custom-fonts instructions. [1][2]

References
[1] pdfmake—Getting started / client-side examples (imports & vfs).
[2] pdfmake—Custom fonts (vfs build, pdfMake.addFonts / pdfMake.fonts).


Critical: Duplicate pdfmake import and incorrect vfs font path.

Line 9's import pdfmake from 'pdfmake' is the server-side Node.js entry point and should not be used in browser/ES6 modules. Line 38's import pdfMake from 'pdfmake/build/pdfmake' (camelCase, build path) is the correct browser import.

Additionally, line 45 assigns an incorrect vfs path. The code uses pdfFonts.vfs which does not exist; the correct path is pdfFonts.pdfMake.vfs.

Required fixes:

  1. Remove line 9 entirely: import pdfmake from 'pdfmake';
  2. Keep lines 38–39 as-is (they are correct)
  3. Line 45: Change pdfMake.vfs = pdfFonts.vfs ?? pdfFonts.default?.vfs; to pdfMake.vfs = pdfFonts.pdfMake.vfs;
🤖 Prompt for AI Agents
In resources/js/app.js around lines 9 and 37–45, remove the server-side
duplicate import "import pdfmake from 'pdfmake';" (line 9), keep the browser/ES6
imports "import pdfMake from 'pdfmake/build/pdfmake';" and "import pdfFonts from
'pdfmake/build/vfs_fonts';" (lines 37–39), and update the vfs assignment to use
the correct path by replacing the current assignment with one that sets
pdfMake.vfs to pdfFonts.pdfMake.vfs.

Comment on lines 44 to 45
// Save fonts
pdfMake.vfs = pdfFonts.vfs ?? pdfFonts.default?.vfs;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify font configuration timing and property access pattern.

The font configuration occurs after DataTable.Buttons.pdfMake(pdfmake) is called (line 42). Depending on how DataTables stores and uses the pdfMake reference, this timing might cause the fonts to be unavailable for PDF exports.

Additionally, the optional chaining pdfFonts.default?.vfs suggests uncertainty about the package structure. For pdfmake 0.2.18, verify:

  1. The correct property path to access fonts (pdfFonts.vfs vs pdfFonts.pdfMake.vfs vs pdfFonts.default.vfs)
  2. Whether fonts must be configured before or after passing pdfMake to DataTable.Buttons

🌐 Web query:

What is the correct way to configure pdfMake fonts with vfs_fonts in pdfmake version 0.2.18?

💡 Result:

Use the browser build and the build vfs file, then set pdfMake.vfs and register your font names. Example that works with pdfmake 0.2.18:

  1. Imports
  • ES/TS:
    import pdfMake from 'pdfmake/build/pdfmake';
    import pdfFonts from 'pdfmake/build/vfs_fonts';
  1. Attach VFS and register fonts
  • set the vfs (the vfs export is under pdfFonts.pdfMake.vfs) and add fonts (or use legacy pdfMake.fonts):
    (pdfMake as any).vfs = pdfFonts.pdfMake.vfs;
    pdfMake.addFonts?.({
    MyFont: {
    normal: 'MyFont-Regular.ttf',
    bold: 'MyFont-Bold.ttf',
    italics: 'MyFont-Italic.ttf',
    bolditalics: 'MyFont-BoldItalic.ttf'
    }
    });
    // or legacy:
    pdfMake.fonts = { /* same object as above */ };
  1. Use the font in your docDefinition
    { defaultStyle: { font: 'MyFont' }, content: [ ... ] }

References: pdfmake docs (VFS / client-side instructions) and examples showing the import + vfs assignment. [1][2]

Sources:
[1] pdfmake docs — Custom fonts via VFS (client-side).
[2] pdfmake getting-started / examples showing import and (pdfMake as any).vfs = pdfFonts.pdfMake.vfs.


I need to verify the actual code structure in the repository before finalizing the review comment.


🏁 Script executed:

#!/bin/bash
# Check the full app.js context around lines 44-45
# Also capture imports and related pdfMake setup
head -50 resources/js/app.js | cat -n

Length of output: 2313


🏁 Script executed:

#!/bin/bash
# Search for pdfMake and pdfFonts imports and usage
rg -n "pdfMake|pdfFonts" resources/js/app.js -C 5

Length of output: 519


🏁 Script executed:

#!/bin/bash
# Check package.json for pdfmake version
rg '"pdfmake"' package.json -A 2 -B 2

Length of output: 130


I found critical issues. Let me verify if these are the same or different pdfMake instances:


🏁 Script executed:

#!/bin/bash
# Check if pdfmake package default export and build/pdfmake are the same
# Search for any usage of the lowercase pdfmake vs camelCase pdfMake
rg -n "pdfmake\b|pdfMake\b" resources/js/app.js

Length of output: 504


🏁 Script executed:

#!/bin/bash
# Check pdfmake package structure - does the default export match build/pdfmake?
# This would help determine if line 9 and line 38 are the same object
npm info [email protected] 2>/dev/null | head -20 || echo "Info: pdfmake 0.2.18 structure needs verification from package exports"

Length of output: 540


Fix incorrect pdfMake VFS font property path on line 45.

The current code uses an incorrect property path that doesn't exist in pdfmake 0.2.18. According to pdfmake documentation, the VFS must be assigned from pdfFonts.pdfMake.vfs, not pdfFonts.vfs ?? pdfFonts.default?.vfs. The fallback expressions will evaluate to undefined, leaving fonts unconfigured.

Change line 45 from:

pdfMake.vfs = pdfFonts.vfs ?? pdfFonts.default?.vfs;

To:

pdfMake.vfs = pdfFonts.pdfMake.vfs;
🤖 Prompt for AI Agents
In resources/js/app.js around lines 44 to 45, the pdfMake VFS assignment uses an
incorrect property path (pdfFonts.vfs ?? pdfFonts.default?.vfs) that results in
undefined for pdfmake v0.2.18; replace that assignment to use the correct
property path pdfFonts.pdfMake.vfs so pdfMake.vfs is set directly from
pdfFonts.pdfMake.vfs.

@dbarzin dbarzin merged commit 35c0de4 into master Nov 18, 2025
5 of 6 checks passed
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.

2 participants