@dudousxd/nestjs-catalog-react 0.12.0 → 0.13.0
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.
- package/dist/DashboardBoard.d.ts +39 -1
- package/dist/DashboardBoard.js +78 -17
- package/dist/ObjectExplorer.d.ts +23 -0
- package/dist/ObjectExplorer.js +15 -5
- package/dist/QueryConsole.d.ts +38 -1
- package/dist/QueryConsole.js +99 -5
- package/dist/SavedQueryPanel.d.ts +11 -1
- package/dist/SavedQueryPanel.js +4 -2
- package/package.json +2 -2
package/dist/DashboardBoard.d.ts
CHANGED
|
@@ -7,7 +7,45 @@
|
|
|
7
7
|
* alternative, a dashboard-wide refresh policy, would override a decision the
|
|
8
8
|
* query's author already made with more information than the dashboard has.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export interface DashboardBoardProps {
|
|
11
|
+
/**
|
|
12
|
+
* Which board to open. Omit to fall back to `?dashboard=` then to the first.
|
|
13
|
+
*
|
|
14
|
+
* The same shape, and the same reasoning, as `ObjectExplorer`'s `type`: the
|
|
15
|
+
* host is the one that knows where its own router keeps parameters, so it
|
|
16
|
+
* passes what it parsed, and {@link paramFromLocation} is the convenience for
|
|
17
|
+
* a host that does not. This screen took no props at all until now, which is
|
|
18
|
+
* why `#dashboards?dashboard=…` from the search box landed here and then
|
|
19
|
+
* showed whichever board the component picked for itself.
|
|
20
|
+
*
|
|
21
|
+
* `| undefined` is spelled out rather than left to `?`, because a host
|
|
22
|
+
* compiling under `exactOptionalPropertyTypes` — which the console in this
|
|
23
|
+
* repo does — cannot pass `params.get('dashboard') ?? undefined` to a bare
|
|
24
|
+
* `?: string` without a spread that exists only to satisfy the compiler. "No
|
|
25
|
+
* board named" is a value this prop genuinely takes.
|
|
26
|
+
*/
|
|
27
|
+
dashboardId?: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Called with whatever board is now open, so the host can put it in the
|
|
30
|
+
* address. `undefined` when nothing is — the board was just deleted, say.
|
|
31
|
+
*
|
|
32
|
+
* **Why the write is a callback and the read is not.** Reading a URL is an
|
|
33
|
+
* observation. Writing one is an act with effects outside this component's
|
|
34
|
+
* box: whether a selection becomes a history entry you can press Back through
|
|
35
|
+
* is the host's decision, and eleven boards clicked through in a session is
|
|
36
|
+
* eleven presses of Back if it is made carelessly. A console mounted inside
|
|
37
|
+
* somebody else's page should not find a library it embedded rewriting the
|
|
38
|
+
* address. So this screen reports and the host writes; omit it and nothing
|
|
39
|
+
* writes, which is what every existing host gets.
|
|
40
|
+
*
|
|
41
|
+
* Fired on SELECTION only, never on the implicit first board. The default
|
|
42
|
+
* board is not something anybody chose, and naming it in the address would
|
|
43
|
+
* hand out links that promise a specific board and deliver "whatever is
|
|
44
|
+
* first" — the failure this whole prop pair exists to remove.
|
|
45
|
+
*/
|
|
46
|
+
onDashboardChange?: (id: string | undefined) => void;
|
|
47
|
+
}
|
|
48
|
+
export declare function DashboardBoard({ dashboardId, onDashboardChange }?: DashboardBoardProps): import("react/jsx-runtime").JSX.Element;
|
|
11
49
|
/**
|
|
12
50
|
* Which chart library draws this card.
|
|
13
51
|
*
|
package/dist/DashboardBoard.js
CHANGED
|
@@ -3,8 +3,9 @@ import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, us
|
|
|
3
3
|
import { SortableContext, arrayMove, rectSortingStrategy, sortableKeyboardCoordinates, useSortable, } from '@dnd-kit/sortable';
|
|
4
4
|
import { CSS } from '@dnd-kit/utilities';
|
|
5
5
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
6
|
-
import { Download, GripVertical, LayoutGrid, Plus, RefreshCw, Trash2 } from 'lucide-react';
|
|
7
|
-
import { useState } from 'react';
|
|
6
|
+
import { Download, GripVertical, LayoutGrid, Link2Off, Plus, RefreshCw, Trash2, } from 'lucide-react';
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
import { paramFromLocation } from './ObjectExplorer';
|
|
8
9
|
import { ChartBody } from './charts/body';
|
|
9
10
|
import { CHART_GRID, chartSpan } from './charts/grid';
|
|
10
11
|
import { registeredChartLibraries, visualizationFor } from './charts/registry';
|
|
@@ -21,22 +22,34 @@ const dashboardKeys = {
|
|
|
21
22
|
all: ['catalog', 'dashboards'],
|
|
22
23
|
card: (id) => ['catalog', 'dashboard-card', id],
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
-
* Saved queries, laid out on a page.
|
|
26
|
-
*
|
|
27
|
-
* Each card runs its own saved query and honours the TTL that query was saved
|
|
28
|
-
* with — so a dashboard of cached cards costs one round trip and no database
|
|
29
|
-
* work, and a dashboard of uncached ones is honest about being expensive. The
|
|
30
|
-
* alternative, a dashboard-wide refresh policy, would override a decision the
|
|
31
|
-
* query's author already made with more information than the dashboard has.
|
|
32
|
-
*/
|
|
33
|
-
export function DashboardBoard() {
|
|
25
|
+
export function DashboardBoard({ dashboardId, onDashboardChange } = {}) {
|
|
34
26
|
const client = useCatalogClient();
|
|
35
27
|
const queryClient = useQueryClient();
|
|
36
28
|
const [selectedId, setSelectedId] = useState(null);
|
|
37
29
|
const [creating, setCreating] = useState(false);
|
|
38
30
|
const [name, setName] = useState('');
|
|
39
|
-
|
|
31
|
+
// The prop wins whenever it changes, not only on the first render — a host
|
|
32
|
+
// navigating from one board to another sets it, and guarding on "nothing open
|
|
33
|
+
// yet" would show the previous board under an address naming the new one.
|
|
34
|
+
// Deliberately NOT guarded on the id existing: ignoring an id we cannot find
|
|
35
|
+
// is how a dead link ends up looking like a live one.
|
|
36
|
+
//
|
|
37
|
+
// The one and only place either source is read. Seeding the state with
|
|
38
|
+
// `dashboardId ?? null` as well would read the prop twice, which is not just
|
|
39
|
+
// redundant: it makes the first render right even when this effect is wrong,
|
|
40
|
+
// so a build that stopped following the prop would still open the right board
|
|
41
|
+
// on arrival and only misbehave on the second navigation — the harder half of
|
|
42
|
+
// the bug, hidden behind the easier one.
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const requested = dashboardId ?? paramFromLocation('dashboard');
|
|
45
|
+
if (requested)
|
|
46
|
+
setSelectedId(requested);
|
|
47
|
+
}, [dashboardId]);
|
|
48
|
+
function select(id) {
|
|
49
|
+
setSelectedId(id);
|
|
50
|
+
onDashboardChange?.(id);
|
|
51
|
+
}
|
|
52
|
+
const { data: dashboards = [], isSuccess: dashboardsLoaded } = useQuery({
|
|
40
53
|
queryKey: dashboardKeys.all,
|
|
41
54
|
queryFn: () => client.listDashboards(),
|
|
42
55
|
});
|
|
@@ -50,7 +63,9 @@ export function DashboardBoard() {
|
|
|
50
63
|
onSuccess: (dashboard) => {
|
|
51
64
|
setCreating(false);
|
|
52
65
|
setName('');
|
|
53
|
-
|
|
66
|
+
// A board you just made is as chosen as one you clicked, so the address
|
|
67
|
+
// names it and the link is sendable the moment it exists.
|
|
68
|
+
select(dashboard.id);
|
|
54
69
|
invalidate();
|
|
55
70
|
},
|
|
56
71
|
});
|
|
@@ -76,10 +91,34 @@ export function DashboardBoard() {
|
|
|
76
91
|
mutationFn: (id) => client.deleteDashboard(id),
|
|
77
92
|
onSuccess: () => {
|
|
78
93
|
setSelectedId(null);
|
|
94
|
+
// The parameter goes with it. Left in place it would name a board that
|
|
95
|
+
// this very session deleted, and the next reload would greet its author
|
|
96
|
+
// with a "that board is gone" notice about their own deliberate act.
|
|
97
|
+
onDashboardChange?.(undefined);
|
|
79
98
|
invalidate();
|
|
80
99
|
},
|
|
81
100
|
});
|
|
82
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Which board is open, and — separately — whether a link asked for one that
|
|
103
|
+
* is not here.
|
|
104
|
+
*
|
|
105
|
+
* The old line was `find(...) ?? dashboards[0] ?? null`, which answered two
|
|
106
|
+
* different questions with one fallback. "Nobody named a board" and "the
|
|
107
|
+
* board somebody named is gone" both landed on the first board in the list:
|
|
108
|
+
* correct for the first, and for the second the behaviour that makes a stale
|
|
109
|
+
* link look like a working link showing the wrong thing. A person who clicked
|
|
110
|
+
* a search result for a specific board would read somebody else's numbers
|
|
111
|
+
* under the title of somebody else's board, with nothing on screen to suggest
|
|
112
|
+
* they were not the ones asked for.
|
|
113
|
+
*
|
|
114
|
+
* So the fallback now applies only when nothing was asked for. `missingId` is
|
|
115
|
+
* the other case, and it waits for `dashboardsLoaded`: until the list has
|
|
116
|
+
* arrived the id is merely unresolved, and reporting that as gone would flash
|
|
117
|
+
* the notice on every correct link.
|
|
118
|
+
*/
|
|
119
|
+
const found = dashboards.find((d) => d.id === selectedId) ?? null;
|
|
120
|
+
const missingId = selectedId !== null && dashboardsLoaded && !found ? selectedId : null;
|
|
121
|
+
const selected = selectedId === null ? (dashboards[0] ?? null) : found;
|
|
83
122
|
// Pointer with a small activation distance so a click on a card's buttons is
|
|
84
123
|
// not swallowed as the start of a drag; keyboard so the layout is reachable
|
|
85
124
|
// without a mouse, which native HTML5 drag never is.
|
|
@@ -157,14 +196,36 @@ export function DashboardBoard() {
|
|
|
157
196
|
return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "flex h-full min-h-0", children: [_jsxs("aside", { className: cn('flex w-60 shrink-0 flex-col border-r', RULE, PANEL), children: [_jsxs("div", { className: cn('flex items-center justify-between border-b px-3 py-2', RULE), children: [_jsx("span", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Dashboards" }), _jsx("button", { type: "button", onClick: () => setCreating((o) => !o), className: cn('rounded-sm p-1 hover:bg-zinc-100 dark:hover:bg-zinc-800', MUTED), "aria-label": "New dashboard", children: _jsx(Plus, { size: 12 }) })] }), creating && (_jsxs("form", { className: "flex gap-1 p-2", onSubmit: (e) => {
|
|
158
197
|
e.preventDefault();
|
|
159
198
|
create.mutate();
|
|
160
|
-
}, children: [_jsx("input", { value: name, onChange: (e) => setName(e.target.value), placeholder: "Name", "aria-label": "Dashboard name", className: cn('min-w-0 flex-1 rounded-md border bg-white px-2 py-1 text-xs outline-none dark:bg-zinc-900', RULE) }), _jsx("button", { type: "submit", disabled: name.trim().length === 0, className: "rounded-md bg-zinc-950 px-2 text-xs text-zinc-50 disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-950", children: "Add" })] })), _jsxs("nav", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [dashboards.length === 0 && (_jsx("p", { className: cn('px-2 py-4 text-center text-[11px]', MUTED), children: "No dashboards yet." })), dashboards.map((dashboard) => (_jsxs("button", { type: "button", onClick: () =>
|
|
199
|
+
}, children: [_jsx("input", { value: name, onChange: (e) => setName(e.target.value), placeholder: "Name", "aria-label": "Dashboard name", className: cn('min-w-0 flex-1 rounded-md border bg-white px-2 py-1 text-xs outline-none dark:bg-zinc-900', RULE) }), _jsx("button", { type: "submit", disabled: name.trim().length === 0, className: "rounded-md bg-zinc-950 px-2 text-xs text-zinc-50 disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-950", children: "Add" })] })), _jsxs("nav", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [dashboards.length === 0 && (_jsx("p", { className: cn('px-2 py-4 text-center text-[11px]', MUTED), children: "No dashboards yet." })), dashboards.map((dashboard) => (_jsxs("button", { type: "button", onClick: () => select(dashboard.id), className: cn('flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-sm', selected?.id === dashboard.id
|
|
161
200
|
? 'bg-sky-100 dark:bg-sky-950'
|
|
162
|
-
: 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(LayoutGrid, { size: 12, className: MUTED }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: dashboard.name }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: dashboard.cards.length })] }, dashboard.id)))] }), selected && saved.length > 0 && (_jsxs("div", { className: cn('border-t p-2', RULE), children: [_jsx("div", { className: cn('px-1 pb-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Add a card" }), saved.map((query) => (_jsxs("button", { type: "button", onClick: () => addCard(query.id), className: cn('w-full truncate rounded-md px-2 py-1 text-left text-[11px]', 'transition-all hover:translate-x-0.5 hover:bg-sky-50', 'dark:hover:bg-sky-950/40'), children: ["+ ", query.name] }, query.id)))] }))] }), _jsx("main", { className: "@container min-w-0 flex-1 overflow-y-auto", children: !selected ? (_jsx(
|
|
201
|
+
: 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(LayoutGrid, { size: 12, className: MUTED }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: dashboard.name }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: dashboard.cards.length })] }, dashboard.id)))] }), selected && saved.length > 0 && (_jsxs("div", { className: cn('border-t p-2', RULE), children: [_jsx("div", { className: cn('px-1 pb-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Add a card" }), saved.map((query) => (_jsxs("button", { type: "button", onClick: () => addCard(query.id), className: cn('w-full truncate rounded-md px-2 py-1 text-left text-[11px]', 'transition-all hover:translate-x-0.5 hover:bg-sky-50', 'dark:hover:bg-sky-950/40'), children: ["+ ", query.name] }, query.id)))] }))] }), _jsx("main", { className: "@container min-w-0 flex-1 overflow-y-auto", children: !selected ? (_jsx(NothingOpen, { missingId: missingId })) : (_jsxs("div", { className: "mx-auto max-w-6xl px-8 py-6", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-2xl font-semibold tracking-tight", children: selected.name }), _jsxs("p", { className: cn('mt-0.5 font-mono text-[11px]', MUTED), children: [selected.cards.length, " cards \u00B7 by ", selected.createdBy] })] }), _jsxs("button", { type: "button", onClick: () => remove.mutate(selected.id), className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs', RULE, MUTED, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(Trash2, { size: 12 }), "Delete"] })] }), _jsx(ShareControl, { className: "mt-4", kind: "dashboard", shared: selected.shared, pending: share.isPending, error: share.error, name: selected.name, onChange: (shared) => share.mutate({ id: selected.id, shared }) }), selected.cards.length === 0 ? (_jsx("p", { className: cn('mt-8 rounded-lg border border-dashed px-4 py-12 text-center text-sm', RULE, MUTED), children: "Empty. Add a saved query from the left." })) : (_jsx(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: onDragEnd, children: _jsx(SortableContext, { items: [...selected.cards]
|
|
163
202
|
.sort((a, b) => a.position - b.position)
|
|
164
203
|
.map((c) => c.id), strategy: rectSortingStrategy, children: _jsx("div", { className: cn('mt-6', CHART_GRID), children: [...selected.cards]
|
|
165
204
|
.sort((a, b) => a.position - b.position)
|
|
166
205
|
.map((card) => (_jsx(SortableCard, { id: card.id, savedQueryId: card.savedQueryId, width: card.width, ...(card.library ? { library: card.library } : {}), onRemove: () => removeCard(card.id), onWidth: (w) => setWidth(card.id, w), onLibrary: (next) => setLibrary(card.id, next) }, card.id))) }) }) }))] })) })] }) }));
|
|
167
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* The two reasons this pane can be empty, which must not be told as one.
|
|
209
|
+
*
|
|
210
|
+
* "There is no board open" is a state a new deployment starts in, and the right
|
|
211
|
+
* thing to say is how to make one. "The board you asked for is not here" is a
|
|
212
|
+
* failure that happened to somebody following a link, and the right thing to
|
|
213
|
+
* say is which board and that nothing was substituted for it — because the
|
|
214
|
+
* alternative reading, the one this notice exists to prevent, is that the click
|
|
215
|
+
* never registered.
|
|
216
|
+
*
|
|
217
|
+
* The id is quoted verbatim: it is the only actionable part of a dead link.
|
|
218
|
+
* Whoever sent it can be told exactly which one, and somebody looking at two
|
|
219
|
+
* environments can see at a glance that the id belongs to the other one. The
|
|
220
|
+
* address is deliberately left naming it — rewriting the URL to something valid
|
|
221
|
+
* would erase the evidence while the reader is still looking at it.
|
|
222
|
+
*/
|
|
223
|
+
function NothingOpen({ missingId }) {
|
|
224
|
+
if (missingId) {
|
|
225
|
+
return (_jsx("div", { className: "flex h-full items-center justify-center px-6", children: _jsxs("div", { className: "max-w-md text-center", children: [_jsx(Link2Off, { size: 20, className: cn('mx-auto', MUTED) }), _jsx("h2", { className: "mt-2 text-lg font-medium", children: "That dashboard is not here" }), _jsxs("p", { className: cn('mt-1 text-sm', MUTED), children: ["This link named ", _jsx("span", { className: "font-mono text-[12px]", children: missingId }), ", which is not in this catalog \u2014 it may have been deleted, or it may belong to a different environment. No other board was opened in its place. Pick one from the left."] })] }) }));
|
|
226
|
+
}
|
|
227
|
+
return (_jsx("div", { className: "flex h-full items-center justify-center px-6", children: _jsxs("div", { className: "max-w-sm text-center", children: [_jsx("h2", { className: "text-lg font-medium", children: "No dashboard open" }), _jsx("p", { className: cn('mt-1 text-sm', MUTED), children: "Save a query first, then make a dashboard and add it as a card." })] }) }));
|
|
228
|
+
}
|
|
168
229
|
/**
|
|
169
230
|
* A card you can pick up.
|
|
170
231
|
*
|
package/dist/ObjectExplorer.d.ts
CHANGED
|
@@ -6,4 +6,27 @@ export interface ObjectExplorerProps {
|
|
|
6
6
|
backHref?: string;
|
|
7
7
|
backLabel?: string;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* A parameter asked for in the URL, wherever the host keeps it.
|
|
11
|
+
*
|
|
12
|
+
* Both the real query string and the hash's own query, because a console like
|
|
13
|
+
* this is very often hash-routed and `#objects?type=Mvr` leaves
|
|
14
|
+
* `location.search` empty. Reading only one of the two made a link that
|
|
15
|
+
* changed the address and nothing else — the worst kind of broken, because it
|
|
16
|
+
* looks like the click did not register.
|
|
17
|
+
*
|
|
18
|
+
* A convenience, not the contract: hosts that route properly should pass the
|
|
19
|
+
* `type` prop and never depend on this.
|
|
20
|
+
*
|
|
21
|
+
* **Why the other deep-linkable screens import it from here.** This was
|
|
22
|
+
* `typeFromLocation`, private to this file, and it is the only argued precedent
|
|
23
|
+
* in the package for how a screen finds a parameter: prop first, this second,
|
|
24
|
+
* and the prop is what a real host is expected to pass. `QueryConsole` and
|
|
25
|
+
* `DashboardBoard` learned the same trick for `?savedQuery=` and `?dashboard=`,
|
|
26
|
+
* and a second copy of these eight lines would have been a second place for the
|
|
27
|
+
* hash-versus-search rule above to be got wrong. Its home is a screen only
|
|
28
|
+
* because a shared module for it does not exist yet; nothing here knows what an
|
|
29
|
+
* object type is, and it should move the day a third concern needs it.
|
|
30
|
+
*/
|
|
31
|
+
export declare function paramFromLocation(name: string): string | null;
|
|
9
32
|
export declare function ObjectExplorer({ type: typeProp, pageSize, backHref, backLabel, }: ObjectExplorerProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/ObjectExplorer.js
CHANGED
|
@@ -38,7 +38,7 @@ function formatCell(value, type) {
|
|
|
38
38
|
}
|
|
39
39
|
const isNumeric = (type) => type === 'number';
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* A parameter asked for in the URL, wherever the host keeps it.
|
|
42
42
|
*
|
|
43
43
|
* Both the real query string and the hash's own query, because a console like
|
|
44
44
|
* this is very often hash-routed and `#objects?type=Mvr` leaves
|
|
@@ -48,18 +48,28 @@ const isNumeric = (type) => type === 'number';
|
|
|
48
48
|
*
|
|
49
49
|
* A convenience, not the contract: hosts that route properly should pass the
|
|
50
50
|
* `type` prop and never depend on this.
|
|
51
|
+
*
|
|
52
|
+
* **Why the other deep-linkable screens import it from here.** This was
|
|
53
|
+
* `typeFromLocation`, private to this file, and it is the only argued precedent
|
|
54
|
+
* in the package for how a screen finds a parameter: prop first, this second,
|
|
55
|
+
* and the prop is what a real host is expected to pass. `QueryConsole` and
|
|
56
|
+
* `DashboardBoard` learned the same trick for `?savedQuery=` and `?dashboard=`,
|
|
57
|
+
* and a second copy of these eight lines would have been a second place for the
|
|
58
|
+
* hash-versus-search rule above to be got wrong. Its home is a screen only
|
|
59
|
+
* because a shared module for it does not exist yet; nothing here knows what an
|
|
60
|
+
* object type is, and it should move the day a third concern needs it.
|
|
51
61
|
*/
|
|
52
|
-
function
|
|
62
|
+
export function paramFromLocation(name) {
|
|
53
63
|
if (typeof window === 'undefined')
|
|
54
64
|
return null;
|
|
55
|
-
const fromSearch = new URLSearchParams(window.location.search).get(
|
|
65
|
+
const fromSearch = new URLSearchParams(window.location.search).get(name);
|
|
56
66
|
if (fromSearch)
|
|
57
67
|
return fromSearch;
|
|
58
68
|
const hash = window.location.hash;
|
|
59
69
|
const mark = hash.indexOf('?');
|
|
60
70
|
if (mark === -1)
|
|
61
71
|
return null;
|
|
62
|
-
return new URLSearchParams(hash.slice(mark + 1)).get(
|
|
72
|
+
return new URLSearchParams(hash.slice(mark + 1)).get(name);
|
|
63
73
|
}
|
|
64
74
|
export function ObjectExplorer({ type: typeProp, pageSize = 25, backHref, backLabel = 'Catalog', }) {
|
|
65
75
|
const client = useCatalogClient();
|
|
@@ -90,7 +100,7 @@ export function ObjectExplorer({ type: typeProp, pageSize = 25, backHref, backLa
|
|
|
90
100
|
useEffect(() => {
|
|
91
101
|
if (typeName || !snapshot?.types.length)
|
|
92
102
|
return;
|
|
93
|
-
const requested = typeProp ??
|
|
103
|
+
const requested = typeProp ?? paramFromLocation('type');
|
|
94
104
|
const match = snapshot.types.find((t) => t.name === requested);
|
|
95
105
|
setTypeName(match?.name ?? snapshot.types[0].name);
|
|
96
106
|
}, [snapshot, typeName, typeProp]);
|
package/dist/QueryConsole.d.ts
CHANGED
|
@@ -7,5 +7,42 @@ export interface QueryConsoleProps {
|
|
|
7
7
|
*/
|
|
8
8
|
onGenerate?: (prompt: string, schema: CatalogQueryRelation[]) => Promise<string>;
|
|
9
9
|
maxRows?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Which saved query to open in the editor. Omit to fall back to
|
|
12
|
+
* `?savedQuery=` then to the starter SQL.
|
|
13
|
+
*
|
|
14
|
+
* The same shape, and the same reasoning, as `ObjectExplorer`'s `type`: the
|
|
15
|
+
* host is the one that knows where its own router keeps parameters, so it
|
|
16
|
+
* passes what it parsed, and {@link paramFromLocation} is the convenience for
|
|
17
|
+
* a host that does not. A search result naming a saved query has been landing
|
|
18
|
+
* on this screen and stopping since the box shipped, because there was no
|
|
19
|
+
* prop for the id to arrive through.
|
|
20
|
+
*
|
|
21
|
+
* `| undefined` is spelled out rather than left to `?`, because a host
|
|
22
|
+
* compiling under `exactOptionalPropertyTypes` — which the console in this
|
|
23
|
+
* repo does — cannot pass `params.get('savedQuery') ?? undefined` to a bare
|
|
24
|
+
* `?: string` without a spread that exists only to satisfy the compiler. "No
|
|
25
|
+
* saved query named" is a value this prop genuinely takes.
|
|
26
|
+
*/
|
|
27
|
+
savedQueryId?: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Called with whatever is now open, so the host can put it in the address.
|
|
30
|
+
*
|
|
31
|
+
* **Why the write is a callback and the read is not.** Reading a URL is an
|
|
32
|
+
* observation and cannot surprise anybody, which is why the fallback reader
|
|
33
|
+
* above is unconditional. Writing one is an act with effects outside this
|
|
34
|
+
* component's box: whether a selection becomes a history entry you can press
|
|
35
|
+
* Back through or replaces the current one, and whether the address may be
|
|
36
|
+
* touched at all, are decisions belonging to the application that owns the
|
|
37
|
+
* address bar — a console mounted at `/analytics/boards` inside somebody's
|
|
38
|
+
* app should not find a library appending parameters to its URL. So this
|
|
39
|
+
* screen reports, and a host that wants copyable links wires it up. Omit it
|
|
40
|
+
* and nothing writes, which is exactly what every existing host gets.
|
|
41
|
+
*
|
|
42
|
+
* `undefined` means nothing is open — the starter SQL, or a query that was
|
|
43
|
+
* just deleted — and the host should drop the parameter rather than leave it
|
|
44
|
+
* naming something gone.
|
|
45
|
+
*/
|
|
46
|
+
onSavedQueryChange?: (id: string | undefined) => void;
|
|
10
47
|
}
|
|
11
|
-
export declare function QueryConsole({ onGenerate, maxRows }: QueryConsoleProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export declare function QueryConsole({ onGenerate, maxRows, savedQueryId, onSavedQueryChange, }: QueryConsoleProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/QueryConsole.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
3
|
-
import { AlertTriangle, History, Layers, Play, Sparkles, TableIcon } from 'lucide-react';
|
|
4
|
-
import { useMemo, useRef, useState } from 'react';
|
|
5
|
-
import {
|
|
3
|
+
import { AlertTriangle, History, Layers, Link2Off, Play, Sparkles, TableIcon } from 'lucide-react';
|
|
4
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { paramFromLocation } from './ObjectExplorer';
|
|
6
|
+
import { SavedQueryPanel, savedQueryKeys } from './SavedQueryPanel';
|
|
6
7
|
import { cn } from './cn';
|
|
7
8
|
import { useCatalogClient } from './context';
|
|
8
9
|
import { CodeEditor } from './ui/code-editor';
|
|
@@ -37,17 +38,94 @@ function AskAssistantPanel({ prompt, onPromptChange, pending, error, onSubmit, }
|
|
|
37
38
|
onSubmit();
|
|
38
39
|
}, children: [_jsx("input", { value: prompt, onChange: (e) => onPromptChange(e.target.value), placeholder: "Which vehicles gained the most work orders since the last load?", "aria-label": "Describe the query", className: cn('flex-1 rounded-md border px-3 py-1.5 text-sm outline-none', RULE, PANEL, 'focus:border-sky-500 focus:ring-2 focus:ring-sky-500/15') }), _jsx("button", { type: "submit", disabled: pending || prompt.trim().length === 0, className: "rounded-md bg-sky-600 px-3 py-1.5 text-xs text-white disabled:opacity-40", children: pending ? 'Writing…' : 'Write the SQL' })] }), _jsx("p", { className: cn('mt-1.5 text-[11px]', MUTED), children: "It sees the relation and column names above, never the rows. Read the SQL before running it." }), error ? (_jsx("p", { className: "mt-1 text-[11px] text-red-600", children: error instanceof Error ? error.message : 'The assistant could not write that.' })) : null] }));
|
|
39
40
|
}
|
|
40
|
-
export function QueryConsole({ onGenerate, maxRows = 500 }) {
|
|
41
|
+
export function QueryConsole({ onGenerate, maxRows = 500, savedQueryId, onSavedQueryChange, }) {
|
|
41
42
|
const client = useCatalogClient();
|
|
42
43
|
const [sql, setSql] = useState(STARTER);
|
|
43
44
|
const [prompt, setPrompt] = useState('');
|
|
44
45
|
const [askOpen, setAskOpen] = useState(false);
|
|
45
46
|
const editorRef = useRef(null);
|
|
47
|
+
/**
|
|
48
|
+
* The id somebody asked for, and the id actually in the editor.
|
|
49
|
+
*
|
|
50
|
+
* Two pieces of state rather than one, because the gap between them is the
|
|
51
|
+
* whole point: an id that was asked for and never opened is a link naming a
|
|
52
|
+
* query that is not here, and it has to be sayable. Collapsing them would
|
|
53
|
+
* leave "asked for something gone" indistinguishable from "asked for
|
|
54
|
+
* nothing", which is the state that renders as the starter SQL and looks
|
|
55
|
+
* exactly like a click that never landed.
|
|
56
|
+
*/
|
|
57
|
+
const [requestedId, setRequestedId] = useState(null);
|
|
58
|
+
const [openedId, setOpenedId] = useState(null);
|
|
59
|
+
// The prop wins whenever it changes, not only on the first render — a host
|
|
60
|
+
// navigating from one saved query to another sets it, and guarding on "no
|
|
61
|
+
// query open yet" would show the previous one under an address naming the
|
|
62
|
+
// new one. `ObjectExplorer` learned this the same way.
|
|
63
|
+
//
|
|
64
|
+
// The one and only place either source is read. Seeding the state with
|
|
65
|
+
// `savedQueryId ?? null` as well would read the prop twice, which is not just
|
|
66
|
+
// redundant: it makes the first render right even when this effect is wrong,
|
|
67
|
+
// so a build that stopped following the prop would still open the right query
|
|
68
|
+
// on arrival and only misbehave on the second navigation — the harder half of
|
|
69
|
+
// the bug, hidden behind the easier one.
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const requested = savedQueryId ?? paramFromLocation('savedQuery');
|
|
72
|
+
if (requested)
|
|
73
|
+
setRequestedId(requested);
|
|
74
|
+
}, [savedQueryId]);
|
|
46
75
|
const { data: relations = [] } = useQuery({
|
|
47
76
|
queryKey: ['catalog', 'query', 'relations'],
|
|
48
77
|
queryFn: () => client.queryRelations(),
|
|
49
78
|
staleTime: 60_000,
|
|
50
79
|
});
|
|
80
|
+
/**
|
|
81
|
+
* The saved list, read here as well as in the panel below.
|
|
82
|
+
*
|
|
83
|
+
* Same key, so this is a cache hit rather than a second request, and the
|
|
84
|
+
* screen that has to resolve an id into SQL is the one that owns the SQL. The
|
|
85
|
+
* alternative — fetching the single query by id — would be a second endpoint
|
|
86
|
+
* answering something already on screen, and it could not tell "deleted"
|
|
87
|
+
* apart from "the server refused" without reading the failure.
|
|
88
|
+
*/
|
|
89
|
+
const { data: saved, isSuccess: savedLoaded } = useQuery({
|
|
90
|
+
queryKey: savedQueryKeys.all,
|
|
91
|
+
queryFn: () => client.listSavedQueries(),
|
|
92
|
+
});
|
|
93
|
+
function open(query) {
|
|
94
|
+
setSql(query.sql);
|
|
95
|
+
setOpenedId(query.id);
|
|
96
|
+
// Also the requested id, so the "not here" notice clears itself when you
|
|
97
|
+
// pick something that is here — without needing the host to have wired the
|
|
98
|
+
// callback up. A screen whose banner can only be dismissed by a host is a
|
|
99
|
+
// banner that never goes away on the hosts that need it most.
|
|
100
|
+
setRequestedId(query.id);
|
|
101
|
+
onSavedQueryChange?.(query.id);
|
|
102
|
+
}
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!requestedId || !saved)
|
|
105
|
+
return;
|
|
106
|
+
// Already in the editor. Without this, every background refetch of the
|
|
107
|
+
// saved list would hand back a new array, re-run this effect and overwrite
|
|
108
|
+
// whatever has been typed since — the query screen's version of losing
|
|
109
|
+
// your work to a poll.
|
|
110
|
+
if (openedId === requestedId)
|
|
111
|
+
return;
|
|
112
|
+
const match = saved.find((query) => query.id === requestedId);
|
|
113
|
+
if (!match)
|
|
114
|
+
return;
|
|
115
|
+
setSql(match.sql);
|
|
116
|
+
setOpenedId(match.id);
|
|
117
|
+
}, [requestedId, saved, openedId]);
|
|
118
|
+
/**
|
|
119
|
+
* A link that named a saved query this catalog does not have.
|
|
120
|
+
*
|
|
121
|
+
* Only once the list has actually arrived: while it is in flight the id is
|
|
122
|
+
* merely unresolved, and reporting that as missing would flash "not here" on
|
|
123
|
+
* every correct link. Nothing is opened in its place and the address is left
|
|
124
|
+
* exactly as it was — falling back to some other query is what turns a stale
|
|
125
|
+
* link into a working link showing the wrong thing, and quietly rewriting the
|
|
126
|
+
* URL would delete the only evidence of which link is broken.
|
|
127
|
+
*/
|
|
128
|
+
const missingId = requestedId && savedLoaded && !saved.some((q) => q.id === requestedId) ? requestedId : null;
|
|
51
129
|
const run = useMutation({
|
|
52
130
|
mutationFn: () => client.runQuery({ sql, maxRows }),
|
|
53
131
|
});
|
|
@@ -96,7 +174,23 @@ export function QueryConsole({ onGenerate, maxRows = 500 }) {
|
|
|
96
174
|
// Tab still moves focus; indentation is Shift-agnostic two spaces on Enter.
|
|
97
175
|
}
|
|
98
176
|
const error = run.error instanceof Error ? run.error.message : null;
|
|
99
|
-
return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "flex h-full min-h-0", children: [_jsxs("aside", { className: cn('flex w-64 shrink-0 flex-col border-r', RULE, PANEL), children: [_jsx("div", { className: cn('border-b px-3 py-2', RULE), children: _jsx("p", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Relations" }) }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [grouped.length === 0 && (_jsx("p", { className: cn('px-2 py-6 text-center text-xs', MUTED), children: "Nothing has been published yet." })), grouped.map(([objectType, list]) => (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: cn('px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: objectType }), list.map((relation) => (_jsx(RelationRow, { relation: relation, onInsert: insert }, relation.name)))] }, objectType)))] }), _jsx(SavedQueryPanel, { currentSql: sql,
|
|
177
|
+
return (_jsx(TooltipProvider, { children: _jsxs("div", { className: "flex h-full min-h-0", children: [_jsxs("aside", { className: cn('flex w-64 shrink-0 flex-col border-r', RULE, PANEL), children: [_jsx("div", { className: cn('border-b px-3 py-2', RULE), children: _jsx("p", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Relations" }) }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto p-2", children: [grouped.length === 0 && (_jsx("p", { className: cn('px-2 py-6 text-center text-xs', MUTED), children: "Nothing has been published yet." })), grouped.map(([objectType, list]) => (_jsxs("div", { className: "mb-3", children: [_jsx("div", { className: cn('px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: objectType }), list.map((relation) => (_jsx(RelationRow, { relation: relation, onInsert: insert }, relation.name)))] }, objectType)))] }), _jsx(SavedQueryPanel, { currentSql: sql, openId: openedId, onLoad: open })] }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsxs("div", { className: cn('flex shrink-0 items-center gap-2 border-b px-4 py-2', RULE, PANEL), children: [_jsxs("button", { type: "button", onClick: () => run.mutate(), disabled: run.isPending, className: "flex items-center gap-1.5 rounded-md bg-zinc-950 px-3 py-1.5 text-xs text-zinc-50 transition-colors hover:bg-zinc-800 disabled:opacity-50 dark:bg-zinc-100 dark:text-zinc-950", children: [_jsx(Play, { size: 12 }), run.isPending ? 'Running…' : 'Run'] }), _jsx("span", { className: cn('font-mono text-[10px]', MUTED), children: "\u2318\u21B5" }), onGenerate && (_jsxs("button", { type: "button", onClick: () => setAskOpen((open) => !open), className: cn('flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs transition-colors', RULE, 'hover:bg-zinc-50 dark:hover:bg-zinc-800', askOpen && 'bg-sky-100 dark:bg-sky-950'), children: [_jsx(Sparkles, { size: 12 }), "Ask"] })), run.data && (_jsxs("span", { className: cn('ml-auto font-mono text-[11px]', MUTED), children: [run.data.rowCount, " rows \u00B7 ", run.data.cached ? 'cached' : `${run.data.elapsedMs} ms`, run.data.truncated && ' · capped'] }))] }), missingId && _jsx(MissingSavedQuery, { id: missingId }), askOpen && onGenerate && (_jsx(AskAssistantPanel, { prompt: prompt, onPromptChange: setPrompt, pending: generate.isPending, error: generate.error, onSubmit: () => generate.mutate() })), _jsx(SqlEditor, { value: sql, onChange: setSql, onKeyDown: onEditorKeyDown, textareaRef: editorRef }), _jsxs("div", { className: "min-h-0 flex-1 overflow-auto", children: [error && (_jsxs("div", { className: "m-4 flex items-start gap-2 rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300", children: [_jsx(AlertTriangle, { size: 14, className: "mt-0.5 shrink-0" }), _jsx("span", { className: "font-mono leading-relaxed", children: error })] })), run.data && _jsx(ResultTable, { result: run.data }), !run.data && !error && (_jsx("p", { className: cn('p-8 text-center text-sm', MUTED), children: "Results appear here." }))] })] })] }) }));
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* What a link naming a query that is not here gets to say.
|
|
181
|
+
*
|
|
182
|
+
* Above the editor rather than inside the results pane, because it is a
|
|
183
|
+
* statement about how you arrived and not about anything that ran — the results
|
|
184
|
+
* pane still says "Results appear here", which is true.
|
|
185
|
+
*
|
|
186
|
+
* The id is quoted verbatim. It is the only part of a broken link worth
|
|
187
|
+
* anything: whoever sent it can be told which one, and a person looking at two
|
|
188
|
+
* environments can see at a glance that the id belongs to the other. A message
|
|
189
|
+
* that said only "that query is gone" would be asking them to go and read the
|
|
190
|
+
* address bar for it.
|
|
191
|
+
*/
|
|
192
|
+
function MissingSavedQuery({ id }) {
|
|
193
|
+
return (_jsxs("div", { className: cn('flex shrink-0 items-start gap-2 border-b bg-amber-50/70 px-4 py-2', 'text-xs text-amber-800 dark:bg-amber-950/25 dark:text-amber-300', RULE), children: [_jsx(Link2Off, { size: 13, className: "mt-0.5 shrink-0" }), _jsxs("span", { className: "leading-relaxed", children: ["This link named a saved query that is not in this catalog:", ' ', _jsx("span", { className: "font-mono", children: id }), ". It may have been deleted, or it may belong to a different environment. Nothing was opened in its place \u2014 the editor is untouched."] })] }));
|
|
100
194
|
}
|
|
101
195
|
function RelationRow({ relation, onInsert, }) {
|
|
102
196
|
const [open, setOpen] = useState(false);
|
|
@@ -2,7 +2,17 @@ import type { SavedQuery } from '@dudousxd/nestjs-catalog/client';
|
|
|
2
2
|
export declare const savedQueryKeys: {
|
|
3
3
|
all: readonly ["catalog", "saved-queries"];
|
|
4
4
|
};
|
|
5
|
-
export declare function SavedQueryPanel({ currentSql, onLoad, }: {
|
|
5
|
+
export declare function SavedQueryPanel({ currentSql, openId, onLoad, }: {
|
|
6
6
|
currentSql: string;
|
|
7
|
+
/**
|
|
8
|
+
* Which of these is in the editor right now, if any.
|
|
9
|
+
*
|
|
10
|
+
* The visible answer to "what is this address naming". A console that opens a
|
|
11
|
+
* saved query from a link and then shows a list where every row looks
|
|
12
|
+
* identical has told you the SQL came from somewhere without telling you
|
|
13
|
+
* where, and the next thing that happens is somebody saving a second copy of
|
|
14
|
+
* a query they already had open.
|
|
15
|
+
*/
|
|
16
|
+
openId?: string | null;
|
|
7
17
|
onLoad: (query: SavedQuery) => void;
|
|
8
18
|
}): import("react/jsx-runtime").JSX.Element;
|
package/dist/SavedQueryPanel.js
CHANGED
|
@@ -43,7 +43,7 @@ function asChartKind(value) {
|
|
|
43
43
|
// a table is the kind that renders any result.
|
|
44
44
|
return found ?? 'table';
|
|
45
45
|
}
|
|
46
|
-
export function SavedQueryPanel({ currentSql, onLoad, }) {
|
|
46
|
+
export function SavedQueryPanel({ currentSql, openId, onLoad, }) {
|
|
47
47
|
const client = useCatalogClient();
|
|
48
48
|
const queryClient = useQueryClient();
|
|
49
49
|
const [saving, setSaving] = useState(false);
|
|
@@ -113,5 +113,7 @@ export function SavedQueryPanel({ currentSql, onLoad, }) {
|
|
|
113
113
|
] })] }), _jsxs("label", { className: cn('flex items-center gap-1.5 text-[11px]', MUTED), children: [_jsx("input", { type: "checkbox", checked: draft.shared ?? false, onChange: (e) => setDraft({ ...draft, shared: e.target.checked }), className: "accent-sky-500" }), "Let other apps embed this"] }), _jsxs("label", { className: cn('flex items-center gap-1.5 text-[11px]', MUTED), children: [_jsx(Timer, { size: 11 }), "Reuse the result for", _jsx("input", { type: "number", min: 0, value: draft.cacheTtlSeconds ?? 0, onChange: (e) => setDraft({ ...draft, cacheTtlSeconds: Number(e.target.value) }), "aria-label": "Cache seconds", className: cn('w-14 rounded-md border bg-white px-1 py-0.5 text-right text-[11px] outline-none dark:bg-zinc-900', RULE) }), "s"] }), _jsx("button", { type: "submit", disabled: save.isPending || draft.name.trim().length === 0, className: "w-full rounded-md bg-zinc-950 px-2 py-1 text-xs text-zinc-50 disabled:opacity-40 dark:bg-zinc-100 dark:text-zinc-950", children: save.isPending ? 'Saving…' : 'Save this query' }), save.error && (_jsx("p", { className: "text-[11px] text-red-600", children: save.error instanceof Error ? save.error.message : 'Could not save.' }))] })), _jsxs("div", { className: "max-h-64 overflow-y-auto px-2 pb-2", children: [saved.length === 0 && (_jsx("p", { className: cn('px-2 py-3 text-center text-[11px]', MUTED), children: "Nothing saved yet." })), grouped.map(([folder, list]) => (_jsxs("div", { className: "mb-2", children: [_jsx("div", { className: cn('px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: folder }), list.map((query) => (_jsxs("div", { className: "group flex items-center", children: [_jsx(Tooltip, { side: "right", content: query.description ??
|
|
114
114
|
(query.cacheTtlSeconds > 0
|
|
115
115
|
? `Results reused for ${query.cacheTtlSeconds}s.`
|
|
116
|
-
: 'Never cached — runs every time.'), children: _jsxs("button", { type: "button", onClick: () => onLoad(query),
|
|
116
|
+
: 'Never cached — runs every time.'), children: _jsxs("button", { type: "button", onClick: () => onLoad(query), "aria-current": query.id === openId ? 'true' : undefined, className: cn('min-w-0 flex-1 truncate rounded-md px-2 py-1 text-left text-[11px]', query.id === openId
|
|
117
|
+
? 'bg-sky-100 dark:bg-sky-950'
|
|
118
|
+
: 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [query.name, query.cacheTtlSeconds > 0 && (_jsxs("span", { className: cn('ml-1 font-mono text-[9px]', MUTED), children: [query.cacheTtlSeconds, "s"] }))] }) }), query.shared && _jsx(ShareBadge, { shared: true, className: "mr-1" }), _jsx(ShareControl, { layout: "row", kind: "query", shared: query.shared, pending: share.isPending, name: query.name, onChange: (shared) => share.mutate({ id: query.id, shared }), className: cn('opacity-0 group-hover:opacity-100 focus-visible:opacity-100', MUTED) }), _jsx(Tooltip, { content: "Download as CSV", children: _jsx("a", { href: client.exportUrl(query.id), className: cn('rounded-sm p-1 opacity-0 group-hover:opacity-100', MUTED), "aria-label": `Export ${query.name}`, children: _jsx(Download, { size: 11 }) }) }), _jsx("button", { type: "button", onClick: () => remove.mutate(query.id), className: cn('rounded-sm p-1 opacity-0 group-hover:opacity-100 hover:text-red-600', MUTED), "aria-label": `Delete ${query.name}`, children: _jsx(Trash2, { size: 11 }) })] }, query.id)))] }, folder))), share.error !== null && (_jsx("p", { className: "px-2 py-1 text-[11px] text-red-600", children: share.error instanceof Error ? share.error.message : 'Could not change sharing.' }))] })] }));
|
|
117
119
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudousxd/nestjs-catalog-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Ready-made React screens for @dudousxd/nestjs-catalog — a model manager and a generic object explorer you can drop into your own app shell.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Davide Carvalho",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"@tiptap/pm": "3.29.2",
|
|
107
107
|
"tiptap-markdown": "0.9.0",
|
|
108
108
|
"@tiptap/core": "3.29.2",
|
|
109
|
-
"@dudousxd/nestjs-catalog": "0.
|
|
109
|
+
"@dudousxd/nestjs-catalog": "0.10.0"
|
|
110
110
|
},
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"clsx": "2.1.1",
|