-
handleSync()}
- disabled={deleteLoading || loading}
- >
-
- Fetch latest code
-
-
-
- setOpen(true)}
- size={'sm'}>{branch.frequency ?? "Select Frequency" }
-
-
-
-
-
-
-
-
handleDelete()}
- disabled={deleteLoading || loading}
- >
-
-
+
+
+
+
+
+
-
- )
-}
-
-export default ManageBranchItem
-
-
+
+ );
+};
+
+const BranchInfo = ({ branch }: { branch: CommitProjectBranch }) => (
+
+ {branch.branch_name}
+ Last synced {convertFrappeTimestampToTimeAgo(branch.last_fetched)}
+
+);
+
+const SyncButton = ({ loading, onSync }: { loading: boolean, onSync: () => void }) => (
+
+
+ Fetch latest code
+
+);
+
+const FrequencyPopover = ({ open, setOpen, methods, onSubmit, control, frequency }: {
+ open: boolean,
+ setOpen: (open: boolean) => void,
+ methods: any,
+ onSubmit: any,
+ control: any,
+ frequency: string | undefined
+}) => (
+
+
+ setOpen(true)}
+ size="sm"
+ aria-label="Set update frequency"
+ >
+ {frequency ?? "Select Frequency"}
+
+
+
+
+
+
+
+
+);
+
+const DeleteButton = ({ loading, onDelete }: { loading: boolean, onDelete: () => void }) => (
+
+
+
+);
+
+export default ManageBranchItem;
diff --git a/dashboard/src/components/features/projects/Org/CreateOrgModal.tsx b/dashboard/src/components/features/projects/Org/CreateOrgModal.tsx
index 7738c2e..fc51ba8 100644
--- a/dashboard/src/components/features/projects/Org/CreateOrgModal.tsx
+++ b/dashboard/src/components/features/projects/Org/CreateOrgModal.tsx
@@ -1,14 +1,15 @@
import { Button } from '@/components/ui/button'
-import { DialogDescription, DialogHeader, DialogTitle, DialogContent, DialogFooter } from '@/components/ui/dialog'
+import { DialogHeader, DialogTitle, DialogContent, DialogFooter } from '@/components/ui/dialog'
import { FormProvider, SubmitHandler, useForm } from 'react-hook-form'
import { Input } from "@/components/ui/input"
-import { Label } from "@/components/ui/label"
import { useFrappeCreateDoc } from 'frappe-react-sdk'
import { useToast } from '@/components/ui/use-toast'
import { ProjectData } from '../Projects'
import { KeyedMutator } from 'swr'
import { ErrorBanner } from '@/components/common/ErrorBanner/ErrorBanner'
import { SpinnerLoader } from '@/components/common/FullPageLoader/SpinnerLoader'
+import { FormElement } from '@/components/common/Forms/FormControl'
+import { useEffect } from 'react'
type FormFields = {
organization_name: string,
@@ -19,10 +20,11 @@ type FormFields = {
interface CreateOrgModalProps {
mutate: KeyedMutator<{ message: ProjectData[]; }>
onClose: () => void
+ open: boolean
}
-const CreateOrgModal = ({ mutate, onClose }: CreateOrgModalProps) => {
+const CreateOrgModal = ({ mutate, onClose, open }: CreateOrgModalProps) => {
const { toast } = useToast()
const methods = useForm
()
@@ -40,50 +42,55 @@ const CreateOrgModal = ({ mutate, onClose }: CreateOrgModalProps) => {
}))
}
+ useEffect(() => {
+ methods.reset()
+ }, [open])
+
return (
Add Organization
-
- Please enter the Name and the Github Repo Name of the Organization.
-
{error && }
diff --git a/dashboard/src/components/features/projects/Projects.tsx b/dashboard/src/components/features/projects/Projects.tsx
index 97e78e9..78f8df6 100644
--- a/dashboard/src/components/features/projects/Projects.tsx
+++ b/dashboard/src/components/features/projects/Projects.tsx
@@ -1,15 +1,12 @@
import { FullPageLoader } from "@/components/common/FullPageLoader/FullPageLoader";
-import { Button } from "@/components/ui/button";
-import { Dialog, DialogTrigger } from "@/components/ui/dialog";
import { CommitProject } from "@/types/commit/CommitProject";
import { useFrappeGetCall } from "frappe-react-sdk";
-import { BsDatabase } from "react-icons/bs";
-import { ViewERDDialogContent } from "./ViewERDAppDialog";
import { isSystemManager } from "@/utils/roles";
import { CommitProjectBranch } from "@/types/commit/CommitProjectBranch";
import { AddMenuButton } from "./AddMenuButton";
import { APIExplorer } from "./APIExplorer";
import ProjectCard from "./Projects/ProjectCard";
+import { ViewERDButton } from "./ViewERDButton";
export interface ProjectWithBranch extends CommitProject {
@@ -18,6 +15,7 @@ export interface ProjectWithBranch extends CommitProject {
export interface ProjectData extends CommitProjectBranch {
projects: ProjectWithBranch[];
organization_name: string;
+ github_org: string;
image: string;
name: string;
about: string;
@@ -48,32 +46,31 @@ export const Projects = () => {
if (data && data.message) {
return (
-
-
-
- {isCreateAccess &&
}
+
+
+
+
-
-
-
- View ERD
-
-
-
-
-
- {data.message.map((org: ProjectData) => {
- const orgName = org.organization_name;
- return org.projects.map((project) => (
-
- ));
- })}
+
+
+
Projects
+ {isCreateAccess &&
}
+
+
+ {data.message.map((org: ProjectData) => {
+ const orgName = org.organization_name;
+ return org.projects.map((project) => (
+
+ ));
+ })}
+
diff --git a/dashboard/src/components/features/projects/Projects/CreateProjectModal.tsx b/dashboard/src/components/features/projects/Projects/CreateProjectModal.tsx
index 4e0fdda..f68c9a9 100644
--- a/dashboard/src/components/features/projects/Projects/CreateProjectModal.tsx
+++ b/dashboard/src/components/features/projects/Projects/CreateProjectModal.tsx
@@ -1,13 +1,14 @@
-import { DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"
+import { DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"
import { useFrappeCreateDoc } from "frappe-react-sdk"
import { FormProvider, SubmitHandler, useForm } from "react-hook-form"
import { Input } from "@/components/ui/input"
-import { Label } from "@/components/ui/label"
import { Button } from '@/components/ui/button'
import { useToast } from "@/components/ui/use-toast"
import { ProjectData } from "../Projects"
import { KeyedMutator } from "swr"
import { AsyncDropdown } from "@/components/common/AsyncDropdown/AsyncDropdown"
+import { FormElement } from "@/components/common/Forms/FormControl"
+import { useEffect } from "react"
export type FormFields = {
org: string,
@@ -18,9 +19,10 @@ export type FormFields = {
interface CreateProjectModalProps {
mutate: KeyedMutator<{ message: ProjectData[]; }>,
onClose: VoidFunction
+ open: boolean
}
-const CreateProjectModal = ({ mutate, onClose }: CreateProjectModalProps) => {
+const CreateProjectModal = ({ mutate, onClose, open }: CreateProjectModalProps) => {
const { toast } = useToast()
const methods = useForm
()
@@ -40,48 +42,57 @@ const CreateProjectModal = ({ mutate, onClose }: CreateProjectModalProps) => {
})
}
+ useEffect(() => {
+ methods.reset()
+ }, [open])
return (
Add Project
-
- Please enter details of the project.
-
diff --git a/dashboard/src/components/features/projects/Projects/ProjectCard.tsx b/dashboard/src/components/features/projects/Projects/ProjectCard.tsx
index 7b1bb4d..f342f5b 100644
--- a/dashboard/src/components/features/projects/Projects/ProjectCard.tsx
+++ b/dashboard/src/components/features/projects/Projects/ProjectCard.tsx
@@ -1,10 +1,4 @@
import { Button } from "@/components/ui/button";
-import {
- Card,
- CardContent,
- CardDescription,
- CardTitle,
-} from "@/components/ui/card";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { AiOutlineDelete } from "react-icons/ai";
import { AlertDialog } from "@/components/ui/alert-dialog";
@@ -25,9 +19,10 @@ export interface ProjectCardProps {
message: ProjectData[];
}>
orgName: string
+ githubOrg: string
}
-const ProjectCard = ({ project, mutate, orgName }: ProjectCardProps) => {
+const ProjectCard = ({ project, mutate, orgName, githubOrg }: ProjectCardProps) => {
const appNameInitials = useMemo(() => {
return project.display_name[0].toUpperCase()
@@ -39,54 +34,52 @@ const ProjectCard = ({ project, mutate, orgName }: ProjectCardProps) => {
const [openDeleteDialogModal, setOpenDeleteDialogModal] = useState(false)
- return (
-
-
-
-
-
-
-
- {appNameInitials}
-
-
-
-
-
-
-
{project.display_name}
-
- {orgName}
-
-
- {isCreateAccess &&
-
-
-
-
- {project.branches.length > 0 &&
- { setOpenManageModal(true) }}>
- <>
-
- Manage Branches
- >
-
- }
- setOpenDeleteDialogModal(true)}>
-
- Delete Project
-
+ const openGithubRepo = () => {
+ window.open(`https://github.com/${githubOrg}/${project.repo_name}`, '_blank')
+ }
-
- }
-
-
-
- {project.description}
-
+ return (
+
+
+
+
+
+ {appNameInitials}
+
+
+
+
{project.display_name}
+
+ {project.description}
+
{orgName}
-
+
+
+ {isCreateAccess && (
+
+
+
+
+
+
+
+ {project.branches.length > 0 && (
+ { setOpenManageModal(true) }}>
+ <>
+
+ Manage Branches
+ >
+
+ )}
+ setOpenDeleteDialogModal(true)}>
+
+ Delete Project
+
+
+
+ )}
+
@@ -95,7 +88,7 @@ const ProjectCard = ({ project, mutate, orgName }: ProjectCardProps) => {
-
+
);
}
diff --git a/dashboard/src/components/features/projects/ViewERDAppDialog.tsx b/dashboard/src/components/features/projects/ViewERDAppDialog.tsx
index ea777e3..d073b1c 100644
--- a/dashboard/src/components/features/projects/ViewERDAppDialog.tsx
+++ b/dashboard/src/components/features/projects/ViewERDAppDialog.tsx
@@ -6,6 +6,7 @@ import { ProjectData, ProjectWithBranch } from "./Projects"
import { Checkbox } from "@/components/ui/checkbox"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { CommitProjectBranch } from "@/types/commit/CommitProjectBranch"
+import { Label } from "@/components/ui/label"
export const ViewERDDialogContent = ({ data }: { data: ProjectData[] }) => {
@@ -23,7 +24,7 @@ export const ViewERDDialogContent = ({ data }: { data: ProjectData[] }) => {
}
return (
-
+
Select Apps
@@ -60,8 +61,9 @@ export const ViewERDProjectCard = ({ project, apps, setApps }: ViewERDProjectCar
return (
-
+
{
@@ -72,8 +74,8 @@ export const ViewERDProjectCard = ({ project, apps, setApps }: ViewERDProjectCar
}
}}
/>
- {project.display_name}
-
+
{project.display_name}
+
setBranch(value)}
defaultValue={project.branches[0]?.name}
diff --git a/dashboard/src/components/features/projects/ViewERDButton.tsx b/dashboard/src/components/features/projects/ViewERDButton.tsx
new file mode 100644
index 0000000..482b710
--- /dev/null
+++ b/dashboard/src/components/features/projects/ViewERDButton.tsx
@@ -0,0 +1,81 @@
+import { Card, CardHeader, CardTitle, CardContent, CardFooter } from "@/components/ui/card";
+import { Dialog, DialogTrigger } from "@/components/ui/dialog";
+import { Button } from "@/components/ui/button";
+import { ViewERDDialogContent } from "./ViewERDAppDialog";
+import { ProjectData } from "./Projects";
+import { MdKeyboardArrowRight } from "react-icons/md";
+import { useNavigate } from "react-router-dom";
+import erd from '../../../assets/erd.svg'
+
+export const ViewERDButton = ({ data }: { data: ProjectData[] }) => {
+ return (
+
+
+
+ Visualize your database
+
+
+ Analyze and understand the relationships between your doctypes with an interactive Entity Relationship Diagram (ERD).
+
+
+
+
+
+ Get Started
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export const ViewERDButtonForSiteApps = () => {
+
+ const navigate = useNavigate()
+
+ return (
+
+
+
+ Visualize your site database
+
+
+ Analyze and understand the relationships between your doctypes with an interactive Entity Relationship Diagram (ERD).
+
+
+ {
+ window.sessionStorage.removeItem('ERDMetaDoctypes')
+ navigate({
+ pathname: `/meta-erd/create`,
+ })
+ }}
+ >
+ Get Started
+
+
+
+
+
+
+
+
+ );
+}
\ No newline at end of file
diff --git a/dashboard/src/pages/features/erd/meta/ERDDoctypeAndAppModal.tsx b/dashboard/src/pages/features/erd/meta/ERDDoctypeAndAppModal.tsx
index 7d4298d..9a1b474 100644
--- a/dashboard/src/pages/features/erd/meta/ERDDoctypeAndAppModal.tsx
+++ b/dashboard/src/pages/features/erd/meta/ERDDoctypeAndAppModal.tsx
@@ -76,7 +76,7 @@ export const ViewERDAppList = ({ apps, setApps, onClose }: { apps: string[], set
onClose()
}
return (
-
+
Select Apps