Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
botway(core): some small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Jun 28, 2023
1 parent f8ab5af commit a6b6cf9
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 7 deletions.
2 changes: 2 additions & 0 deletions core/app/api/integrations/add/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export async function POST(request: Request) {
} else {
vars = `variables: {${body.vars.k1}: "${body.vars.v1}" ${body.vars.k2}: "${body.vars.v2}" ${body.def_vars}}`;
}
} else {
vars = `variables: {${body.def_vars}}`;
}

const volumes = body.has_volume
Expand Down
38 changes: 37 additions & 1 deletion core/app/project/[id]/integrations/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,47 @@ const Project = ({ user, projectId, slug }: any) => {
}

const check = async (int: any) => {
if (!int.is_plugin) {
if (!int.is_plugin && int.variables.length != 0) {
setOpen(true);
} else if (!int.is_plugin && int.variables.length === 0) {
try {
setIsLoading(true);

const body = {
name: int.name,
slug: int.slug,
template_repo: int.template_repo,
is_plugin: int.is_plugin,
projectId: project?.railway_project_id,
def_vars: int.def_variables,
plugin: int.plugin,
has_volume: int.has_volume,
volume_path: int.volume_path,
};

const newInt = await fetcher("/api/integrations/add", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});

if (newInt.message === "Success") {
toast.success(
"You have successfully created a new bot integration",
toastStyle
);
} else {
toast.error(newInt.error, toastStyle);
}
} catch (e: any) {
toast.error(e.message, toastStyle);
} finally {
setIsLoading(false);
}
} else {
try {
setIsLoading(true);

const newInt = await fetcher("/api/integrations/add", {
method: "POST",
headers: { "Content-Type": "application/json" },
Expand Down
13 changes: 7 additions & 6 deletions core/app/project/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { fetcher } from "@/tools/fetch";
import {
CheckIcon,
DatabaseIcon,
GearIcon,
MarkGithubIcon,
XCircleIcon,
Expand Down Expand Up @@ -210,14 +211,14 @@ const Project = ({ user, projectId }: any) => {
width={20}
/>
) : node.type === "volume" ? (
<img
src={`https://cdn-botway.deno.dev/icons/volume.svg`}
width={17}
<DatabaseIcon
className="fill-white"
size={19}
/>
) : (
<img
src={`https://cdn-botway.deno.dev/icons/github.svg`}
width={20}
<MarkGithubIcon
className="fill-white"
size={19}
/>
)}
</div>
Expand Down

0 comments on commit a6b6cf9

Please sign in to comment.