aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/web/src/components/App.css6
-rw-r--r--src/web/src/components/App.js4
-rw-r--r--src/web/src/components/Search/Detail/SearchDetail.js27
-rw-r--r--src/web/src/components/Search/Searches.js77
-rw-r--r--src/web/src/components/Shared/LoaderSegment.js11
5 files changed, 75 insertions, 50 deletions
diff --git a/src/web/src/components/App.css b/src/web/src/components/App.css
index 9cad4f33..1f52554c 100644
--- a/src/web/src/components/App.css
+++ b/src/web/src/components/App.css
@@ -145,4 +145,8 @@ body {
.menu-icon-no-shadow {
font-size: 1rem !important;
text-shadow: unset !important;
-} \ No newline at end of file
+}
+
+.loader-segment.ui.placeholder > :before {
+ background-color: transparent !important;
+}
diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js
index 2a390de4..5e1cda69 100644
--- a/src/web/src/components/App.js
+++ b/src/web/src/components/App.js
@@ -244,7 +244,7 @@ class App extends Component {
</Sidebar>
<Sidebar.Pusher className='app-content'>
<Switch>
- <Route path={`${urlBase}/searches/:id?`} render={(props) => this.withTokenCheck(<Searches {...props}/>)}/>
+ <Route path={`${urlBase}/searches/:id?`} render={(props) => this.withTokenCheck(<div className='search-container'><Searches {...props}/></div>)}/>
<Route path={`${urlBase}/browse`} render={(props) => this.withTokenCheck(<Browse {...props}/>)}/>
<Route path={`${urlBase}/users`} render={(props) => this.withTokenCheck(<Users {...props}/>)}/>
<Route path={`${urlBase}/chat`} render={(props) => this.withTokenCheck(<Chat {...props}/>)}/>
@@ -260,4 +260,4 @@ class App extends Component {
};
};
-export default App;
+export default App; \ No newline at end of file
diff --git a/src/web/src/components/Search/Detail/SearchDetail.js b/src/web/src/components/Search/Detail/SearchDetail.js
index fd696f8e..31d2616e 100644
--- a/src/web/src/components/Search/Detail/SearchDetail.js
+++ b/src/web/src/components/Search/Detail/SearchDetail.js
@@ -12,13 +12,14 @@ import {
import ErrorSegment from '../../Shared/ErrorSegment';
import Response from '../Response';
import { getResponses, parseFiltersFromString, filterResponse } from '../../../lib/searches';
+import LoaderSegment from '../../Shared/LoaderSegment';
const sortDropdownOptions = [
{ key: 'uploadSpeed', text: 'Upload Speed (Fastest to Slowest)', value: 'uploadSpeed' },
{ key: 'queueLength', text: 'Queue Depth (Least to Most)', value: 'queueLength' }
];
-const SearchDetail = ({ search }) => {
+const SearchDetail = ({ search, onStop, onBack }) => {
const { id, state, isComplete, fileCount, lockedFileCount, responseCount } = search;
const [loading, setLoading] = useState(false);
@@ -100,11 +101,33 @@ const SearchDetail = ({ search }) => {
}
if (loading) {
- return (<Loader active size='big' inline='centered'/>)
+ return (<LoaderSegment/>)
}
return (
<>
+ <Segment className='search-segment' raised>
+ {/* <Input
+ input={<input placeholder="Search phrase" type="search" data-lpignore="true"></input>}
+ size='big'
+ ref={searchRef}
+ disabled={true}
+ className='search-input'
+ placeholder="Search phrase"
+ action={<Button icon='x' color='red' onClick={() => history.push(`/searches`)}/>}
+ /> */}
+ <Button
+ negative
+ icon={isComplete ? 'arrow left' : 'stop circle'}
+ onClick={() => {
+ if (isComplete) {
+ onBack();
+ } else {
+ onStop(search);
+ }
+ }}
+ />
+ </Segment>
{(results && results.length > 0) &&
<Segment className='search-options' raised>
<Dropdown
diff --git a/src/web/src/components/Search/Searches.js b/src/web/src/components/Search/Searches.js
index 273d0c0a..34b0db88 100644
--- a/src/web/src/components/Search/Searches.js
+++ b/src/web/src/components/Search/Searches.js
@@ -5,6 +5,7 @@ import { useParams, useHistory, useRouteMatch } from 'react-router-dom';
import * as lib from '../../lib/searches';
import { createSearchHubConnection } from '../../lib/hubFactory';
+import LoaderSegment from '../Shared/LoaderSegment';
import SearchList from './List/SearchList';
import './Search.css';
@@ -127,7 +128,7 @@ const Searches = () => {
}
if (connecting) {
- return <Loader active size='big'/>;
+ return <LoaderSegment/>
}
if (connectError) {
@@ -136,60 +137,46 @@ const Searches = () => {
if (searchId) {
if (searches[searchId]) {
- const { searchText } = searches[searchId];
-
return (
- <div className='search-container'>
- <Segment className='search-segment' raised>
- {/* <Input
- input={<input placeholder="Search phrase" type="search" data-lpignore="true"></input>}
- size='big'
- ref={searchRef}
- disabled={true}
- className='search-input'
- placeholder="Search phrase"
- action={<Button icon='x' color='red' onClick={() => history.push(`/searches`)}/>}
- /> */}
- <Button icon="trash"/>
- </Segment>
- <SearchDetail search={searches[searchId]}/>
- </div>
+ <SearchDetail
+ search={searches[searchId]}
+ onStop={stop}
+ onBack={() => history.push('/searches')}
+ />
);
}
return (
- <div className='search-container'>
- <ErrorSegment caption='Invalid Search ID'/>
- </div>
+ <ErrorSegment caption='Invalid Search ID'/>
);
}
return (
- <div className='search-container'>
- <Segment className='search-segment' raised>
- <Input
- input={<input placeholder="Search phrase" type="search" data-lpignore="true"></input>}
- size='big'
- ref={inputRef}
- loading={creating}
- disabled={creating}
- className='search-input'
- placeholder="Search phrase"
- action={<>
- <Button icon='plus' onClick={create}/>
- <Button icon='search' onClick={() => create({ navigate: true })}/>
- </>}
- onKeyUp={(e) => e.key === 'Enter' ? create() : ''}
- />
- </Segment>
- <SearchList
- connecting={connecting}
- error={error}
- searches={searches}
- onRemove={remove}
- onStop={stop}
+ <>
+ <Segment className='search-segment' raised>
+ <Input
+ input={<input placeholder="Search phrase" type="search" data-lpignore="true"></input>}
+ size='big'
+ ref={inputRef}
+ loading={creating}
+ disabled={creating}
+ className='search-input'
+ placeholder="Search phrase"
+ action={<>
+ <Button icon='plus' onClick={create}/>
+ <Button icon='search' onClick={() => create({ navigate: true })}/>
+ </>}
+ onKeyUp={(e) => e.key === 'Enter' ? create() : ''}
/>
- </div>
+ </Segment>
+ <SearchList
+ connecting={connecting}
+ error={error}
+ searches={searches}
+ onRemove={remove}
+ onStop={stop}
+ />
+ </>
)
};
diff --git a/src/web/src/components/Shared/LoaderSegment.js b/src/web/src/components/Shared/LoaderSegment.js
new file mode 100644
index 00000000..e63d8029
--- /dev/null
+++ b/src/web/src/components/Shared/LoaderSegment.js
@@ -0,0 +1,11 @@
+import React from 'react';
+
+import { Segment, Loader } from 'semantic-ui-react';
+
+const LoaderSegment = ({ caption }) => (
+ <Segment className='loader-segment' placeholder basic>
+ <Loader active size='large'>{caption}</Loader>
+ </Segment>
+);
+
+export default LoaderSegment; \ No newline at end of file