mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
Optimized module code (#2574)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import { gettext, repoID, slug, permission, siteRoot } from '../../utils/constants';
|
import { gettext, siteRoot } from '../../utils/constants';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ListTagDialog from '../dialog/list-tag-dialog';
|
import ListTagDialog from '../dialog/list-tag-dialog';
|
||||||
@@ -7,7 +7,10 @@ import CreateTagDialog from '../dialog/create-tag-dialog';
|
|||||||
import UpdateTagDialog from '../dialog/update-tag-dialog';
|
import UpdateTagDialog from '../dialog/update-tag-dialog';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
currentPath: PropTypes.string.isRequired
|
repoID: PropTypes.string.isRequired,
|
||||||
|
repoName: PropTypes.string.isRequired,
|
||||||
|
permission: PropTypes.bool.isRequired,
|
||||||
|
currentPath: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DirTool extends React.Component {
|
class DirTool extends React.Component {
|
||||||
@@ -47,12 +50,12 @@ class DirTool extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let { currentPath } = this.props;
|
let { repoID, repoName, permission, currentPath } = this.props;
|
||||||
let isFile = this.isMarkdownFile(currentPath);
|
let isFile = this.isMarkdownFile(currentPath);
|
||||||
let name = Utils.getFileName(currentPath);
|
let name = Utils.getFileName(currentPath);
|
||||||
let trashUrl = siteRoot + 'repo/recycle/' + repoID + '/?referer=' + encodeURIComponent(location.href);
|
let trashUrl = siteRoot + 'repo/recycle/' + repoID + '/?referer=' + encodeURIComponent(location.href);
|
||||||
let historyUrl = siteRoot + 'repo/history/' + repoID + '/?referer=' + encodeURIComponent(location.href);
|
let historyUrl = siteRoot + 'repo/history/' + repoID + '/?referer=' + encodeURIComponent(location.href);
|
||||||
if ( (name === slug || name === '') && !isFile && permission) {
|
if ( (name === repoName || name === '') && !isFile && permission) {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<ul className="path-toolbar">
|
<ul className="path-toolbar">
|
||||||
@@ -63,6 +66,7 @@ class DirTool extends React.Component {
|
|||||||
{
|
{
|
||||||
this.state.isListRepoTagShow &&
|
this.state.isListRepoTagShow &&
|
||||||
<ListTagDialog
|
<ListTagDialog
|
||||||
|
repoID={repoID}
|
||||||
onListTagCancel={this.onListRepoTagToggle}
|
onListTagCancel={this.onListRepoTagToggle}
|
||||||
onCreateRepoTag={this.onCreateRepoTagToggle}
|
onCreateRepoTag={this.onCreateRepoTagToggle}
|
||||||
onUpdateRepoTag={this.onUpdateRepoTagToggle}
|
onUpdateRepoTag={this.onUpdateRepoTagToggle}
|
||||||
@@ -71,12 +75,14 @@ class DirTool extends React.Component {
|
|||||||
{
|
{
|
||||||
this.state.isCreateRepoTagShow &&
|
this.state.isCreateRepoTagShow &&
|
||||||
<CreateTagDialog
|
<CreateTagDialog
|
||||||
|
repoID={repoID}
|
||||||
toggleCancel={this.onCreateRepoTagToggle}
|
toggleCancel={this.onCreateRepoTagToggle}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
this.state.isUpdateRepoTagShow &&
|
this.state.isUpdateRepoTagShow &&
|
||||||
<UpdateTagDialog
|
<UpdateTagDialog
|
||||||
|
repoID={repoID}
|
||||||
currentTag={this.state.currentTag}
|
currentTag={this.state.currentTag}
|
||||||
toggleCancel={this.onUpdateRepoTagToggle}
|
toggleCancel={this.onUpdateRepoTagToggle}
|
||||||
/>
|
/>
|
||||||
|
@@ -4,7 +4,9 @@ import DirPath from './dir-path';
|
|||||||
import DirTool from './dir-tool';
|
import DirTool from './dir-tool';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
repoName: PropTypes.string.isRequired,
|
repoName: PropTypes.string.isRequired,
|
||||||
|
permission: PropTypes.bool.isRequired,
|
||||||
currentPath: PropTypes.string.isRequired,
|
currentPath: PropTypes.string.isRequired,
|
||||||
onPathClick: PropTypes.func.isRequired,
|
onPathClick: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
@@ -19,7 +21,12 @@ class CurDirPath extends React.Component {
|
|||||||
currentPath={this.props.currentPath}
|
currentPath={this.props.currentPath}
|
||||||
onPathClick={this.props.onPathClick}
|
onPathClick={this.props.onPathClick}
|
||||||
/>
|
/>
|
||||||
<DirTool currentPath={this.props.currentPath} />
|
<DirTool
|
||||||
|
repoID={this.props.repoID}
|
||||||
|
repoName={this.props.repoName}
|
||||||
|
permission={this.props.permission}
|
||||||
|
currentPath={this.props.currentPath}
|
||||||
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button, Modal, ModalHeader, ModalFooter, ModalBody, Alert } from 'reactstrap';
|
import { Button, Modal, ModalHeader, ModalFooter, ModalBody, Alert } from 'reactstrap';
|
||||||
import { gettext, repoID } from '../../utils/constants';
|
import { gettext } from '../../utils/constants';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import FileChooser from '../file-chooser/file-chooser';
|
import FileChooser from '../file-chooser/file-chooser';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
dirent: PropTypes.object,
|
dirent: PropTypes.object,
|
||||||
selectedDirentList: PropTypes.array,
|
selectedDirentList: PropTypes.array,
|
||||||
isMutipleOperation: PropTypes.bool.isRequired,
|
isMutipleOperation: PropTypes.bool.isRequired,
|
||||||
@@ -43,7 +44,7 @@ class CopyDirent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copyItems = () => {
|
copyItems = () => {
|
||||||
let { repo, selectedPath } = this.state;
|
let { repo, repoID, selectedPath } = this.state;
|
||||||
let message = gettext('Invalid destination path');
|
let message = gettext('Invalid destination path');
|
||||||
|
|
||||||
if (!repo || selectedPath === '') {
|
if (!repo || selectedPath === '') {
|
||||||
@@ -93,7 +94,7 @@ class CopyDirent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copyItem = () => {
|
copyItem = () => {
|
||||||
let { repo, selectedPath } = this.state;
|
let { repo, repoID, selectedPath } = this.state;
|
||||||
let direntPath = Utils.joinPath(this.props.path, this.props.dirent.name);
|
let direntPath = Utils.joinPath(this.props.path, this.props.dirent.name);
|
||||||
let message = 'Invalid destination path';
|
let message = 'Invalid destination path';
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ class CopyDirent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// copy the dirent to current path
|
// copy the dirent to current path
|
||||||
if (selectedPath && this.props.path === selectedPath) {
|
if (selectedPath && this.props.path === selectedPath && repo.repo_id === repoID) {
|
||||||
this.setState({errMessage: message});
|
this.setState({errMessage: message});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -159,6 +160,7 @@ class CopyDirent extends React.Component {
|
|||||||
<ModalHeader toggle={this.toggle}><div dangerouslySetInnerHTML={{__html: title}}></div></ModalHeader>
|
<ModalHeader toggle={this.toggle}><div dangerouslySetInnerHTML={{__html: title}}></div></ModalHeader>
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<FileChooser
|
<FileChooser
|
||||||
|
repoID={this.props.repoID}
|
||||||
onDirentItemClick={this.onDirentItemClick}
|
onDirentItemClick={this.onDirentItemClick}
|
||||||
onRepoItemClick={this.onRepoItemClick}
|
onRepoItemClick={this.onRepoItemClick}
|
||||||
/>
|
/>
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Input } from 'reactstrap';
|
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Input } from 'reactstrap';
|
||||||
import { gettext, repoID } from '../../utils/constants';
|
import { gettext } from '../../utils/constants';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
toggleCancel: PropTypes.func.isRequired,
|
toggleCancel: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ class CreateTagDialog extends React.Component {
|
|||||||
createTag = () => {
|
createTag = () => {
|
||||||
let name = this.state.tagName;
|
let name = this.state.tagName;
|
||||||
let color = this.state.tagColor;
|
let color = this.state.tagColor;
|
||||||
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.createRepoTag(repoID, name, color).then(() =>{
|
seafileAPI.createRepoTag(repoID, name, color).then(() =>{
|
||||||
this.props.toggleCancel();
|
this.props.toggleCancel();
|
||||||
});
|
});
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
||||||
import { repoID, gettext } from '../../utils/constants';
|
import { gettext } from '../../utils/constants';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import RepoTag from '../../models/repo-tag';
|
import RepoTag from '../../models/repo-tag';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
filePath: PropTypes.string.isRequired,
|
filePath: PropTypes.string.isRequired,
|
||||||
fileTagList: PropTypes.array.isRequired,
|
fileTagList: PropTypes.array.isRequired,
|
||||||
onFileTagChanged: PropTypes.func.isRequired,
|
onFileTagChanged: PropTypes.func.isRequired,
|
||||||
@@ -25,6 +26,7 @@ class EditFileTagDialog extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRepoTagList = () => {
|
getRepoTagList = () => {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.listRepoTags(repoID).then(res => {
|
seafileAPI.listRepoTags(repoID).then(res => {
|
||||||
let repotagList = [];
|
let repotagList = [];
|
||||||
res.data.repo_tags.forEach(item => {
|
res.data.repo_tags.forEach(item => {
|
||||||
@@ -47,6 +49,7 @@ class EditFileTagDialog extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
editFileTag = (repoTag) => {
|
editFileTag = (repoTag) => {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
let repoTagIdList = this.getRepoTagIdList();
|
let repoTagIdList = this.getRepoTagIdList();
|
||||||
if (repoTagIdList.indexOf(repoTag.id) === -1) {
|
if (repoTagIdList.indexOf(repoTag.id) === -1) {
|
||||||
let id = repoTag.id;
|
let id = repoTag.id;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
||||||
import { gettext, repoID } from '../../utils/constants';
|
import { gettext } from '../../utils/constants';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import RepoTag from '../../models/repo-tag';
|
import RepoTag from '../../models/repo-tag';
|
||||||
import '../../css/repo-tag.css';
|
import '../../css/repo-tag.css';
|
||||||
@@ -31,6 +31,7 @@ class TagListItem extends React.Component {
|
|||||||
TagListItem.propTypes = tagListItemPropTypes;
|
TagListItem.propTypes = tagListItemPropTypes;
|
||||||
|
|
||||||
const listTagPropTypes = {
|
const listTagPropTypes = {
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
onListTagCancel: PropTypes.func.isRequired,
|
onListTagCancel: PropTypes.func.isRequired,
|
||||||
onCreateRepoTag: PropTypes.func.isRequired,
|
onCreateRepoTag: PropTypes.func.isRequired,
|
||||||
onUpdateRepoTag: PropTypes.func.isRequired,
|
onUpdateRepoTag: PropTypes.func.isRequired,
|
||||||
@@ -45,6 +46,7 @@ class ListTagDialog extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.listRepoTags(repoID).then(res => {
|
seafileAPI.listRepoTags(repoID).then(res => {
|
||||||
let repotagList = [];
|
let repotagList = [];
|
||||||
res.data.repo_tags.forEach(item => {
|
res.data.repo_tags.forEach(item => {
|
||||||
|
@@ -1,12 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button, Modal, ModalHeader, ModalFooter, ModalBody, Alert } from 'reactstrap';
|
import { Button, Modal, ModalHeader, ModalFooter, ModalBody, Alert } from 'reactstrap';
|
||||||
import { gettext, repoID } from '../../utils/constants';
|
import { gettext } from '../../utils/constants';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import FileChooser from '../file-chooser/file-chooser';
|
import FileChooser from '../file-chooser/file-chooser';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
dirent: PropTypes.object,
|
dirent: PropTypes.object,
|
||||||
selectedDirentList: PropTypes.array,
|
selectedDirentList: PropTypes.array,
|
||||||
isMutipleOperation: PropTypes.bool.isRequired,
|
isMutipleOperation: PropTypes.bool.isRequired,
|
||||||
@@ -43,7 +44,7 @@ class MoveDirent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moveItems = () => {
|
moveItems = () => {
|
||||||
let { repo, selectedPath } = this.state;
|
let { repo, repoID, selectedPath } = this.state;
|
||||||
let message = gettext('Invalid destination path');
|
let message = gettext('Invalid destination path');
|
||||||
|
|
||||||
if (!repo || selectedPath === '') {
|
if (!repo || selectedPath === '') {
|
||||||
@@ -93,7 +94,7 @@ class MoveDirent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moveItem = () => {
|
moveItem = () => {
|
||||||
let { repo, selectedPath } = this.state;
|
let { repo, repoID, selectedPath } = this.state;
|
||||||
let direntPath = Utils.joinPath(this.props.path, this.props.dirent.name);
|
let direntPath = Utils.joinPath(this.props.path, this.props.dirent.name);
|
||||||
let message = gettext('Invalid destination path');
|
let message = gettext('Invalid destination path');
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ class MoveDirent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// copy the dirent to current path
|
// copy the dirent to current path
|
||||||
if (selectedPath && Utils.getDirName(direntPath) === selectedPath) {
|
if (selectedPath && this.props.path === selectedPath && repo.repo_id === repoID) {
|
||||||
this.setState({errMessage: message});
|
this.setState({errMessage: message});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -159,6 +160,7 @@ class MoveDirent extends React.Component {
|
|||||||
<ModalHeader toggle={this.toggle}><div dangerouslySetInnerHTML={{__html: title}}></div></ModalHeader>
|
<ModalHeader toggle={this.toggle}><div dangerouslySetInnerHTML={{__html: title}}></div></ModalHeader>
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<FileChooser
|
<FileChooser
|
||||||
|
repoID={this.props.repoID}
|
||||||
onDirentItemClick={this.onDirentItemClick}
|
onDirentItemClick={this.onDirentItemClick}
|
||||||
onRepoItemClick={this.onRepoItemClick}
|
onRepoItemClick={this.onRepoItemClick}
|
||||||
/>
|
/>
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Input } from 'reactstrap';
|
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Input } from 'reactstrap';
|
||||||
import { gettext, repoID } from '../../utils/constants';
|
import { gettext } from '../../utils/constants';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
currentTag: PropTypes.object,
|
currentTag: PropTypes.object,
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
toggleCancel: PropTypes.func.isRequired,
|
toggleCancel: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,6 +43,7 @@ class UpdateTagDialog extends React.Component {
|
|||||||
let tag_id = this.props.currentTag.id;
|
let tag_id = this.props.currentTag.id;
|
||||||
let name = this.state.newName;
|
let name = this.state.newName;
|
||||||
let color = this.state.newColor;
|
let color = this.state.newColor;
|
||||||
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.updateRepoTag(repoID, tag_id, name, color).then(() => {
|
seafileAPI.updateRepoTag(repoID, tag_id, name, color).then(() => {
|
||||||
this.props.toggleCancel();
|
this.props.toggleCancel();
|
||||||
});
|
});
|
||||||
@@ -65,6 +67,7 @@ class UpdateTagDialog extends React.Component {
|
|||||||
|
|
||||||
onDeleteTag = () => {
|
onDeleteTag = () => {
|
||||||
let tag = this.props.currentTag;
|
let tag = this.props.currentTag;
|
||||||
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.deleteRepoTag(repoID, tag.id).then(() => {
|
seafileAPI.deleteRepoTag(repoID, tag.id).then(() => {
|
||||||
this.props.toggleCancel();
|
this.props.toggleCancel();
|
||||||
});
|
});
|
||||||
|
@@ -7,6 +7,7 @@ import EditFileTagDialog from '../dialog/edit-filetag-dialog';
|
|||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
repo: PropTypes.object.isRequired,
|
repo: PropTypes.object.isRequired,
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
dirent: PropTypes.object.isRequired,
|
dirent: PropTypes.object.isRequired,
|
||||||
direntType: PropTypes.string.isRequired,
|
direntType: PropTypes.string.isRequired,
|
||||||
direntDetail: PropTypes.object.isRequired,
|
direntDetail: PropTypes.object.isRequired,
|
||||||
@@ -90,6 +91,7 @@ class DetailListView extends React.Component {
|
|||||||
{
|
{
|
||||||
this.state.isEditFileTagShow &&
|
this.state.isEditFileTagShow &&
|
||||||
<EditFileTagDialog
|
<EditFileTagDialog
|
||||||
|
repoID={this.props.repoID}
|
||||||
fileTagList={fileTagList}
|
fileTagList={fileTagList}
|
||||||
filePath={this.props.direntPath}
|
filePath={this.props.direntPath}
|
||||||
toggleCancel={this.onEditFileTagToggle}
|
toggleCancel={this.onEditFileTagToggle}
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import { serviceUrl, repoID } from '../../utils/constants';
|
|
||||||
import DetailListView from './detail-list-view';
|
import DetailListView from './detail-list-view';
|
||||||
import Repo from '../../models/repo';
|
import Repo from '../../models/repo';
|
||||||
import FileTag from '../../models/file-tag';
|
import FileTag from '../../models/file-tag';
|
||||||
import '../../css/dirent-detail.css';
|
import '../../css/dirent-detail.css';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
|
serviceUrl: PropTypes.string.isRequired,
|
||||||
dirent: PropTypes.object.isRequired,
|
dirent: PropTypes.object.isRequired,
|
||||||
direntPath: PropTypes.string.isRequired,
|
direntPath: PropTypes.string.isRequired,
|
||||||
onItemDetailsClose: PropTypes.func.isRequired,
|
onItemDetailsClose: PropTypes.func.isRequired,
|
||||||
@@ -27,7 +28,7 @@ class DirentDetail extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
let { dirent, direntPath } = this.props;
|
let { dirent, direntPath, repoID } = this.props;
|
||||||
seafileAPI.getRepoInfo(repoID).then(res => {
|
seafileAPI.getRepoInfo(repoID).then(res => {
|
||||||
let repo = new Repo(res.data);
|
let repo = new Repo(res.data);
|
||||||
this.setState({repo: repo});
|
this.setState({repo: repo});
|
||||||
@@ -40,6 +41,7 @@ class DirentDetail extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateDetailView = (dirent, direntPath) => {
|
updateDetailView = (dirent, direntPath) => {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
if (dirent.type === 'file') {
|
if (dirent.type === 'file') {
|
||||||
seafileAPI.getFileInfo(repoID, direntPath).then(res => {
|
seafileAPI.getFileInfo(repoID, direntPath).then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -66,7 +68,7 @@ class DirentDetail extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let { dirent } = this.props;
|
let { dirent, serviceUrl } = this.props;
|
||||||
return (
|
return (
|
||||||
<div className="detail-container">
|
<div className="detail-container">
|
||||||
<div className="detail-header">
|
<div className="detail-header">
|
||||||
@@ -84,6 +86,7 @@ class DirentDetail extends React.Component {
|
|||||||
<div className="dirent-table-container">
|
<div className="dirent-table-container">
|
||||||
<DetailListView
|
<DetailListView
|
||||||
repo={this.state.repo}
|
repo={this.state.repo}
|
||||||
|
repoID={this.props.repoID}
|
||||||
dirent={this.props.dirent}
|
dirent={this.props.dirent}
|
||||||
direntPath={this.props.direntPath}
|
direntPath={this.props.direntPath}
|
||||||
direntType={this.state.direntType}
|
direntType={this.state.direntType}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { serviceUrl, gettext, repoID } from '../../utils/constants';
|
import { gettext } from '../../utils/constants';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import URLDecorator from '../../utils/url-decorator';
|
import URLDecorator from '../../utils/url-decorator';
|
||||||
import Toast from '../toast';
|
import Toast from '../toast';
|
||||||
@@ -13,6 +13,8 @@ import CopyDirentDialog from '../dialog/copy-dirent-dialog';
|
|||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
|
serviceUrl: PropTypes.string.isRequired,
|
||||||
isItemFreezed: PropTypes.bool.isRequired,
|
isItemFreezed: PropTypes.bool.isRequired,
|
||||||
dirent: PropTypes.object.isRequired,
|
dirent: PropTypes.object.isRequired,
|
||||||
onItemClick: PropTypes.func.isRequired,
|
onItemClick: PropTypes.func.isRequired,
|
||||||
@@ -123,6 +125,7 @@ class DirentListItem extends React.Component {
|
|||||||
|
|
||||||
onItemStarred = () => {
|
onItemStarred = () => {
|
||||||
let dirent = this.props.dirent;
|
let dirent = this.props.dirent;
|
||||||
|
let repoID = this.props.repoID;
|
||||||
let filePath = this.getDirentPath(dirent);
|
let filePath = this.getDirentPath(dirent);
|
||||||
if (dirent.starred) {
|
if (dirent.starred) {
|
||||||
seafileAPI.unStarFile(repoID, filePath).then(() => {
|
seafileAPI.unStarFile(repoID, filePath).then(() => {
|
||||||
@@ -247,6 +250,7 @@ class DirentListItem extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onLockItem = () => {
|
onLockItem = () => {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
let filePath = this.getDirentPath(this.props.dirent);
|
let filePath = this.getDirentPath(this.props.dirent);
|
||||||
seafileAPI.lockfile(repoID, filePath).then(() => {
|
seafileAPI.lockfile(repoID, filePath).then(() => {
|
||||||
this.props.updateDirent(this.props.dirent, 'is_locked', true);
|
this.props.updateDirent(this.props.dirent, 'is_locked', true);
|
||||||
@@ -256,6 +260,7 @@ class DirentListItem extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onUnlockItem = () => {
|
onUnlockItem = () => {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
let filePath = this.getDirentPath(this.props.dirent);
|
let filePath = this.getDirentPath(this.props.dirent);
|
||||||
seafileAPI.unlockfile(repoID, filePath).then(() => {
|
seafileAPI.unlockfile(repoID, filePath).then(() => {
|
||||||
this.props.updateDirent(this.props.dirent, 'is_locked', false);
|
this.props.updateDirent(this.props.dirent, 'is_locked', false);
|
||||||
@@ -265,6 +270,7 @@ class DirentListItem extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onNewDraft = () => {
|
onNewDraft = () => {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
let filePath = this.getDirentPath(this.props.dirent);
|
let filePath = this.getDirentPath(this.props.dirent);
|
||||||
seafileAPI.createDraft(repoID, filePath).then(res => {
|
seafileAPI.createDraft(repoID, filePath).then(res => {
|
||||||
let draft_file_Path = res.data.draft_file_path;
|
let draft_file_Path = res.data.draft_file_path;
|
||||||
@@ -283,6 +289,7 @@ class DirentListItem extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onHistory = () => {
|
onHistory = () => {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
let filePath = this.getDirentPath(this.props.dirent);
|
let filePath = this.getDirentPath(this.props.dirent);
|
||||||
let referer = location.href;
|
let referer = location.href;
|
||||||
let url = URLDecorator.getUrl({type: 'file_revisions', repoID: repoID, filePath: filePath, referer: referer});
|
let url = URLDecorator.getUrl({type: 'file_revisions', repoID: repoID, filePath: filePath, referer: referer});
|
||||||
@@ -295,6 +302,7 @@ class DirentListItem extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onOpenViaClient = () => {
|
onOpenViaClient = () => {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
let filePath = this.getDirentPath(this.props.dirent);
|
let filePath = this.getDirentPath(this.props.dirent);
|
||||||
let url = URLDecorator.getUrl({type: 'open_via_client', repoID: repoID, filePath: filePath});
|
let url = URLDecorator.getUrl({type: 'open_via_client', repoID: repoID, filePath: filePath});
|
||||||
location.href = url;
|
location.href = url;
|
||||||
@@ -304,6 +312,7 @@ class DirentListItem extends React.Component {
|
|||||||
onItemDownload = (e) => {
|
onItemDownload = (e) => {
|
||||||
e.nativeEvent.stopImmediatePropagation();
|
e.nativeEvent.stopImmediatePropagation();
|
||||||
let dirent = this.props.dirent;
|
let dirent = this.props.dirent;
|
||||||
|
let repoID = this.props.repoID;
|
||||||
let direntPath = this.getDirentPath(dirent);
|
let direntPath = this.getDirentPath(dirent);
|
||||||
if (dirent.type === 'dir') {
|
if (dirent.type === 'dir') {
|
||||||
this.setState({isProgressDialogShow: true, progress: 0});
|
this.setState({isProgressDialogShow: true, progress: 0});
|
||||||
@@ -359,7 +368,7 @@ class DirentListItem extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let { dirent } = this.props;
|
let { dirent, serviceUrl } = this.props;
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
|
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
|
||||||
@@ -429,6 +438,7 @@ class DirentListItem extends React.Component {
|
|||||||
<ModalPortal>
|
<ModalPortal>
|
||||||
<MoveDirentDialog
|
<MoveDirentDialog
|
||||||
path={this.props.path}
|
path={this.props.path}
|
||||||
|
repoID={this.props.repoID}
|
||||||
dirent={this.props.dirent}
|
dirent={this.props.dirent}
|
||||||
isMutipleOperation={this.state.isMutipleOperation}
|
isMutipleOperation={this.state.isMutipleOperation}
|
||||||
onItemMove={this.props.onItemMove}
|
onItemMove={this.props.onItemMove}
|
||||||
@@ -440,6 +450,7 @@ class DirentListItem extends React.Component {
|
|||||||
<ModalPortal>
|
<ModalPortal>
|
||||||
<CopyDirentDialog
|
<CopyDirentDialog
|
||||||
path={this.props.path}
|
path={this.props.path}
|
||||||
|
repoID={this.props.repoID}
|
||||||
dirent={this.props.dirent}
|
dirent={this.props.dirent}
|
||||||
isMutipleOperation={this.state.isMutipleOperation}
|
isMutipleOperation={this.state.isMutipleOperation}
|
||||||
onItemCopy={this.props.onItemCopy}
|
onItemCopy={this.props.onItemCopy}
|
||||||
|
@@ -6,6 +6,12 @@ import DirentListItem from './dirent-list-item';
|
|||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
|
serviceUrl: PropTypes.string.isRequired,
|
||||||
|
isRepoOwner: PropTypes.bool,
|
||||||
|
currentRepo: PropTypes.object,
|
||||||
|
isAllItemSelected: PropTypes.bool.isRequired,
|
||||||
|
isDirentListLoading: PropTypes.bool.isRequired,
|
||||||
direntList: PropTypes.array.isRequired,
|
direntList: PropTypes.array.isRequired,
|
||||||
onItemDelete: PropTypes.func.isRequired,
|
onItemDelete: PropTypes.func.isRequired,
|
||||||
onAllItemSelected: PropTypes.func.isRequired,
|
onAllItemSelected: PropTypes.func.isRequired,
|
||||||
@@ -16,10 +22,6 @@ const propTypes = {
|
|||||||
onItemCopy: PropTypes.func.isRequired,
|
onItemCopy: PropTypes.func.isRequired,
|
||||||
onItemDetails: PropTypes.func.isRequired,
|
onItemDetails: PropTypes.func.isRequired,
|
||||||
updateDirent: PropTypes.func.isRequired,
|
updateDirent: PropTypes.func.isRequired,
|
||||||
isDirentListLoading: PropTypes.bool.isRequired,
|
|
||||||
isRepoOwner: PropTypes.bool,
|
|
||||||
currentRepo: PropTypes.object,
|
|
||||||
isAllItemSelected: PropTypes.bool.isRequired,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DirentListView extends React.Component {
|
class DirentListView extends React.Component {
|
||||||
@@ -78,6 +80,8 @@ class DirentListView extends React.Component {
|
|||||||
key={index}
|
key={index}
|
||||||
dirent={dirent}
|
dirent={dirent}
|
||||||
path={this.props.path}
|
path={this.props.path}
|
||||||
|
repoID={this.props.repoID}
|
||||||
|
serviceUrl={this.props.serviceUrl}
|
||||||
currentRepo={this.props.currentRepo}
|
currentRepo={this.props.currentRepo}
|
||||||
isRepoOwner={this.props.isRepoOwner}
|
isRepoOwner={this.props.isRepoOwner}
|
||||||
onItemClick={this.props.onItemClick}
|
onItemClick={this.props.onItemClick}
|
||||||
|
@@ -2,12 +2,13 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import RepoListView from './repo-list-view';
|
import RepoListView from './repo-list-view';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import { gettext, repoID } from '../../utils/constants';
|
import { gettext } from '../../utils/constants';
|
||||||
import Repo from '../../models/repo';
|
import Repo from '../../models/repo';
|
||||||
|
|
||||||
import '../../css/file-chooser.css';
|
import '../../css/file-chooser.css';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
onDirentItemClick: PropTypes.func,
|
onDirentItemClick: PropTypes.func,
|
||||||
onRepoItemClick: PropTypes.func,
|
onRepoItemClick: PropTypes.func,
|
||||||
};
|
};
|
||||||
@@ -28,6 +29,7 @@ class FileChooser extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.getRepoInfo(repoID).then(res => {
|
seafileAPI.getRepoInfo(repoID).then(res => {
|
||||||
let repo = new Repo(res.data);
|
let repo = new Repo(res.data);
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@@ -2,13 +2,15 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Resumablejs from '@seafile/resumablejs';
|
import Resumablejs from '@seafile/resumablejs';
|
||||||
import MD5 from 'MD5';
|
import MD5 from 'MD5';
|
||||||
import { repoID, enableResumableFileUpload } from '../../utils/constants';
|
import { enableResumableFileUpload } from '../../utils/constants';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import UploadProgressDialog from './upload-progress-dialog';
|
import UploadProgressDialog from './upload-progress-dialog';
|
||||||
import UploadRemindDialog from '../dialog/upload-remind-dialog';
|
import UploadRemindDialog from '../dialog/upload-remind-dialog';
|
||||||
import '../../css/file-uploader.css';
|
import '../../css/file-uploader.css';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
|
direntList: PropTypes.array.isRequired,
|
||||||
filetypes: PropTypes.array,
|
filetypes: PropTypes.array,
|
||||||
chunkSize: PropTypes.number,
|
chunkSize: PropTypes.number,
|
||||||
withCredentials: PropTypes.bool,
|
withCredentials: PropTypes.bool,
|
||||||
@@ -112,6 +114,7 @@ class FileUploader extends React.Component {
|
|||||||
return; // is upload a folder;
|
return; // is upload a folder;
|
||||||
}
|
}
|
||||||
if (enableResumableFileUpload) {
|
if (enableResumableFileUpload) {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.getFileUploadedBytes(repoID, this.props.path, file.fileName).then(res => {
|
seafileAPI.getFileUploadedBytes(repoID, this.props.path, file.fileName).then(res => {
|
||||||
let uploadedBytes = res.data.uploadedBytes;
|
let uploadedBytes = res.data.uploadedBytes;
|
||||||
let offset = Math.floor(uploadedBytes / (1024 * 1024));
|
let offset = Math.floor(uploadedBytes / (1024 * 1024));
|
||||||
@@ -277,6 +280,7 @@ class FileUploader extends React.Component {
|
|||||||
onFileUpload = () => {
|
onFileUpload = () => {
|
||||||
this.uploadInput.removeAttribute('webkitdirectory');
|
this.uploadInput.removeAttribute('webkitdirectory');
|
||||||
this.uploadInput.click();
|
this.uploadInput.click();
|
||||||
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.getUploadLink(repoID, this.props.path).then(res => {
|
seafileAPI.getUploadLink(repoID, this.props.path).then(res => {
|
||||||
this.resumable.opts.target = res.data;
|
this.resumable.opts.target = res.data;
|
||||||
});
|
});
|
||||||
@@ -285,12 +289,14 @@ class FileUploader extends React.Component {
|
|||||||
onFolderUpload = () => {
|
onFolderUpload = () => {
|
||||||
this.uploadInput.setAttribute('webkitdirectory', 'webkitdirectory');
|
this.uploadInput.setAttribute('webkitdirectory', 'webkitdirectory');
|
||||||
this.uploadInput.click();
|
this.uploadInput.click();
|
||||||
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.getUploadLink(repoID, this.props.path).then(res => {
|
seafileAPI.getUploadLink(repoID, this.props.path).then(res => {
|
||||||
this.resumable.opts.target = res.data;
|
this.resumable.opts.target = res.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onDragStart = () => {
|
onDragStart = () => {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
this.uploadInput.setAttribute('webkitdirectory', 'webkitdirectory');
|
this.uploadInput.setAttribute('webkitdirectory', 'webkitdirectory');
|
||||||
seafileAPI.getUploadLink(repoID, this.props.path).then(res => {
|
seafileAPI.getUploadLink(repoID, this.props.path).then(res => {
|
||||||
this.resumable.opts.target = res.data;
|
this.resumable.opts.target = res.data;
|
||||||
|
@@ -1,12 +1,13 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { repoID, siteRoot } from '../../utils/constants';
|
import { siteRoot } from '../../utils/constants';
|
||||||
import SearchResultItem from './search-result-item';
|
import SearchResultItem from './search-result-item';
|
||||||
import editorUtilities from '../../utils/editor-utilties';
|
import editorUtilities from '../../utils/editor-utilties';
|
||||||
import More from '../more';
|
import More from '../more';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
onSearchedClick: PropTypes.func.isRequired,
|
onSearchedClick: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ class Search extends Component {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
let repoID = this.props.repoID;
|
||||||
let queryData = {
|
let queryData = {
|
||||||
q: newValue,
|
q: newValue,
|
||||||
search_repo: repoID ? repoID : 'all',
|
search_repo: repoID ? repoID : 'all',
|
||||||
@@ -165,6 +166,7 @@ class Search extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onShowMore = () => {
|
onShowMore = () => {
|
||||||
|
let repoID = this.props.repoID;
|
||||||
let newValue = this.state.value;
|
let newValue = this.state.value;
|
||||||
let queryData = {
|
let queryData = {
|
||||||
q: newValue,
|
q: newValue,
|
||||||
|
@@ -6,6 +6,7 @@ import Notification from '../common/notification';
|
|||||||
import Account from '../common/account';
|
import Account from '../common/account';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
|
repoID: PropTypes.string.isRequired,
|
||||||
onSearchedClick: PropTypes.func.isRequired,
|
onSearchedClick: PropTypes.func.isRequired,
|
||||||
searchPlaceholder: PropTypes.string
|
searchPlaceholder: PropTypes.string
|
||||||
};
|
};
|
||||||
@@ -14,7 +15,13 @@ class CommonToolbar extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="common-toolbar">
|
<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 />
|
<Notification />
|
||||||
<Account />
|
<Account />
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import { gettext, serviceUrl } from '../../utils/constants';
|
import { gettext } from '../../utils/constants';
|
||||||
import ModalPortal from '../modal-portal';
|
import ModalPortal from '../modal-portal';
|
||||||
import CreateFolder from '../../components/dialog/create-folder-dialog';
|
import CreateFolder from '../../components/dialog/create-folder-dialog';
|
||||||
import CreateFile from '../../components/dialog/create-file-dialog';
|
import CreateFile from '../../components/dialog/create-file-dialog';
|
||||||
@@ -10,6 +10,7 @@ const propTypes = {
|
|||||||
isViewFile: PropTypes.bool,
|
isViewFile: PropTypes.bool,
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
repoID: PropTypes.string.isRequired,
|
repoID: PropTypes.string.isRequired,
|
||||||
|
serviceUrl: PropTypes.string.isRequired,
|
||||||
permission: PropTypes.string.isRequired,
|
permission: PropTypes.string.isRequired,
|
||||||
onAddFile: PropTypes.func.isRequired,
|
onAddFile: PropTypes.func.isRequired,
|
||||||
onAddFolder: PropTypes.func.isRequired,
|
onAddFolder: PropTypes.func.isRequired,
|
||||||
@@ -57,7 +58,7 @@ class DirOperationToolbar extends React.Component {
|
|||||||
|
|
||||||
onEditClick = (e) => {
|
onEditClick = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let { path, repoID} = this.props;
|
let { path, repoID, serviceUrl } = this.props;
|
||||||
window.location.href= serviceUrl + '/lib/' + repoID + '/file' + path + '?mode=edit';
|
window.location.href= serviceUrl + '/lib/' + repoID + '/file' + path + '?mode=edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,6 +11,7 @@ const propTypes = {
|
|||||||
class GeneralToolbar extends React.Component {
|
class GeneralToolbar extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
// todo get repoID?
|
||||||
let { onShowSidePanel, onSearchedClick } = this.props;
|
let { onShowSidePanel, onSearchedClick } = this.props;
|
||||||
let placeHolder = this.props.searchPlaceholder || 'Search files in this library';
|
let placeHolder = this.props.searchPlaceholder || 'Search files in this library';
|
||||||
return (
|
return (
|
||||||
@@ -23,6 +24,7 @@ class GeneralToolbar extends React.Component {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<CommonToolbar
|
<CommonToolbar
|
||||||
|
repoID={'todo'}
|
||||||
searchPlaceholder={placeHolder}
|
searchPlaceholder={placeHolder}
|
||||||
onSearchedClick={onSearchedClick}
|
onSearchedClick={onSearchedClick}
|
||||||
/>
|
/>
|
||||||
|
@@ -104,6 +104,7 @@ class MutipleDirOperationToolbar extends React.Component {
|
|||||||
{this.state.isMoveDialogShow &&
|
{this.state.isMoveDialogShow &&
|
||||||
<MoveDirentDialog
|
<MoveDirentDialog
|
||||||
path={this.props.path}
|
path={this.props.path}
|
||||||
|
repoID={this.props.repoID}
|
||||||
isMutipleOperation={this.state.isMutipleOperation}
|
isMutipleOperation={this.state.isMutipleOperation}
|
||||||
selectedDirentList={this.props.selectedDirentList}
|
selectedDirentList={this.props.selectedDirentList}
|
||||||
onItemsMove={this.props.onItemsMove}
|
onItemsMove={this.props.onItemsMove}
|
||||||
@@ -113,6 +114,7 @@ class MutipleDirOperationToolbar extends React.Component {
|
|||||||
{this.state.isCopyDialogShow &&
|
{this.state.isCopyDialogShow &&
|
||||||
<CopyDirentDialog
|
<CopyDirentDialog
|
||||||
path={this.props.path}
|
path={this.props.path}
|
||||||
|
repoID={this.props.repoID}
|
||||||
selectedDirentList={this.props.selectedDirentList}
|
selectedDirentList={this.props.selectedDirentList}
|
||||||
isMutipleOperation={this.state.isMutipleOperation}
|
isMutipleOperation={this.state.isMutipleOperation}
|
||||||
onItemsCopy={this.props.onItemsCopy}
|
onItemsCopy={this.props.onItemsCopy}
|
||||||
|
@@ -44,4 +44,5 @@
|
|||||||
.uploader-list-content {
|
.uploader-list-content {
|
||||||
padding: 0.625rem 1rem 1.25rem;
|
padding: 0.625rem 1rem 1.25rem;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
@@ -1,7 +1,7 @@
|
|||||||
import React, { Component, Fragment } from 'react';
|
import React, { Component, Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import cookie from 'react-cookies';
|
import cookie from 'react-cookies';
|
||||||
import { gettext, repoID, serviceUrl, slug } from '../../utils/constants';
|
import { gettext, repoID, serviceUrl, slug, permission } from '../../utils/constants';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import Repo from '../../models/repo';
|
import Repo from '../../models/repo';
|
||||||
@@ -139,8 +139,9 @@ class MainPanel extends Component {
|
|||||||
onItemsDelete={this.props.onItemsDelete}
|
onItemsDelete={this.props.onItemsDelete}
|
||||||
/> :
|
/> :
|
||||||
<DirOperationToolBar
|
<DirOperationToolBar
|
||||||
repoID={repoID}
|
|
||||||
path={this.props.path}
|
path={this.props.path}
|
||||||
|
repoID={repoID}
|
||||||
|
serviceUrl={serviceUrl}
|
||||||
permission={this.props.permission}
|
permission={this.props.permission}
|
||||||
isViewFile={this.props.isViewFile}
|
isViewFile={this.props.isViewFile}
|
||||||
onAddFile={this.props.onAddFile}
|
onAddFile={this.props.onAddFile}
|
||||||
@@ -152,12 +153,18 @@ class MainPanel extends Component {
|
|||||||
</div>
|
</div>
|
||||||
<ViewModeToolbar currentMode={this.state.currentMode} switchViewMode={this.switchViewMode}/>
|
<ViewModeToolbar currentMode={this.state.currentMode} switchViewMode={this.switchViewMode}/>
|
||||||
</div>
|
</div>
|
||||||
<CommonToolbar onSearchedClick={this.props.onSearchedClick} searchPlaceholder={'Search files in this library'}/>
|
<CommonToolbar repoID={repoID} onSearchedClick={this.props.onSearchedClick} searchPlaceholder={'Search files in this library'}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="main-panel-center flex-direction-row">
|
<div className="main-panel-center flex-direction-row">
|
||||||
<div className="cur-view-container">
|
<div className="cur-view-container">
|
||||||
<div className="cur-view-path">
|
<div className="cur-view-path">
|
||||||
<CurDirPath currentPath={this.props.path} repoName={slug} onPathClick={this.onMainNavBarClick}/>
|
<CurDirPath
|
||||||
|
repoID={repoID}
|
||||||
|
repoName={slug}
|
||||||
|
currentPath={this.props.path}
|
||||||
|
permission={permission}
|
||||||
|
onPathClick={this.onMainNavBarClick}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="cur-view-content">
|
<div className="cur-view-content">
|
||||||
{ !this.props.pathExist ?
|
{ !this.props.pathExist ?
|
||||||
@@ -173,8 +180,10 @@ class MainPanel extends Component {
|
|||||||
/> :
|
/> :
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<DirentListView
|
<DirentListView
|
||||||
direntList={this.props.direntList}
|
|
||||||
path={this.props.path}
|
path={this.props.path}
|
||||||
|
repoID={repoID}
|
||||||
|
serviceUrl={serviceUrl}
|
||||||
|
direntList={this.props.direntList}
|
||||||
onItemClick={this.props.onItemClick}
|
onItemClick={this.props.onItemClick}
|
||||||
onItemDelete={this.props.onItemDelete}
|
onItemDelete={this.props.onItemDelete}
|
||||||
onItemRename={this.props.onItemRename}
|
onItemRename={this.props.onItemRename}
|
||||||
@@ -193,6 +202,7 @@ class MainPanel extends Component {
|
|||||||
ref={uploader => this.uploader = uploader}
|
ref={uploader => this.uploader = uploader}
|
||||||
dragAndDrop={true}
|
dragAndDrop={true}
|
||||||
path={this.props.path}
|
path={this.props.path}
|
||||||
|
repoID={repoID}
|
||||||
onFileSuccess={this.onFileSuccess}
|
onFileSuccess={this.onFileSuccess}
|
||||||
direntList={this.props.direntList}
|
direntList={this.props.direntList}
|
||||||
/>
|
/>
|
||||||
@@ -205,6 +215,8 @@ class MainPanel extends Component {
|
|||||||
{ this.state.isDirentDetailShow &&
|
{ this.state.isDirentDetailShow &&
|
||||||
<div className="cur-view-detail">
|
<div className="cur-view-detail">
|
||||||
<DirentDetail
|
<DirentDetail
|
||||||
|
repoID={repoID}
|
||||||
|
serviceUrl={serviceUrl}
|
||||||
dirent={this.state.currentDirent}
|
dirent={this.state.currentDirent}
|
||||||
direntPath={this.state.direntPath}
|
direntPath={this.state.direntPath}
|
||||||
onItemDetailsClose={this.onItemDetailsClose}
|
onItemDetailsClose={this.onItemDetailsClose}
|
||||||
|
Reference in New Issue
Block a user