Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Separator } from "@ctrlplane/ui/separator";
import { SidebarTrigger } from "@ctrlplane/ui/sidebar";

import { PageHeader } from "~/app/[workspaceSlug]/(appv2)/_components/PageHeader";
import { DeleteSystemDialog } from "~/app/[workspaceSlug]/(appv2)/systems/[systemSlug]/_components/DeleteSystemDialog";
import { DeleteSystemDialog } from "~/app/[workspaceSlug]/(appv2)/_components/system/DeleteSystemDialog";
import { Sidebars } from "~/app/[workspaceSlug]/sidebars";
import { api } from "~/trpc/server";
import { GeneralSettings } from "./GeneralSettings";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { useInView } from "react-intersection-observer";

import { Button } from "@ctrlplane/ui/button";
import { Skeleton } from "@ctrlplane/ui/skeleton";

import { api } from "~/trpc/react";
import { ApprovalDialog } from "../../release/ApprovalDialog";
Expand Down Expand Up @@ -49,7 +50,15 @@ const DeploymentEnvironmentCell: React.FC<DeploymentEnvironmentCellProps> = ({
const isLoading = isStatusesLoading || isReleaseLoading;

if (isLoading)
return <p className="text-xs text-muted-foreground/70">Loading...</p>;
return (
<div className="flex h-full w-full items-center gap-2">
<Skeleton className="h-6 w-6 rounded-full" />
<div className="flex flex-col gap-2">
<Skeleton className="h-[16px] w-20 rounded-full" />
<Skeleton className="h-3 w-20 rounded-full" />
</div>
</div>
);

if (release == null)
return (
Expand Down Expand Up @@ -185,7 +194,15 @@ export const LazyDeploymentEnvironmentCell: React.FC<

return (
<div className="flex w-full items-center justify-center" ref={ref}>
{!inView && <p className="text-xs text-muted-foreground">Loading...</p>}
{!inView && (
<div className="flex h-full w-full items-center gap-2">
<Skeleton className="h-6 w-6 rounded-full" />
<div className="flex flex-col gap-2">
<Skeleton className="h-[16px] w-20 rounded-full" />
<Skeleton className="h-3 w-20 rounded-full" />
</div>
</div>
)}
{inView && <DeploymentEnvironmentCell {...props} />}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Button } from "@ctrlplane/ui/button";
import { api } from "~/trpc/server";
import { CreateDeploymentDialog } from "../_components/deployments/CreateDeployment";
import { CreateSystemDialog } from "../../(app)/_components/CreateSystem";
import { SystemDeploymentTable } from "./[systemSlug]/_components/SystemDeploymentTable";
import { SystemDeploymentTable } from "./system-deployment-table/SystemDeploymentTable";

export default async function SystemsPage(props: {
params: Promise<{ workspaceSlug: string }>;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Skeleton } from "@ctrlplane/ui/skeleton";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@ctrlplane/ui/table";

export const SystemDeploymentSkeleton: React.FC = () => (
<Table className="w-full min-w-max bg-background">
<TableHeader className="[&_tr]:border-0">
<TableRow className="hover:bg-transparent">
<TableHead className="w-[350px] rounded-tl-md py-4 pl-6">
<Skeleton className="h-4 w-40 rounded-full" />
</TableHead>
{[...Array(3)].map((_, i) => (
<TableHead key={i} className="w-[220px]">
<Skeleton className="h-4 w-20 rounded-full" />
</TableHead>
))}
<TableCell className="flex-grow" />
</TableRow>
</TableHeader>
<TableBody>
{[...Array(2)].map((_, i) => (
<TableRow key={i} className="border-0 hover:bg-transparent">
<TableCell className="h-[70px] w-[350px] max-w-[300px] pl-6">
<Skeleton className="h-4 w-40 rounded-full" />
</TableCell>
{[...Array(3)].map((_, j) => (
<TableCell key={j} className="h-[70px] w-[220px]">
<div className="flex items-center gap-2">
<Skeleton className="h-6 w-6 rounded-full" />
<div className="flex flex-col gap-2">
<Skeleton className="h-3 w-20 rounded-full" />
<Skeleton className="h-3 w-20 rounded-full" />
</div>
</div>
</TableCell>
))}
<TableCell className="flex-grow" />
</TableRow>
))}
</TableBody>
</Table>
);
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import {
} from "@ctrlplane/ui/dropdown-menu";

import { CreateDeploymentDialog } from "~/app/[workspaceSlug]/(appv2)/_components/deployments/CreateDeployment";
import { DeleteSystemDialog } from "~/app/[workspaceSlug]/(appv2)/_components/system/DeleteSystemDialog";
import { api } from "~/trpc/react";
import { DeleteSystemDialog } from "./DeleteSystemDialog";
import { SystemDeploymentSkeleton } from "./SystemDeploymentSkeleton";
import DeploymentTable from "./TableDeployments";

export const SystemDeploymentTable: React.FC<{
Expand All @@ -30,6 +31,8 @@ export const SystemDeploymentTable: React.FC<{
enabled: inView,
});

const isLoading = environments.isLoading || deployments.isLoading;

return (
<div key={system.id} className="space-y-4">
<div className="flex w-full items-center justify-between">
Expand Down Expand Up @@ -70,14 +73,21 @@ export const SystemDeploymentTable: React.FC<{
</DropdownMenu>
</div>

<div ref={ref} className="overflow-hidden rounded-md border">
<DeploymentTable
workspace={workspace}
systemSlug={system.slug}
environments={environments.data ?? []}
deployments={deployments.data ?? []}
/>
</div>
{isLoading && (
<div className="rounded-md border">
<SystemDeploymentSkeleton />
</div>
)}
{!isLoading && (
<div ref={ref} className="overflow-hidden rounded-md border">
<DeploymentTable
workspace={workspace}
systemSlug={system.slug}
environments={environments.data ?? []}
deployments={deployments.data ?? []}
/>
</div>
)}
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const EnvHeader: React.FC<{

const envUrl = `/${workspaceSlug}/systems?environment_id=${env.id}`;
return (
<TableHead className="w-fit p-2" key={env.id}>
<TableHead className="w-[220px] p-2" key={env.id}>
<Link
href={envUrl}
className="flex w-fit items-center gap-2 rounded-md px-2 py-1 text-white hover:bg-secondary/50"
Expand Down Expand Up @@ -72,7 +72,7 @@ const DeploymentTable: React.FC<{
<Table className="w-full min-w-max bg-background">
<TableHeader className="[&_tr]:border-0">
<TableRow className="hover:bg-transparent">
<TableHead className="sticky left-0 z-10 rounded-tl-md py-4 pl-6 backdrop-blur-lg">
<TableHead className="sticky left-0 z-10 w-[350px] rounded-tl-md py-4 pl-6 backdrop-blur-lg">
Deployments
</TableHead>
{environments.map((env) => (
Expand All @@ -82,6 +82,7 @@ const DeploymentTable: React.FC<{
workspaceSlug={workspace.slug}
/>
))}
<TableCell className="flex-grow" />
</TableRow>
</TableHeader>
<TableBody>
Expand Down
Loading