From b62aea80068a8b45aea3edc9b566471c83c4f36c Mon Sep 17 00:00:00 2001 From: Sudharsan Selvaraj Date: Sat, 8 Jun 2024 03:40:43 +0530 Subject: [PATCH 1/7] feat: Add functionality to search through app source tree --- app/common/renderer/actions/Inspector.js | 7 ++ .../components/Inspector/Inspector.jsx | 15 +++- .../components/Inspector/Inspector.module.css | 9 ++ .../renderer/components/Inspector/Source.jsx | 82 +++++++++++++++++-- app/common/renderer/reducers/Inspector.js | 8 +- 5 files changed, 112 insertions(+), 9 deletions(-) diff --git a/app/common/renderer/actions/Inspector.js b/app/common/renderer/actions/Inspector.js index 05b6a4095e..244262fb34 100644 --- a/app/common/renderer/actions/Inspector.js +++ b/app/common/renderer/actions/Inspector.js @@ -31,6 +31,7 @@ export const SET_EXPANDED_PATHS = 'SET_EXPANDED_PATHS'; export const SET_OPTIMAL_LOCATORS = 'SET_OPTIMAL_LOCATORS'; export const SELECT_HOVERED_ELEMENT = 'SELECT_HOVERED_ELEMENT'; export const UNSELECT_HOVERED_ELEMENT = 'UNSELECT_HOVERED_ELEMENT'; +export const SET_PAGE_SOURCE_SEARCH_TEXT = 'SET_PAGE_SOURCE_SEARCH_TEXT'; export const SELECT_HOVERED_CENTROID = 'SELECT_HOVERED_CENTROID'; export const UNSELECT_HOVERED_CENTROID = 'UNSELECT_HOVERED_CENTROID'; @@ -292,6 +293,12 @@ export function addAssignedVarCache(varName) { }; } +export function setPageSourceSearchText(text) { + return (dispatch) => { + dispatch({type: SET_PAGE_SOURCE_SEARCH_TEXT, text}); + }; +} + export function setExpandedPaths(paths) { return (dispatch) => { dispatch({type: SET_EXPANDED_PATHS, paths}); diff --git a/app/common/renderer/components/Inspector/Inspector.jsx b/app/common/renderer/components/Inspector/Inspector.jsx index ee4cd7696b..1b59f722c1 100644 --- a/app/common/renderer/components/Inspector/Inspector.jsx +++ b/app/common/renderer/components/Inspector/Inspector.jsx @@ -11,8 +11,9 @@ import { SelectOutlined, TagOutlined, ThunderboltOutlined, + SearchOutlined, } from '@ant-design/icons'; -import {Button, Card, Modal, Space, Spin, Switch, Tabs, Tooltip} from 'antd'; +import {Button, Card, Modal, Row, Space, Spin, Switch, Tabs, Tooltip, Input} from 'antd'; import {debounce} from 'lodash'; import React, {useEffect, useRef, useState} from 'react'; import {useNavigate} from 'react-router-dom'; @@ -87,6 +88,7 @@ const Inspector = (props) => { toggleShowAttributes, isSourceRefreshOn, windowSize, + setPageSourceSearchText, t, } = props; @@ -322,7 +324,14 @@ const Inspector = (props) => { } extra={ - + + setPageSourceSearchText(e.target.value)} + prefix={} + />