Skip to content

Added session info size#24

Open
chris-adam wants to merge 8 commits intomainfrom
PARAF-364/quick_look_size
Open

Added session info size#24
chris-adam wants to merge 8 commits intomainfrom
PARAF-364/quick_look_size

Conversation

@chris-adam
Copy link
Copy Markdown
Contributor

@chris-adam chris-adam commented Mar 11, 2026

Summary by CodeRabbit

  • New Features

    • Quick-look now displays session size (MB) and highlights when near the configured maximum.
    • Sessions show a total file-count indicator.
  • Documentation

    • Added English and French translation entries for the session message.
  • Chores

    • Added an unreleased changelog entry noting session size on quick look.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 11, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds session-size display to the quick-look UI: FilesColumn now computes max session size from registry and renders size with a warning threshold; SessionFilesView records files_count; session_files.pt displays a paragraph with the session element count; changelog and i18n entries added.

Changes

Cohort / File(s) Summary
Changelog
CHANGES.rst
Added unreleased changelog entry: "Added session info size on quick look."
UI rendering / table
src/imio/esign/browser/table.py
Imported get_esign_registry_max_session_size, added SESSION_SIZE_WARNING_THRESHOLD, introduced renderQuickLook(self, item) to display "(size MB / max MB)" and conditional red styling, and updated renderCell to use this renderer.
View state
src/imio/esign/browser/views.py
SessionFilesView.__call__ now sets self.files_count = len(files) before returning the template.
Template
src/imio/esign/browser/templates/session_files.pt
Added a paragraph that renders "This session contains ${count} element(s)." bound to view/files_count; existing "No files" and file list markup preserved.
Translations
src/imio/esign/locales/...
src/imio/esign/locales/en/LC_MESSAGES/imio.esign.po, src/imio/esign/locales/fr/LC_MESSAGES/imio.esign.po, src/imio/esign/locales/imio.esign.pot
Added msgid This session contains ${count} element(s). and French translation Cette session contient ${count} élément(s). to PO/POT catalogs.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant Table as FilesColumn
    participant Registry as Registry\n(get_esign_registry_max_session_size)
    participant View as SessionFilesView
    participant Template as session_files.pt

    User->>Table: open quick-look
    Table->>Registry: get_esign_registry_max_session_size()
    Table->>View: read item / session context
    View->>View: set files_count = len(files)
    Table->>Template: renderQuickLook(size, max, warning, files_count)
    Template->>User: return rendered quick-look
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • gbastien
  • sgeulette

Poem

🐇 I counted files and gave a peep,
I fetched the cap from registry deep,
A little red when sizes grow bold,
Two tongues whisper what I told,
Hop-hop—session info snug and neat!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Added session info size' is vague and does not clearly convey the main objective of the PR, which is to display session element count information persistently rather than just showing size. Consider a more specific title like 'Display session element count persistently in quick look' to better reflect the actual implementation and user-facing changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch PARAF-364/quick_look_size

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

Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/imio/esign/browser/templates/session_files.pt`:
- Around line 2-7: The template sets i18n:translate="session_files_count" which
doesn't match the PO msgid; change the element to use i18n:translate="" so the
element's text becomes the msgid that matches the catalog (keep the existing
tal:condition="python: view.files_count >= 10" and the <strong
tal:content="view/files_count" i18n:name="count">N</strong> as-is) — replace the
explicit message id with an empty i18n:translate to let the literal text "This
session contains ${count} element(s)." be used for translation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0e3a470e-a04d-4085-a94e-9c8e3ec4f0d6

📥 Commits

Reviewing files that changed from the base of the PR and between 94c7b5e and 17edd74.

📒 Files selected for processing (7)
  • CHANGES.rst
  • src/imio/esign/browser/table.py
  • src/imio/esign/browser/templates/session_files.pt
  • src/imio/esign/browser/views.py
  • src/imio/esign/locales/en/LC_MESSAGES/imio.esign.po
  • src/imio/esign/locales/fr/LC_MESSAGES/imio.esign.po
  • src/imio/esign/locales/imio.esign.pot

Comment thread src/imio/esign/browser/templates/session_files.pt Outdated
@chris-adam chris-adam force-pushed the PARAF-364/quick_look_size branch 3 times, most recently from 6a4b17f to 101681b Compare March 11, 2026 08:51
Copy link
Copy Markdown

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/imio/esign/browser/views.py (1)

95-103: ⚠️ Potential issue | 🟡 Minor

Count only the files that will actually be rendered.

files_count is taken from the raw session payload before Lines 98-103 drop unresolved entries. That can make the UI report more files than the list shows, or even show a count when nothing is renderable.

🧮 Suggested fix
     def __call__(self):
         session_id = int(self.request.get("session_id"))
         session = self.get_session(session_id)
-        self.files_count = len(session["files"])
         files = []
         for f in session["files"]:
             ctx = uuidToObject(f["context_uid"])
             obj = uuidToObject(f["uid"])
             if obj and ctx:
                 files.append((ctx, obj))
         self.files = files
+        self.files_count = len(files)
         return self.index()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/imio/esign/browser/views.py` around lines 95 - 103, The code sets
self.files_count from the raw session payload before filtering unresolved
entries; change the order to resolve entries first and count only renderable
files: call session = self.get_session(session_id), build the files list by
resolving each entry with uuidToObject for f["context_uid"] and f["uid"] (as
done in the loop using ctx and obj), assign self.files = files, and then set
self.files_count = len(self.files) so files_count reflects only successfully
resolved/renderable items (adjust code in the block around get_session,
uuidToObject, self.files, and self.files_count).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/imio/esign/browser/table.py`:
- Around line 117-126: The size label in renderQuickLook is not localized and
uses "Mb"; update the code that builds size_label (in function renderQuickLook)
to use the translation machinery (e.g. translate/_) for the full user-facing
string and change the unit to "MB" (uppercase), passing size_mb and max_size_mb
as interpolation parameters so translators can reorder/format them; ensure the
translated string is used when constructing the returned HTML span (preserving
size_style and escaping/interpolating values appropriately).

---

Outside diff comments:
In `@src/imio/esign/browser/views.py`:
- Around line 95-103: The code sets self.files_count from the raw session
payload before filtering unresolved entries; change the order to resolve entries
first and count only renderable files: call session =
self.get_session(session_id), build the files list by resolving each entry with
uuidToObject for f["context_uid"] and f["uid"] (as done in the loop using ctx
and obj), assign self.files = files, and then set self.files_count =
len(self.files) so files_count reflects only successfully resolved/renderable
items (adjust code in the block around get_session, uuidToObject, self.files,
and self.files_count).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 35b3993c-5916-45d8-a5ee-5c251d8be040

📥 Commits

Reviewing files that changed from the base of the PR and between 30cfb8b and 101681b.

📒 Files selected for processing (7)
  • CHANGES.rst
  • src/imio/esign/browser/table.py
  • src/imio/esign/browser/templates/session_files.pt
  • src/imio/esign/browser/views.py
  • src/imio/esign/locales/en/LC_MESSAGES/imio.esign.po
  • src/imio/esign/locales/fr/LC_MESSAGES/imio.esign.po
  • src/imio/esign/locales/imio.esign.pot
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/imio/esign/browser/templates/session_files.pt
  • src/imio/esign/locales/imio.esign.pot
  • src/imio/esign/locales/en/LC_MESSAGES/imio.esign.po
  • src/imio/esign/locales/fr/LC_MESSAGES/imio.esign.po

Comment thread src/imio/esign/browser/table.py Outdated
@chris-adam chris-adam force-pushed the PARAF-364/quick_look_size branch from 101681b to 745ff80 Compare March 11, 2026 09:02
@chris-adam chris-adam requested a review from gbastien March 11, 2026 09:13
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 1, 2026

Coverage Report for CI Build 25096885729

Coverage increased (+0.2%) to 76.753%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: 1 uncovered change across 1 file (13 of 14 lines covered, 92.86%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/imio/esign/browser/views.py 2 1 50.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1269
Covered Lines: 974
Line Coverage: 76.75%
Coverage Strength: 0.77 hits per line

💛 - Coveralls

@chris-adam chris-adam force-pushed the PARAF-364/quick_look_size branch from 4f6d669 to 50956b8 Compare April 1, 2026 14:14
@chris-adam chris-adam force-pushed the PARAF-364/quick_look_size branch from 65bfa6a to 5b313a9 Compare April 3, 2026 12:04
@chris-adam chris-adam force-pushed the PARAF-364/quick_look_size branch from 5b313a9 to 9452a0b Compare April 3, 2026 12:05
<div tal:replace="structure view/render_table"></div>
<div style="text-align: right;">
<a tal:attributes="href view/get_parapheo_link" target="_blank">
<button class="apButton apButtonAction apButtonAction_parapheo">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cela me semblerait mieux d'en faire un simple lien et centré sous le tableau afin que les utilisateurs ne pensent pas qu'il faut utiliser exclusivement ce bouton, qui est trop mis en évidence niveau UI par rapport aux éléments du tableau.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, j'ai changé ça mais je trouve pas ça très beau ^^'

</tal:none>
<p i18n:translate="">
This session contains
<strong tal:content="view/files_count" i18n:name="count">N</strong>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Je mettrais cette information directement visible dans la cellule, avant l'information de taille car cela me semble pertinent aussi de visualiser sans ouvrir le nombre de fichiers à signer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fait aussi

@chris-adam chris-adam requested a review from sgeulette April 13, 2026 15:12
@gbastien
Copy link
Copy Markdown
Member

@chris-adam des détails, mais ne mettrions nous pas: "Ouvrir la plateforme de signature électronique"? A priori on met "signature électronique" partout pour ne pas avoir parfois eSign, parfois e-signature, parfois "signature digitale", ...
Pour le [+], çà me va comme çà, mais on pourrait remettre "Voir aperçu (13 élément(s), taille totale 0.41 MB / 100 MB)", est ce que la notion de "Voir aperçu" ou simplement "Aperçu" est importante? Pour que les utilisateurs soient invités à cliquer dessus? C'est du détail, on se met d'accord aujourd'hui et on merge :-)

@chris-adam
Copy link
Copy Markdown
Contributor Author

@chris-adam des détails, mais ne mettrions nous pas: "Ouvrir la plateforme de signature électronique"? A priori on met "signature électronique" partout pour ne pas avoir parfois eSign, parfois e-signature, parfois "signature digitale", ... Pour le [+], çà me va comme çà, mais on pourrait remettre "Voir aperçu (13 élément(s), taille totale 0.41 MB / 100 MB)", est ce que la notion de "Voir aperçu" ou simplement "Aperçu" est importante? Pour que les utilisateurs soient invités à cliquer dessus? C'est du détail, on se met d'accord aujourd'hui et on merge :-)

@gbastien On peut voir ça cette après-midi après les ateliers :)

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.

4 participants