Skip to content

Commit a026e35

Browse files
feat(related-records): add "add record" action and empty indicator
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>
1 parent 6036516 commit a026e35

2 files changed

Lines changed: 54 additions & 6 deletions

File tree

frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.css

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,50 @@
175175
}
176176

177177
.related-records__table-name {
178-
flex: 1 0 auto;
178+
flex: 1 1 auto;
179+
min-width: 0;
180+
display: flex;
181+
align-items: center;
182+
gap: 8px;
183+
margin-right: 8px;
184+
}
185+
186+
.related-records__table-name-text {
187+
overflow: hidden;
188+
text-overflow: ellipsis;
189+
white-space: nowrap;
190+
min-width: 0;
179191
}
180192

181193
.related-records__actions {
182-
flex-grow: 0;
194+
flex: 0 0 auto;
183195
justify-content: flex-end;
184196
}
185197

198+
.related-records__empty-mark {
199+
flex: 0 0 auto;
200+
font-size: 11px;
201+
line-height: 16px;
202+
text-transform: uppercase;
203+
letter-spacing: 0.04em;
204+
padding: 1px 6px;
205+
border-radius: 8px;
206+
color: rgba(0, 0, 0, 0.5);
207+
background: rgba(0, 0, 0, 0.06);
208+
}
209+
210+
.related-records__add-button {
211+
flex: 0 0 auto;
212+
white-space: nowrap;
213+
}
214+
215+
@media (prefers-color-scheme: dark) {
216+
.related-records__empty-mark {
217+
color: rgba(255, 255, 255, 0.6);
218+
background: rgba(255, 255, 255, 0.1);
219+
}
220+
}
221+
186222
.related-record {
187223
--mat-list-list-item-two-line-container-height: 60px;
188224

frontend/src/app/components/dashboard/db-table-view/db-table-row-view/db-table-row-view.component.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,29 @@ <h3 class="related-records-section__title">Related records</h3>
3333
<mat-accordion multi="true">
3434
<mat-expansion-panel *ngFor="let referencedTable of referencedTables; let i = index" class="related-records__panel">
3535
<mat-expansion-panel-header class="related-records__header">
36-
<mat-panel-title class="related-records__table-name"> {{referencedTable.displayTableName}} </mat-panel-title>
36+
<mat-panel-title class="related-records__table-name">
37+
<span class="related-records__table-name-text" [matTooltip]="referencedTable.displayTableName">{{referencedTable.displayTableName}}</span>
38+
<span *ngIf="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rows.length"
39+
class="related-records__empty-mark">
40+
Empty
41+
</span>
42+
</mat-panel-title>
3743
<mat-panel-description class="related-records__actions">
3844
<mat-spinner *ngIf="!referencedRecords[referencedTable.table_name]" diameter="20"></mat-spinner>
39-
<span *ngIf="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rows.length">Absent</span>
40-
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name] && referencedRecords[referencedTable.table_name].rows.length"
45+
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name]" target="_blank"
46+
class="related-records__add-button"
47+
routerLink="/dashboard/{{selectedRow.connectionID}}/{{referencedTable.table_name}}/entry"
48+
matTooltip="Add a new record to {{referencedTable.displayTableName}}"
49+
(click)="handleClose(); $event.stopPropagation()">
50+
<mat-icon>add</mat-icon>
51+
</a>
52+
<!--<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name] && referencedRecords[referencedTable.table_name].rows.length"
4153
target="_blank"
4254
[routerLink]="['/dashboard', selectedRow.connectionID, referencedTable.table_name, 'settings']"
4355
matTooltip="Set up records view"
4456
(click)="handleClose()">
4557
<mat-icon>settings</mat-icon>
46-
</a>
58+
</a>-->
4759
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name]" target="_blank"
4860
routerLink="/dashboard/{{selectedRow.connectionID}}/{{referencedTable.table_name}}"
4961
[queryParams]="referencedTablesURLParams[i]"

0 commit comments

Comments
 (0)