Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,69 @@
}

.related-records__table-name {
flex: 1 0 auto;
flex: 1 1 auto;
min-width: 0;
display: flex;
align-items: center;
gap: 8px;
margin-right: 8px;
}

.related-records__table-name-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
}

.related-records__actions {
flex-grow: 0;
flex: 0 0 auto;
justify-content: flex-end;
/* Stay clickable even when the panel is disabled (no related records). */
pointer-events: auto;
}

/* Keep the action icons fully dark in every panel state (enabled or
disabled), instead of Material's lighter default icon color. */
.related-records__actions .mat-icon {
color: rgba(0, 0, 0, 0.87);
}

@media (prefers-color-scheme: dark) {
.related-records__actions .mat-icon {
color: rgba(255, 255, 255, 0.87);
}
}

.related-records__empty-mark {
flex: 0 0 auto;
font-size: 11px;
line-height: 16px;
text-transform: uppercase;
letter-spacing: 0.04em;
padding: 1px 6px;
border-radius: 8px;
color: rgba(0, 0, 0, 0.5);
background: rgba(0, 0, 0, 0.06);
}

.related-records__add-button {
flex: 0 0 auto;
white-space: nowrap;
}

/* Keep header content legible when the panel is disabled (no related
records) — disabling only blocks expand/collapse, not the actions. */
.related-records__panel ::ng-deep .mat-expansion-panel-header[aria-disabled='true'] {
color: inherit;
cursor: default;
}

@media (prefers-color-scheme: dark) {
.related-records__empty-mark {
color: rgba(255, 255, 255, 0.6);
background: rgba(255, 255, 255, 0.1);
}
}

.related-record {
Expand All @@ -207,3 +264,7 @@
.related-records__panel ::ng-deep .mat-expansion-panel-body {
padding: 0 8px;
}
.related-record ::ng-deep .mdc-list-item__end {
margin-right: -8px !important;
margin-left: 4px !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,33 @@ <h2 class="mat-heading-2 row-preview-sidebar__title">Preview</h2>
<h3 class="related-records-section__title">Related records</h3>

<mat-accordion multi="true">
<mat-expansion-panel *ngFor="let referencedTable of referencedTables; let i = index" class="related-records__panel">
<mat-expansion-panel *ngFor="let referencedTable of referencedTables; let i = index" class="related-records__panel"
[disabled]="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rows.length"
[hideToggle]="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rows.length">
<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>
<span *ngIf="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rows.length"
class="related-records__empty-mark">
Empty
</span>
Comment on lines +40 to +43

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

</mat-panel-title>
<mat-panel-description class="related-records__actions">
<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"
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>
Comment on lines +49 to +52
</a>
<!--<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>-->
Comment on lines +54 to +60
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name]" target="_blank"
routerLink="/dashboard/{{selectedRow.connectionID}}/{{referencedTable.table_name}}"
[queryParams]="referencedTablesURLParams[i]"
Expand All @@ -70,14 +84,17 @@ <h3 class="related-records-section__title">Related records</h3>
</span>
</span>

<a matListItemMeta mat-icon-button
class="related-record__open"
matTooltip="Open record"
[routerLink]="['/dashboard', selectedRow.connectionID, referencedTable.table_name, 'entry']"
[queryParams]="referencedRecords[referencedTable.table_name]?.links[i]"
(click)="handleClose()">
<mat-icon>chevron_right</mat-icon>
</a>
<div matListItemMeta>
<a mat-icon-button
class="related-record__open"
matTooltip="Open record"
[routerLink]="['/dashboard', selectedRow.connectionID, referencedTable.table_name, 'entry']"
[queryParams]="referencedRecords[referencedTable.table_name]?.links[i]"
(click)="handleClose()">
<mat-icon>chevron_right</mat-icon>
</a>
</div>

</mat-list-item>
</mat-list>
</mat-expansion-panel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,68 @@
}

.related-records__table-name {
flex: 1 0 auto;
flex: 1 1 auto;
min-width: 0;
display: flex;
align-items: center;
gap: 8px;
margin-right: 8px;
}

.related-records__table-name-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
}

.related-records__actions {
flex-grow: 0;
flex: 0 0 auto;
justify-content: flex-end;
/* Stay clickable even when the panel is disabled (no related records). */
pointer-events: auto;
}

/* Keep the action icons fully dark in every panel state (enabled or
disabled), instead of Material's lighter default icon color. */
.related-records__actions .mat-icon {
color: rgba(0, 0, 0, 0.87);
}

@media (prefers-color-scheme: dark) {
.related-records__actions .mat-icon {
color: rgba(255, 255, 255, 0.87);
}
}

/* Keep header content legible when the panel is disabled (no related
records) — disabling only blocks expand/collapse, not the actions. */
.related-records__panel ::ng-deep .mat-expansion-panel-header[aria-disabled='true'] {
color: inherit;
cursor: default;
}

.related-records__empty-mark {
flex: 0 0 auto;
font-size: 11px;
line-height: 16px;
text-transform: uppercase;
letter-spacing: 0.04em;
padding: 1px 6px;
border-radius: 8px;
color: rgba(0, 0, 0, 0.5);
background: rgba(0, 0, 0, 0.06);
}

.related-records__add-button {
flex: 0 0 auto;
}

@media (prefers-color-scheme: dark) {
.related-records__empty-mark {
color: rgba(255, 255, 255, 0.6);
background: rgba(255, 255, 255, 0.1);
}
}

.related-record {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,25 @@ <h3>
</h3>

<mat-accordion multi="true">
<mat-expansion-panel *ngFor="let referencedTable of referencedTables; let i = index" class="related-records__panel">
<mat-expansion-panel *ngFor="let referencedTable of referencedTables; let i = index" class="related-records__panel"
[disabled]="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rawRows.length"
[hideToggle]="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rawRows.length">
<mat-expansion-panel-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>
<span *ngIf="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rawRows.length"
class="related-records__empty-mark">
Empty
</span>
</mat-panel-title>
<mat-panel-description class="related-records__actions">
<mat-spinner *ngIf="!referencedRecords[referencedTable.table_name]" diameter="20"></mat-spinner>
<span *ngIf="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rawRows.length">Absent</span>
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name] && referencedRecords[referencedTable.table_name].rawRows.length"
[routerLink]="['/dashboard', connectionID, referencedTable.table_name, 'settings']"
matTooltip="Set up records view">
<mat-icon>settings</mat-icon>
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name]" target="_blank"
class="related-records__add-button"
routerLink="/dashboard/{{connectionID}}/{{referencedTable.table_name}}/entry"
matTooltip="Add a new record to {{referencedTable.displayTableName}}"
(click)="$event.stopPropagation()">
<mat-icon>add</mat-icon>
</a>
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name]"
routerLink="/dashboard/{{connectionID}}/{{referencedTable.table_name}}"
Expand Down
Loading