Skip to content

Added session info size#24

Open
chris-adam wants to merge 1 commit intomainfrom
PARAF-364/quick_look_size
Open

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

Conversation

@chris-adam
Copy link
Contributor

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

Summary by CodeRabbit

  • New Features

    • Quick-look now shows session size with a warning when near capacity.
    • Sessions display a total file-count indicator when containing 10 or more items.
  • Documentation

    • Added English and French translations for the new session message.
  • Chores

    • Added changelog entry for the unreleased release.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b6f94f9e-8aea-445c-8cca-10b4a4d16b54

📥 Commits

Reviewing files that changed from the base of the PR and between 101681b and 745ff80.

📒 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 (1)
  • src/imio/esign/locales/en/LC_MESSAGES/imio.esign.po

📝 Walkthrough

Walkthrough

Adds session size display to the quick-look UI: FilesColumn.renderQuickLook uses registry max session size and a warning threshold; SessionFilesView records files_count; session_files.pt shows a conditional paragraph for sessions with ≥10 files; English and French 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_registry_max_session_size, added SESSION_SIZE_WARNING_THRESHOLD, introduced renderQuickLook(self, item), and updated renderCell to use the new quick-look renderer.
View state
src/imio/esign/browser/views.py
SessionFilesView.__call__ now sets self.files_count = len(files) after assembling files.
Template
src/imio/esign/browser/templates/session_files.pt
Added conditional paragraph rendering "This session contains ${count} element(s)." when view.files_count >= 10; preserved existing "No files" and file list.
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 Config\n(get_registry_max_session_size)
    participant View as SessionFilesView
    participant Template as session_files.pt

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

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Discriminate session size #8 — Introduced/exposed get_registry_max_session_size, which is imported and used by the new quick-look rendering in table.py.

Suggested reviewers

  • sgeulette

Poem

🐇 I counted files and nudged the view,
I peeked the registry and grew a clue,
A little badge, a gentle red,
Français et English tucked in my bed,
Hoppity hop—session info, woo!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Added session info size' accurately describes the main change: adding session size information to the quick-look display in the file browser table.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • 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

@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

@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

@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

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