feat(all): add organisation, api updates with organisation check

Now calling run endpoints with GET, POST will check against the API key, whether there is org_id or not, if the operation workflow doesnt match with the user org or user id, will return with workflow not found, run not found
This commit is contained in:
BennyKok
2024-01-01 23:13:01 +08:00
parent 75776e6d8f
commit c66de45522
19 changed files with 907 additions and 59 deletions
@@ -12,7 +12,7 @@ import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { usePathname } from "next/navigation";
import { useRouter } from "next/navigation";
export function NavbarRight() {
export function NavbarMenu() {
const pathnames = usePathname();
const pathname = `/${pathnames.split("/")[1]}`;
@@ -34,10 +34,11 @@ export function NavbarRight() {
];
return (
<div>
<div className="mr-2">
{/* <div className="w-full h-full absolute inset-x-0 top-0 flex items-center justify-center pointer-events-none"> */}
<Tabs
defaultValue={pathname}
className="w-[300px] hidden lg:flex"
className="w-[300px] hidden lg:flex pointer-events-auto"
onValueChange={(value) => {
router.push(value);
}}
@@ -50,6 +51,7 @@ export function NavbarRight() {
))}
</TabsList>
</Tabs>
{/* </div> */}
<div className="w-[100px] flex lg:hidden">
<Select
+1 -1
View File
@@ -29,7 +29,7 @@ export function VersionDetails({
return (
<div className="mt-4">
Workflow Details
Workflow Inputs
<div className="border rounded-lg p-2">
{inputs && inputs.length > 0 ? (
<div className="flex flex-col gap-2">
+7 -1
View File
@@ -165,7 +165,13 @@ export function RunWorkflowButton({
try {
const origin = window.location.origin;
await callServerPromise(
createRun(origin, workflow_version_id, machine, val, true)
createRun({
origin,
workflow_version_id,
machine_id: machine,
inputs: val,
isManualRun: true,
})
);
// console.log(res.json());
setIsLoading(false);