diff --git a/studio/web/app/home/organisations/[organisationId]/edit/page.tsx b/studio/web/app/home/organisations/[organisationId]/edit/page.tsx index f3e2343..2b8a7b1 100644 --- a/studio/web/app/home/organisations/[organisationId]/edit/page.tsx +++ b/studio/web/app/home/organisations/[organisationId]/edit/page.tsx @@ -127,16 +127,6 @@ export default function Page({ params: { organisationId } }: OrgaisationParam) { logo - -
- - - + +
+ + +
diff --git a/studio/web/app/home/organisations/[organisationId]/projects/[projectId]/dataset/new/page.tsx b/studio/web/app/home/organisations/[organisationId]/projects/[projectId]/dataset/new/page.tsx index 0074cdf..67d3eab 100644 --- a/studio/web/app/home/organisations/[organisationId]/projects/[projectId]/dataset/new/page.tsx +++ b/studio/web/app/home/organisations/[organisationId]/projects/[projectId]/dataset/new/page.tsx @@ -1,9 +1,10 @@ "use client"; -import React, { useState } from "react"; +import React, { useRef, useState } from "react"; import { Button } from "@/components/ui/Button"; import { Input } from "@/components/dataEntry/input"; import { Label } from "@/components/dataEntry/label"; import Link from "next/link"; +import Image from "next/image"; import { ProjectParam } from "@/types/params/project_param"; import { CreateFileSchema, createFileSchema } from "@/lib/zod/validators/files"; import axios, { AxiosError } from "axios"; @@ -14,6 +15,10 @@ import { useRouter } from "next/navigation"; import UppyUploader from "@/components/UppyUploader"; import { getServerUrl } from "@/lib/utils/serverUrl"; import { kavachAxiosConfig } from "@/lib/utils/kavachAxiosConfig"; +import UploadImage from "@/assets/uploadImage.png"; +import FileImage from "@/assets/document.png"; +import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog"; +import { title } from "process"; export default function Page({ params: { projectId, organisationId }, @@ -21,12 +26,19 @@ export default function Page({ const { handleSubmit, register, - formState: { errors }, + formState, + getValues } = useForm({ resolver: zodResolver(createFileSchema), }); + const [title, setTitle] = useState(""); const [filename, setFilename] = useState(""); + const [uploadDialogOpen, setUploadDialogOpen] = useState(false) const router = useRouter(); + const {errors} = formState + + const diableAddButton = filename === '' || title === '' + return (
@@ -41,6 +53,7 @@ export default function Page({ id="title" {...register("name")} placeholder="Enter the title" + onChange={(e) => setTitle(e.target.value)} /> {errors.name ? (
@@ -50,28 +63,35 @@ export default function Page({ "" )}
-
- { - setFilename(path); - }} - isDataset={true} - /> +
+ + + +
+ logo + {filename} +
+
+ + { + setFilename(path); + setUploadDialogOpen(false); + }} + isDataset={true} + /> + +
- -
- + +
+
diff --git a/studio/web/app/home/organisations/[organisationId]/projects/[projectId]/edit/page.tsx b/studio/web/app/home/organisations/[organisationId]/projects/[projectId]/edit/page.tsx index 90800c5..e341ca5 100644 --- a/studio/web/app/home/organisations/[organisationId]/projects/[projectId]/edit/page.tsx +++ b/studio/web/app/home/organisations/[organisationId]/projects/[projectId]/edit/page.tsx @@ -4,14 +4,6 @@ import { Button } from "@/components/ui/Button"; import { Input } from "@/components/dataEntry/input"; import { Label } from "@/components/dataEntry/label"; import { Textarea } from "@/components/dataEntry/textarea"; -import { - Select, - SelectContent, - SelectGroup, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select"; import Link from "next/link"; import { useForm } from "react-hook-form"; import { useOrganisationsStore } from "@/lib/zustand/organisation"; @@ -39,6 +31,7 @@ export default function Page({ register, formState: { errors }, setValue, + watch, } = useForm({ resolver: zodResolver(createProjectSchema), }); @@ -94,46 +87,15 @@ export default function Page({ ); } - const currentOrganisation = organisations.find( - (org) => parseInt(org.id) === parseInt(orgId), - ); + const titleValue = watch("title"); + + const disableButton = titleValue === undefined || titleValue === "";`` return (

Edit {project.title}

-
- - -
-
-
- + +
+
diff --git a/studio/web/app/home/organisations/[organisationId]/projects/new/page.tsx b/studio/web/app/home/organisations/[organisationId]/projects/new/page.tsx index 3f06614..0172c3d 100644 --- a/studio/web/app/home/organisations/[organisationId]/projects/new/page.tsx +++ b/studio/web/app/home/organisations/[organisationId]/projects/new/page.tsx @@ -4,14 +4,6 @@ import { Button } from "@/components/ui/Button"; import { Input } from "@/components/dataEntry/input"; import { Label } from "@/components/dataEntry/label"; import { Textarea } from "@/components/dataEntry/textarea"; -import { - Select, - SelectContent, - SelectGroup, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select"; import Link from "next/link"; import { useForm } from "react-hook-form"; import { useOrganisationsStore } from "@/lib/zustand/organisation"; @@ -38,6 +30,7 @@ export default function Page({ handleSubmit, register, formState: { errors }, + watch } = useForm({ resolver: zodResolver(createProjectSchema), }); @@ -60,40 +53,14 @@ export default function Page({ getOrganisations(); }, []); + const watchTitle = watch("title"); + const disableButton = watchTitle === undefined || watchTitle === "" || orgId === undefined || orgId === ""; + return (

Create New Project

-
- - -
-
-
- + +
+
diff --git a/studio/web/app/home/organisations/new/page.tsx b/studio/web/app/home/organisations/new/page.tsx index bed1f8b..c4821d1 100644 --- a/studio/web/app/home/organisations/new/page.tsx +++ b/studio/web/app/home/organisations/new/page.tsx @@ -114,16 +114,6 @@ export default function Page() { - -
- - - + +
+ + +
diff --git a/studio/web/app/home/organisations/page.tsx b/studio/web/app/home/organisations/page.tsx index 8570dd4..8e7109f 100644 --- a/studio/web/app/home/organisations/page.tsx +++ b/studio/web/app/home/organisations/page.tsx @@ -1,5 +1,6 @@ "use client"; import React, { useEffect } from "react"; +import { useRouter } from "next/navigation"; import { SearchBar } from "@/components/ui/searchBar"; import { Organisation } from "../../../components/ui/Organisation"; import { Organisation as OrganisationType } from "@/types/organisation"; @@ -17,6 +18,7 @@ export default function Page() { const [loading, setLoading] = React.useState(true); const { organisations, setOrganisations } = useOrganisationsStore(); const serverUrl = getServerUrl(); + const router = useRouter(); useEffect(() => { async function getOrganisations() { @@ -29,6 +31,10 @@ export default function Page() { ...kavachAxiosConfig, }); setOrganisations(resp.data.organisations); + if (resp.data.organisations.length === 0) { + router.push("/home/organisations/new"); + toast.error("No organisations found. Create a new one"); + } } catch (err) { console.log(err); toast.error("Error getting organisations"); @@ -36,7 +42,7 @@ export default function Page() { setLoading(false); } } - getOrganisations(); + getOrganisations() }, []); const [selectedOrg, setSelectedOrg] = React.useState(null); @@ -57,6 +63,8 @@ export default function Page() { } }; + + return (
diff --git a/studio/web/assets/document.png b/studio/web/assets/document.png new file mode 100644 index 0000000..3d2dda9 Binary files /dev/null and b/studio/web/assets/document.png differ diff --git a/studio/web/components/ui/feature/searchSql.tsx b/studio/web/components/ui/feature/searchSql.tsx index 8b91254..6e3c0ab 100644 --- a/studio/web/components/ui/feature/searchSql.tsx +++ b/studio/web/components/ui/feature/searchSql.tsx @@ -8,6 +8,13 @@ import { fetchRowsForTable, fetchSchemaForTable, } from "@/lib/actions/features/getSchema"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; import { convertTextToSql } from "@/lib/actions/features/textToSql"; import Loading from "../loading"; import { fetchSqlForQuery } from "@/lib/actions/features/searchSql"; @@ -77,6 +84,11 @@ function SearchSql({ dataset }: { dataset: File }) { setLoading(false); } }; + + const selectOptions = [ + { label: "Schema", value: "Schema" }, + { label: "Rows", value: "Rows" }, + ]; return (
@@ -106,20 +118,22 @@ function SearchSql({ dataset }: { dataset: File }) {
{textToSqlEnabled ? ( <> -
+

Search Results in:

-
- Schema - - setSelectedOption( - selectedOption === "Rows" ? "Schema" : "Rows", - ) - } - /> - Rows -
+