From c9cb83603b414f949833c86a7f472ec0c8f90ad2 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 2 May 2022 08:15:49 -0500 Subject: revert back to checkbox-less version --- src/web/src/components/Search/List/SearchList.js | 79 +++++++++++----------- .../src/components/Search/List/SearchListRow.js | 41 +++++++++-- 2 files changed, 78 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/web/src/components/Search/List/SearchList.js b/src/web/src/components/Search/List/SearchList.js index 806196f1..1bbeedb9 100644 --- a/src/web/src/components/Search/List/SearchList.js +++ b/src/web/src/components/Search/List/SearchList.js @@ -16,7 +16,8 @@ import { Icon, Loader, Segment, - Checkbox + Header, + List } from 'semantic-ui-react'; import SearchIcon from '../SearchIcon'; @@ -120,53 +121,55 @@ const SearchList = () => { await lib.stop({ id: search.id }) } - console.log(searches) - return ( - + - - - Searches - - +
} error={error && } > - - - - - - Search - Files - Locked - Responses - Ended - - - +
+
+ + Searches +
+
+ + - - No searches to display - - } + noSearches={!searchCount && + No searches to display + } > - {Object.values(searches) - .sort((a, b) => (new Date(b.startedAt) - new Date(a.startedAt))) - .map((search, index) => )} +
+ + + + Search + Files + Locked + Responses + Ended + + + + + {Object.values(searches) + .sort((a, b) => (new Date(b.startedAt) - new Date(a.startedAt))) + .map((search, index) => )} + +
- - + + - +
) diff --git a/src/web/src/components/Search/List/SearchListRow.js b/src/web/src/components/Search/List/SearchListRow.js index 6288ef17..860bf465 100644 --- a/src/web/src/components/Search/List/SearchListRow.js +++ b/src/web/src/components/Search/List/SearchListRow.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import SearchIcon from '../SearchIcon'; @@ -9,15 +9,48 @@ import { } from 'semantic-ui-react'; const SearchListRow = ({ search, index, onRemove, onStop }) => { + const [working, setWorking] = useState(false); + + const invoke = async (func) => { + setWorking(true); + await func(); + setWorking(false); + } + + const ActionIcon = () => { + if (working) { + return () + } + + if (search.state.includes('Completed')) { + return ( invoke(() => onRemove(search))} + />) + } + + return ( invoke(() => onStop(search))} + />) + } + return ( - - + - {search.searchText} + {search.searchText} {search.fileCount} {search.lockedFileCount} {search.responseCount} {search.endedAt ? new Date(search.endedAt).toLocaleTimeString() : '-'} + + + ) } -- cgit v1.2.3