mirror of
https://github.com/haiwen/seahub.git
synced 2025-10-21 19:00:12 +00:00
@@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component, Fragment } from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { Router } from '@reach/router';
|
import { Router, Link } from '@reach/router';
|
||||||
import { siteRoot } from './utils/constants';
|
import { gettext, siteRoot } from './utils/constants';
|
||||||
import SidePanel from './components/side-panel';
|
import SidePanel from './components/side-panel';
|
||||||
import MainPanel from './components/main-panel';
|
import MainPanel from './components/main-panel';
|
||||||
import DraftsView from './pages/drafts/drafts-view';
|
import DraftsView from './pages/drafts/drafts-view';
|
||||||
@@ -52,8 +52,8 @@ class App extends Component {
|
|||||||
draftList:[],
|
draftList:[],
|
||||||
isLoadingDraft: true,
|
isLoadingDraft: true,
|
||||||
currentTab: '/',
|
currentTab: '/',
|
||||||
|
pathPrefix: null,
|
||||||
};
|
};
|
||||||
this.currentTab = ''; //just for refresh brower
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -101,12 +101,42 @@ class App extends Component {
|
|||||||
//todos
|
//todos
|
||||||
}
|
}
|
||||||
|
|
||||||
tabItemClick = (tabName) => {
|
tabItemClick = (tabName, groupID) => {
|
||||||
this.setState({currentTab: tabName});
|
let pathPrefix = this.generatorPrefix(tabName, groupID);
|
||||||
|
this.setState({
|
||||||
|
currentTab: tabName,
|
||||||
|
pathPrefix: pathPrefix
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCurrentTab = (tabName) => {
|
generatorPrefix = (currentTab, groupID) => {
|
||||||
this.currentTab = tabName;
|
if (groupID) { //group
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<Link to={siteRoot + 'groups/'} className="normal">{gettext('Groups')}</Link>
|
||||||
|
<span className="path-split">/</span>
|
||||||
|
<Link to={siteRoot + 'group/' + groupID + '/'} className="normal">{currentTab}</Link>
|
||||||
|
<span className="path-split">/</span>
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (currentTab === 'my-libs') {
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<Link to={siteRoot + 'my-libs/'} className="normal">{gettext('Libraries')}</Link>
|
||||||
|
<span className="path-split">/</span>
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (currentTab === 'shared-libs') {
|
||||||
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<Link to={siteRoot + 'shared-libs/'} className="normal">{gettext('Shared with me')}</Link>
|
||||||
|
<span className="path-split">/</span>
|
||||||
|
</Fragment>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -141,7 +171,7 @@ class App extends Component {
|
|||||||
<ShareAdminUploadLinksWrapper path={siteRoot + 'share-admin-upload-links'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
|
<ShareAdminUploadLinksWrapper path={siteRoot + 'share-admin-upload-links'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
|
||||||
<SharedLibrariesWrapper path={siteRoot + 'shared-libs'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
|
<SharedLibrariesWrapper path={siteRoot + 'shared-libs'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
|
||||||
<MyLibraries path={siteRoot + 'my-libs'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
|
<MyLibraries path={siteRoot + 'my-libs'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick} />
|
||||||
<DirView path={siteRoot + 'library/:repoID/*'} onMenuClick={this.onShowSidePanel} updateCurrentTab={this.updateCurrentTab}/>
|
<DirView path={siteRoot + 'library/:repoID/*'} pathPrefix={this.state.pathPrefix} onMenuClick={this.onShowSidePanel}/>
|
||||||
<Groups path={siteRoot + 'groups'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick}/>
|
<Groups path={siteRoot + 'groups'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick}/>
|
||||||
<Group path={siteRoot + 'group/:groupID'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick}/>
|
<Group path={siteRoot + 'group/:groupID'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick}/>
|
||||||
<WikisWrapper path={siteRoot + 'wikis'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick}/>
|
<WikisWrapper path={siteRoot + 'wikis'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick}/>
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
import React from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { siteRoot, gettext } from '../../utils/constants';
|
import { siteRoot, gettext } from '../../utils/constants';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
repoName: PropTypes.string.isRequired,
|
repoName: PropTypes.string.isRequired,
|
||||||
|
pathPrefix: PropTypes.object,
|
||||||
currentPath: PropTypes.string.isRequired,
|
currentPath: PropTypes.string.isRequired,
|
||||||
onPathClick: PropTypes.func.isRequired,
|
onPathClick: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
@@ -45,8 +46,13 @@ class DirPath extends React.Component {
|
|||||||
let pathElem = this.turnPathToLink(currentPath);
|
let pathElem = this.turnPathToLink(currentPath);
|
||||||
return (
|
return (
|
||||||
<div className="path-containter">
|
<div className="path-containter">
|
||||||
<a href={siteRoot + 'my-libs/'} className="normal">{gettext('Libraries')}</a>
|
{this.props.pathPrefix ?
|
||||||
<span className="path-split">/</span>
|
this.props.pathPrefix :
|
||||||
|
<Fragment>
|
||||||
|
<a href={siteRoot + 'my-libs/'} className="normal">{gettext('Libraries')}</a>
|
||||||
|
<span className="path-split">/</span>
|
||||||
|
</Fragment>
|
||||||
|
}
|
||||||
{currentPath === '/' ?
|
{currentPath === '/' ?
|
||||||
<span>{repoName}</span>:
|
<span>{repoName}</span>:
|
||||||
<a className="path-link" data-path="/" onClick={this.onPathClick}>{repoName}</a>
|
<a className="path-link" data-path="/" onClick={this.onPathClick}>{repoName}</a>
|
||||||
|
@@ -5,6 +5,7 @@ import DirTool from './dir-tool';
|
|||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
repoID: PropTypes.string.isRequired,
|
repoID: PropTypes.string.isRequired,
|
||||||
|
pathPrefix: PropTypes.object.isRequired,
|
||||||
repoName: PropTypes.string.isRequired,
|
repoName: PropTypes.string.isRequired,
|
||||||
permission: PropTypes.bool.isRequired,
|
permission: PropTypes.bool.isRequired,
|
||||||
currentPath: PropTypes.string.isRequired,
|
currentPath: PropTypes.string.isRequired,
|
||||||
@@ -18,6 +19,7 @@ class CurDirPath extends React.Component {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<DirPath
|
<DirPath
|
||||||
repoName={this.props.repoName}
|
repoName={this.props.repoName}
|
||||||
|
pathPrefix={this.props.pathPrefix}
|
||||||
currentPath={this.props.currentPath}
|
currentPath={this.props.currentPath}
|
||||||
onPathClick={this.props.onPathClick}
|
onPathClick={this.props.onPathClick}
|
||||||
/>
|
/>
|
||||||
|
@@ -14,6 +14,7 @@ import FileUploader from '../file-uploader/file-uploader';
|
|||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
currentRepo: PropTypes.object,
|
currentRepo: PropTypes.object,
|
||||||
|
pathPrefix: PropTypes.object.isRequired,
|
||||||
path: PropTypes.string.isRequired,
|
path: PropTypes.string.isRequired,
|
||||||
repoID: PropTypes.string.isRequired,
|
repoID: PropTypes.string.isRequired,
|
||||||
repoName: PropTypes.string.isRequired,
|
repoName: PropTypes.string.isRequired,
|
||||||
@@ -147,6 +148,7 @@ class DirPanel extends React.Component {
|
|||||||
<CurDirPath
|
<CurDirPath
|
||||||
repoID={this.props.repoID}
|
repoID={this.props.repoID}
|
||||||
repoName={this.props.repoName}
|
repoName={this.props.repoName}
|
||||||
|
pathPrefix={this.props.pathPrefix}
|
||||||
currentPath={this.props.path}
|
currentPath={this.props.path}
|
||||||
permission={this.props.permission}
|
permission={this.props.permission}
|
||||||
onPathClick={this.props.onPathClick}
|
onPathClick={this.props.onPathClick}
|
||||||
|
@@ -11,8 +11,8 @@ import FileTag from '../../models/file-tag';
|
|||||||
import Repo from '../../models/repo';
|
import Repo from '../../models/repo';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
|
pathPrefix: PropTypes.object.isRequired,
|
||||||
onMenuClick: PropTypes.func.isRequired,
|
onMenuClick: PropTypes.func.isRequired,
|
||||||
updateCurrentTab: PropTypes.func.isRequired,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DirView extends React.Component {
|
class DirView extends React.Component {
|
||||||
@@ -53,15 +53,9 @@ class DirView extends React.Component {
|
|||||||
permission: repo.permission === 'rw',
|
permission: repo.permission === 'rw',
|
||||||
currentRepo: repo,
|
currentRepo: repo,
|
||||||
});
|
});
|
||||||
|
|
||||||
let repoName = encodeURIComponent(repo.repo_name);
|
|
||||||
let index = location.href.indexOf(repoName) + repoName.length;
|
|
||||||
let path = decodeURIComponent(location.href.slice(index));
|
|
||||||
this.setState({path: path});
|
|
||||||
this.updateDirentList(path);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.props.updateCurrentTab('my-libs'); // just for refersh brower;
|
this.updateDirentList(this.state.path);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDirentList = (filePath) => {
|
updateDirentList = (filePath) => {
|
||||||
@@ -430,6 +424,7 @@ class DirView extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<DirPanel
|
<DirPanel
|
||||||
|
pathPrefix={this.props.pathPrefix}
|
||||||
currentRepo={this.state.currentRepo}
|
currentRepo={this.state.currentRepo}
|
||||||
path={this.state.path}
|
path={this.state.path}
|
||||||
pathExist={this.state.pathExit}
|
pathExist={this.state.pathExit}
|
||||||
|
@@ -52,8 +52,8 @@ class MainSideNav extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
tabItemClick = (param) => {
|
tabItemClick = (param, id) => {
|
||||||
this.props.tabItemClick(param);
|
this.props.tabItemClick(param, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
getActiveClass = (tab) => {
|
getActiveClass = (tab) => {
|
||||||
@@ -76,7 +76,7 @@ class MainSideNav extends React.Component {
|
|||||||
{this.state.groupItems.map(item => {
|
{this.state.groupItems.map(item => {
|
||||||
return (
|
return (
|
||||||
<li key={item.id} className="nav-item">
|
<li key={item.id} className="nav-item">
|
||||||
<Link to={siteRoot + 'group/' + item.id + '/'} className={`nav-link ellipsis ${this.getActiveClass(item.id)}`} onClick={() => this.tabItemClick(item.id)}>
|
<Link to={siteRoot + 'group/' + item.id + '/'} className={`nav-link ellipsis ${this.getActiveClass(item.name)}`} onClick={() => this.tabItemClick(item.name, item.id)}>
|
||||||
<span className="sharp" aria-hidden="true">#</span>
|
<span className="sharp" aria-hidden="true">#</span>
|
||||||
<span className="nav-text">{item.name}</span>
|
<span className="nav-text">{item.name}</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
@@ -2,6 +2,7 @@ import React, { Fragment } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
|
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
|
||||||
|
import { Link } from '@reach/router';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import { gettext, siteRoot, isPro, username, folderPermEnabled } from '../../utils/constants';
|
import { gettext, siteRoot, isPro, username, folderPermEnabled } from '../../utils/constants';
|
||||||
|
|
||||||
@@ -74,14 +75,13 @@ class SharedRepoListItem extends React.Component {
|
|||||||
|
|
||||||
getRepoComputeParams = () => {
|
getRepoComputeParams = () => {
|
||||||
let repo = this.props.repo;
|
let repo = this.props.repo;
|
||||||
let currentGroup = this.props.currentGroup; //todo--change to libray
|
let isReadOnly = false;
|
||||||
let isReadyOnly = false;
|
if (repo.permission === 'r' || repo.permission === 'preview') {
|
||||||
if ( repo.permission === 'r' || repo.permission === 'preview') {
|
isReadOnly = true;
|
||||||
isReadyOnly = true;
|
|
||||||
}
|
}
|
||||||
let iconUrl = Utils.getLibIconUrl({
|
let iconUrl = Utils.getLibIconUrl({
|
||||||
is_encryted: repo.encrypted,
|
is_encrypted: repo.encrypted,
|
||||||
is_readyonly: isReadyOnly,
|
is_readonly: isReadOnly,
|
||||||
size: Utils.isHiDPI() ? 48 : 24
|
size: Utils.isHiDPI() ? 48 : 24
|
||||||
});
|
});
|
||||||
let iconTitle = Utils.getLibIconTitle({
|
let iconTitle = Utils.getLibIconTitle({
|
||||||
@@ -91,7 +91,7 @@ class SharedRepoListItem extends React.Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//todo change to library; div-view is not compatibility
|
//todo change to library; div-view is not compatibility
|
||||||
let libPath = `${siteRoot}#group/${currentGroup.id}/lib/${this.props.repo.repo_id}/`;
|
let libPath = `${siteRoot}library/${this.props.repo.repo_id}/`;
|
||||||
|
|
||||||
return { iconUrl, iconTitle, libPath };
|
return { iconUrl, iconTitle, libPath };
|
||||||
}
|
}
|
||||||
@@ -269,7 +269,7 @@ class SharedRepoListItem extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<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}>
|
||||||
<td><img src={iconUrl} title={repo.iconTitle} alt={iconTitle} width="24" /></td>
|
<td><img src={iconUrl} title={repo.iconTitle} alt={iconTitle} width="24" /></td>
|
||||||
<td><a href={libPath}>{repo.repo_name}</a></td>
|
<td><Link to={libPath}>{repo.repo_name}</Link></td>
|
||||||
<td>{this.state.isOperationShow && this.generatorPCMenu()}</td>
|
<td>{this.state.isOperationShow && this.generatorPCMenu()}</td>
|
||||||
<td>{repo.size}</td>
|
<td>{repo.size}</td>
|
||||||
<td title={moment(repo.last_modified).format('llll')}>{moment(repo.last_modified).fromNow()}</td>
|
<td title={moment(repo.last_modified).format('llll')}>{moment(repo.last_modified).fromNow()}</td>
|
||||||
|
@@ -25,3 +25,8 @@
|
|||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
margin: 3px 0 0 10px;
|
margin: 3px 0 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.department-group-icon {
|
||||||
|
margin-left: 0.25rem;
|
||||||
|
color:#888;
|
||||||
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import React,{ Fragment } from 'react';
|
import React,{ Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { gettext, siteRoot, username, loginUrl } from '../../utils/constants';
|
import { gettext, siteRoot, username, loginUrl } from '../../utils/constants';
|
||||||
|
import { Link } from '@reach/router';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import Loading from '../../components/loading';
|
import Loading from '../../components/loading';
|
||||||
import ModalPortal from '../../components/modal-portal';
|
import ModalPortal from '../../components/modal-portal';
|
||||||
@@ -202,11 +203,11 @@ class GroupView extends React.Component {
|
|||||||
{currentGroup && (
|
{currentGroup && (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<div className="path-container">
|
<div className="path-container">
|
||||||
<a href={`${siteRoot}groups/`}>{gettext("Groups")}</a>
|
<Link to={`${siteRoot}groups/`}>{gettext("Groups")}</Link>
|
||||||
<span className="path-split">/</span>
|
<span className="path-split">/</span>
|
||||||
<span>{currentGroup.name}</span>
|
<span>{currentGroup.name}</span>
|
||||||
{currentGroup.parent_group_id !== 0 && (
|
{currentGroup.parent_group_id !== 0 && (
|
||||||
<span className="address-book-group-icon icon-building" title={gettext("This is a special group representing a department.")}></span>
|
<span className="department-group-icon fas fa-building" title={gettext("This is a special group representing a department.")}></span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="path-tool">
|
<div className="path-tool">
|
||||||
|
@@ -26,8 +26,8 @@ class Content extends Component {
|
|||||||
const desktopThead = (
|
const desktopThead = (
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="8%"><span className="sr-only">{gettext("Library Type")}</span></th>
|
<th width="4%"><span className="sr-only">{gettext("Library Type")}</span></th>
|
||||||
<th width="34%">{gettext("Name")}<a className="table-sort-op by-name" href="#">{/*TODO: sort*/}<span className="sort-icon icon-caret-down hide"></span></a></th>
|
<th width="38%">{gettext("Name")}<a className="table-sort-op by-name" href="#">{/*TODO: sort*/}<span className="sort-icon icon-caret-down hide"></span></a></th>
|
||||||
<th width="10%"><span className="sr-only">{gettext("Actions")}</span></th>
|
<th width="10%"><span className="sr-only">{gettext("Actions")}</span></th>
|
||||||
<th width="14%">{gettext("Size")}</th>
|
<th width="14%">{gettext("Size")}</th>
|
||||||
<th width="18%">{gettext("Last Update")}<a className="table-sort-op by-time" href="#">{/*TODO: sort*/}<span className="sort-icon icon-caret-up"></span></a></th>
|
<th width="18%">{gettext("Last Update")}<a className="table-sort-op by-time" href="#">{/*TODO: sort*/}<span className="sort-icon icon-caret-up"></span></a></th>
|
||||||
|
@@ -820,7 +820,7 @@ table .star .empty {
|
|||||||
table .rename-container input {
|
table .rename-container input {
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
padding: 2px 3px;
|
padding: 2px 3px;
|
||||||
width: 16.25rem;
|
width: 15rem;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
line-height: 19px;
|
line-height: 19px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
|
Reference in New Issue
Block a user