mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-18 00:00:00 +00:00
Optimize/seasearch filters (#7723)
* update seasearch filters * seasearch support filter by owner and search_filename_only --------- Co-authored-by: zhouwenxuan <aries@Mac.local>
This commit is contained in:
@@ -9,12 +9,12 @@ import './index.css';
|
||||
|
||||
const SCROLLABLE_CONTAINER_HEIGHT = 44;
|
||||
|
||||
const SearchFilters = ({ repoID, onChange, hasFileSearch }) => {
|
||||
const SearchFilters = ({ repoID, onChange }) => {
|
||||
return (
|
||||
<div className="search-filters-container" style={{ height: hasFileSearch && SCROLLABLE_CONTAINER_HEIGHT }}>
|
||||
{hasFileSearch && <FilterByText onSelect={onChange} />}
|
||||
{hasFileSearch && <FilterByCreator repoID={repoID} onSelect={onChange} />}
|
||||
{hasFileSearch && <FilterByDate onSelect={onChange} />}
|
||||
<div className="search-filters-container" style={{ height: SCROLLABLE_CONTAINER_HEIGHT }}>
|
||||
<FilterByText onSelect={onChange} />
|
||||
<FilterByCreator repoID={repoID} onSelect={onChange} />
|
||||
<FilterByDate onSelect={onChange} />
|
||||
<FilterBySuffix onSelect={onChange} />
|
||||
</div>
|
||||
);
|
||||
@@ -23,7 +23,6 @@ const SearchFilters = ({ repoID, onChange, hasFileSearch }) => {
|
||||
SearchFilters.propTypes = {
|
||||
repoID: PropTypes.string,
|
||||
onChange: PropTypes.func,
|
||||
hasFileSearch: PropTypes.bool,
|
||||
};
|
||||
|
||||
export default SearchFilters;
|
||||
|
@@ -22,7 +22,6 @@ const propTypes = {
|
||||
onSearchedClick: PropTypes.func.isRequired,
|
||||
isPublic: PropTypes.bool,
|
||||
isViewFile: PropTypes.bool,
|
||||
hasFileSearch: PropTypes.bool,
|
||||
};
|
||||
|
||||
const PER_PAGE = 20;
|
||||
@@ -798,7 +797,6 @@ class Search extends Component {
|
||||
<SearchFilters
|
||||
repoID={this.props.repoID}
|
||||
onChange={this.handleFiltersChange}
|
||||
hasFileSearch={this.props.hasFileSearch}
|
||||
/>
|
||||
}
|
||||
<div
|
||||
|
@@ -7,7 +7,6 @@ import Notification from '../common/notification';
|
||||
import Account from '../common/account';
|
||||
import Logout from '../common/logout';
|
||||
import { EVENT_BUS_TYPE } from '../common/event-bus-type';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
|
||||
const propTypes = {
|
||||
repoID: PropTypes.string,
|
||||
@@ -33,7 +32,6 @@ class CommonToolbar extends React.Component {
|
||||
path: props.path,
|
||||
isViewFile: props.isViewFile,
|
||||
currentRepoInfo: props.currentRepoInfo,
|
||||
hasFileSearch: false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -41,9 +39,6 @@ class CommonToolbar extends React.Component {
|
||||
if (this.props.eventBus) {
|
||||
this.unsubscribeLibChange = this.props.eventBus.subscribe(EVENT_BUS_TYPE.CURRENT_LIBRARY_CHANGED, this.onRepoChange);
|
||||
}
|
||||
seafileAPI.getSearchInfo().then(res => {
|
||||
this.setState({ hasFileSearch: res.data.has_file_search });
|
||||
});
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@@ -64,7 +59,7 @@ class CommonToolbar extends React.Component {
|
||||
};
|
||||
|
||||
renderSearch = () => {
|
||||
const { repoID, repoName, isLibView, path, isViewFile, hasFileSearch } = this.state;
|
||||
const { repoID, repoName, isLibView, path, isViewFile } = this.state;
|
||||
const { searchPlaceholder } = this.props;
|
||||
const placeholder = searchPlaceholder || gettext('Search files');
|
||||
|
||||
@@ -77,7 +72,6 @@ class CommonToolbar extends React.Component {
|
||||
isViewFile={isViewFile}
|
||||
isPublic={false}
|
||||
path={path}
|
||||
hasFileSearch={hasFileSearch}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user