From 15e092b1c972de0ad21a9ffc4bb36ebe361cac30 Mon Sep 17 00:00:00 2001 From: Paul Adamsen <117673433+pauladamseniii@users.noreply.github.com> Date: Fri, 22 Sep 2023 16:51:14 -0400 Subject: [PATCH] CEC-3466 - Issues search bar (#449) * CEC-3466 - Issues search bar * UI fixes * fix --- .../App/__snapshots__/App.test.js.snap | 54 +++++++++++++++++++ .../Controls/IssueSelectionTable/index.jsx | 54 +++++++++---------- src/components/Issues/List/index.jsx | 11 +++- 3 files changed, 89 insertions(+), 30 deletions(-) diff --git a/src/components/App/__snapshots__/App.test.js.snap b/src/components/App/__snapshots__/App.test.js.snap index 8b94ada..7318107 100644 --- a/src/components/App/__snapshots__/App.test.js.snap +++ b/src/components/App/__snapshots__/App.test.js.snap @@ -3267,6 +3267,60 @@ exports[`App Route /issues authenticated 1`] = `
+
+
+ +
+ +
+ +
+
+
+
{ (async () => { try { if (!token) return; - await getIssues( - { - limit: pageSize, - offset: pageSize * pageIndex, - order: `${orderBy} ${order}`, - }, - token - ); + const options = { + limit: pageSize, + offset: pageSize * pageIndex, + order: `${orderBy} ${order}`, + }; + await getIssues(Object.assign(options, search), token); } catch (e) { setMessage(e.message); logger.warn(e.stack); @@ -130,14 +128,12 @@ const IssueSelectionTable = (props) => { const handleDelete = (id) => { deleteIssue(id, token).then(() => { - getIssues( - { - limit: pageSize, - offset: pageSize * pageIndex, - order: `${orderBy} ${order}`, - }, - token - ); + const options = { + limit: pageSize, + offset: pageSize * pageIndex, + order: `${orderBy} ${order}`, + }; + getIssues(Object.assign(options, search), token); }); }; @@ -185,19 +181,19 @@ const IssueSelectionTable = (props) => { - + diff --git a/src/components/Issues/List/index.jsx b/src/components/Issues/List/index.jsx index cbf115b..42b881e 100644 --- a/src/components/Issues/List/index.jsx +++ b/src/components/Issues/List/index.jsx @@ -7,10 +7,13 @@ import { useUserContext } from "../../Contexts/UserContext"; import { IssueProvider } from "../../Contexts/IssueContext"; import IssueSelectionTable from "../../Controls/IssueSelectionTable"; +import SearchField from "../../Controls/SearchField"; +import { useLocalStorage } from "../../useLocalStorage"; import useStyles from "../../useStyles"; const MainForm = () => { const classes = useStyles(); + const [search, setSearch] = useLocalStorage("ISSUES_SEARCH", ""); const { setTitle, setSitePath } = useStatusContext(); const { token: { @@ -18,7 +21,9 @@ const MainForm = () => { }, } = useUserContext(); - + const handleSearch = (query) => { + setSearch(query); + }; useEffect(() => { setTitle("Issues"); @@ -32,11 +37,15 @@ const MainForm = () => { + + +
);