Merge pull request #809 from SuanmoSuanyangTechnology/feature/ui_upgrade_zy

Feature/UI upgrade zy
This commit is contained in:
yingzhao
2026-04-07 23:26:45 +08:00
committed by GitHub
4 changed files with 41 additions and 11 deletions

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing * @Author: ZhaoYing
* @Date: 2026-02-03 16:25:37 * @Date: 2026-02-03 16:25:37
* @Last Modified by: ZhaoYing * @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-24 11:47:27 * @Last Modified time: 2026-04-07 22:35:08
*/ */
/** /**
* Knowledge Configuration Modal * Knowledge Configuration Modal
@@ -32,7 +32,9 @@ interface KnowledgeConfigModalProps {
/** /**
* Available retrieval types * Available retrieval types
*/ */
const retrieveTypes: RetrieveType[] = ['participle', 'semantic', 'hybrid', 'graph'] const retrieveTypes: RetrieveType[] = ['participle', 'semantic', 'hybrid',
// 'graph'
]
/** /**
* Modal for configuring knowledge base retrieval settings * Modal for configuring knowledge base retrieval settings

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing * @Author: ZhaoYing
* @Date: 2026-02-03 17:28:07 * @Date: 2026-02-03 17:28:07
* @Last Modified by: ZhaoYing * @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-11 14:57:55 * @Last Modified time: 2026-04-07 23:23:04
*/ */
/** /**
* Top Card List Component * Top Card List Component
@@ -62,8 +62,8 @@ const TopCardList: FC<{data?: DashboardData}> = ({ data }) => {
'rb:text-[#FF5D34]': data?.[`${item.key}_change` as keyof DashboardData] && data?.[`${item.key}_change` as keyof DashboardData] < 0, 'rb:text-[#FF5D34]': data?.[`${item.key}_change` as keyof DashboardData] && data?.[`${item.key}_change` as keyof DashboardData] < 0,
'rb:text-[#369F21]': !data?.[`${item.key}_change` as keyof DashboardData] || data?.[`${item.key}_change` as keyof DashboardData] >= 0, 'rb:text-[#369F21]': !data?.[`${item.key}_change` as keyof DashboardData] || data?.[`${item.key}_change` as keyof DashboardData] >= 0,
})}> })}>
{data?.[`${item.key}_change` as keyof DashboardData] && data?.[item.key as keyof DashboardData] > 0 {data?.[`${item.key}_change` as keyof DashboardData] && typeof data?.[item.key as keyof DashboardData] === 'number'
? (100 * data?.[`${item.key}_change` as keyof DashboardData] / data?.[item.key as keyof DashboardData]).toFixed(2) ? (100 * data?.[`${item.key}_change` as keyof DashboardData]).toFixed(2)
: 0 : 0
}% }%
<div className={clsx("rb:size-3.5 rb:cursor-pointer rb:bg-cover", { <div className={clsx("rb:size-3.5 rb:cursor-pointer rb:bg-cover", {

View File

@@ -12,7 +12,9 @@ const FormItem = Form.Item;
interface KnowledgeConfigModalProps { interface KnowledgeConfigModalProps {
refresh: (values: KnowledgeConfigForm, type: 'knowledgeConfig') => void; refresh: (values: KnowledgeConfigForm, type: 'knowledgeConfig') => void;
} }
const retrieveTypes: RetrieveType[] = ['participle', 'semantic', 'hybrid', 'graph'] const retrieveTypes: RetrieveType[] = ['participle', 'semantic', 'hybrid',
// 'graph'
]
const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfigModalProps>(({ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfigModalProps>(({
refresh, refresh,

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing * @Author: ZhaoYing
* @Date: 2026-02-03 15:17:48 * @Date: 2026-02-03 15:17:48
* @Last Modified by: ZhaoYing * @Last Modified by: ZhaoYing
* @Last Modified time: 2026-04-07 20:56:46 * @Last Modified time: 2026-04-07 23:17:50
*/ */
import { useRef, useEffect, useState } from 'react'; import { useRef, useEffect, useState } from 'react';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
@@ -444,7 +444,12 @@ export const useWorkflowGraph = ({
setTimeout(() => { setTimeout(() => {
if (graphRef.current) { if (graphRef.current) {
graphRef.current.centerContent() graphRef.current.centerContent()
graphRef.current.getNodes().forEach(node => node.toFront()); // graphRef.current.getNodes().forEach(node => node.toFront());
// Bring edges to front first, then child nodes above edges; parent nodes stay behind
graphRef.current.getEdges().forEach(edge => edge.toFront());
graphRef.current.getNodes().forEach(node => {
if (node.getData()?.cycle) node.toFront();
});
} }
}, 200) }, 200)
} }
@@ -915,12 +920,13 @@ export const useWorkflowGraph = ({
if (!view) return null if (!view) return null
const cell = view.cell const cell = view.cell
if (cell.isNode()) { if (cell.isNode()) {
// Parent (iteration/loop) nodes are not restricted
if (cell.getData()?.type === 'iteration' || cell.getData()?.type === 'loop') return null
const parent = cell.getParent() const parent = cell.getParent()
if (parent) { if (parent) {
return parent.getBBox() return parent.getBBox()
} }
} }
return null return null
}, },
}, },
@@ -1022,10 +1028,30 @@ export const useWorkflowGraph = ({
graphRef.current.on('scale', scaleEvent); graphRef.current.on('scale', scaleEvent);
// Listen to node move event // Listen to node move event
graphRef.current.on('node:moved', nodeMoved); graphRef.current.on('node:moved', nodeMoved);
// When parent (isGroup) node position changes, move children with it
graphRef.current.on('node:change:position', ({ node, current, previous }: { node: Node; current: { x: number; y: number }; previous: { x: number; y: number } }) => {
if (!(node.getData()?.type === 'iteration' && node.getData()?.type === 'loop') || !current || !previous) return;
const dx = current.x - previous.x;
const dy = current.y - previous.y;
const parentId = node.getData()?.id || node.id;
graphRef.current?.getNodes().forEach(child => {
if (child.getData()?.cycle === parentId) {
const cp = child.getPosition();
child.setPosition(cp.x + dx, cp.y + dy, { silent: true });
}
});
});
graphRef.current.on('node:removed', blankClick) graphRef.current.on('node:removed', blankClick)
// When edge connected, bring connected nodes' ports to front // When edge connected, bring connected nodes' ports to front
graphRef.current.on('edge:connected', ({ isNew }) => { graphRef.current.on('edge:connected', ({ isNew, edge }) => {
graphRef.current?.getNodes().forEach(node => node.toFront()); // Bring edge to front first, then bring child nodes above edges
// Parent (loop/iteration) nodes stay behind to avoid covering edges
edge.toFront();
graphRef.current?.getNodes().forEach(node => {
if (node.getData()?.cycle) node.toFront();
});
// Reset any port hover state left from dragging // Reset any port hover state left from dragging
if (isNew) { if (isNew) {
graphRef.current?.getNodes().forEach(node => { graphRef.current?.getNodes().forEach(node => {