Skip to content

Commit f0a10a3

Browse files
feat(related-records): apply add-record action and empty badge to row 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>
1 parent 19b3eac commit f0a10a3

2 files changed

Lines changed: 50 additions & 8 deletions

File tree

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

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,49 @@
156156
}
157157

158158
.related-records__table-name {
159-
flex: 1 0 auto;
159+
flex: 1 1 auto;
160+
min-width: 0;
161+
display: flex;
162+
align-items: center;
163+
gap: 8px;
164+
margin-right: 8px;
165+
}
166+
167+
.related-records__table-name-text {
168+
overflow: hidden;
169+
text-overflow: ellipsis;
170+
white-space: nowrap;
171+
min-width: 0;
160172
}
161173

162174
.related-records__actions {
163-
flex-grow: 0;
175+
flex: 0 0 auto;
164176
justify-content: flex-end;
165177
}
166178

179+
.related-records__empty-mark {
180+
flex: 0 0 auto;
181+
font-size: 11px;
182+
line-height: 16px;
183+
text-transform: uppercase;
184+
letter-spacing: 0.04em;
185+
padding: 1px 6px;
186+
border-radius: 8px;
187+
color: rgba(0, 0, 0, 0.5);
188+
background: rgba(0, 0, 0, 0.06);
189+
}
190+
191+
.related-records__add-button {
192+
flex: 0 0 auto;
193+
}
194+
195+
@media (prefers-color-scheme: dark) {
196+
.related-records__empty-mark {
197+
color: rgba(255, 255, 255, 0.6);
198+
background: rgba(255, 255, 255, 0.1);
199+
}
200+
}
201+
167202
.related-record {
168203
--mat-list-list-item-two-line-container-height: 60px;
169204
}

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,21 @@ <h3>
7979
<mat-accordion multi="true">
8080
<mat-expansion-panel *ngFor="let referencedTable of referencedTables; let i = index" class="related-records__panel">
8181
<mat-expansion-panel-header>
82-
<mat-panel-title class="related-records__table-name"> {{referencedTable.displayTableName}} </mat-panel-title>
82+
<mat-panel-title class="related-records__table-name">
83+
<span class="related-records__table-name-text" [matTooltip]="referencedTable.displayTableName">{{referencedTable.displayTableName}}</span>
84+
<span *ngIf="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rawRows.length"
85+
class="related-records__empty-mark">
86+
Empty
87+
</span>
88+
</mat-panel-title>
8389
<mat-panel-description class="related-records__actions">
8490
<mat-spinner *ngIf="!referencedRecords[referencedTable.table_name]" diameter="20"></mat-spinner>
85-
<span *ngIf="referencedRecords[referencedTable.table_name] && !referencedRecords[referencedTable.table_name].rawRows.length">Absent</span>
86-
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name] && referencedRecords[referencedTable.table_name].rawRows.length"
87-
[routerLink]="['/dashboard', connectionID, referencedTable.table_name, 'settings']"
88-
matTooltip="Set up records view">
89-
<mat-icon>settings</mat-icon>
91+
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name]" target="_blank"
92+
class="related-records__add-button"
93+
routerLink="/dashboard/{{connectionID}}/{{referencedTable.table_name}}/entry"
94+
matTooltip="Add a new record to {{referencedTable.displayTableName}}"
95+
(click)="$event.stopPropagation()">
96+
<mat-icon>add</mat-icon>
9097
</a>
9198
<a mat-icon-button *ngIf="referencedRecords[referencedTable.table_name]"
9299
routerLink="/dashboard/{{connectionID}}/{{referencedTable.table_name}}"

0 commit comments

Comments
 (0)