Skip to content

Commit

Permalink
Remove connection string display (#744)
Browse files Browse the repository at this point in the history
Removes the connection string display in postgres peer page
  • Loading branch information
Amogh-Bharadwaj authored Dec 1, 2023
1 parent 864e502 commit 40117c5
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions ui/app/peers/[peerName]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,16 @@
import { CopyButton } from '@/components/CopyButton';
import ReloadButton from '@/components/ReloadButton';
import { PostgresConfig } from '@/grpc_generated/peers';
import { PeerSlotResponse, PeerStatResponse } from '@/grpc_generated/route';
import { Label } from '@/lib/Label';
import { GetFlowHttpAddressFromEnv } from '@/rpc/http';
import Link from 'next/link';
import prisma from '../../utils/prisma';
import SlotTable from './slottable';
import StatTable from './stattable';
import { connStringStyle } from './style';
export const dynamic = 'force-dynamic';

type DataConfigProps = {
params: { peerName: string };
};

async function fetchConnectionString(peerName: string) {
const config = await prisma.peers.findUnique({
select: {
options: true,
},
where: {
name: peerName,
},
});
if (config) {
const pgConfig = PostgresConfig.decode(config.options);
return `postgresql://${pgConfig.user}:${pgConfig.password}@${pgConfig.host}:${pgConfig.port}`;
}
return '';
}

const PeerData = async ({ params: { peerName } }: DataConfigProps) => {
const getSlotData = async () => {
const flowServiceAddr = GetFlowHttpAddressFromEnv();
Expand Down Expand Up @@ -71,21 +51,13 @@ const PeerData = async ({ params: { peerName } }: DataConfigProps) => {

const slots = await getSlotData();
const stats = await getStatData();
const connectionString = await fetchConnectionString(peerName);

return (
<div style={{ padding: '2rem', display: 'flex', flexDirection: 'column' }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div style={{ fontSize: 20, fontWeight: 'bold' }}>{peerName}</div>
<ReloadButton />
</div>
<div style={{ marginTop: '1rem' }}>
<Label variant='subheadline'>Connection string:</Label>
<div style={connStringStyle}>
{connectionString}
<CopyButton text={connectionString} />
</div>
</div>
{slots && stats ? (
<div
style={{
Expand Down

0 comments on commit 40117c5

Please sign in to comment.