Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop mirror: Deal with peer names only in client side #1852

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion ui/app/api/mirrors/drop/route.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import { UDropMirrorResponse } from '@/app/dto/MirrorsDTO';
import prisma from '@/app/utils/prisma';
import { ShutdownRequest, ShutdownResponse } from '@/grpc_generated/route';
import { GetFlowHttpAddressFromEnv } from '@/rpc/http';
import { getTruePeer } from '../../peers/getTruePeer';

const getPeerFromName = async (name: string) => {
const catalogPeer = await prisma.peers.findUnique({
where: {
name,
},
});
const peer = getTruePeer(catalogPeer!);
return peer;
};
export async function POST(request: Request) {
const body = await request.json();
const { workflowId, flowJobName, sourcePeer, destinationPeer } = body;
const { workflowId, flowJobName, sourcePeerName, destinationPeerName } = body;
const sourcePeer = await getPeerFromName(sourcePeerName);
const destinationPeer = await getPeerFromName(destinationPeerName);
const flowServiceAddr = GetFlowHttpAddressFromEnv();
const req: ShutdownRequest = {
workflowId,
Expand Down
8 changes: 4 additions & 4 deletions ui/app/mirrors/tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ export function CDCFlows({ cdcFlows }: { cdcFlows: any }) {
dropArgs={{
workflowId: flow.workflow_id,
flowJobName: flow.name,
sourcePeer: flow.sourcePeer,
destinationPeer: flow.destinationPeer,
sourcePeerName: flow.sourcePeer.name,
destinationPeerName: flow.destinationPeer.name,
}}
/>
</TableCell>
Expand Down Expand Up @@ -172,8 +172,8 @@ export function QRepFlows({
dropArgs={{
workflowId: flow.workflow_id,
flowJobName: flow.name,
sourcePeer: flow.sourcePeer,
destinationPeer: flow.destinationPeer,
sourcePeerName: flow.sourcePeer.name,
destinationPeerName: flow.destinationPeer.name,
}}
/>
</TableCell>
Expand Down
5 changes: 2 additions & 3 deletions ui/components/DropDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { UDropMirrorResponse } from '@/app/dto/MirrorsDTO';
import { UDropPeerResponse } from '@/app/dto/PeersDTO';
import { DeleteScript } from '@/app/scripts/handlers';
import { Peer } from '@/grpc_generated/peers';
import { Button } from '@/lib/Button';
import { Dialog, DialogClose } from '@/lib/Dialog';
import { Icon } from '@/lib/Icon';
Expand All @@ -14,8 +13,8 @@ import { BarLoader } from 'react-spinners';
interface dropMirrorArgs {
workflowId: string | null;
flowJobName: string;
sourcePeer: Peer;
destinationPeer: Peer;
sourcePeerName: string;
destinationPeerName: string;
forResync?: boolean;
}

Expand Down
4 changes: 2 additions & 2 deletions ui/components/ResyncDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const ResyncDialog = ({
{
workflowId: workflowId,
flowJobName: mirrorConfig.flowJobName,
sourcePeer: mirrorConfig.source!,
destinationPeer: mirrorConfig.destination!,
sourcePeerName: mirrorConfig.source!.name,
destinationPeerName: mirrorConfig.destination!.name,
forResync: true,
},
setDropping,
Expand Down
Loading