Skip to content

Commit f074468

Browse files
Merge branch 'main' into fix-css-budget
2 parents 4d6a380 + 1bf3da0 commit f074468

32 files changed

Lines changed: 2717 additions & 340 deletions

autoadmin-ws-server/src/handlers/command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function executeCommand(c: Context): Promise<Response> {
4242
resolve(c.json({ error: message }, status as 400));
4343
};
4444

45-
cacheResponse(resId, handleResolve, handleReject, handleSendError);
45+
cacheResponse(resId, handleResolve, handleReject, handleSendError, connectionToken.token);
4646

4747
try {
4848
sendCommandToClient(connectionToken.token, body, resId);

autoadmin-ws-server/src/handlers/websocket.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import { validateConnectionToken } from '../services/token-validator.js';
99
import { hashToken } from '../utils/crypto.js';
1010
import { logger } from '../utils/logger.js';
1111

12+
interface AuthenticatedSocket extends WebSocket {
13+
agentToken?: string;
14+
}
15+
1216
export function setupWebSocketServer(server: Server): WebSocketServer {
1317
const wss = new WebSocketServer({ server });
1418

@@ -46,12 +50,22 @@ export function setupWebSocketServer(server: Server): WebSocketServer {
4650
);
4751
connectionToken = hashedToken;
4852
data.connectionToken = connectionToken;
53+
(ws as AuthenticatedSocket).agentToken = hashedToken;
4954
}
5055

5156
if (operationType === COMMAND_TYPE.dataFromAgent && resId) {
5257
const cachedResponse = responseCache.get(resId);
5358

5459
if (cachedResponse) {
60+
const socketToken = (ws as AuthenticatedSocket).agentToken;
61+
if (!socketToken || socketToken !== cachedResponse.routedToken) {
62+
logger.warn(
63+
{ resId, authenticated: !!socketToken },
64+
'Discarding dataFromAgent from a socket not bound to the routed connection token',
65+
);
66+
return;
67+
}
68+
5569
logger.debug({ resId }, 'Received data from agent');
5670
cachedResponse.resolve(rawMessage.toString());
5771
responseCache.delete(resId);

autoadmin-ws-server/src/services/response-cache.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ interface CachedResponse {
77
reject: (error: Error) => void;
88
sendError: (status: number, message: string) => void;
99
createdAt: Date;
10+
routedToken: string;
1011
}
1112

1213
export const responseCache = new LRUCache<string, CachedResponse>({
@@ -23,12 +24,14 @@ export function cacheResponse(
2324
resolve: (data: string) => void,
2425
reject: (error: Error) => void,
2526
sendError: (status: number, message: string) => void,
27+
routedToken: string,
2628
): void {
2729
responseCache.set(resId, {
2830
resolve,
2931
reject,
3032
sendError,
3133
createdAt: new Date(),
34+
routedToken,
3235
});
3336
logger.debug({ resId }, 'Response cached');
3437
}

frontend/src/app/app.component.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,20 @@
139139
.logo__image {
140140
height: 24px;
141141
margin-right: 12px;
142+
display: block;
143+
vertical-align: middle;
144+
}
145+
146+
.logo picture {
147+
display: inline-flex;
148+
align-items: center;
149+
}
150+
151+
@media (width <= 600px) {
152+
.logo__image {
153+
height: 28px;
154+
margin-right: 8px;
155+
}
142156
}
143157

144158
.logo__demo-mark {

frontend/src/app/app.component.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,18 @@
8686
<a routerLink="/connections-list"
8787
*ngIf="userLoggedIn"
8888
class="logo">
89-
<img *ngIf="whiteLabelSettingsLoaded"
90-
[src]="whiteLabelSettings.logo || '../assets/rocketadmin_logo_white.svg'"
91-
alt="Logo"
92-
class="logo__image"
93-
>
89+
<ng-container *ngIf="whiteLabelSettingsLoaded">
90+
<img *ngIf="whiteLabelSettings.logo; else defaultRocketLogo"
91+
[src]="whiteLabelSettings.logo"
92+
alt="Logo"
93+
class="logo__image">
94+
<ng-template #defaultRocketLogo>
95+
<picture>
96+
<source media="(max-width: 600px)" srcset="../assets/rocketadmin_logo_white-short.svg">
97+
<img src="../assets/rocketadmin_logo_white.svg" alt="Rocketadmin logo" class="logo__image">
98+
</picture>
99+
</ng-template>
100+
</ng-container>
94101
</a>
95102

96103
<a *ngIf="userLoggedIn === false" href="https://rocketadmin.com/" class="logo">

frontend/src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ export class AppComponent {
304304
user_hash: res.intercom_hash,
305305
user_id: res.id,
306306
email: res.email,
307-
hide_default_launcher: window.innerWidth > 600,
307+
hide_default_launcher: window.innerWidth <= 600,
308308
});
309309

310310
if (this.isDemo)

frontend/src/app/components/connections-list/own-connections/own-connections.component.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@
319319
padding: 0;
320320
}
321321

322+
.connectionItem {
323+
min-width: 0;
324+
}
325+
322326
.connection {
323327
display: flex;
324328
flex-direction: column;
@@ -357,6 +361,7 @@
357361
flex-shrink: 0;
358362
display: flex;
359363
align-items: center;
364+
min-width: 0;
360365
gap: 12px;
361366
background-color: var(--color-primaryPalette-500);
362367
border-radius: 2px;
@@ -398,9 +403,14 @@
398403
}
399404

400405
.connection {
406+
gap: 4px;
401407
padding: 8px;
402408
}
403409

410+
.connection:has(.connectionSchemaButton) {
411+
padding: 8px 8px 4px;
412+
}
413+
404414
.connectionLogoPreview {
405415
height: 56px;
406416
padding: 6px 10px;
@@ -409,6 +419,7 @@
409419

410420
.connectionInfo .connectionInfo__connectionTitle {
411421
font-size: 14px !important;
422+
margin-bottom: -8px;
412423
}
413424

414425
.connectionLogoPreview .mat-body-2 {

frontend/src/app/components/dashboard/dashboard.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ export class DashboardComponent implements OnInit, OnDestroy {
288288
openTableFilters(structure) {
289289
let filterDialodRef = this.dialog.open(DbTableFiltersDialogComponent, {
290290
width: '56em',
291+
panelClass: 'mobile-bottom-sheet-dialog',
292+
autoFocus: false,
291293
data: {
292294
connectionID: this.connectionID,
293295
tableName: this.selectedTableName,

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

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,43 @@
33
align-items: center;
44
justify-content: space-between;
55
margin-top: 16px;
6+
margin-bottom: 12px;
7+
}
8+
9+
.filters-header__settings {
10+
flex: 0 0 auto;
11+
margin-left: auto;
12+
}
13+
14+
.filters-header__text {
15+
display: flex;
16+
flex-direction: column;
17+
align-items: flex-start;
18+
gap: 2px;
19+
line-height: 1.2;
20+
text-align: left;
21+
}
22+
23+
@media (width <= 600px) {
24+
.filters-header {
25+
justify-content: flex-start;
26+
gap: 12px;
27+
}
28+
29+
.filters-header__text {
30+
flex: 1 1 auto;
31+
}
32+
}
33+
34+
.filters-header__label {
35+
font-size: 18px;
36+
font-weight: 600;
37+
}
38+
39+
.filters-header__table {
40+
font-size: 12px;
41+
font-weight: 500;
42+
opacity: 0.6;
643
}
744

845
.filters-content {
@@ -11,6 +48,11 @@
1148
grid-column-gap: 8px;
1249
align-content: flex-start;
1350
align-items: flex-start;
51+
padding-top: 8px !important;
52+
}
53+
54+
.filters-select {
55+
margin-top: 4px;
1456
}
1557

1658
.filters-select {
@@ -59,6 +101,48 @@
59101
margin-top: 4px;
60102
}
61103

104+
.filter-line ::ng-deep .mat-mdc-form-field-subscript-wrapper {
105+
display: none;
106+
}
107+
108+
.filter-line {
109+
margin-bottom: 12px;
110+
}
111+
112+
@media (width <= 600px) {
113+
.filters-content {
114+
grid-template-columns: 1fr 32px;
115+
}
116+
117+
.filter-line {
118+
grid-template-columns: 1fr 32px;
119+
grid-template-areas:
120+
"name name"
121+
"field button";
122+
row-gap: 2px;
123+
}
124+
125+
.column-name {
126+
grid-area: name;
127+
grid-column: 1 / -1;
128+
margin: 0;
129+
font-size: 12px;
130+
font-weight: 600;
131+
opacity: 0.6;
132+
}
133+
134+
.filter-line__field {
135+
grid-area: field;
136+
grid-column: 1;
137+
}
138+
139+
.filter-delete-button {
140+
grid-area: button;
141+
grid-column: 2;
142+
margin-top: 0;
143+
}
144+
}
145+
62146
.settings-form__reset-button {
63147
margin-right: auto;
64148
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<form #tableFiltersForm="ngForm" class="filters-form">
22
<h1 mat-dialog-title class="filters-header">
3-
<span>Filters for <strong>{{ data.displayTableName }}</strong> table</span>
3+
<span class="filters-header__text">
4+
<span class="filters-header__label">Filters</span>
5+
<span class="filters-header__table">Table: {{ data.displayTableName }}</span>
6+
</span>
47
<a mat-icon-button mat-dialog-close
8+
class="filters-header__settings"
59
routerLink="/dashboard/{{data.connectionID}}/{{data.tableName}}/settings"
610
matTooltip="Advanced settings">
711
<mat-icon>settings</mat-icon>

0 commit comments

Comments
 (0)