Skip to content
Open
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
202 changes: 202 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,28 @@
import Tooltip from "@rilldata/web-common/components/tooltip/Tooltip.svelte";
import TooltipContent from "@rilldata/web-common/components/tooltip/TooltipContent.svelte";
import { featureFlags } from "@rilldata/web-common/features/feature-flags";
import ExportPdfOptions from "@rilldata/web-common/features/exports/pdf/ExportPdfOptions.svelte";
import { exportCanvasPdf } from "@rilldata/web-common/features/exports/pdf/export-canvas-pdf";
import type { PdfExportRunOptions } from "@rilldata/web-common/features/exports/pdf/types";

export let createMagicAuthTokens: boolean;
// Provide canvas identifiers to enable the "PDF" tab (canvas dashboards only).
export let canvasName: string | undefined = undefined;
export let instanceId: string | undefined = undefined;

const { hidePublicUrl } = featureFlags;
let isOpen = false;
let copied = false;

$: runPdfExport = ((): ((o: PdfExportRunOptions) => Promise<void>) | null => {
if (canvasName && instanceId) {
const name = canvasName;
const id = instanceId;
return (o) => exportCanvasPdf({ canvasName: name, instanceId: id, ...o });
}
return null;
})();

function onCopy() {
navigator.clipboard.writeText(window.location.href).catch(console.error);
copied = true;
Expand All @@ -50,6 +65,9 @@
{#if createMagicAuthTokens && !$hidePublicUrl}
<TabsTrigger value="tab2">Create public URL</TabsTrigger>
{/if}
{#if runPdfExport}
<TabsTrigger value="pdf">PDF</TabsTrigger>
{/if}
</TabsList>
<TabsContent value="tab1" class="mt-0 p-4">
<div class="flex flex-col gap-y-4">
Expand Down Expand Up @@ -77,6 +95,19 @@
<CreatePublicURLForm />
{/if}
</TabsContent>
{#if runPdfExport}
<TabsContent value="pdf" class="mt-0 p-4">
<div class="flex flex-col gap-y-4">
<h3 class="text-xs text-fg-primary font-normal">
Export this dashboard as a PDF.
</h3>
<ExportPdfOptions
runExport={runPdfExport}
onComplete={() => (isOpen = false)}
/>
</div>
</TabsContent>
{/if}
</Tabs>
</PopoverContent>
</Popover>
Expand Down
2 changes: 2 additions & 0 deletions web-admin/src/features/projects/ProjectHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@
<CanvasBookmarks {organization} {project} canvasName={dashboard} />
<ShareDashboardPopover
createMagicAuthTokens={projectPermissions.createMagicAuthTokens}
canvasName={dashboard}
instanceId={runtimeClient.instanceId}
/>
{/if}
{/if}
Expand Down
1 change: 1 addition & 0 deletions web-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"html-to-image": "^1.11.13",
"jsdom": "^26.0.0",
"json-schema": "^0.4.0",
"jspdf": "^2.5.2",
"lucide-svelte": "^0.298.0",
"luxon": "^3.5.0",
"marked": "^16.4.0",
Expand Down
Loading
Loading