-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
custom formatter and collapsable tree (#313)
* Merge pull request #311 from lmnr-ai/fix/dashboard-tooltip fix double conversion date in chart tooltip too * Collapsable trace tree (#312) * Add ability to rename projects (#306) * Add ability to rename projects * Added user feedback notifiaction and convert PUT to POST * change to router.refresh * add close dialog after rename * Custom-formatter (#305) --------- Co-authored-by: skull8888888 <skull8888888@gmail.com> Co-authored-by: Nidhi Singh <120259299+nidhi-wa@users.noreply.github.com>
- Loading branch information
Showing
32 changed files
with
9,702 additions
and
9,348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
frontend/app/api/projects/[projectId]/prompt-copilot/run/route.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
frontend/app/api/projects/[projectId]/render-templates/[templateId]/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { and, eq } from "drizzle-orm"; | ||
import { NextResponse } from "next/server"; | ||
|
||
import { db } from "@/lib/db/drizzle"; | ||
import { renderTemplates } from "@/lib/db/migrations/schema"; | ||
|
||
export async function GET(request: Request, { params }: { params: { projectId: string, templateId: string } }) { | ||
const { projectId, templateId } = params; | ||
const template = await db.query.renderTemplates.findFirst({ | ||
where: and( | ||
eq(renderTemplates.id, templateId), | ||
eq(renderTemplates.projectId, projectId) | ||
) | ||
}); | ||
|
||
if (!template) { | ||
return NextResponse.json({ error: 'Template not found' }, { status: 404 }); | ||
} | ||
|
||
return NextResponse.json(template); | ||
} | ||
|
||
export async function POST(request: Request, { params }: { params: { projectId: string, templateId: string } }) { | ||
const { projectId, templateId } = params; | ||
const body = await request.json(); | ||
|
||
const template = await db.update(renderTemplates).set({ | ||
name: body.name, | ||
code: body.code | ||
}) | ||
.where(and(eq(renderTemplates.id, templateId), eq(renderTemplates.projectId, projectId))) | ||
.returning(); | ||
|
||
if (!template.length) { | ||
return NextResponse.json({ error: 'Template not found' }, { status: 404 }); | ||
} | ||
|
||
return NextResponse.json(template[0]); | ||
} | ||
|
||
export async function DELETE(request: Request, { params }: { params: { projectId: string, templateId: string } }) { | ||
const { projectId, templateId } = params; | ||
const template = await db.delete(renderTemplates) | ||
.where(and( | ||
eq(renderTemplates.id, templateId), | ||
eq(renderTemplates.projectId, projectId) | ||
)) | ||
.returning(); | ||
|
||
if (!template) { | ||
return NextResponse.json({ error: 'Template not found' }, { status: 404 }); | ||
} | ||
|
||
return NextResponse.json(template); | ||
} |
40 changes: 40 additions & 0 deletions
40
frontend/app/api/projects/[projectId]/render-templates/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { eq } from 'drizzle-orm'; | ||
import { NextResponse } from 'next/server'; | ||
|
||
import { db } from '@/lib/db/drizzle'; | ||
import { renderTemplates } from '@/lib/db/migrations/schema'; | ||
|
||
export async function GET( | ||
req: Request, | ||
{ params }: { params: { projectId: string } } | ||
): Promise<Response> { | ||
const projectId = params.projectId; | ||
|
||
const templates = await db.query.renderTemplates.findMany({ | ||
where: eq(renderTemplates.projectId, projectId), | ||
columns: { | ||
id: true, | ||
name: true, | ||
} | ||
}); | ||
|
||
return NextResponse.json(templates); | ||
} | ||
|
||
|
||
export async function POST(req: Request, { params }: { params: { projectId: string } }) { | ||
const projectId = params.projectId; | ||
const body = await req.json(); | ||
|
||
const result = await db.insert(renderTemplates).values({ | ||
projectId, | ||
name: body.name, | ||
code: body.code | ||
}).returning(); | ||
|
||
if (!result) { | ||
return new Response('Failed to create template', { status: 500 }); | ||
} | ||
|
||
return new Response(JSON.stringify(result[0])); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.