feat(pipeline): render-derived shot thumbnails, and bulk shot delete
Deploy / deploy (push) Failing after 19m11s
Deploy / deploy (push) Failing after 19m11s
Two independent features landing together: Generated shot thumbnails — a shot can now carry a thumbnail promoted from a render export (Shot.generatedThumbnailUrl/generatedThumbnailFrom) alongside the existing brief-supplied thumbnailUrl, which always takes display precedence (lib/shot-thumbnail.ts) so a promoted frame can only ever fill a gap, never overwrite the brief. Shows with pipelineConfig.autoShotThumbnail promote automatically on every finished export (lib/render-pipeline/preview.ts); promoteExportThumbnail/ clearGeneratedThumbnail (actions/shots.ts) are the manual equivalent for everyone else. Worker-side seek logic for picking the promoted frame is covered by RenderWorker/VFXReviewWorker.Tests/ThumbnailSeekTests.cs. Bulk shot delete — the shot-status page's selection bar gets a "Bulk Actions" dropdown (alongside the existing Change Due Date) with Delete Shots. bulkDeleteShots() (actions/shots.ts) deletes one at a time rather than in a single statement: exports_shotId_fkey is ON DELETE RESTRICT by design, so a shot with renders or deliveries on record is protected and gets skipped and reported by name rather than aborting the whole selection or being silently destroyed along with its history. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import Image from "next/image";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { Layers, ExternalLink } from "lucide-react";
|
||||
import { Layers, ExternalLink, ImageIcon, Loader2 } from "lucide-react";
|
||||
import { promoteExportThumbnail } from "@/actions/shots";
|
||||
import { useToast } from "@/components/ui/use-toast";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
EXPORT_STATUS_STYLES,
|
||||
@@ -16,6 +21,7 @@ interface ExportRow {
|
||||
statusChangedAt: string;
|
||||
createdAt: string;
|
||||
outputDir: string;
|
||||
thumbnailUrl: string | null;
|
||||
job: {
|
||||
attempt: number;
|
||||
progress: number;
|
||||
@@ -29,6 +35,29 @@ interface ExportRow {
|
||||
* pipeline history for this shot, linking into the Export detail page.
|
||||
*/
|
||||
export function ShotExportsTab({ shotId }: { shotId: string }) {
|
||||
const router = useRouter();
|
||||
const { toast } = useToast();
|
||||
const [promotingId, setPromotingId] = useState<string | null>(null);
|
||||
|
||||
// Take this export's frame as the shot's thumbnail. Fills in only where the
|
||||
// shot has no reference frame of its own (§9.1a) — it never overwrites one.
|
||||
const promote = async (exportId: string, versionString: string) => {
|
||||
setPromotingId(exportId);
|
||||
try {
|
||||
await promoteExportThumbnail(shotId, exportId);
|
||||
toast({ title: `Shot thumbnail taken from ${versionString}` });
|
||||
router.refresh();
|
||||
} catch (err) {
|
||||
toast({
|
||||
title: "Could not use that frame",
|
||||
description: (err as Error).message,
|
||||
variant: "destructive",
|
||||
});
|
||||
} finally {
|
||||
setPromotingId(null);
|
||||
}
|
||||
};
|
||||
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: ["shot-exports", shotId],
|
||||
queryFn: async () => {
|
||||
@@ -56,29 +85,54 @@ export function ShotExportsTab({ shotId }: { shotId: string }) {
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{exports.map((e) => (
|
||||
<Link
|
||||
<div
|
||||
key={e.id}
|
||||
href={`/pipeline/exports/${e.id}`}
|
||||
className="flex items-center gap-4 rounded-lg border border-border bg-card p-4 hover:border-zinc-600 transition-colors"
|
||||
>
|
||||
<span className="font-mono text-sm text-white w-14">{e.versionString}</span>
|
||||
<span
|
||||
className={cn(
|
||||
"rounded-full border px-2 py-0.5 text-xs whitespace-nowrap",
|
||||
EXPORT_STATUS_STYLES[e.status] ?? "bg-zinc-500/15 text-zinc-300 border-zinc-500/30"
|
||||
<Link href={`/pipeline/exports/${e.id}`} className="flex flex-1 min-w-0 items-center gap-4">
|
||||
{e.thumbnailUrl ? (
|
||||
<span className="relative h-8 w-[76px] shrink-0 overflow-hidden rounded border border-border">
|
||||
<Image src={e.thumbnailUrl} alt="" fill className="object-cover" sizes="76px" />
|
||||
</span>
|
||||
) : (
|
||||
<span className="h-8 w-[76px] shrink-0 rounded border border-border bg-zinc-900" />
|
||||
)}
|
||||
>
|
||||
{statusLabel(e.status)}
|
||||
</span>
|
||||
<span className="flex-1 min-w-0 truncate text-xs text-muted-foreground">
|
||||
{e.job?.machineName ? `${e.job.machineName} · attempt ${e.job.attempt} · ` : ""}
|
||||
{e.outputDir}
|
||||
</span>
|
||||
<span className="text-xs text-muted-foreground whitespace-nowrap">
|
||||
{new Date(e.createdAt).toLocaleDateString()}
|
||||
</span>
|
||||
<ExternalLink className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
|
||||
</Link>
|
||||
<span className="font-mono text-sm text-white w-14">{e.versionString}</span>
|
||||
<span
|
||||
className={cn(
|
||||
"rounded-full border px-2 py-0.5 text-xs whitespace-nowrap",
|
||||
EXPORT_STATUS_STYLES[e.status] ?? "bg-zinc-500/15 text-zinc-300 border-zinc-500/30"
|
||||
)}
|
||||
>
|
||||
{statusLabel(e.status)}
|
||||
</span>
|
||||
<span className="flex-1 min-w-0 truncate text-xs text-muted-foreground">
|
||||
{e.job?.machineName ? `${e.job.machineName} · attempt ${e.job.attempt} · ` : ""}
|
||||
{e.outputDir}
|
||||
</span>
|
||||
<span className="text-xs text-muted-foreground whitespace-nowrap">
|
||||
{new Date(e.createdAt).toLocaleDateString()}
|
||||
</span>
|
||||
<ExternalLink className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
|
||||
</Link>
|
||||
|
||||
{e.thumbnailUrl && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => promote(e.id, e.versionString)}
|
||||
disabled={promotingId !== null}
|
||||
title="Use this frame as the shot thumbnail (never replaces one supplied with the brief)"
|
||||
className="shrink-0 flex items-center gap-1.5 rounded-md border border-border px-2 py-1 text-xs text-muted-foreground hover:text-foreground hover:border-zinc-600 disabled:opacity-50 transition-colors"
|
||||
>
|
||||
{promotingId === e.id ? (
|
||||
<Loader2 className="h-3.5 w-3.5 animate-spin" />
|
||||
) : (
|
||||
<ImageIcon className="h-3.5 w-3.5" />
|
||||
)}
|
||||
Use frame
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user