Skip to content

Commit bfdc73f

Browse files
authored
Merge pull request #197 from Dokploy/canary
v0.3.1
2 parents 64ada70 + 525a711 commit bfdc73f

File tree

28 files changed

+2989
-107
lines changed

28 files changed

+2989
-107
lines changed

components/dashboard/application/general/deploy-application.tsx

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
} from "@/components/ui/alert-dialog";
1212
import { Button } from "@/components/ui/button";
1313
import { api } from "@/utils/api";
14-
import { useEffect, useState } from "react";
1514
import { toast } from "sonner";
1615

1716
interface Props {
@@ -26,8 +25,6 @@ export const DeployApplication = ({ applicationId }: Props) => {
2625
{ enabled: !!applicationId },
2726
);
2827

29-
const { mutateAsync: markRunning } =
30-
api.application.markRunning.useMutation();
3128
const { mutateAsync: deploy } = api.application.deploy.useMutation();
3229

3330
return (
@@ -48,24 +45,16 @@ export const DeployApplication = ({ applicationId }: Props) => {
4845
<AlertDialogCancel>Cancel</AlertDialogCancel>
4946
<AlertDialogAction
5047
onClick={async () => {
51-
await markRunning({
52-
applicationId,
53-
})
54-
.then(async () => {
55-
toast.success("Deploying Application....");
48+
toast.success("Deploying Application....");
5649

57-
await refetch();
58-
await deploy({
59-
applicationId,
60-
}).catch(() => {
61-
toast.error("Error to deploy Application");
62-
});
50+
await refetch();
51+
await deploy({
52+
applicationId,
53+
}).catch(() => {
54+
toast.error("Error to deploy Application");
55+
});
6356

64-
await refetch();
65-
})
66-
.catch((e) => {
67-
toast.error(e.message || "Error to deploy Application");
68-
});
57+
await refetch();
6958
}}
7059
>
7160
Confirm

components/dashboard/application/rebuild-application.tsx

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export const RedbuildApplication = ({ applicationId }: Props) => {
2525
},
2626
{ enabled: !!applicationId },
2727
);
28-
const { mutateAsync: markRunning } =
29-
api.application.markRunning.useMutation();
28+
3029
const { mutateAsync } = api.application.redeploy.useMutation();
3130
const utils = api.useUtils();
3231
return (
@@ -54,22 +53,14 @@ export const RedbuildApplication = ({ applicationId }: Props) => {
5453
<AlertDialogCancel>Cancel</AlertDialogCancel>
5554
<AlertDialogAction
5655
onClick={async () => {
57-
await markRunning({
56+
toast.success("Redeploying Application....");
57+
await mutateAsync({
5858
applicationId,
5959
})
6060
.then(async () => {
61-
await mutateAsync({
61+
await utils.application.one.invalidate({
6262
applicationId,
63-
})
64-
.then(async () => {
65-
await utils.application.one.invalidate({
66-
applicationId,
67-
});
68-
toast.success("Application rebuild succesfully");
69-
})
70-
.catch(() => {
71-
toast.error("Error to rebuild the application");
72-
});
63+
});
7364
})
7465
.catch(() => {
7566
toast.error("Error to rebuild the application");

components/dashboard/compose/deployments/show-deployments-compose.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@ import {
99
import { api } from "@/utils/api";
1010
import { RocketIcon } from "lucide-react";
1111
import React, { useEffect, useState } from "react";
12-
// import { CancelQueues } from "./cancel-queues";
13-
// import { ShowDeployment } from "./show-deployment-compose";
1412
import { StatusTooltip } from "@/components/shared/status-tooltip";
1513
import { DateTooltip } from "@/components/shared/date-tooltip";
1614
import { ShowDeploymentCompose } from "./show-deployment-compose";
1715
import { RefreshTokenCompose } from "./refresh-token-compose";
1816
import { CancelQueuesCompose } from "./cancel-queues-compose";
19-
// import { RefreshToken } from "./refresh-token";//
2017

2118
interface Props {
2219
composeId: string;
@@ -90,6 +87,11 @@ export const ShowDeploymentsCompose = ({ composeId }: Props) => {
9087
<span className="text-sm text-muted-foreground">
9188
{deployment.title}
9289
</span>
90+
{deployment.description && (
91+
<span className="text-sm text-muted-foreground">
92+
{deployment.description}
93+
</span>
94+
)}
9395
</div>
9496
<div className="flex flex-col items-end gap-2">
9597
<div className="text-sm capitalize text-muted-foreground">

components/dashboard/compose/general/deploy-compose.tsx

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const DeployCompose = ({ composeId }: Props) => {
2525
{ enabled: !!composeId },
2626
);
2727

28-
const { mutateAsync: markRunning } = api.compose.update.useMutation();
2928
const { mutateAsync: deploy } = api.compose.deploy.useMutation();
3029

3130
return (
@@ -44,25 +43,16 @@ export const DeployCompose = ({ composeId }: Props) => {
4443
<AlertDialogCancel>Cancel</AlertDialogCancel>
4544
<AlertDialogAction
4645
onClick={async () => {
47-
await markRunning({
48-
composeId,
49-
composeStatus: "running",
50-
})
51-
.then(async () => {
52-
toast.success("Deploying Compose....");
46+
toast.success("Deploying Compose....");
5347

54-
await refetch();
55-
await deploy({
56-
composeId,
57-
}).catch(() => {
58-
toast.error("Error to deploy Compose");
59-
});
48+
await refetch();
49+
await deploy({
50+
composeId,
51+
}).catch(() => {
52+
toast.error("Error to deploy Compose");
53+
});
6054

61-
await refetch();
62-
})
63-
.catch((e) => {
64-
toast.error(e.message || "Error to deploy Compose");
65-
});
55+
await refetch();
6656
}}
6757
>
6858
Confirm

components/dashboard/compose/general/rebuild-compose.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const RedbuildCompose = ({ composeId }: Props) => {
2525
},
2626
{ enabled: !!composeId },
2727
);
28-
const { mutateAsync: markRunning } = api.compose.update.useMutation();
2928
const { mutateAsync } = api.compose.redeploy.useMutation();
3029
const utils = api.useUtils();
3130
return (
@@ -53,23 +52,14 @@ export const RedbuildCompose = ({ composeId }: Props) => {
5352
<AlertDialogCancel>Cancel</AlertDialogCancel>
5453
<AlertDialogAction
5554
onClick={async () => {
56-
await markRunning({
55+
toast.success("Redeploying Compose....");
56+
await mutateAsync({
5757
composeId,
58-
composeStatus: "running",
5958
})
6059
.then(async () => {
61-
await mutateAsync({
60+
await utils.compose.one.invalidate({
6261
composeId,
63-
})
64-
.then(async () => {
65-
await utils.compose.one.invalidate({
66-
composeId,
67-
});
68-
toast.success("Compose rebuild succesfully");
69-
})
70-
.catch(() => {
71-
toast.error("Error to rebuild the compose");
72-
});
62+
});
7363
})
7464
.catch(() => {
7565
toast.error("Error to rebuild the compose");

components/dashboard/compose/general/stop-compose.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const StopCompose = ({ composeId }: Props) => {
2525
},
2626
{ enabled: !!composeId },
2727
);
28-
const { mutateAsync: markRunning } = api.compose.update.useMutation();
2928
const { mutateAsync, isLoading } = api.compose.stop.useMutation();
3029
const utils = api.useUtils();
3130
return (
@@ -47,23 +46,14 @@ export const StopCompose = ({ composeId }: Props) => {
4746
<AlertDialogCancel>Cancel</AlertDialogCancel>
4847
<AlertDialogAction
4948
onClick={async () => {
50-
await markRunning({
49+
await mutateAsync({
5150
composeId,
52-
composeStatus: "running",
5351
})
5452
.then(async () => {
55-
await mutateAsync({
53+
await utils.compose.one.invalidate({
5654
composeId,
57-
})
58-
.then(async () => {
59-
await utils.compose.one.invalidate({
60-
composeId,
61-
});
62-
toast.success("Compose rebuild succesfully");
63-
})
64-
.catch(() => {
65-
toast.error("Error to stop the compose");
66-
});
55+
});
56+
toast.success("Compose stopped succesfully");
6757
})
6858
.catch(() => {
6959
toast.error("Error to stop the compose");

components/dashboard/project/add-template.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const AddTemplate = ({ projectId }: Props) => {
5454
</DropdownMenuItem>
5555
</DialogTrigger>
5656
<DialogContent className="max-h-screen overflow-y-auto sm:max-w-7xl p-0">
57-
<div className="sticky top-0 z-10 flex flex-col gap-4 dark:bg-black p-6 border-b">
57+
<div className="sticky top-0 z-10 flex flex-col gap-4 bg-background p-6 border-b">
5858
<DialogHeader>
5959
<DialogTitle>Create Template</DialogTitle>
6060
<DialogDescription>

components/dashboard/settings/github/github-setup.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ export const GithubSetup = () => {
4848
const [organizationName, setOrganization] = useState<string>("");
4949
const { data } = api.admin.one.useQuery();
5050
useEffect(() => {
51+
const url = document.location.origin;
5152
const manifest = JSON.stringify(
5253
{
5354
redirect_url: `${origin}/api/redirect?authId=${data?.authId}`,
5455
name: generateName(),
5556
url: origin,
5657
hook_attributes: {
5758
// JUST FOR TESTING
58-
url: "https://webhook.site/b6a167c0-ceb5-4f0c-a257-97c0fd163977",
59+
url: `${url}/api/deploy/github`,
5960
// url: `${origin}/api/webhook`, // Aquí especificas la URL del endpoint de tu webhook
6061
},
6162
callback_urls: [`${origin}/api/redirect`], // Los URLs de callback para procesos de autenticación
@@ -92,8 +93,18 @@ export const GithubSetup = () => {
9293
</span>
9394
<BadgeCheck className="size-4 text-green-700" />
9495
</div>
95-
<div className="flex items-end">
96+
<div className="flex items-end gap-4 flex-wrap">
9697
<RemoveGithubApp />
98+
{/* <Link
99+
href={`https://github.com/settings/apps/${data?.githubAppName}`}
100+
target="_blank"
101+
className={buttonVariants({
102+
className: "w-fit",
103+
variant: "secondary",
104+
})}
105+
>
106+
<span className="text-sm">Manage Github App</span>
107+
</Link> */}
97108
</div>
98109
</div>
99110
) : (

components/dashboard/settings/github/remove-github-app.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ import {
1313
} from "@/components/ui/alert-dialog";
1414
import { Button } from "@/components/ui/button";
1515
import { toast } from "sonner";
16+
import {
17+
Tooltip,
18+
TooltipContent,
19+
TooltipTrigger,
20+
TooltipProvider,
21+
} from "@/components/ui/tooltip";
22+
import { InfoIcon } from "lucide-react";
1623

1724
export const RemoveGithubApp = () => {
1825
const { refetch } = api.auth.get.useQuery();
@@ -22,7 +29,20 @@ export const RemoveGithubApp = () => {
2229
return (
2330
<AlertDialog>
2431
<AlertDialogTrigger asChild>
25-
<Button variant="destructive">Remove Current Github App</Button>
32+
<Button variant="destructive">
33+
Remove Current Github App
34+
<TooltipProvider delayDuration={0}>
35+
<Tooltip>
36+
<TooltipTrigger asChild>
37+
<InfoIcon className="size-4 fill-muted-destructive text-muted-destructive" />
38+
</TooltipTrigger>
39+
<TooltipContent>
40+
We recommend deleting the GitHub app first, and then removing
41+
the current one from here.
42+
</TooltipContent>
43+
</Tooltip>
44+
</TooltipProvider>
45+
</Button>
2646
</AlertDialogTrigger>
2747
<AlertDialogContent>
2848
<AlertDialogHeader>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "admin" ADD COLUMN "githubWebhookSecret" text;

0 commit comments

Comments
 (0)