From d93c9d45a9e5602fef19ede24b0af2c8ef66f95b Mon Sep 17 00:00:00 2001 From: Luke De Feo Date: Mon, 6 Feb 2023 04:33:11 -0800 Subject: [PATCH] Ability to highlight nodes that match monitored event Summary: Listen to framework events and store in a map based on node id Added UI to allow for monitoring framework event types. The event type is a string separated by : Each segment of this string represents a level in the dialog hierachy. For example Litho:Layout:StateUpdateSync would have levels, Litho Layout StateUpdateSync When event type monitored and event comes in for a node flash the visualiser node briefly Reviewed By: lblasa Differential Revision: D42074988 fbshipit-source-id: 52458ad87ab84bf7b1749e87be516ed73106a6c0 --- .../ui-debugger/components/Controls.tsx | 225 +++++++++++++++++- .../components/Visualization2D.tsx | 13 +- desktop/plugins/public/ui-debugger/index.tsx | 75 +++++- desktop/plugins/public/ui-debugger/types.tsx | 12 + 4 files changed, 309 insertions(+), 16 deletions(-) diff --git a/desktop/plugins/public/ui-debugger/components/Controls.tsx b/desktop/plugins/public/ui-debugger/components/Controls.tsx index 6a5d5fdd9..aff0b41d2 100644 --- a/desktop/plugins/public/ui-debugger/components/Controls.tsx +++ b/desktop/plugins/public/ui-debugger/components/Controls.tsx @@ -6,11 +6,26 @@ * * @format */ -import React from 'react'; +import React, {useState} from 'react'; import {plugin} from '../index'; -import {Button, Input, Tooltip} from 'antd'; -import {PauseCircleOutlined, PlayCircleOutlined} from '@ant-design/icons'; +import { + Button, + Input, + Modal, + Tooltip, + Dropdown, + Menu, + Typography, + TreeSelect, + Space, +} from 'antd'; +import { + MoreOutlined, + PauseCircleOutlined, + PlayCircleOutlined, +} from '@ant-design/icons'; import {usePlugin, useValue, Layout} from 'flipper-plugin'; +import {FrameworkEventType} from '../types'; /** * Copyright (c) Meta Platforms, Inc. and affiliates. @@ -25,6 +40,20 @@ export const Controls: React.FC = () => { const instance = usePlugin(plugin); const searchTerm = useValue(instance.uiState.searchTerm); const isPaused = useValue(instance.uiState.isPaused); + + const frameworkEventMonitoring: Map = useValue( + instance.uiState.frameworkEventMonitoring, + ); + + const onSetEventMonitored: ( + eventType: FrameworkEventType, + monitored: boolean, + ) => void = (eventType: FrameworkEventType, monitored: boolean) => { + instance.uiState.frameworkEventMonitoring.update((draft) => + draft.set(eventType, monitored), + ); + }; + return ( { {isPaused ? : } }> + ); }; + +function MoreOptionsMenu({ + onSetEventMonitored, + frameworkEventTypes, +}: { + onSetEventMonitored: ( + eventType: FrameworkEventType, + monitored: boolean, + ) => void; + frameworkEventTypes: [FrameworkEventType, boolean][]; +}) { + const [showFrameworkEventsModal, setShowFrameworkEventsModal] = + useState(false); + + const moreOptionsMenu = ( + + { + setShowFrameworkEventsModal(true); + }}> + Framework event monitoring + + + ); + + return ( + <> + +