Spaces:
Running
Running
Imperfect tooltip for parameters.
Browse files
lynxkite-app/web/src/index.css
CHANGED
@@ -205,6 +205,13 @@ body {
|
|
205 |
display: block;
|
206 |
}
|
207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
.param-name {
|
209 |
display: block;
|
210 |
font-size: 10px;
|
|
|
205 |
display: block;
|
206 |
}
|
207 |
|
208 |
+
.param-name-row {
|
209 |
+
display: flex;
|
210 |
+
flex-direction: row;
|
211 |
+
justify-content: space-between;
|
212 |
+
align-items: end;
|
213 |
+
}
|
214 |
+
|
215 |
.param-name {
|
216 |
display: block;
|
217 |
font-size: 10px;
|
lynxkite-app/web/src/workspace/nodes/LynxKiteNode.tsx
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import { Handle, NodeResizeControl, type Position, useReactFlow } from "@xyflow/react";
|
2 |
import type React from "react";
|
3 |
import { ErrorBoundary } from "react-error-boundary";
|
4 |
-
import Markdown from "react-markdown";
|
5 |
// @ts-ignore
|
6 |
import AlertTriangle from "~icons/tabler/alert-triangle-filled.jsx";
|
7 |
// @ts-ignore
|
@@ -9,9 +8,10 @@ import ChevronDownRight from "~icons/tabler/chevron-down-right.jsx";
|
|
9 |
// @ts-ignore
|
10 |
import Dots from "~icons/tabler/dots.jsx";
|
11 |
// @ts-ignore
|
12 |
-
import Help from "~icons/tabler/
|
13 |
// @ts-ignore
|
14 |
import Skull from "~icons/tabler/skull.jsx";
|
|
|
15 |
|
16 |
interface LynxKiteNodeProps {
|
17 |
id: string;
|
@@ -100,7 +100,11 @@ function LynxKiteNodeComponent(props: LynxKiteNodeProps) {
|
|
100 |
<Dots />
|
101 |
</span>
|
102 |
)}
|
103 |
-
<NodeDocumentation doc={data.meta?.value?.doc} width={props.width - 60}
|
|
|
|
|
|
|
|
|
104 |
</div>
|
105 |
{expanded && (
|
106 |
<>
|
@@ -154,19 +158,3 @@ export default function LynxKiteNode(Component: React.ComponentType<any>) {
|
|
154 |
);
|
155 |
};
|
156 |
}
|
157 |
-
|
158 |
-
function NodeDocumentation(props: any) {
|
159 |
-
if (!props.doc) return null;
|
160 |
-
return (
|
161 |
-
<div className="dropdown dropdown-hover dropdown-top dropdown-end title-icon">
|
162 |
-
<button tabIndex={0}>
|
163 |
-
<Help />
|
164 |
-
</button>
|
165 |
-
<div className="node-documentation dropdown-content" style={{ width: props.width }}>
|
166 |
-
{props.doc.map(
|
167 |
-
(section: any) => section.kind === "text" && <Markdown>{section.value}</Markdown>,
|
168 |
-
)}
|
169 |
-
</div>
|
170 |
-
</div>
|
171 |
-
);
|
172 |
-
}
|
|
|
1 |
import { Handle, NodeResizeControl, type Position, useReactFlow } from "@xyflow/react";
|
2 |
import type React from "react";
|
3 |
import { ErrorBoundary } from "react-error-boundary";
|
|
|
4 |
// @ts-ignore
|
5 |
import AlertTriangle from "~icons/tabler/alert-triangle-filled.jsx";
|
6 |
// @ts-ignore
|
|
|
8 |
// @ts-ignore
|
9 |
import Dots from "~icons/tabler/dots.jsx";
|
10 |
// @ts-ignore
|
11 |
+
import Help from "~icons/tabler/question-mark.jsx";
|
12 |
// @ts-ignore
|
13 |
import Skull from "~icons/tabler/skull.jsx";
|
14 |
+
import NodeDocumentation from "./NodeDocumentation";
|
15 |
|
16 |
interface LynxKiteNodeProps {
|
17 |
id: string;
|
|
|
100 |
<Dots />
|
101 |
</span>
|
102 |
)}
|
103 |
+
<NodeDocumentation doc={data.meta?.value?.doc} width={props.width - 60}>
|
104 |
+
<button tabIndex={0}>
|
105 |
+
<Help />
|
106 |
+
</button>
|
107 |
+
</NodeDocumentation>
|
108 |
</div>
|
109 |
{expanded && (
|
110 |
<>
|
|
|
158 |
);
|
159 |
};
|
160 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lynxkite-app/web/src/workspace/nodes/NodeDocumentation.tsx
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import Markdown from "react-markdown";
|
2 |
+
|
3 |
+
export default function NodeDocumentation(props: any) {
|
4 |
+
if (!props.doc) return null;
|
5 |
+
return (
|
6 |
+
<div className="dropdown dropdown-hover dropdown-top dropdown-end title-icon">
|
7 |
+
{props.children}
|
8 |
+
<div className="node-documentation dropdown-content" style={{ width: props.width }}>
|
9 |
+
{props.doc.map?.(
|
10 |
+
(section: any, i: number) =>
|
11 |
+
section.kind === "text" && <Markdown key={i}>{section.value}</Markdown>,
|
12 |
+
) ?? <Markdown>{props.doc}</Markdown>}
|
13 |
+
</div>
|
14 |
+
</div>
|
15 |
+
);
|
16 |
+
}
|
lynxkite-app/web/src/workspace/nodes/NodeParameter.tsx
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
import { useRef } from "react";
|
2 |
// @ts-ignore
|
3 |
import ArrowsHorizontal from "~icons/tabler/arrows-horizontal.jsx";
|
|
|
|
|
|
|
4 |
import NodeGroupParameter from "./NodeGroupParameter";
|
5 |
|
6 |
const BOOLEAN = "<class 'bool'>";
|
@@ -9,8 +12,21 @@ const MODEL_TRAINING_INPUT_MAPPING =
|
|
9 |
const MODEL_INFERENCE_INPUT_MAPPING =
|
10 |
"<class 'lynxkite_graph_analytics.ml_ops.ModelInferenceInputMapping'>";
|
11 |
const MODEL_OUTPUT_MAPPING = "<class 'lynxkite_graph_analytics.ml_ops.ModelOutputMapping'>";
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
}
|
15 |
|
16 |
function Input({
|
@@ -195,7 +211,20 @@ interface NodeParameterProps {
|
|
195 |
|
196 |
export type UpdateOptions = { delay?: number };
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
export default function NodeParameter({ name, value, meta, data, setParam }: NodeParameterProps) {
|
|
|
199 |
function onChange(value: any, opts?: UpdateOptions) {
|
200 |
setParam(meta.name, value, opts || {});
|
201 |
}
|
@@ -261,7 +290,7 @@ export default function NodeParameter({ name, value, meta, data, setParam }: Nod
|
|
261 |
</label>
|
262 |
) : (
|
263 |
<label className="param">
|
264 |
-
<ParamName name={name} />
|
265 |
<Input value={value} onChange={onChange} />
|
266 |
</label>
|
267 |
);
|
|
|
1 |
import { useRef } from "react";
|
2 |
// @ts-ignore
|
3 |
import ArrowsHorizontal from "~icons/tabler/arrows-horizontal.jsx";
|
4 |
+
// @ts-ignore
|
5 |
+
import Help from "~icons/tabler/question-mark.jsx";
|
6 |
+
import NodeDocumentation from "./NodeDocumentation";
|
7 |
import NodeGroupParameter from "./NodeGroupParameter";
|
8 |
|
9 |
const BOOLEAN = "<class 'bool'>";
|
|
|
12 |
const MODEL_INFERENCE_INPUT_MAPPING =
|
13 |
"<class 'lynxkite_graph_analytics.ml_ops.ModelInferenceInputMapping'>";
|
14 |
const MODEL_OUTPUT_MAPPING = "<class 'lynxkite_graph_analytics.ml_ops.ModelOutputMapping'>";
|
15 |
+
|
16 |
+
function ParamName({ name, doc }: { name: string; doc: string }) {
|
17 |
+
const help = doc && (
|
18 |
+
<NodeDocumentation doc={doc} width={200}>
|
19 |
+
<button tabIndex={0}>
|
20 |
+
<Help />
|
21 |
+
</button>
|
22 |
+
</NodeDocumentation>
|
23 |
+
);
|
24 |
+
return (
|
25 |
+
<div className="param-name-row">
|
26 |
+
<span className="param-name bg-base-200">{name.replace(/_/g, " ")}</span>
|
27 |
+
{help}
|
28 |
+
</div>
|
29 |
+
);
|
30 |
}
|
31 |
|
32 |
function Input({
|
|
|
211 |
|
212 |
export type UpdateOptions = { delay?: number };
|
213 |
|
214 |
+
function findDocs(docs: any, parameter: string) {
|
215 |
+
for (const sec of docs) {
|
216 |
+
if (sec.kind === "parameters") {
|
217 |
+
for (const p of sec.value) {
|
218 |
+
if (p.name === parameter) {
|
219 |
+
return p.description;
|
220 |
+
}
|
221 |
+
}
|
222 |
+
}
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
export default function NodeParameter({ name, value, meta, data, setParam }: NodeParameterProps) {
|
227 |
+
const doc = findDocs(data.meta?.value?.doc ?? [], name);
|
228 |
function onChange(value: any, opts?: UpdateOptions) {
|
229 |
setParam(meta.name, value, opts || {});
|
230 |
}
|
|
|
290 |
</label>
|
291 |
) : (
|
292 |
<label className="param">
|
293 |
+
<ParamName name={name} doc={doc} />
|
294 |
<Input value={value} onChange={onChange} />
|
295 |
</label>
|
296 |
);
|