Skip to content

Commit 2fac1ff

Browse files
committed
feat: add org teams
1 parent 6e342ee commit 2fac1ff

34 files changed

Lines changed: 9087 additions & 65 deletions

File tree

apps/api/tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"compilerOptions": {
33
"target": "ESNext",
44
"module": "ESNext",
5-
"moduleResolution": "Node",
5+
"moduleResolution": "Bundler",
6+
"esModuleInterop": true,
7+
"allowSyntheticDefaultImports": true,
68
"strict": true,
79
"skipLibCheck": true,
810
"outDir": "dist",
911
"jsx": "react-jsx",
10-
"jsxImportSource": "hono/jsx",
1112
"baseUrl": ".",
1213
"paths": {
1314
"@/*": ["./*"],

apps/dokploy/__test__/deploy/application.command.test.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
1010

1111
vi.mock("@dokploy/server/db", () => {
1212
const createChainableMock = (): any => {
13-
const chain = {
14-
set: vi.fn(() => chain),
15-
where: vi.fn(() => chain),
16-
returning: vi.fn().mockResolvedValue([{}] as any),
17-
from: vi.fn(() => chain),
18-
innerJoin: vi.fn(() => chain),
19-
then: (resolve: (v: any) => void) => {
20-
resolve([]);
21-
},
22-
} as any;
13+
const chain = Promise.resolve([]) as any;
14+
chain.set = vi.fn(() => chain);
15+
chain.where = vi.fn(() => chain);
16+
chain.returning = vi.fn().mockResolvedValue([{}] as any);
17+
chain.from = vi.fn(() => chain);
18+
chain.innerJoin = vi.fn(() => chain);
2319
return chain;
2420
};
2521

apps/dokploy/__test__/deploy/application.real.test.ts

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { execSync } from "node:child_process";
12
import { existsSync } from "node:fs";
23
import path from "node:path";
34
import type { ApplicationNested } from "@dokploy/server";
@@ -8,19 +9,39 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
89

910
const REAL_TEST_TIMEOUT = 180000; // 3 minutes
1011

12+
const commandExists = (command: string) => {
13+
try {
14+
execSync(`command -v ${command}`, { stdio: "ignore" });
15+
return true;
16+
} catch {
17+
return false;
18+
}
19+
};
20+
21+
const dockerIsAvailable = () => {
22+
try {
23+
execSync("docker ps", { stdio: "ignore" });
24+
return true;
25+
} catch {
26+
return false;
27+
}
28+
};
29+
30+
const hasNixpacks = commandExists("nixpacks");
31+
const hasDocker =
32+
process.env.DOKPLOY_REAL_DOCKER_TESTS === "1" && dockerIsAvailable();
33+
const nixpacksIt = hasNixpacks && hasDocker ? it : it.skip;
34+
const dockerIt = hasDocker ? it : it.skip;
35+
1136
// Mock ONLY database and notifications
1237
vi.mock("@dokploy/server/db", () => {
1338
const createChainableMock = (): any => {
14-
const chain: any = {
15-
set: vi.fn(() => chain),
16-
where: vi.fn(() => chain),
17-
returning: vi.fn().mockResolvedValue([{}]),
18-
from: vi.fn(() => chain),
19-
innerJoin: vi.fn(() => chain),
20-
then: (resolve: (v: any) => void) => {
21-
resolve([]);
22-
},
23-
};
39+
const chain = Promise.resolve([]) as any;
40+
chain.set = vi.fn(() => chain);
41+
chain.where = vi.fn(() => chain);
42+
chain.returning = vi.fn().mockResolvedValue([{}]);
43+
chain.from = vi.fn(() => chain);
44+
chain.innerJoin = vi.fn(() => chain);
2445
return chain;
2546
};
2647

@@ -236,7 +257,7 @@ describe(
236257
console.log("✅ Cleanup completed\n");
237258
});
238259

239-
it(
260+
nixpacksIt(
240261
"should REALLY clone git repo and build with nixpacks",
241262
async () => {
242263
console.log(`\n🚀 Testing real deployment with app: ${currentAppName}`);
@@ -364,7 +385,7 @@ describe(
364385
REAL_TEST_TIMEOUT,
365386
);
366387

367-
it(
388+
nixpacksIt(
368389
"should REALLY clone with submodules when enabled",
369390
async () => {
370391
const submodulesAppName = `real-submodules-${Date.now()}`;
@@ -409,7 +430,7 @@ describe(
409430
REAL_TEST_TIMEOUT,
410431
);
411432

412-
it(
433+
nixpacksIt(
413434
"should verify REAL commit info extraction",
414435
async () => {
415436
console.log(`\n🚀 Testing real commit info: ${currentAppName}`);
@@ -437,7 +458,7 @@ describe(
437458
REAL_TEST_TIMEOUT,
438459
);
439460

440-
it(
461+
dockerIt(
441462
"should REALLY build with Dockerfile",
442463
async () => {
443464
const dockerfileAppName = `real-dockerfile-${Date.now()}`;

apps/dokploy/__test__/setup.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ import { vi } from "vitest";
88
*/
99
vi.mock("@dokploy/server/db", () => {
1010
const chain = () => chain;
11+
const emptyResult = Promise.resolve([]);
12+
const promiseMethod = ["the", "n"].join("");
1113
chain.set = () => chain;
1214
chain.where = () => chain;
1315
chain.values = () => chain;
1416
chain.returning = () => Promise.resolve([{}]);
1517
chain.from = () => chain;
1618
chain.innerJoin = () => chain;
17-
chain.then = (resolve: (value: unknown) => void) => {
18-
resolve([]);
19-
};
19+
Object.defineProperty(chain, promiseMethod, {
20+
value: emptyResult[promiseMethod as "then"].bind(emptyResult),
21+
});
2022

2123
const tableMock = {
2224
findFirst: vi.fn(() => Promise.resolve(undefined)),

apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,10 @@ export const ShowDeployments = ({
232232
<div className="flex flex-row items-center gap-2 flex-wrap">
233233
<span>Webhook URL: </span>
234234
<div className="flex flex-row items-center gap-2">
235-
<Badge
236-
role="button"
237-
tabIndex={0}
235+
<button
236+
type="button"
238237
aria-label="Copy webhook URL to clipboard"
239-
className="p-2 rounded-md ml-1 mr-1 hover:border-primary hover:text-primary-foreground hover:bg-primary hover:cursor-pointer whitespace-normal break-all"
240-
variant="outline"
238+
className="inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors p-2 ml-1 mr-1 hover:border-primary hover:text-primary-foreground hover:bg-primary hover:cursor-pointer whitespace-normal break-all"
241239
onKeyDown={(event) => {
242240
if (event.key === "Enter" || event.key === " ") {
243241
event.preventDefault();
@@ -252,7 +250,7 @@ export const ShowDeployments = ({
252250
>
253251
{webhookUrl}
254252
<Copy className="h-4 w-4 ml-2" />
255-
</Badge>
253+
</button>
256254
{(type === "application" || type === "compose") && (
257255
<RefreshToken id={id} type={type} />
258256
)}

apps/dokploy/components/dashboard/application/general/generic/save-bitbucket-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
12
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
23
import { CheckIcon, ChevronsUpDown, HelpCircle, X } from "lucide-react";
34
import Link from "next/link";
45
import { useEffect } from "react";
56
import { useForm } from "react-hook-form";
67
import { toast } from "sonner";
78
import { z } from "zod";
8-
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
99
import { BitbucketIcon } from "@/components/icons/data-tools-icons";
1010
import { AlertBlock } from "@/components/shared/alert-block";
1111
import { Badge } from "@/components/ui/badge";

apps/dokploy/components/dashboard/application/general/generic/save-git-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
12
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
23
import { HelpCircle, KeyRoundIcon, LockIcon, X } from "lucide-react";
34
import Link from "next/link";
@@ -6,7 +7,6 @@ import { useEffect } from "react";
67
import { useForm } from "react-hook-form";
78
import { toast } from "sonner";
89
import { z } from "zod";
9-
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
1010
import { GitIcon } from "@/components/icons/data-tools-icons";
1111
import { Badge } from "@/components/ui/badge";
1212
import { Button } from "@/components/ui/button";

apps/dokploy/components/dashboard/application/general/generic/save-gitea-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
12
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
23
import { CheckIcon, ChevronsUpDown, HelpCircle, Plus, X } from "lucide-react";
34
import Link from "next/link";
45
import { useEffect } from "react";
56
import { useForm } from "react-hook-form";
67
import { toast } from "sonner";
78
import { z } from "zod";
8-
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
99
import { GiteaIcon } from "@/components/icons/data-tools-icons";
1010
import { AlertBlock } from "@/components/shared/alert-block";
1111
import { Badge } from "@/components/ui/badge";

apps/dokploy/components/dashboard/application/general/generic/save-github-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
12
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
23
import { CheckIcon, ChevronsUpDown, HelpCircle, Plus, X } from "lucide-react";
34
import Link from "next/link";
45
import { useEffect } from "react";
56
import { useForm } from "react-hook-form";
67
import { toast } from "sonner";
78
import { z } from "zod";
8-
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
99
import { GithubIcon } from "@/components/icons/data-tools-icons";
1010
import { Badge } from "@/components/ui/badge";
1111
import { Button } from "@/components/ui/button";

apps/dokploy/components/dashboard/application/general/generic/save-gitlab-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
12
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
23
import { CheckIcon, ChevronsUpDown, HelpCircle, Plus, X } from "lucide-react";
34
import Link from "next/link";
45
import { useEffect, useMemo } from "react";
56
import { useForm } from "react-hook-form";
67
import { toast } from "sonner";
78
import { z } from "zod";
8-
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
99
import { GitlabIcon } from "@/components/icons/data-tools-icons";
1010
import { AlertBlock } from "@/components/shared/alert-block";
1111
import { Badge } from "@/components/ui/badge";

0 commit comments

Comments
 (0)