Skip to content

Commit 5b0dd95

Browse files
Merge branch 'main' into fix/nginx-ai-streaming-buffering
2 parents c304869 + ed93565 commit 5b0dd95

File tree

8 files changed

+110
-58
lines changed

8 files changed

+110
-58
lines changed

backend/src/shared/services/turnstile.service.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,21 @@ export class TurnstileService {
2929
formData.append('secret', secretKey);
3030
formData.append('response', token);
3131

32-
const response = await axios.post<TurnstileVerifyResponse>(this.verifyUrl, formData.toString(), {
33-
headers: {
34-
'Content-Type': 'application/x-www-form-urlencoded',
35-
},
36-
});
37-
38-
if (!response.data.success) {
39-
const errorCodes = response.data['error-codes']?.join(', ') || 'Unknown error';
40-
throw new BadRequestException(`Turnstile verification failed: ${errorCodes}`);
32+
try {
33+
const response = await axios.post<TurnstileVerifyResponse>(this.verifyUrl, formData.toString(), {
34+
headers: {
35+
'Content-Type': 'application/x-www-form-urlencoded',
36+
},
37+
});
38+
39+
if (!response.data.success) {
40+
const errorCodes = response.data['error-codes']?.join(', ') || 'Unknown error';
41+
throw new BadRequestException(`Turnstile verification failed: ${errorCodes}`);
42+
}
43+
} catch (error) {
44+
if (error instanceof BadRequestException) throw error;
45+
console.error('Turnstile verification error:', error?.response?.data || error?.message || error);
46+
throw new BadRequestException('Turnstile verification failed. Please try again.');
4147
}
4248

4349
return true;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787

8888
.connections-divider {
8989
position: relative;
90-
margin: 44px auto 52px;
90+
margin: 24px auto 32px;
9191
width: calc(100% - 16px);
9292
}
9393

frontend/src/app/components/connections-list/connections-list.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ <h1 class="mat-headline-4 pageTitle__name" data-testid="company-name">{{companyN
2222
<app-own-connections
2323
[currentUser]="currentUser"
2424
[connections]="ownConnections"
25-
[isDemo]="isDemo">
25+
[isDemo]="isDemo"
26+
[companyId]="currentUser?.company?.id">
2627
</app-own-connections>
2728

2829
<mat-divider *ngIf="testConnections && testConnections.length"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858

5959
@media (prefers-color-scheme: dark) {
6060
.testConnectionLink {
61-
background: #404040;
62-
border: 1px solid #404040;
61+
background: #2a2a2a;
62+
border: 1px solid #2a2a2a;
6363
}
6464

6565
.testConnectionLink:hover {

frontend/src/app/components/connections-list/demo-connections/demo-connections.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1 *ngIf="!isDemo" class="mat-display-1">Explore demo admin panels</h1>
1+
<h1 *ngIf="!isDemo" class="mat-display-1">Explore demo panels</h1>
22
<h1 *ngIf="isDemo" class="mat-display-1">Try out a demo admin panel</h1>
33

44
<ul class="testConnections">

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

Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
:host {
2-
display: flex;
3-
flex-direction: column;
4-
align-items: center;
5-
width: 100%;
2+
flex-grow: 1;
3+
display: flex;
4+
flex-direction: column;
5+
align-items: center;
6+
width: 100%;
67
}
78

89
.empty-state {
@@ -53,24 +54,23 @@
5354
}
5455

5556
.addConnectionLink {
56-
display: flex;
57-
flex-direction: column;
58-
align-items: center;
59-
gap: 6px;
60-
border-radius: 4px;
61-
box-shadow:
62-
0px 1px 3px 0px rgba(0, 0, 0, 0.2),
63-
0px 2px 2px 0px rgba(0, 0, 0, 0.12),
64-
0px 0px 2px 0px rgba(0, 0, 0, 0.14);
65-
color: inherit;
66-
font-weight: 600;
67-
padding: 12px;
68-
text-decoration: none;
69-
height: 100%;
70-
transition:
71-
box-shadow 200ms,
72-
background 200ms,
73-
border 200ms;
57+
display: flex;
58+
flex-direction: column;
59+
align-items: center;
60+
justify-content: center;
61+
gap: 4px;
62+
border-radius: 4px;
63+
box-shadow:
64+
0px 1px 3px 0px rgba(0, 0, 0, 0.2),
65+
0px 2px 2px 0px rgba(0, 0, 0, 0.12),
66+
0px 0px 2px 0px rgba(0, 0, 0, 0.14);
67+
color: inherit;
68+
font-weight: 600;
69+
padding: 8px;
70+
text-decoration: none;
71+
height: 100%;
72+
min-height: 90px;
73+
transition: box-shadow 200ms, background 200ms, border 200ms;
7474
}
7575

7676
.addConnectionLink:hover {
@@ -81,10 +81,10 @@
8181
}
8282

8383
@media (prefers-color-scheme: dark) {
84-
.addConnectionLink {
85-
background: #404040;
86-
border: 1px solid #404040;
87-
}
84+
.addConnectionLink {
85+
background: #2a2a2a;
86+
border: 1px solid #2a2a2a;
87+
}
8888

8989
.addConnectionLink:hover {
9090
background: #212121;
@@ -97,26 +97,41 @@
9797
}
9898

9999
.addConnectionLink__iconBox {
100-
flex-shrink: 0;
101-
display: flex;
102-
align-items: center;
103-
justify-content: center;
104-
background-color: #fff;
105-
border-radius: 4px;
106-
height: 40px;
107-
width: 40px;
100+
flex-shrink: 0;
101+
display: flex;
102+
align-items: center;
103+
justify-content: center;
104+
height: 32px;
105+
width: 32px;
108106
}
109107

110108
.addConnectionLink__icon {
111-
flex-shrink: 0;
112-
height: 30px;
113-
width: 30px;
109+
flex-shrink: 0;
110+
height: 28px;
111+
width: 28px;
112+
}
113+
114+
@media (prefers-color-scheme: dark) {
115+
.addConnectionLink__icon[data-mat-icon-name="mongodb"],
116+
.addConnectionLink__icon[data-mat-icon-name="mysql"],
117+
.addConnectionLink__icon[data-mat-icon-name="dynamodb"],
118+
.addConnectionLink__icon[data-mat-icon-name="mssql"] {
119+
filter: brightness(2);
120+
}
114121
}
115122

116123
.addConnectionLink__label {
117124
text-align: center;
118125
}
119126

127+
.addConnectionLink__subLabel {
128+
display: block;
129+
font-weight: 400;
130+
opacity: 0.6;
131+
font-size: 12px;
132+
margin-top: -2px;
133+
}
134+
120135
.showAllButton {
121136
margin-top: 20px;
122137
margin-bottom: -56px;

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<h1 *ngIf="isDemo" class="mat-display-1">Create you own test connection</h1>
1+
<h1 *ngIf="isDemo" class="mat-display-1">Create your own test connection</h1>
22

33
<div *ngIf="!connections?.length && connections !== null" class="empty-state">
44
<h1 *ngIf="(currentUser?.role === 'ADMIN' || currentUser?.role === 'DB_ADMIN') && !isDemo" class="mat-display-1">
5-
Create your first connection
5+
Create first connection
66
</h1>
77
<ul class="supportedDatabases">
88
<li *ngFor="let supportedDatabase of supportedOrderedDatabases">
@@ -13,7 +13,10 @@ <h1 *ngIf="(currentUser?.role === 'ADMIN' || currentUser?.role === 'DB_ADMIN') &
1313
<div class="addConnectionLink__iconBox">
1414
<mat-icon [svgIcon]="supportedDatabase" class="addConnectionLink__icon"></mat-icon>
1515
</div>
16-
<span class="addConnectionLink__label">{{ supportedDatabasesTitles[supportedDatabase] }}</span>
16+
<span class="addConnectionLink__label">
17+
{{ getMainTitle(supportedDatabase) }}
18+
<span *ngIf="getSubTitle(supportedDatabase)" class="addConnectionLink__subLabel">{{ getSubTitle(supportedDatabase) }}</span>
19+
</span>
1720
</a>
1821
</li>
1922
</ul>
@@ -80,7 +83,7 @@ <h2 class="connectionInfo__connectionTitle">{{ connectionItem.displayTitle }}</h
8083
Add database
8184
</a>-->
8285

83-
<div *ngIf="!connections?.length && connections !== null && !isDemo" class="empty-state_bottom">
86+
<div *ngIf="!connections?.length && connections !== null && !isDemo && hasMultipleMembers" class="empty-state_bottom">
8487
<p class="mat-body-1 empty-state__text">
8588
Invited to a company but don't see your admin panel?
8689
</p>

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

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CommonModule } from '@angular/common';
2-
import { Component, Input } from '@angular/core';
2+
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
33
import { MatButtonModule } from '@angular/material/button';
44
import { MatIconModule } from '@angular/material/icon';
55
import { RouterModule } from '@angular/router';
@@ -8,6 +8,7 @@ import posthog from 'posthog-js';
88
import { supportedDatabasesTitles, supportedOrderedDatabases } from 'src/app/consts/databases';
99
import { ConnectionItem } from 'src/app/models/connection';
1010
import { UiSettings } from 'src/app/models/ui-settings';
11+
import { CompanyService } from 'src/app/services/company.service';
1112
import { UiSettingsService } from 'src/app/services/ui-settings.service';
1213

1314
@Component({
@@ -16,18 +17,24 @@ import { UiSettingsService } from 'src/app/services/ui-settings.service';
1617
templateUrl: './own-connections.component.html',
1718
styleUrl: './own-connections.component.css',
1819
})
19-
export class OwnConnectionsComponent {
20+
21+
export class OwnConnectionsComponent implements OnInit, OnChanges {
2022
protected posthog = posthog;
2123
@Input() currentUser: User;
2224
@Input() connections: ConnectionItem[] = null;
2325
@Input() isDemo: boolean = false;
26+
@Input() companyId: string;
2427

2528
public displayedCardCount: number = 3;
2629
public connectionsListCollapsed: boolean;
2730
public supportedDatabasesTitles = supportedDatabasesTitles;
2831
public supportedOrderedDatabases = supportedOrderedDatabases;
32+
public hasMultipleMembers: boolean = false;
2933

30-
constructor(private _uiSettings: UiSettingsService) {}
34+
constructor(
35+
private _uiSettings: UiSettingsService,
36+
private _companyService: CompanyService
37+
) {}
3138

3239
ngOnInit() {
3340
this._uiSettings.getUiSettings().subscribe((settings: UiSettings) => {
@@ -36,6 +43,14 @@ export class OwnConnectionsComponent {
3643
});
3744
}
3845

46+
ngOnChanges(changes: SimpleChanges) {
47+
if (changes['companyId'] && this.companyId) {
48+
this._companyService.fetchCompanyMembers(this.companyId).subscribe((members: any[]) => {
49+
this.hasMultipleMembers = members && members.length > 1;
50+
});
51+
}
52+
}
53+
3954
showMore() {
4055
this.displayedCardCount = this.connections.length;
4156
this._uiSettings.updateGlobalSetting('connectionsListCollapsed', false);
@@ -45,4 +60,16 @@ export class OwnConnectionsComponent {
4560
this.displayedCardCount = 3;
4661
this._uiSettings.updateGlobalSetting('connectionsListCollapsed', true);
4762
}
63+
64+
getMainTitle(database: string): string {
65+
const title = this.supportedDatabasesTitles[database] || database;
66+
const match = title.match(/^([^(]+)/);
67+
return match ? match[1].trim() : title;
68+
}
69+
70+
getSubTitle(database: string): string {
71+
const title = this.supportedDatabasesTitles[database] || database;
72+
const match = title.match(/(\([^)]+\))/);
73+
return match ? match[1] : '';
74+
}
4875
}

0 commit comments

Comments
 (0)