mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 07:01:12 +00:00
Optimized module code (#2574)
This commit is contained in:
@@ -6,6 +6,7 @@ import Notification from '../common/notification';
|
||||
import Account from '../common/account';
|
||||
|
||||
const propTypes = {
|
||||
repoID: PropTypes.string.isRequired,
|
||||
onSearchedClick: PropTypes.func.isRequired,
|
||||
searchPlaceholder: PropTypes.string
|
||||
};
|
||||
@@ -14,7 +15,13 @@ class CommonToolbar extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div className="common-toolbar">
|
||||
{isPro && <Search onSearchedClick={this.props.onSearchedClick} placeholder={gettext(this.props.searchPlaceholder)}/>}
|
||||
{isPro && (
|
||||
<Search
|
||||
repoID={this.props.repoID}
|
||||
placeholder={gettext(this.props.searchPlaceholder)}
|
||||
onSearchedClick={this.props.onSearchedClick}
|
||||
/>
|
||||
)}
|
||||
<Notification />
|
||||
<Account />
|
||||
</div>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import React, { Fragment } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Utils } from '../../utils/utils';
|
||||
import { gettext, serviceUrl } from '../../utils/constants';
|
||||
import { gettext } from '../../utils/constants';
|
||||
import ModalPortal from '../modal-portal';
|
||||
import CreateFolder from '../../components/dialog/create-folder-dialog';
|
||||
import CreateFile from '../../components/dialog/create-file-dialog';
|
||||
@@ -10,6 +10,7 @@ const propTypes = {
|
||||
isViewFile: PropTypes.bool,
|
||||
path: PropTypes.string.isRequired,
|
||||
repoID: PropTypes.string.isRequired,
|
||||
serviceUrl: PropTypes.string.isRequired,
|
||||
permission: PropTypes.string.isRequired,
|
||||
onAddFile: PropTypes.func.isRequired,
|
||||
onAddFolder: PropTypes.func.isRequired,
|
||||
@@ -57,7 +58,7 @@ class DirOperationToolbar extends React.Component {
|
||||
|
||||
onEditClick = (e) => {
|
||||
e.preventDefault();
|
||||
let { path, repoID} = this.props;
|
||||
let { path, repoID, serviceUrl } = this.props;
|
||||
window.location.href= serviceUrl + '/lib/' + repoID + '/file' + path + '?mode=edit';
|
||||
}
|
||||
|
||||
|
@@ -11,6 +11,7 @@ const propTypes = {
|
||||
class GeneralToolbar extends React.Component {
|
||||
|
||||
render() {
|
||||
// todo get repoID?
|
||||
let { onShowSidePanel, onSearchedClick } = this.props;
|
||||
let placeHolder = this.props.searchPlaceholder || 'Search files in this library';
|
||||
return (
|
||||
@@ -23,6 +24,7 @@ class GeneralToolbar extends React.Component {
|
||||
</span>
|
||||
</div>
|
||||
<CommonToolbar
|
||||
repoID={'todo'}
|
||||
searchPlaceholder={placeHolder}
|
||||
onSearchedClick={onSearchedClick}
|
||||
/>
|
||||
|
@@ -104,6 +104,7 @@ class MutipleDirOperationToolbar extends React.Component {
|
||||
{this.state.isMoveDialogShow &&
|
||||
<MoveDirentDialog
|
||||
path={this.props.path}
|
||||
repoID={this.props.repoID}
|
||||
isMutipleOperation={this.state.isMutipleOperation}
|
||||
selectedDirentList={this.props.selectedDirentList}
|
||||
onItemsMove={this.props.onItemsMove}
|
||||
@@ -113,6 +114,7 @@ class MutipleDirOperationToolbar extends React.Component {
|
||||
{this.state.isCopyDialogShow &&
|
||||
<CopyDirentDialog
|
||||
path={this.props.path}
|
||||
repoID={this.props.repoID}
|
||||
selectedDirentList={this.props.selectedDirentList}
|
||||
isMutipleOperation={this.state.isMutipleOperation}
|
||||
onItemsCopy={this.props.onItemsCopy}
|
||||
|
Reference in New Issue
Block a user