11"use client" ;
22
33import React from "react" ;
4- import { usePathname } from "next/navigation" ;
4+ import { useParams , usePathname } from "next/navigation" ;
55
66import { Button } from "@ctrlplane/ui/button" ;
77
@@ -15,6 +15,7 @@ export const NavigationMenuAction: React.FC<{
1515 deploymentId : string ;
1616 systemId : string ;
1717} > = ( { deploymentId, systemId } ) => {
18+ const { workspaceSlug } = useParams < { workspaceSlug : string } > ( ) ;
1819 const pathname = usePathname ( ) ;
1920 const isVariablesActive = pathname . includes ( "variables" ) ;
2021 const isReleaseChannelsActive = pathname . includes ( "release-channels" ) ;
@@ -24,8 +25,13 @@ export const NavigationMenuAction: React.FC<{
2425 api . deployment . releaseChannel . list . byDeploymentId . useQuery ( deploymentId ) ;
2526 const releaseChannels = releaseChannelsQ . data ?? [ ] ;
2627
27- const runbooksQ = api . runbook . bySystemId . useQuery ( systemId ) ;
28- const runbooks = runbooksQ . data ?? [ ] ;
28+ const workspaceQ = api . workspace . bySlug . useQuery ( workspaceSlug ) ;
29+ const workspace = workspaceQ . data ;
30+
31+ const jobAgentsQ = api . job . agent . byWorkspaceId . useQuery ( workspace ?. id ?? "" , {
32+ enabled : workspace != null ,
33+ } ) ;
34+ const jobAgents = jobAgentsQ . data ?? [ ] ;
2935
3036 return (
3137 < div >
@@ -48,8 +54,12 @@ export const NavigationMenuAction: React.FC<{
4854 </ CreateReleaseChannelDialog >
4955 ) }
5056
51- { isHooksActive && (
52- < CreateHookDialog deploymentId = { deploymentId } runbooks = { runbooks } >
57+ { isHooksActive && workspace != null && (
58+ < CreateHookDialog
59+ deploymentId = { deploymentId }
60+ jobAgents = { jobAgents }
61+ workspace = { workspace }
62+ >
5363 < Button size = "sm" variant = "secondary" >
5464 New Hook
5565 </ Button >
0 commit comments