Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix deployments props error

Tomas Valenta44683f303d69
diff --git a/components/DashboardHome.tsx b/components/DashboardHome.tsx
index 55bad3157..a9b8d442f 100644
--- a/components/DashboardHome.tsx
+++ b/components/DashboardHome.tsx
@@ -2,14 +2,14 @@ import { useRouter } from 'next/router'
import { usePostHog } from 'posthog-js/react'
import { useSupabaseClient } from '@supabase/auth-helpers-react'
-import { projects } from 'db/prisma'
+import { deployments, projects } from 'db/prisma'
import AgentList from 'components/AgentList'
import AgentRunsList from 'components/AgentRunsList'
import { LogFile } from 'utils/agentLogs'
export interface Props {
- projects: (projects & { logs: LogFile[] })[]
+ projects: (projects & { logs: LogFile[], deployments: deployments[] })[]
}
function DashboardHome({
@@ -34,16 +34,30 @@ function DashboardHome({
router.push(`/?view=runs&projectID=${projectID}`, undefined, { shallow: true })
}
+ const projectsWithDeployments = projects
+ .filter(p => {
+ if (p.deployments.length !== 1) return false
+
+ const deployment = p.deployments[0]
+ const auth = deployment.auth as any
+ if (!auth) return false
+ return deployment.enabled
+ })
+ .map(p => ({
+ project: p,
+ deployment: p.deployments[0],
+ }))
+
return (
<>
{view === 'deployed' ? (
<AgentList
- agents={projectsWithLogs}
+ agents={projectsWithDeployments}
onSelectAgent={selectAgent}
/>
) : view === 'runs' ? (
<AgentRunsList
- allDeployedAgents={projectsWithLogs}
+ allDeployedAgents={projectsWithDeployments}
initialSelectedAgentID={selectedAgentInstanceID}
/>
) : view === 'logs' ? (
diff --git a/pages/index.tsx b/pages/index.tsx
index 80c9fc6d3..d02234a82 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -1,7 +1,7 @@
import type { GetServerSideProps, Redirect } from 'next'
import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
-import { logs, prisma, projects } from 'db/prisma'
+import { deployments, logs, prisma, projects } from 'db/prisma'
import { serverCreds } from 'db/credentials'
import DashboardHome from 'components/DashboardHome'
import { LogFile, RawFileLog } from 'utils/agentLogs'
@@ -36,6 +36,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {
},
include: {
logs: true,
+ deployments: true,
},
},
},
@@ -103,12 +104,12 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {
}
export interface Props {
- projects: (projects & { logs: logs[] })[]
+ projects: (projects & { logs: logs[], deployments: deployments[] })[]
}
function Home({ projects }: Props) {
const projectWithLogs = projects
- .map<projects & { logs: LogFile[] }>(p => {
+ .map<projects & { logs: LogFile[], deployments: deployments[] }>(p => {
return {
...p,
logs: p