update README
This commit is contained in:
1 parent
907956fbfe
commit
de5e70e084
4 files changed
+44
-10
No files matched your search
@@ -35,10 +35,14 @@ export interface NodeDef {
|
|||||||
| "enum?"
|
| "enum?"
|
||||||
| "string"
|
| "string"
|
||||||
| "string?"
|
| "string?"
|
||||||
|
| "json"
|
||||||
|
| "json?"
|
||||||
| "code"
|
| "code"
|
||||||
| "code?";
|
| "code?";
|
||||||
desc: string;
|
desc: string;
|
||||||
default?: unknown;
|
default?: unknown;
|
||||||
|
/** Input `value`, only one is allowed between `value` and this arg.*/
|
||||||
|
oneof?: string;
|
||||||
options?: { name: string; value: unknown }[];
|
options?: { name: string; value: unknown }[];
|
||||||
}[];
|
}[];
|
||||||
status?:
|
status?:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { EditNode, EditTree, useWorkspace } from "@/contexts/workspace-context";
|
import { EditNode, EditTree, useWorkspace } from "@/contexts/workspace-context";
|
||||||
import { NodeArg, NodeArgType, NodeModel, TreeGraphData } from "@/misc/b3type";
|
import { NodeArg, NodeModel, TreeGraphData } from "@/misc/b3type";
|
||||||
import { checkOneof } from "@/misc/b3util";
|
import { checkOneof } from "@/misc/b3util";
|
||||||
import { Hotkey, isMacos } from "@/misc/keys";
|
import { Hotkey, isMacos } from "@/misc/keys";
|
||||||
import { EditOutlined } from "@ant-design/icons";
|
import { EditOutlined } from "@ant-design/icons";
|
||||||
@@ -388,7 +388,7 @@ const NodeInspector: FC = () => {
|
|||||||
</Divider>
|
</Divider>
|
||||||
{def.args.map((v) => {
|
{def.args.map((v) => {
|
||||||
const required = v.type.indexOf("?") === -1;
|
const required = v.type.indexOf("?") === -1;
|
||||||
const type = v.type.replace("?", "") as NodeArgType;
|
const type = v.type.replace("?", "") as NodeArg["type"];
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={`args.${v.name}`}
|
name={`args.${v.name}`}
|
||||||
|
|||||||
+36
-6
@@ -1,6 +1,5 @@
|
|||||||
import { TreeGraphData as G6TreeGraphData } from "@antv/g6";
|
import { TreeGraphData as G6TreeGraphData } from "@antv/g6";
|
||||||
|
|
||||||
export type NodeArgType = "boolean" | "string" | "int" | "float" | "json" | "enum" | "code";
|
|
||||||
export type NodeType = "Action" | "Composite" | "Decorator" | "Condition" | "Other" | "Error";
|
export type NodeType = "Action" | "Composite" | "Decorator" | "Condition" | "Other" | "Error";
|
||||||
|
|
||||||
export interface NodeArgOption {
|
export interface NodeArgOption {
|
||||||
@@ -10,7 +9,21 @@ export interface NodeArgOption {
|
|||||||
|
|
||||||
export interface NodeArg {
|
export interface NodeArg {
|
||||||
name: string;
|
name: string;
|
||||||
type: NodeArgType | `${NodeArgType}?`;
|
type:
|
||||||
|
| "boolean"
|
||||||
|
| "boolean?"
|
||||||
|
| "int"
|
||||||
|
| "int?"
|
||||||
|
| "float"
|
||||||
|
| "float?"
|
||||||
|
| "string"
|
||||||
|
| "string?"
|
||||||
|
| "json"
|
||||||
|
| "json?"
|
||||||
|
| "enum"
|
||||||
|
| "enum?"
|
||||||
|
| "code"
|
||||||
|
| "code?";
|
||||||
desc: string;
|
desc: string;
|
||||||
oneof?: string;
|
oneof?: string;
|
||||||
default?: unknown;
|
default?: unknown;
|
||||||
@@ -29,10 +42,27 @@ export interface NodeDef {
|
|||||||
doc?: string;
|
doc?: string;
|
||||||
color?: string;
|
color?: string;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
status?: Exclude<
|
/**
|
||||||
`${Status}` | `!${Status}` | `|${Status}` | `&${Status}`,
|
* + `!success` !(child_success|child_success|...)
|
||||||
"!running" | "&running"
|
* + `!failure` !(child_failure|child_failure|...)
|
||||||
>[];
|
* + `|success` child_success|child_success|...
|
||||||
|
* + `|failure` child_failure|child_failure|...
|
||||||
|
* + `|running` child_running|child_running|...
|
||||||
|
* + `&success` child_success&child_success&...
|
||||||
|
* + `&failure` child_failure&child_failure&...
|
||||||
|
*/
|
||||||
|
status?: (
|
||||||
|
| "success"
|
||||||
|
| "failure"
|
||||||
|
| "running"
|
||||||
|
| "!success"
|
||||||
|
| "!failure"
|
||||||
|
| "|success"
|
||||||
|
| "|failure"
|
||||||
|
| "|running"
|
||||||
|
| "&success"
|
||||||
|
| "&failure"
|
||||||
|
)[];
|
||||||
children?: -1 | 0 | 1;
|
children?: -1 | 0 | 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { useWorkspace } from "@/contexts/workspace-context";
|
import { useWorkspace } from "@/contexts/workspace-context";
|
||||||
import { NodeArg, NodeArgType, NodeDef, NodeModel, TreeGraphData, TreeModel } from "@/misc/b3type";
|
import { NodeArg, NodeDef, NodeModel, TreeGraphData, TreeModel } from "@/misc/b3type";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import { message } from "./hooks";
|
import { message } from "./hooks";
|
||||||
import Path from "./path";
|
import Path from "./path";
|
||||||
@@ -79,7 +79,7 @@ const checkNodeArg = (
|
|||||||
) => {
|
) => {
|
||||||
let hasError = false;
|
let hasError = false;
|
||||||
const arg = conf.args![i] as NodeArg;
|
const arg = conf.args![i] as NodeArg;
|
||||||
const type = arg.type.replace("?", "") as NodeArgType;
|
const type = arg.type.replace("?", "") as NodeArg["type"];
|
||||||
const value = data.args?.[arg.name];
|
const value = data.args?.[arg.name];
|
||||||
if (type === "float") {
|
if (type === "float") {
|
||||||
const isNumber = typeof value === "number";
|
const isNumber = typeof value === "number";
|
||||||
|
|||||||
Reference in new issue
Block a user