feat: open console on scan launch

This commit is contained in:
dextmorgn
2025-10-18 11:36:41 +02:00
parent 50cc233c72
commit 04d3986417
7 changed files with 10 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

View File

@@ -9,11 +9,9 @@ import { type CosmosInputNode } from '@cosmograph/cosmos'
import { ResizablePanel, ResizablePanelGroup } from '../ui/resizable'
import EmptyState from './empty-state'
// Lazy loading du timeline
const CosmographTimeline = lazy(() =>
import('@cosmograph/react').then((module) => ({ default: module.CosmographTimeline }))
)
// Hook pour tracker l'état de chargement de Cosmograph
const useCosmographLoader = (nodes: any[], edges: any[]) => {
const [isCosmographReady, setIsCosmographReady] = useState(true)
const [loadingStage, setLoadingStage] = useState<'importing' | 'rendering' | 'ready'>('ready')
@@ -21,7 +19,6 @@ const useCosmographLoader = (nodes: any[], edges: any[]) => {
const dataVersionRef = useRef(0)
useEffect(() => {
// Reset l'état quand les données changent
dataVersionRef.current += 1
setIsCosmographReady(false)
setLoadingStage('importing')
@@ -30,7 +27,6 @@ const useCosmographLoader = (nodes: any[], edges: any[]) => {
setLoadingStage('ready')
return
}
// Skip simulation if no edges
if (edges.length === 0) {
setIsCosmographReady(true)
setLoadingStage('ready')
@@ -149,7 +145,6 @@ const GraphContent = memo(() => {
}
}, [cosmograph?.cosmograph, isCosmographReady])
// Configuration des actions une seule fois
useEffect(() => {
if (cosmograph?.cosmograph && !actionsSetRef.current) {
const actions = {
@@ -217,7 +212,6 @@ const GraphContent = memo(() => {
})
GraphContent.displayName = 'GraphContent'
// Timeline avec ses propres optimisations
const TimelinePanel = memo(() => {
const handleAnimationPlay = useCallback(() => {}, [])
@@ -244,7 +238,6 @@ const TimelinePanel = memo(() => {
})
TimelinePanel.displayName = 'TimelinePanel'
// Provider wrapper mémorisé pour éviter les re-créations
const GraphProvider = memo(
({ nodes, edges, children }: { nodes: any[]; edges: any[]; children: React.ReactNode }) => {
return (
@@ -256,7 +249,6 @@ const GraphProvider = memo(
)
GraphProvider.displayName = 'GraphProvider'
// Composant principal avec optimisations maximales
const Graph = memo(() => {
const nodes = useGraphStore((s) => s.filteredNodes)
const edges = useGraphStore((s) => s.filteredEdges)

View File

@@ -3,16 +3,19 @@ import { useConfirm } from '@/components/use-confirm-dialog'
import { flowService } from '@/api/flow-service'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { queryKeys } from '@/api/query-keys'
import { useLayoutStore } from '@/stores/layout-store'
export function useLaunchFlow(askUser: boolean = false) {
const { confirm } = useConfirm()
const queryClient = useQueryClient()
const openClonsole = useLayoutStore(s => s.openConsole)
// Launch flow mutation
const launchFlowMutation = useMutation({
mutationFn: ({ flowId, body }: { flowId: string; body: BodyInit }) =>
flowService.launch(flowId, body),
onSuccess: (data, variables) => {
onSuccess: (_, variables) => {
openClonsole()
queryClient.invalidateQueries({
queryKey: queryKeys.flows.detail(variables.flowId)
})

View File

@@ -1,9 +1,12 @@
import { toast } from 'sonner'
import { useConfirm } from '@/components/use-confirm-dialog'
import { transformService } from '@/api/transform-service'
import { useLayoutStore } from '@/stores/layout-store'
export function useLaunchTransform(askUser: boolean = false) {
const { confirm } = useConfirm()
const openClonsole = useLayoutStore(s => s.openConsole)
const launchTransform = async (
values: string[],
transformName: string,
@@ -26,6 +29,7 @@ export function useLaunchTransform(askUser: boolean = false) {
`Transform ${transformName} has been launched on ${sliced.join(', ')}${left > 0 ? ` and ${left} others` : ''}.`,
error: () => `An error occurred launching transform.`
})
openClonsole()
return
}
return {

View File

@@ -9,6 +9,7 @@ interface LayoutStore {
isOpenAnalysis: boolean
chatWidth: number
chatHeight: number
openConsole: () => void
toggleConsole: () => void
togglePanel: () => void
toggleChat: () => void
@@ -39,6 +40,7 @@ export const useLayoutStore = create<LayoutStore>()(
chatHeight: 600,
activeTab: 'entities',
activeTransformTab: 'transforms',
openConsole: () => set(() => ({ isOpenConsole: true })),
toggleConsole: () => set((state) => ({ isOpenConsole: !state.isOpenConsole })),
togglePanel: () => set((state) => ({ isOpenPanel: !state.isOpenPanel })),
toggleDetails: () => set((state) => ({ isOpenDetails: !state.isOpenDetails })),

View File

@@ -13,7 +13,6 @@ from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from dotenv import load_dotenv
# Charger les variables d'environnement
load_dotenv()