@malloy-publisher/sdk 0.9.8 → 0.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/{RenderedResult-BrvrMDAP.cjs.js → RenderedResult-BcgYjkZ0.cjs.js} +1 -1
  2. package/dist/{RenderedResult-DZj-FnOJ.es.js → RenderedResult-Dp1Qdajz.es.js} +2 -2
  3. package/dist/ServerProvider-B0dUY8be.cjs.js +1 -0
  4. package/dist/{ServerProvider-B_bPAsu2.es.js → ServerProvider-CQy4jVYK.es.js} +1394 -1051
  5. package/dist/builder/index.cjs.js +61 -61
  6. package/dist/builder/index.es.js +783 -794
  7. package/dist/client/api.d.ts +412 -1
  8. package/dist/client/index.cjs.js +1 -1
  9. package/dist/client/index.es.js +125 -114
  10. package/dist/components/Dashboard/DashboardView.d.ts +11 -0
  11. package/dist/components/Dashboard/useStuck.d.ts +14 -0
  12. package/dist/components/DocumentCreate/newNotebook.d.ts +9 -5
  13. package/dist/components/Package/ContentTypeIcon.d.ts +3 -3
  14. package/dist/components/ReportBuilder/FilterStrip.d.ts +3 -1
  15. package/dist/components/ReportBuilder/TileMenu.d.ts +7 -2
  16. package/dist/index.cjs.js +9 -9
  17. package/dist/index.es.js +2112 -2063
  18. package/dist/{useCompiledDocument-x0B2RAH3.es.js → useCompiledDocument-BMPDvdFx.es.js} +2348 -2310
  19. package/dist/{useCompiledDocument-oocN5cGE.cjs.js → useCompiledDocument-UY28ITET.cjs.js} +34 -34
  20. package/package.json +1 -1
  21. package/src/components/Dashboard/DashboardView.tsx +62 -13
  22. package/src/components/Dashboard/useStuck.ts +38 -0
  23. package/src/components/DocumentCreate/newNotebook.spec.ts +8 -6
  24. package/src/components/DocumentCreate/newNotebook.ts +26 -12
  25. package/src/components/Package/ContentTypeIcon.tsx +16 -3
  26. package/src/components/Package/Package.agents.spec.tsx +76 -0
  27. package/src/components/Package/Package.tsx +44 -1
  28. package/src/components/ReportBuilder/BuilderDialogs.tsx +5 -3
  29. package/src/components/ReportBuilder/BuilderGrid.tsx +13 -3
  30. package/src/components/ReportBuilder/FilterStrip.tsx +118 -118
  31. package/src/components/ReportBuilder/ReportBuilder.inline.spec.tsx +0 -1
  32. package/src/components/ReportBuilder/ReportBuilder.spec.tsx +5 -6
  33. package/src/components/ReportBuilder/ReportBuilder.tsx +1 -0
  34. package/src/components/ReportBuilder/TileMenu.tsx +8 -3
  35. package/src/components/ReportBuilder/newDashboard.spec.ts +2 -3
  36. package/dist/ServerProvider-DuEOzwPc.cjs.js +0 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/sdk",
3
3
  "description": "Malloy Publisher SDK",
4
- "version": "0.9.8",
4
+ "version": "0.9.10",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.es.js",
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
 
4
4
  import { Alert, Box, Stack, Typography } from "@mui/material";
5
- import { useCallback, useMemo, useState } from "react";
5
+ import { useCallback, useMemo, useState, type ReactNode } from "react";
6
6
  import type { DashboardManifest } from "../../client";
7
7
  import type { HostGivenValue } from "../../hooks/givenValue";
8
8
  import { useDocumentControls } from "../../hooks/useDocumentControls";
@@ -16,6 +16,8 @@ import {
16
16
  import { GivensPanel, type GivensLayout } from "../given";
17
17
  import { givensToRequest, withHostGivens } from "../given/paramCodec";
18
18
  import { Prose } from "../Prose";
19
+ import { MOTION_FAST, reducedMotionSx } from "../../theme/motion";
20
+ import { usePublisherTheme } from "../../theme/ThemeContext";
19
21
  import { TILE_MAX_HEIGHT } from "../RenderedResult/resultSizing";
20
22
  import {
21
23
  DashboardGrid,
@@ -29,6 +31,7 @@ import { RowsDialog, stepsOf, type RowsRequest } from "./RowsDialog";
29
31
  import { useReportEvents } from "../Report/telemetry";
30
32
  import { TileCard, type TileChrome } from "./TileCard";
31
33
  import { tileIgnoredFilterLabels } from "./TileFilterTag";
34
+ import { useStuck } from "./useStuck";
32
35
 
33
36
  /** Narrowest a tile that sets no `colspan` is allowed to render. */
34
37
  const MIN_TILE_PX = 240;
@@ -231,20 +234,16 @@ export function DashboardView({
231
234
  <DashboardHeader manifest={manifest} chrome={chrome} />
232
235
  )}
233
236
 
234
- {/* Sticky so the controls stay in reach while the tiles scroll under.
235
- Only when there are controls: GivensPanel draws nothing without
236
- them, and an empty box would still cost the Stack a gap. */}
237
+ {/* Sticky so the controls stay in reach while the tiles scroll under,
238
+ in a grid only: a linear report's controls are a full panel, and
239
+ pinned they would take a third of a laptop screen from the prose
240
+ they sit above. Only when there are controls: GivensPanel draws
241
+ nothing without them, and an empty box would still cost the Stack
242
+ a gap. */}
237
243
  {specs.length > 0 && (
238
- <Box
239
- sx={{
240
- position: "sticky",
241
- top: 0,
242
- zIndex: STICKY_CONTROLS_Z,
243
- bgcolor: "background.default",
244
- }}
245
- >
244
+ <StickyControls sticky={chrome === "card"}>
246
245
  <GivensPanel {...controls.panel} layout={controlsLayout} />
247
- </Box>
246
+ </StickyControls>
248
247
  )}
249
248
 
250
249
  {modelPath === undefined ? (
@@ -410,3 +409,53 @@ export function DashboardProse({
410
409
  </Stack>
411
410
  );
412
411
  }
412
+
413
+ /**
414
+ * A control row that pins to the top of the scroller and, while pinned, draws
415
+ * a hairline under itself, so tiles scrolling beneath read as passing under a
416
+ * bar rather than being cut off by nothing. Shared by the reader and the
417
+ * builder so both pin the same way.
418
+ */
419
+ export function StickyControls({
420
+ sticky = true,
421
+ children,
422
+ }: {
423
+ sticky?: boolean;
424
+ children: ReactNode;
425
+ }) {
426
+ const { theme } = usePublisherTheme();
427
+ const { sentinelRef, stuck } = useStuck();
428
+ if (!sticky) return <Box>{children}</Box>;
429
+ const edge = theme.cardBorder.replace(/^1px solid /, "");
430
+ return (
431
+ <>
432
+ {/* The sentinel the pin is detected from; it costs the parent Stack
433
+ no gap, since it is a zero-height sibling and Stack gaps are on
434
+ the bar's own margin. */}
435
+ <Box
436
+ ref={sentinelRef}
437
+ aria-hidden
438
+ sx={{ height: 0, m: "0 !important" }}
439
+ />
440
+ <Box
441
+ data-stuck={stuck || undefined}
442
+ sx={{
443
+ position: "sticky",
444
+ top: 0,
445
+ zIndex: STICKY_CONTROLS_Z,
446
+ bgcolor: "background.default",
447
+ // Room under the bar for the edge, so the line never sits on
448
+ // the controls themselves.
449
+ pb: 1,
450
+ // A shadow rather than a border: drawing the edge must not
451
+ // change the bar's height, or the page jumps as it pins.
452
+ boxShadow: stuck ? `0 1px 0 ${edge}` : "none",
453
+ transition: `box-shadow ${MOTION_FAST}`,
454
+ ...reducedMotionSx,
455
+ }}
456
+ >
457
+ {children}
458
+ </Box>
459
+ </>
460
+ );
461
+ }
@@ -0,0 +1,38 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import { useCallback, useRef, useState } from "react";
5
+
6
+ /**
7
+ * Whether a `position: sticky` bar is currently pinned, so it can draw an edge
8
+ * only while content scrolls under it. Unpinned, the bar sits in the flow and
9
+ * an edge would be a stray line between it and the first tile.
10
+ *
11
+ * Watches a zero-height sentinel placed directly before the bar: once the
12
+ * sentinel has scrolled out through the top, the bar is pinned. No explicit
13
+ * root, so it works whichever ancestor scrolls — an observer with the implicit
14
+ * root counts clipping by every scrolling ancestor, not just the viewport.
15
+ */
16
+ export function useStuck(): {
17
+ sentinelRef: (node: HTMLElement | null) => void;
18
+ stuck: boolean;
19
+ } {
20
+ const [stuck, setStuck] = useState(false);
21
+ const observer = useRef<IntersectionObserver | null>(null);
22
+ const sentinelRef = useCallback((node: HTMLElement | null) => {
23
+ observer.current?.disconnect();
24
+ observer.current = null;
25
+ if (!node || typeof IntersectionObserver === "undefined") return;
26
+ observer.current = new IntersectionObserver(([entry]) => {
27
+ if (!entry) return;
28
+ // Out of view BELOW the fold is not pinned: only out through the top.
29
+ setStuck(
30
+ !entry.isIntersecting &&
31
+ entry.boundingClientRect.top <
32
+ (entry.rootBounds?.height ?? window.innerHeight) / 2,
33
+ );
34
+ });
35
+ observer.current.observe(node);
36
+ }, []);
37
+ return { sentinelRef, stuck };
38
+ }
@@ -35,7 +35,7 @@ describe("newNotebookSource", () => {
35
35
  expect(lintNotebookText("notebooks/q3.malloy", text)).toEqual([]);
36
36
  });
37
37
 
38
- it("reads back as a layout notebook: an intro text tile, then one query tile, and no run cell", async () => {
38
+ it("reads back as a layout notebook: one labelled query tile, no text tile, and no run cell", async () => {
39
39
  const text = newNotebookSource(INPUT);
40
40
  const result = await readDashboardDocument(text);
41
41
  if (readFailed(result)) throw new Error(result.reason);
@@ -43,9 +43,11 @@ describe("newNotebookSource", () => {
43
43
  expect(document.layout).toBe("linear");
44
44
  expect(
45
45
  document.tiles.map((t) => (isTextTile(t) ? "text" : "query")),
46
- ).toEqual(["text", "query"]);
46
+ ).toEqual(["query"]);
47
47
  const query = document.tiles.find(isQueryTile);
48
48
  expect(query?.name).toBe("by_category_tile");
49
+ // Titled for the view it shows, not the extension's `_tile` name.
50
+ expect(query?.label).toBe("By category");
49
51
  expect(text).toContain(
50
52
  "source: order_items_tiles is order_items extend {",
51
53
  );
@@ -54,7 +56,7 @@ describe("newNotebookSource", () => {
54
56
 
55
57
  it("writes the artifact tag as a block with a tile on each line, named for its view", () => {
56
58
  expect(newNotebookSource(INPUT)).toContain(
57
- '##| artifact { layout=linear title="Sales \\"West\\""\n tiles=[\n intro { kind=text },\n "order_items_tiles -> by_category_tile"\n ]\n}\n|##\n',
59
+ '##| artifact { layout=linear title="Sales \\"West\\""\n tiles=[\n "order_items_tiles -> by_category_tile"\n ]\n}\n|##\n',
58
60
  );
59
61
  });
60
62
 
@@ -118,7 +120,7 @@ describe("newReportSource", () => {
118
120
  expect(grid.document.columns).toBe(12);
119
121
  expect(
120
122
  grid.document.tiles.map((t) => (isTextTile(t) ? "text" : "query")),
121
- ).toEqual(["text", "query"]);
123
+ ).toEqual(["query"]);
122
124
  const linear = await readDashboardDocument(
123
125
  newReportSource(INPUT, "linear"),
124
126
  );
@@ -163,10 +165,10 @@ describe("newDocumentProblem", () => {
163
165
  expect(newDocumentProblem({ ...INPUT, source: "date" })).toBeUndefined();
164
166
  });
165
167
 
166
- it("trims the title once, for the tag and the heading", () => {
168
+ it("trims the title, and writes it once: in the tag, not again as a heading", () => {
167
169
  const text = newNotebookSource({ ...INPUT, title: " Q3 " });
168
170
  expect(text).toContain('title="Q3"');
169
- expect(text).toContain("# Q3\n");
171
+ expect(text).not.toContain("# Q3\n");
170
172
  });
171
173
 
172
174
  it("refuses names that cannot be written", () => {
@@ -5,16 +5,34 @@ import { importPathOf } from "../ReportBuilder/imports";
5
5
  import type { ReportLayout } from "../Package/documentLocation";
6
6
  import { malloyName, newDocumentProblem, type NewDocument } from "./guards";
7
7
 
8
+ /**
9
+ * `top_products` → `Top products`: the title a tile derives from a view name.
10
+ * Restated rather than imported from `drill/resolveDrill`, which would pull
11
+ * the filter parser into the create entry this module ships in.
12
+ */
13
+ const titleOf = (name: string) => {
14
+ const words = name.replace(/[-_]+/g, " ").trim();
15
+ return words.charAt(0).toUpperCase() + words.slice(1);
16
+ };
17
+
18
+ /** A Malloy tag string. */
19
+ const quote = (text: string) =>
20
+ `"${text.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
21
+
8
22
  /** Where a new report goes when nobody says otherwise: the package root. */
9
23
  const ROOT_REPORT_PATH = "report.malloy";
10
24
 
11
25
  /**
12
26
  * A new report file, in the format the builder writes: the givens flag, the
13
- * artifact tag (a block, a tile per line) listing an intro text tile and one
14
- * query tile, a named import of the one source it runs (written relative to
15
- * where the report sits, so a report at the root imports `"<model>"`), the
16
- * intro block, and one extension of the source (`<source>_tiles`, the
17
- * builder's naming) holding the picked view as the query tile.
27
+ * artifact tag (a block, a tile per line) listing one query tile, a named
28
+ * import of the one source it runs (written relative to where the report
29
+ * sits, so a report at the root imports `"<model>"`), and one extension of the
30
+ * source (`<source>_tiles`, the builder's naming) holding the picked view as
31
+ * the query tile, labelled with the view's own title.
32
+ *
33
+ * No intro text tile: the page already shows the title, and offers the
34
+ * description in place, so a generated `# <title>` and a line asking for a
35
+ * description said both twice on the first screen of every new report.
18
36
  *
19
37
  * The two layouts differ only in `layout=` and the grid tag a grid carries.
20
38
  * `layout=` is always written, so the file never depends on the reading rule.
@@ -29,7 +47,7 @@ export function newReportSource(
29
47
  if (problem) throw new Error(problem);
30
48
  const { modelPath, source, view } = input;
31
49
  const title = input.title.trim();
32
- const quoted = `"${title.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
50
+ const quoted = quote(title);
33
51
  const extension = malloyName(`${source}_tiles`);
34
52
  const tile = malloyName(`${view}_tile`);
35
53
  // The entry is a quoted string, so a back-quoted extension name is written inside it as is.
@@ -38,19 +56,15 @@ export function newReportSource(
38
56
  "##! experimental.givens",
39
57
  `##| artifact { layout=${layout} title=${quoted}`,
40
58
  " tiles=[",
41
- " intro { kind=text },",
42
59
  ` ${entry}`,
43
60
  " ]",
44
61
  layout === "grid" ? "} dashboard { columns=12 }" : "}",
45
62
  "|##",
46
63
  `import { ${malloyName(source)} } from "${importPathOf(modelPath, reportPath)}"`,
47
64
  "",
48
- "##|(markdown) intro",
49
- `# ${title}`,
50
- "Say what this report is for, then let the queries below answer it.",
51
- "|##",
52
- "",
53
65
  `source: ${extension} is ${malloyName(source)} extend {`,
66
+ // The view's title, not the extension's `<view>_tile` name humanized.
67
+ ` # label=${quote(titleOf(view))}`,
54
68
  ` view: ${tile} is ${malloyName(view)}`,
55
69
  "}",
56
70
  "",
@@ -10,14 +10,15 @@ export type ContentType =
10
10
  | "data"
11
11
  | "materialization"
12
12
  | "dataApp"
13
- | "dashboard";
13
+ | "dashboard"
14
+ | "agent";
14
15
 
15
16
  /**
16
17
  * The backplate color behind each icon. One per content type and no repeats: on
17
- * a page that lists all six, a shared color reads as a shared kind, and the
18
+ * a page that lists all seven, a shared color reads as a shared kind, and the
18
19
  * glyphs are small enough that color does most of the telling apart.
19
20
  *
20
- * Six hues from `PALETTE`, spaced far enough apart to survive being 18px of
21
+ * Seven hues from `PALETTE`, spaced far enough apart to survive being 18px of
21
22
  * white on a 32px plate, and disjoint from the three `SURFACE_TINT` uses so a
22
23
  * colour means one kind of thing everywhere in the Console.
23
24
  *
@@ -32,6 +33,7 @@ export const CONTENT_TINT: Record<ContentType, string> = {
32
33
  dataApp: PALETTE.pink,
33
34
  data: PALETTE.lime,
34
35
  materialization: PALETTE.amber,
36
+ agent: PALETTE.red,
35
37
  };
36
38
 
37
39
  interface ContentTypeIconProps extends Omit<SvgIconProps, "fontSize"> {
@@ -90,6 +92,7 @@ const CONTENT_GLYPH: Record<ContentType, () => React.ReactElement> = {
90
92
  materialization: StackPath,
91
93
  dataApp: BrowserWindowPath,
92
94
  dashboard: DashboardGridPath,
95
+ agent: PersonPath,
93
96
  };
94
97
 
95
98
  /** File outline with a folded top-right corner and three chart bars inside. */
@@ -162,6 +165,16 @@ function DashboardGridPath() {
162
165
  );
163
166
  }
164
167
 
168
+ /** A head and shoulders: someone who works with the package. */
169
+ function PersonPath() {
170
+ return (
171
+ <>
172
+ <circle cx="12" cy="8" r="3.5" />
173
+ <path d="M5 20 a7 7 0 0 1 14 0" />
174
+ </>
175
+ );
176
+ }
177
+
165
178
  /** Browser-window outline with an address-bar separator and content lines. */
166
179
  function BrowserWindowPath() {
167
180
  return (
@@ -0,0 +1,76 @@
1
+ // Copyright (c) Credible Data Inc.
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ /** The package page's Agents section: what a package declares, read-only. */
5
+ import { render, screen } from "@testing-library/react";
6
+ import { beforeEach, expect, it } from "bun:test";
7
+ import {
8
+ clearCache,
9
+ mockServerProvider,
10
+ pending,
11
+ serverWrapper,
12
+ } from "../../../test/serverProvider";
13
+
14
+ let agents: unknown[] | undefined;
15
+
16
+ mockServerProvider(
17
+ {
18
+ packages: {
19
+ getPackage: () =>
20
+ Promise.resolve({
21
+ data: { name: "pkg", ...(agents ? { agents } : {}) },
22
+ }),
23
+ },
24
+ reports: { listReports: () => Promise.resolve({ data: [] }) },
25
+ models: { listModels: () => Promise.resolve({ data: [] }) },
26
+ databases: { listDatabases: () => Promise.resolve({ data: [] }) },
27
+ dataApps: { listDataApps: () => Promise.resolve({ data: [] }) },
28
+ materializations: { listMaterializations: pending },
29
+ },
30
+ { mutable: true },
31
+ );
32
+
33
+ const { default: Package } = await import("./Package");
34
+
35
+ const mount = () =>
36
+ render(<Package resourceUri="publisher://environments/env/packages/pkg" />, {
37
+ wrapper: serverWrapper,
38
+ });
39
+
40
+ beforeEach(() => {
41
+ clearCache();
42
+ agents = undefined;
43
+ });
44
+
45
+ it("lists each agent with its description, a non-default model, and its schedules as not run yet", async () => {
46
+ agents = [
47
+ {
48
+ name: "analyst",
49
+ description: "Answers revenue questions",
50
+ model: "sonnet",
51
+ schedules: [
52
+ { cron: "0 13 * * MON", task: "agents/analyst/weekly.md" },
53
+ ],
54
+ },
55
+ { name: "plain", description: "No schedule", model: "inherit" },
56
+ ];
57
+
58
+ mount();
59
+
60
+ const section = await screen.findByRole("region", { name: "Agents" });
61
+ expect(section.textContent).toContain("analyst");
62
+ expect(section.textContent).toContain("Answers revenue questions");
63
+ expect(section.textContent).toContain("sonnet");
64
+ expect(section.textContent).toContain("13:00");
65
+ expect(section.textContent).toContain("agents/analyst/weekly.md");
66
+ expect(section.textContent).toContain("Not run yet");
67
+ expect(section.textContent).not.toContain("inherit");
68
+ expect(section.querySelectorAll('[role="button"]')).toHaveLength(0);
69
+ });
70
+
71
+ it("shows no section for a package that declares no agents", async () => {
72
+ mount();
73
+
74
+ await screen.findByRole("region", { name: "Models" });
75
+ expect(screen.queryByRole("region", { name: "Agents" })).toBeNull();
76
+ });
@@ -15,7 +15,7 @@ import {
15
15
  } from "@mui/material";
16
16
  import { useQueryClient } from "@tanstack/react-query";
17
17
  import React, { useCallback, useEffect, useMemo, useState } from "react";
18
- import { Database } from "../../client";
18
+ import { Database, type AgentSummary } from "../../client";
19
19
  import { useNarrowScreen } from "../../hooks/useNarrowScreen";
20
20
  import { useQueryWithApiError } from "../../hooks/useQueryWithApiError";
21
21
  import { ApiErrorDisplay } from "../ApiErrorDisplay";
@@ -40,6 +40,7 @@ import ContentTypeIcon, {
40
40
  } from "./ContentTypeIcon";
41
41
  import { ItemRow } from "../ItemRow";
42
42
  import { Materializations } from "../Materializations";
43
+ import { describeCron } from "../Materializations/cron";
43
44
  import { PackageSection } from "../PackageSection";
44
45
  import { draftKey } from "../DocumentCreate/documentPath";
45
46
  import {
@@ -315,6 +316,7 @@ export default function Package({
315
316
  ]);
316
317
 
317
318
  const description = pkgQuery.data?.data?.description ?? "";
319
+ const agents = pkgQuery.data?.data?.agents ?? [];
318
320
  const readmePath = (
319
321
  reports.find((r) => r.path === README_NOTEBOOK) ??
320
322
  reports.find((r) => isRootReadme(r.path))
@@ -619,6 +621,18 @@ export default function Package({
619
621
  {models.length === 0 && <EmptyRow label="No models" />}
620
622
  </PackageSection>
621
623
 
624
+ {agents.length > 0 && (
625
+ <PackageSection
626
+ title="Agents"
627
+ count={agents.length}
628
+ description="Declared in publisher.json. Name one in an agent session to work as it. Schedules are listed only; nothing runs them yet."
629
+ >
630
+ {agents.map((agent) => (
631
+ <PackageAgentRow key={agent.name} agent={agent} />
632
+ ))}
633
+ </PackageSection>
634
+ )}
635
+
622
636
  <PackageSection title="Data" count={databases.length}>
623
637
  {databases.map((database) => (
624
638
  <PackageItemRow
@@ -697,6 +711,35 @@ function PackageItemRow({
697
711
  );
698
712
  }
699
713
 
714
+ function PackageAgentRow({ agent }: { agent: AgentSummary }) {
715
+ return (
716
+ <>
717
+ <PackageItemRow
718
+ type="agent"
719
+ label={agent.name ?? ""}
720
+ {...(agent.description ? { description: agent.description } : {})}
721
+ {...(agent.model && agent.model !== "inherit"
722
+ ? { rightLabel: agent.model }
723
+ : {})}
724
+ />
725
+ {(agent.schedules ?? []).map((schedule) => {
726
+ const cron = describeCron(schedule.cron ?? "");
727
+ return (
728
+ <Typography
729
+ key={`${schedule.cron}|${schedule.task}`}
730
+ variant="caption"
731
+ color="text.secondary"
732
+ sx={{ display: "block", ml: 6, mb: 0.5 }}
733
+ >
734
+ {cron.valid ? cron.description : schedule.cron} (UTC), task{" "}
735
+ {schedule.task}. Not run yet.
736
+ </Typography>
737
+ );
738
+ })}
739
+ </>
740
+ );
741
+ }
742
+
700
743
  interface ReportRow {
701
744
  path: string;
702
745
  layout: ReportLayout;
@@ -104,9 +104,11 @@ export function BuilderDialogs({
104
104
  }
105
105
  : {})}
106
106
  view={menuView}
107
- onDrills={() => {
108
- setDrillSource(menuTile?.source);
109
- }}
107
+ {...((editor.document.sources.find(
108
+ (s) => s.name === menuTile?.source,
109
+ )?.dimensions?.length ?? 0) > 0
110
+ ? { onDrills: () => setDrillSource(menuTile?.source) }
111
+ : {})}
110
112
  />
111
113
  <DrillDialog
112
114
  open={drillSource !== undefined}
@@ -87,9 +87,14 @@ export function BuilderGrid({
87
87
  )
88
88
  : (preview ?? editor.document.tiles);
89
89
  // And, while a drag is live, the empty end of every row as a drop target.
90
- // Not otherwise: a gap is only a place to land while something is in hand.
90
+ // While an edge is dragged too: narrowing a tile frees columns its row-mate
91
+ // does not take, and an undrawn hole there read as a broken layout rather
92
+ // than room to fill. Not otherwise: a gap is only shown mid-gesture.
91
93
  const empty = editor.document.tiles.length === 0;
92
- const entries = dragging ? withGaps(shown, columns) : shown.map(tileEntry);
94
+ const entries =
95
+ dragging || resize !== undefined
96
+ ? withGaps(shown, columns)
97
+ : shown.map(tileEntry);
93
98
  const heading = (tile: QueryTile) =>
94
99
  headingOf(tile, tileDisplayTitle(tile), editTile);
95
100
  return (
@@ -126,7 +131,12 @@ export function BuilderGrid({
126
131
  flash={tileKey(each) === flash}
127
132
  menuOpen={menuIndex === index}
128
133
  bare={chrome === "none"}
129
- {...(notebook && canAdd
134
+ // Not on the last tile: the "Add tile" under the
135
+ // list adds there already, and the two drew on top
136
+ // of each other.
137
+ {...(notebook &&
138
+ canAdd &&
139
+ index < editor.document.tiles.length - 1
130
140
  ? {
131
141
  onInsertAfter: () => openAdd(index + 1),
132
142
  }