Skip to content

Commit

Permalink
Remove search single page (#7339)
Browse files Browse the repository at this point in the history
* 01 remove jquery-ui css

* 02 remove search page

* 03 remove pubuser_search
  • Loading branch information
Michael18811380328 authored Jan 9, 2025
1 parent 14e56ee commit f7f69aa
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 1,454 deletions.
1 change: 0 additions & 1 deletion frontend/config/webpack.entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const entryFiles = {
repoFolderTrash: '/repo-folder-trash.js',
orgAdmin: '/pages/org-admin',
sysAdmin: '/pages/sys-admin',
search: '/pages/search',
uploadLink: '/pages/upload-link',
subscription: '/subscription.js',
institutionAdmin: '/pages/institution-admin/index.js'
Expand Down
29 changes: 2 additions & 27 deletions frontend/src/components/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import classnames from 'classnames';
import MediaQuery from 'react-responsive';
import { seafileAPI } from '../../utils/seafile-api';
import searchAPI from '../../utils/search-api';
import { gettext, siteRoot } from '../../utils/constants';
import { gettext } from '../../utils/constants';
import SearchResultItem from './search-result-item';
import SearchResultLibrary from './search-result-library';
import { Utils } from '../../utils/utils';
import toaster from '../toast';
import Loading from '../loading';
import { SEARCH_MASK, SEARCH_CONTAINER } from '../../constants/zIndexes';
import { PRIVATE_FILE_TYPE } from '../../constants';
import Icon from '../icon';

const propTypes = {
repoID: PropTypes.string,
Expand All @@ -35,7 +34,6 @@ class Search extends Component {

constructor(props) {
super(props);
this.baseSearchPageURL = `${siteRoot}search/`;
this.state = {
width: 'default',
value: '',
Expand All @@ -44,13 +42,11 @@ class Search extends Component {
highlightIndex: 0,
page: 0,
isLoading: false,
hasMore: false,
isMaskShow: false,
showRecent: true,
isResultGotten: false,
isCloseShow: false,
isSearchInputShow: false, // for mobile
searchPageUrl: this.baseSearchPageURL,
searchTypesMax: 0,
highlightSearchTypesIndex: 0,
};
Expand Down Expand Up @@ -367,7 +363,6 @@ class Search extends Component {
inputValue: newValue,
isLoading: false,
highlightIndex: 0,
// resultItems: [],
isResultGotten: false,
}, () => {
if (!isInRepo && trimmedValue !== '') {
Expand All @@ -392,7 +387,6 @@ class Search extends Component {
this.setState({
resultItems: results,
isLoading: false,
hasMore: false,
});
}).catch(error => {
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -428,15 +422,13 @@ class Search extends Component {
isResultGotten: true,
page: page + 1,
isLoading: false,
hasMore: res.data.has_more,
});
} else {
this.setState({
highlightIndex: 0,
resultItems: [],
isLoading: false,
isResultGotten: true,
hasMore: res.data.has_more,
});
}
}).catch(error => {
Expand All @@ -450,7 +442,6 @@ class Search extends Component {
};

onNormalSearch = (queryData, cancelToken, page) => {
this.updateSearchPageURL(queryData);
queryData['per_page'] = PER_PAGE;
queryData['page'] = page;
seafileAPI.searchFiles(queryData, cancelToken).then(res => {
Expand All @@ -461,7 +452,6 @@ class Search extends Component {
isResultGotten: true,
isLoading: false,
page: page + 1,
hasMore: res.data.has_more,
});
return;
}
Expand All @@ -470,7 +460,6 @@ class Search extends Component {
resultItems: [],
isLoading: false,
isResultGotten: true,
hasMore: res.data.has_more,
});
}).catch(error => {
/* eslint-disable */
Expand All @@ -479,14 +468,6 @@ class Search extends Component {
});
};

updateSearchPageURL(queryData) {
let params = '';
for (let key in queryData) {
params += key + '=' + encodeURIComponent(queryData[key]) + '&';
}
this.setState({searchPageUrl: `${this.baseSearchPageURL}?${params.substring(0, params.length - 1)}`});
}

formatResultItems(data) {
let items = [];
for (let i = 0; i < data.length; i++) {
Expand Down Expand Up @@ -681,7 +662,7 @@ class Search extends Component {
};

renderResults = (resultItems, isVisited) => {
const { highlightIndex, hasMore, searchPageUrl } = this.state;
const { highlightIndex } = this.state;

const results = (
<>
Expand All @@ -700,12 +681,6 @@ class Search extends Component {
);
})}
</ul>
{(!this.props.isPublic && hasMore) &&
<div className="more-search-result mb-1 pl-2 d-flex align-items-center">
<Icon symbol="more-level" className="more-search-result-icon" />
<a href={searchPageUrl} className="more-search-result-text ml-1">{gettext('More')}</a>
</div>
}
</>
);

Expand Down
15 changes: 0 additions & 15 deletions frontend/src/css/search.css
Original file line number Diff line number Diff line change
Expand Up @@ -451,18 +451,3 @@
font-size: 14px;
margin-bottom: 10px;
}

.search-result-container .more-search-result {
margin-top: -4px;
height: 40px;
}

.search-result-container .more-search-result-icon {
width: 1rem;
color: #ec8000;
margin: 0 10px;
}

.search-result-container .more-search-result-text {
font-size: .875rem;
}
Loading

0 comments on commit f7f69aa

Please sign in to comment.