Skip to content
Merged
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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import React from "react";
import { usePathname } from "next/navigation";
import { useParams, usePathname } from "next/navigation";

import { Button } from "@ctrlplane/ui/button";

Expand All @@ -15,6 +15,7 @@ export const NavigationMenuAction: React.FC<{
deploymentId: string;
systemId: string;
}> = ({ deploymentId, systemId }) => {
const { workspaceSlug } = useParams<{ workspaceSlug: string }>();
const pathname = usePathname();
const isVariablesActive = pathname.includes("variables");
const isReleaseChannelsActive = pathname.includes("release-channels");
Expand All @@ -24,8 +25,13 @@ export const NavigationMenuAction: React.FC<{
api.deployment.releaseChannel.list.byDeploymentId.useQuery(deploymentId);
const releaseChannels = releaseChannelsQ.data ?? [];

const runbooksQ = api.runbook.bySystemId.useQuery(systemId);
const runbooks = runbooksQ.data ?? [];
const workspaceQ = api.workspace.bySlug.useQuery(workspaceSlug);
const workspace = workspaceQ.data;

const jobAgentsQ = api.job.agent.byWorkspaceId.useQuery(workspace?.id ?? "", {
enabled: workspace != null,
});
const jobAgents = jobAgentsQ.data ?? [];

return (
<div>
Expand All @@ -48,8 +54,12 @@ export const NavigationMenuAction: React.FC<{
</CreateReleaseChannelDialog>
)}

{isHooksActive && (
<CreateHookDialog deploymentId={deploymentId} runbooks={runbooks}>
{isHooksActive && workspace != null && (
<CreateHookDialog
deploymentId={deploymentId}
jobAgents={jobAgents}
workspace={workspace}
>
<Button size="sm" variant="secondary">
New Hook
</Button>
Expand Down
Loading
Loading