Skip to content

Commit 68b9110

Browse files
committed
Fix storybook
1 parent e51b326 commit 68b9110

File tree

3 files changed

+17
-23
lines changed

3 files changed

+17
-23
lines changed

src/components/graph/RelationsGraph.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { ResultViewWrapper } from "@/components/graph/ResultViewWrapper"
2020
import { ResultViewProps } from "@elastic/react-search-ui-views"
2121

2222
/**
23-
* Renders an interactive graph for the specified RelationNodes.
23+
* Renders an interactive graph for the specified results. Results will be fetched from cache via PID. Currently intended for internal use only.
2424
*/
2525
export function RelationsGraph(props: { base: string; referencedBy: string[]; references: string[]; resultView: ComponentType<ResultViewProps> }) {
2626
const getFromCache = useStore(resultCache, (s) => s.get)

src/stories/GenericResultView.stories.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ export default meta
1515

1616
type Story = StoryObj<typeof meta>
1717

18+
const emptyConfig = { host: "", indices: [] }
19+
1820
export const Simple: Story = {
1921
decorators: [
2022
(Story) => (
2123
<TooltipProvider>
22-
<GlobalModalProvider resultView={GenericResultView}>
24+
<GlobalModalProvider resultView={(props) => <GenericResultView {...props} {...Simple.args} config={emptyConfig} />}>
2325
<div>
2426
<Story />
2527
</div>
@@ -35,15 +37,16 @@ export const Simple: Story = {
3537
titleField: "title",
3638
descriptionField: "description",
3739
imageField: undefined,
38-
invertImageInDarkMode: true
40+
invertImageInDarkMode: true,
41+
config: emptyConfig
3942
}
4043
}
4144

4245
export const MultipleImages: Story = {
4346
decorators: [
4447
(Story) => (
4548
<TooltipProvider>
46-
<GlobalModalProvider resultView={GenericResultView}>
49+
<GlobalModalProvider resultView={(props) => <GenericResultView {...props} {...MultipleImages.args} config={emptyConfig} />}>
4750
<div>
4851
<Story />
4952
</div>
@@ -66,15 +69,16 @@ export const MultipleImages: Story = {
6669
titleField: "title",
6770
descriptionField: "description",
6871
invertImageInDarkMode: true,
69-
imageField: "images"
72+
imageField: "images",
73+
config: emptyConfig
7074
}
7175
}
7276

7377
export const Full: Story = {
7478
decorators: [
7579
(Story) => (
7680
<TooltipProvider>
77-
<GlobalModalProvider resultView={GenericResultView}>
81+
<GlobalModalProvider resultView={(props) => <GenericResultView {...props} {...Full.args} config={{ host: "", indices: [] }} />}>
7882
<div>
7983
<Story />
8084
</div>
@@ -160,6 +164,7 @@ export const Full: Story = {
160164
field: "stringArrayTest",
161165
singleValueMapper: (v) => v.toUpperCase()
162166
}
163-
]
167+
],
168+
config: emptyConfig
164169
}
165170
}
Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { Meta, StoryObj } from "@storybook/react"
2-
3-
import { BasicRelationNode } from "@/lib/RelationNode"
42
import { ReactFlowProvider } from "@xyflow/react"
53
import { RelationsGraph } from "@/components/graph/RelationsGraph"
4+
import { GenericResultView } from "@/components/result"
65

76
const meta = {
87
component: RelationsGraph,
@@ -24,19 +23,9 @@ export const Default: Story = {
2423
)
2524
],
2625
args: {
27-
referencedBy: [
28-
new BasicRelationNode("T10/parentA", "Parent"),
29-
new BasicRelationNode("T10/parentB", "Parent"),
30-
new BasicRelationNode("T10/parentC", "Source")
31-
],
32-
base: new BasicRelationNode("T10/436895408650943, abcde", "Current", "", true),
33-
references: [
34-
new BasicRelationNode("T10/436895408650941", "Dataset", "Something else"),
35-
new BasicRelationNode("T10/436895408650942", "Dataset"),
36-
new BasicRelationNode("T10/436895408650944", "Dataset"),
37-
new BasicRelationNode("T10/436895408650945", "Dataset", "Another example"),
38-
new BasicRelationNode("T10/436895408650946", "Dataset"),
39-
new BasicRelationNode("T10/436895408650947", "Dataset")
40-
]
26+
referencedBy: ["a", "b", "c"],
27+
base: "self",
28+
references: ["1", "2", "3", "4", "5"],
29+
resultView: (props) => <GenericResultView {...props} config={{ host: "", indices: [] }} />
4130
}
4231
}

0 commit comments

Comments
 (0)