Skip to content

Commit

Permalink
feat: add workloads data table to dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed Jan 8, 2024
1 parent bf15c0d commit 0e2d969
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 8 deletions.
13 changes: 10 additions & 3 deletions src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { ActionButton } from '@/app/dashboard/components/add-button'
import TotalWorkloadsCard from './components/total-workloads-card'
import TotalSolutionsCard from './components/total-solutions-card'
import LoadingCard from './components/loading-card'
import { Main } from '@/components/main'
import WorkloadsListCard from '@/components/dashboard/workloads-card'

export const metadata: Metadata = {
title: 'Dashboard',
Expand All @@ -29,8 +31,8 @@ export default async function Page() {
<ActionButton />
</SubNavActions>
</SubNav>
<main>
<div className="flex-1 space-y-4 p-8 pt-6">
<Main className="space-y-8 p-8">
<div className="flex-1 space-y-4">
<div className="flex items-center justify-between space-y-2"></div>
<Tabs defaultValue="overview" className="space-y-4">
<TabsList>
Expand All @@ -54,10 +56,15 @@ export default async function Page() {
<TotalSolutionsCard />
</Suspense>
</div>
<div className="grid gap-4">
<Suspense fallback={<LoadingCard />}>
<WorkloadsListCard />
</Suspense>
</div>
</TabsContent>
</Tabs>
</div>
</main>
</Main>
</>
)
}
6 changes: 3 additions & 3 deletions src/app/dashboard/workloads/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { AddWorkloadButton } from './components/add-button'
import { AddWorkloadButton } from '@/components/workloads/add-button'
import {
SubNav,
SubNavTitle,
SubNavActions,
SubNavSubtitle
} from '@/components/sub-nav'
import { Main } from '@/components/main'
import { WorkloadDataTable } from './components/data-table'
import { WorkloadDataTable } from '@/components/workloads/data-table'

export default function Page() {
return (
Expand All @@ -20,7 +20,7 @@ export default function Page() {
<AddWorkloadButton />
</SubNavActions>
</SubNav>
<Main>
<Main className="space-y-8 p-8">
<WorkloadDataTable />
</Main>
</>
Expand Down
20 changes: 20 additions & 0 deletions src/components/dashboard/workloads-card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use client'

import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { use } from 'react'
import { api } from '@/trpc/client'
import { MagicWandIcon } from '@radix-ui/react-icons'
import { WorkloadDataTable } from '@/components/workloads/data-table'

export default function WorkloadsListCard() {
return (
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Workloads</CardTitle>
</CardHeader>
<CardContent className="py-4">
<WorkloadDataTable />
</CardContent>
</Card>
)
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { buttonVariants } from '@/components/ui/button'
import { Workload } from '@/db/models/workload'
import type { Profile } from '@/db/models/profile'
import { DataTableColumnHeader } from '@/components/data-table-column-header'
import { DataTableRowActions } from '@/app/dashboard/workloads/components/data-rows-actions'
import { DataTableRowActions } from '@/components/workloads/data-rows-actions'

export const columns: ColumnDef<Workload>[] = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function WorkloadDataTable() {
)

return (
<div className="hidden h-full flex-1 flex-col space-y-8 p-8 md:flex">
<div className="h-full flex-1 flex-col md:flex">
<DataTable columns={columns} query={query()} options={options} />
</div>
)
Expand Down
File renamed without changes.

0 comments on commit 0e2d969

Please sign in to comment.