Skip to content

Commit 0ecfb40

Browse files
Add variable to API endpoint
Allow API to retrun max_connections for frontend database page
1 parent f0e4764 commit 0ecfb40

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

app/Transformers/Api/Client/DatabaseTransformer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function transform(Database $model): array
5858
'name' => $model->database,
5959
'username' => $model->username,
6060
'connections_from' => $model->remote,
61+
'max_connections' => $model->max_connections,
6162
];
6263
}
6364

resources/scripts/api/server/getServerDatabases.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface ServerDatabase {
66
username: string;
77
connectionString: string;
88
allowConnectionsFrom: string;
9+
maxConnections: string;
910
password?: string;
1011
}
1112

@@ -15,6 +16,7 @@ export const rawDataToServerDatabase = (data: any): ServerDatabase => ({
1516
username: data.username,
1617
connectionString: `${data.host.address}:${data.host.port}`,
1718
allowConnectionsFrom: data.connections_from,
19+
maxConnections: data.max_connections,
1820
password: data.relationships && data.relationships.password ? data.relationships.password.attributes.password : undefined,
1921
});
2022

resources/scripts/components/server/databases/DatabaseRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export default ({ database, className }: Props) => {
152152
<p className={'mt-1 text-2xs text-neutral-500 uppercase select-none'}>Username</p>
153153
</div>
154154
<div className={'ml-8 text-center'}>
155-
<p className={'text-sm'}>{database.max_connections}</p>
155+
<p className={'text-sm'}>{database.maxConnections}</p>
156156
<p className={'mt-1 text-2xs text-neutral-500 uppercase select-none'}>Max Connections</p>
157157
</div>
158158
<div className={'ml-8'}>

0 commit comments

Comments
 (0)