Louis Young aab4183d65
feat(runtime): flowgram workflow node.js runtime (#304)
* feat(runtime): init nodejs runtime

* feat(runtime): init folder struct

* feat(runtime): interface & test

* feat(runtime): basic api & schema interfaces

* feat(runtime): init runtime model framework

* feat(runtime): create document & node entities

* feat(runtime): runtime engine basic execute logic

* feat(runtime): node add variable data

* refactor(runtime): split to sub domains

* test(runtime): document module test

* feat(runtime): variable store

* feat(runtime): workflow runtime executor

* chore(demo): reset initial data

* feat(runtime): workflow runtime branch logic

* feat(runtime): workflow runtime access to ai model

* feat(runtime): workflow runtime data all add to context

* feat(runtime): workflow runtime invoke record snaphots

* feat(runtime): workflow runtime status

* feat(runtime): main api request processing chain

* chore(demo): reset initial data

* refactor(runtime): types move to interface package

* feat(runtime): router access api defines & interfaces

* feat(runtime): standardize api register & gen api docs

* feat(runtime): create snapshot before node execute

* fix(sub-canvas): tips cannot close

* chore(demo): reset initial data

* feat(demo): make node schema runnable

* feat(demo): access test run

* feat(runtime): runtime core can run in both browser & server env

* fix(runtime): condition value empty issue

* feat(runtime): beautify structure data view

* feat(demo): test run sidesheet

* chore(demo): test run sidesheet button fixed

* feat(demo): running node show flowing line

* chore(demo): hide node result overflow

* chore(demo): reset initial data

* feat(runtime): workflow runtime support loop node

* fix(container): sub canvas height issue

* feat(demo): test run multiple result render

* test(runtime): enbale test coverage

* refactor(runtime): interface folders structure

* refactor(runtime): core folders structure

* refactor(runtime): core export apis & access to router

* feat(demo): runtime plugin

* feat(runtime): server add try-catch protection

* fix(runtime): node process reset end time

* chore: format json

* chore: rush update

* refactor(demo): running service move to runtime-plugin as built-in runtime service

* fix(runtime): build error

* test(runtime): disable nodejs test

* fix(demo): test run result key indent width
2025-06-09 09:13:24 +00:00

62 lines
1.5 KiB
TypeScript

import { FC, useState } from 'react';
import { IconSmallTriangleDown } from '@douyinfe/semi-icons';
import { DataStructureViewer } from '../viewer';
import './index.css';
import { Tag } from '@douyinfe/semi-ui';
interface NodeStatusGroupProps {
title: string;
data: unknown;
optional?: boolean;
disableCollapse?: boolean;
}
const isObjectHasContent = (obj: any = {}): boolean => Object.keys(obj).length > 0;
export const NodeStatusGroup: FC<NodeStatusGroupProps> = ({
title,
data,
optional = false,
disableCollapse = false,
}) => {
const hasContent = isObjectHasContent(data);
const [isExpanded, setIsExpanded] = useState(true);
if (optional && !hasContent) {
return null;
}
return (
<>
<div className="node-status-group" onClick={() => hasContent && setIsExpanded(!isExpanded)}>
{!disableCollapse && (
<IconSmallTriangleDown
style={{
transform: isExpanded ? 'rotate(0deg)' : 'rotate(-90deg)',
transition: 'transform 0.2s',
cursor: 'pointer',
marginRight: '4px',
opacity: hasContent ? 1 : 0,
}}
/>
)}
<span>{title}:</span>
{!hasContent && (
<Tag
size="small"
style={{
marginLeft: 4,
}}
>
null
</Tag>
)}
</div>
{hasContent && isExpanded ? <DataStructureViewer data={data} /> : null}
</>
);
};