1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 07:01:12 +00:00

merge seasearch and es (#6632)

* merge seasearch and es

* rebase

* update
This commit is contained in:
JoinTyang
2024-08-24 23:08:18 +08:00
committed by GitHub
parent b0e62adc64
commit 56999ee4c5
17 changed files with 281 additions and 1241 deletions

View File

@@ -1,8 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { isPro, gettext, showLogoutIcon, enableSeasearch, enableElasticsearch } from '../../utils/constants';
import { isPro, gettext, showLogoutIcon } from '../../utils/constants';
import Search from '../search/search';
import AISearch from '../search/ai-search';
import SearchByName from '../search/search-by-name';
import Notification from '../common/notification';
import Account from '../common/account';
@@ -60,35 +59,21 @@ class CommonToolbar extends React.Component {
};
renderSearch = () => {
const { repoID, repoName, isLibView, path, isViewFile, currentRepoInfo } = this.state;
const { repoID, repoName, isLibView, path, isViewFile } = this.state;
const { searchPlaceholder } = this.props;
const placeholder = searchPlaceholder || gettext('Search files');
if (isPro) {
if (enableSeasearch && !enableElasticsearch) {
return (
<AISearch
repoID={repoID}
path={path}
isViewFile={isViewFile}
placeholder={placeholder}
currentRepoInfo={currentRepoInfo}
onSearchedClick={this.onSearchedClick}
isLibView={isLibView}
/>
);
} else {
return (
<Search
repoID={repoID}
placeholder={placeholder}
onSearchedClick={this.onSearchedClick}
isViewFile={isViewFile}
isPublic={false}
path={path}
/>
);
}
return (
<Search
repoID={repoID}
placeholder={placeholder}
onSearchedClick={this.onSearchedClick}
isViewFile={isViewFile}
isPublic={false}
path={path}
/>
);
} else {
if (isLibView) {
return (