Skip to content

feat(related-records): add "add record" action and empty indicator#1832

Merged
lyubov-voloshko merged 6 commits into
mainfrom
add-related-record
Jun 8, 2026
Merged

feat(related-records): add "add record" action and empty indicator#1832
lyubov-voloshko merged 6 commits into
mainfrom
add-related-record

Conversation

@lyubov-voloshko

@lyubov-voloshko lyubov-voloshko commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Add an icon button to each related-records panel header that links to the new-record form for the referenced table. Replace the "Absent" text with an "Empty" badge next to the table name, and truncate long table names with an ellipsis and tooltip.

Summary by CodeRabbit

  • Style

    • Improved related-records header layout, spacing and truncation with tooltip-enabled table names
    • Dark-mode color and icon contrast enhancements; disabled panel headers remain legible and non-interactive
  • New Features

    • Empty-state marker shown for referenced tables with no rows
    • Persistent "Add" action to create related records; panels toggle/disable based on presence of referenced rows

Add an icon button to each related-records panel header that links to the
new-record form for the referenced table. Replace the "Absent" text with an
"Empty" badge next to the table name, and truncate long table names with an
ellipsis and tooltip.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 8, 2026 09:20
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Expansion-panel headers and per-row action markup for related-records were updated to conditionally disable/hide toggles, show a tooltip-enabled table name, display an "Empty" marker when there are no rows, and always render an "Add" icon button when entries exist. CSS was changed to enforce header flex layout, single-line truncation, action sizing/clickability, icon color overrides, and an empty-state pill style.

Changes

Related Records Panel Header

Layer / File(s) Summary
Expansion-panel header templates and per-row action markup
frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.html, frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.html
Adds disabled/hideToggle bindings on related-records panels, wraps table-name in a tooltip-enabled span, replaces the "Absent" indicator with a conditional "Empty" marker, renders an "Add" icon button routing to /entry with stopped propagation, and rewraps per-row chevron inside a div matListItemMeta.
Panel header flex layout, truncation, and actions styling
frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.css, frontend/src/app/components/db-table-row-edit/db-table-row-edit.component.css
Enforces flex sizing for .related-records__table-name and .related-records__actions, applies single-line ellipsis to .related-records__table-name-text, forces icon color visibility (light/dark), ensures .related-records__actions remains clickable, prevents add-button wrapping, and styles the .related-records__empty-mark pill with dark-mode overrides.
List item end spacing override
frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.css
Adds a ::ng-deep override to adjust .mdc-list-item__end left/right margins for related-records list items.

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • rocket-admin/rocketadmin#1814: Touches the same related-records UI and markup/styling in row preview/edit components; likely overlaps in header/action rendering changes.

Suggested reviewers:

  • gugu

"I'm a rabbit in the UI glade,
I trim the headers, mend the braid,
Empty pills and icons bright,
Flex and ellipses sleeping tight. 🐇"

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly and clearly summarizes the main changes: adding an 'add record' action button and replacing the 'Absent' indicator with an 'Empty' indicator in related-records panels.
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.
Security Check ✅ Passed PR adds navigation UI without XSS, authorization bypass, or data exposure. Data comes from backend and Angular sanitizes interpolations.

✏️ 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 add-related-record

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.

@lyubov-voloshko lyubov-voloshko enabled auto-merge June 8, 2026 09:21
@lyubov-voloshko lyubov-voloshko disabled auto-merge June 8, 2026 09:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the “Related records” UI in the row preview sidebar by adding a quick “add record” action per referenced table and improving the empty-state presentation for referenced tables (badge + truncated names with tooltip).

Changes:

  • Added an “Add” icon action in each related-records panel header linking to the referenced table’s new-record form.
  • Replaced the prior “Absent” text with an “Empty” badge near the referenced table name.
  • Updated layout/CSS to support ellipsis truncation for long table names and styling for the new badge/action.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.html Adds “Add record” action, moves empty indicator to a badge, and adds tooltip for truncated table names.
frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.css Adjusts flex layout for header/title, adds ellipsis styling, and introduces badge/button styling (including dark-scheme tweaks).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<mat-spinner *ngIf="!referencedRecords[referencedTable.table_name]" diameter="20"></mat-spinner>
<span *ngIf="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rows.length">Absent</span>
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name] && referencedRecords[referencedTable.table_name].rows.length"
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name]" target="_blank"
Comment on lines +47 to +50
routerLink="/dashboard/{{selectedRow.connectionID}}/{{referencedTable.table_name}}/entry"
matTooltip="Add a new record to {{referencedTable.displayTableName}}"
(click)="handleClose(); $event.stopPropagation()">
<mat-icon>add</mat-icon>
<mat-expansion-panel-header class="related-records__header">
<mat-panel-title class="related-records__table-name"> {{referencedTable.displayTableName}} </mat-panel-title>
<mat-panel-title class="related-records__table-name">
<span class="related-records__table-name-text" [matTooltip]="referencedTable.displayTableName">{{referencedTable.displayTableName}}</span>
Comment on lines +52 to +58
<!--<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name] && referencedRecords[referencedTable.table_name].rows.length"
target="_blank"
[routerLink]="['/dashboard', selectedRow.connectionID, referencedTable.table_name, 'settings']"
matTooltip="Set up records view"
(click)="handleClose()">
<mat-icon>settings</mat-icon>
</a>
</a>-->
… edit

Mirror the row-view related-records changes in the row-edit view: add an
icon button linking to the new-record form, replace "Absent" with an
"Empty" badge next to the table name, and truncate long table names.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.html (1)

47-47: ⚡ Quick win

Use array binding for routerLink instead of string interpolation.

String interpolation in routerLink attributes can lead to improper URL encoding and is inconsistent with the pattern used elsewhere in this template (line 88). Array binding provides better security and type safety.

♻️ Proposed refactor to use array binding
-                            routerLink="/dashboard/{{selectedRow.connectionID}}/{{referencedTable.table_name}}/entry"
+                            [routerLink]="['/dashboard', selectedRow.connectionID, referencedTable.table_name, 'entry']"
🤖 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
`@frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.html`
at line 47, Replace the string-interpolated routerLink attribute on the template
element (currently using selectedRow.connectionID and
referencedTable.table_name) with Angular array binding for routerLink; build the
route segments as an array consisting of "/dashboard", the
selectedRow.connectionID value, the referencedTable.table_name value, and
"entry" so Angular composes and encodes the URL correctly (update the attribute
on the element that contains routerLink in db-table-row-view.component.html).
🤖 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.

Inline comments:
In
`@frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.html`:
- Around line 38-41: Replace the Angular structural directives (*ngIf) with
Angular 19 control-flow syntax (`@if`) for the conditional rendering around the
span that shows "Empty" and the other two occurrences; use the `@if` form to
evaluate the same condition (referencedRecords[referencedTable.table_name] &&
!referencedRecords[referencedTable.table_name].rows.length) and render the span
with class related-records__empty-mark when true, and similarly convert the
other *ngIf usages on lines referenced in the comment to equivalent `@if` blocks
so they reference the same referencedRecords and referencedTable.table_name
symbols.

---

Nitpick comments:
In
`@frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.html`:
- Line 47: Replace the string-interpolated routerLink attribute on the template
element (currently using selectedRow.connectionID and
referencedTable.table_name) with Angular array binding for routerLink; build the
route segments as an array consisting of "/dashboard", the
selectedRow.connectionID value, the referencedTable.table_name value, and
"entry" so Angular composes and encodes the URL correctly (update the attribute
on the element that contains routerLink in db-table-row-view.component.html).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 350e8fc8-96b3-40eb-9db6-6bd967143974

📥 Commits

Reviewing files that changed from the base of the PR and between 869e97a and 19b3eac.

📒 Files selected for processing (2)
  • frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.css
  • frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.html

Comment on lines +38 to +41
<span *ngIf="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rows.length"
class="related-records__empty-mark">
Empty
</span>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use Angular 19's @if control flow instead of *ngIf structural directives.

The new code uses *ngIf structural directives on lines 38, 44, and 45. As per coding guidelines, Angular 19's built-in control flow syntax should be used for all new code.

♻️ Proposed refactor to use `@if` control flow
-                        <span *ngIf="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rows.length"
+                        `@if` (referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rows.length) {
+                            <span
                             class="related-records__empty-mark">
                             Empty
-                        </span>
+                            </span>
+                        }
                     </mat-panel-title>
                     <mat-panel-description class="related-records__actions">
-                        <mat-spinner *ngIf="!referencedRecords[referencedTable.table_name]" diameter="20"></mat-spinner>
-                        <a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name]" target="_blank"
+                        `@if` (!referencedRecords[referencedTable.table_name]) {
+                            <mat-spinner diameter="20"></mat-spinner>
+                        }
+                        `@if` (referencedRecords[referencedTable.table_name]) {
+                            <a mat-icon-button target="_blank"
                             class="related-records__add-button"
                             routerLink="/dashboard/{{selectedRow.connectionID}}/{{referencedTable.table_name}}/entry"
                             matTooltip="Add a new record to {{referencedTable.displayTableName}}"
                             (click)="handleClose(); $event.stopPropagation()">
                             <mat-icon>add</mat-icon>
-                        </a>
+                            </a>
+                        }

As per coding guidelines: "Use Angular 19's built-in control flow (@if, @for, @switch) instead of structural directives (*ngIf, *ngFor, *ngSwitch) in all new code"

Also applies to: 44-44, 45-51

🤖 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
`@frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.html`
around lines 38 - 41, Replace the Angular structural directives (*ngIf) with
Angular 19 control-flow syntax (`@if`) for the conditional rendering around the
span that shows "Empty" and the other two occurrences; use the `@if` form to
evaluate the same condition (referencedRecords[referencedTable.table_name] &&
!referencedRecords[referencedTable.table_name].rows.length) and render the span
with class related-records__empty-mark when true, and similarly convert the
other *ngIf usages on lines referenced in the comment to equivalent `@if` blocks
so they reference the same referencedRecords and referencedTable.table_name
symbols.

Source: Coding guidelines

lyubov-voloshko and others added 3 commits June 8, 2026 09:30
Mark empty related-records panels as disabled with no expand toggle, while
keeping the header actions (add / open in table view) clickable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Give the related-records header action icons a full-strength color in both
enabled and disabled panel states, replacing Material's lighter default.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Correct the `.mdc-list-item__end` selector so margins actually apply (the
trailing-meta class lives on the host, not a descendant) and wrap the
open-record link in a meta container for consistent alignment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai coderabbitai Bot requested a review from gugu June 8, 2026 11:57
@lyubov-voloshko lyubov-voloshko merged commit 890feb0 into main Jun 8, 2026
14 of 15 checks passed
@lyubov-voloshko lyubov-voloshko deleted the add-related-record branch June 8, 2026 11:59
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