fix(ui): pass onNodeAction to diagram components to restore context menu
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
import { useState, useMemo, useCallback, useRef } from 'react';
|
import { useState, useMemo, useCallback, useRef } from 'react';
|
||||||
import { useParams } from 'react-router';
|
import { useParams, useNavigate } from 'react-router';
|
||||||
import { useGlobalFilters } from '@cameleer/design-system';
|
import { useGlobalFilters } from '@cameleer/design-system';
|
||||||
import { useExecutionDetail } from '../../api/queries/executions';
|
import { useExecutionDetail } from '../../api/queries/executions';
|
||||||
import { useDiagramByRoute } from '../../api/queries/diagrams';
|
import { useDiagramByRoute } from '../../api/queries/diagrams';
|
||||||
import { useRouteCatalog } from '../../api/queries/catalog';
|
import { useRouteCatalog } from '../../api/queries/catalog';
|
||||||
|
import type { NodeAction } from '../../components/ProcessDiagram/types';
|
||||||
import { ExchangeHeader } from './ExchangeHeader';
|
import { ExchangeHeader } from './ExchangeHeader';
|
||||||
import { ExecutionDiagram } from '../../components/ExecutionDiagram/ExecutionDiagram';
|
import { ExecutionDiagram } from '../../components/ExecutionDiagram/ExecutionDiagram';
|
||||||
import { ProcessDiagram } from '../../components/ProcessDiagram';
|
import { ProcessDiagram } from '../../components/ProcessDiagram';
|
||||||
@@ -78,6 +79,7 @@ interface DiagramPanelProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function DiagramPanel({ appId, routeId, exchangeId }: DiagramPanelProps) {
|
function DiagramPanel({ appId, routeId, exchangeId }: DiagramPanelProps) {
|
||||||
|
const navigate = useNavigate();
|
||||||
const { timeRange } = useGlobalFilters();
|
const { timeRange } = useGlobalFilters();
|
||||||
const timeFrom = timeRange.start.toISOString();
|
const timeFrom = timeRange.start.toISOString();
|
||||||
const timeTo = timeRange.end.toISOString();
|
const timeTo = timeRange.end.toISOString();
|
||||||
@@ -98,6 +100,12 @@ function DiagramPanel({ appId, routeId, exchangeId }: DiagramPanelProps) {
|
|||||||
return ids;
|
return ids;
|
||||||
}, [catalog]);
|
}, [catalog]);
|
||||||
|
|
||||||
|
const handleNodeAction = useCallback((nodeId: string, action: NodeAction) => {
|
||||||
|
if (action === 'configure-tap') {
|
||||||
|
navigate(`/admin/appconfig?app=${encodeURIComponent(appId)}&processor=${encodeURIComponent(nodeId)}`);
|
||||||
|
}
|
||||||
|
}, [appId, navigate]);
|
||||||
|
|
||||||
if (exchangeId && detail) {
|
if (exchangeId && detail) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -106,6 +114,7 @@ function DiagramPanel({ appId, routeId, exchangeId }: DiagramPanelProps) {
|
|||||||
executionId={exchangeId}
|
executionId={exchangeId}
|
||||||
executionDetail={detail}
|
executionDetail={detail}
|
||||||
knownRouteIds={knownRouteIds}
|
knownRouteIds={knownRouteIds}
|
||||||
|
onNodeAction={handleNodeAction}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -118,6 +127,7 @@ function DiagramPanel({ appId, routeId, exchangeId }: DiagramPanelProps) {
|
|||||||
routeId={routeId}
|
routeId={routeId}
|
||||||
diagramLayout={diagramQuery.data}
|
diagramLayout={diagramQuery.data}
|
||||||
knownRouteIds={knownRouteIds}
|
knownRouteIds={knownRouteIds}
|
||||||
|
onNodeAction={handleNodeAction}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user