mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-28 16:17:02 +00:00
fix system admin department link (#7484)
This commit is contained in:
@@ -93,25 +93,6 @@ Content.propTypes = {
|
|||||||
|
|
||||||
class Item extends Component {
|
class Item extends Component {
|
||||||
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.state = {
|
|
||||||
isOpIconShown: false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
handleMouseOver = () => {
|
|
||||||
this.setState({
|
|
||||||
isOpIconShown: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
handleMouseOut = () => {
|
|
||||||
this.setState({
|
|
||||||
isOpIconShown: false
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
getActionTextByEType = (etype) => {
|
getActionTextByEType = (etype) => {
|
||||||
if (etype.indexOf('add') != -1) {
|
if (etype.indexOf('add') != -1) {
|
||||||
return gettext('Add');
|
return gettext('Add');
|
||||||
@@ -129,9 +110,8 @@ class Item extends Component {
|
|||||||
case 'user':
|
case 'user':
|
||||||
return <UserLink email={item.to_user_email} name={item.to_user_name} />;
|
return <UserLink email={item.to_user_email} name={item.to_user_name} />;
|
||||||
case 'group':
|
case 'group':
|
||||||
return <Link to={`${siteRoot}sys/groups/${item.to_group_id}/libraries/`}>{item.to_group_name}</Link>;
|
|
||||||
case 'department':
|
case 'department':
|
||||||
return <Link to={`${siteRoot}sys/departments/${item.to_group_id}/`}>{item.to_group_name}</Link>;
|
return <Link to={`${siteRoot}sys/groups/${item.to_group_id}/libraries/`}>{item.to_group_name}</Link>;
|
||||||
case 'all':
|
case 'all':
|
||||||
return <Link to={`${siteRoot}org/`}>{gettext('All')}</Link>;
|
return <Link to={`${siteRoot}org/`}>{gettext('All')}</Link>;
|
||||||
default:
|
default:
|
||||||
@@ -142,7 +122,7 @@ class Item extends Component {
|
|||||||
render() {
|
render() {
|
||||||
let { item } = this.props;
|
let { item } = this.props;
|
||||||
return (
|
return (
|
||||||
<tr onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}>
|
<tr>
|
||||||
<td><UserLink email={item.from_user_email} name={item.from_user_name} /></td>
|
<td><UserLink email={item.from_user_email} name={item.from_user_name} /></td>
|
||||||
<td>{this.getShareTo(item)}</td>
|
<td>{this.getShareTo(item)}</td>
|
||||||
<td>{this.getActionTextByEType(item.etype)}</td>
|
<td>{this.getActionTextByEType(item.etype)}</td>
|
||||||
|
@@ -79,7 +79,6 @@ class Item extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
isOpIconShown: false,
|
|
||||||
highlight: false,
|
highlight: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -87,7 +86,6 @@ class Item extends Component {
|
|||||||
handleMouseEnter = () => {
|
handleMouseEnter = () => {
|
||||||
if (!this.props.isItemFreezed) {
|
if (!this.props.isItemFreezed) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isOpIconShown: true,
|
|
||||||
highlight: true
|
highlight: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -96,7 +94,6 @@ class Item extends Component {
|
|||||||
handleMouseLeave = () => {
|
handleMouseLeave = () => {
|
||||||
if (!this.props.isItemFreezed) {
|
if (!this.props.isItemFreezed) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isOpIconShown: false,
|
|
||||||
highlight: false
|
highlight: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -129,9 +126,7 @@ class Item extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { item } = this.props;
|
const { item } = this.props;
|
||||||
const url = item.parent_group_id == 0 ?
|
const url = `${siteRoot}sys/groups/${item.id}/libraries/`;
|
||||||
`${siteRoot}sys/groups/${item.id}/libraries/` :
|
|
||||||
`${siteRoot}sys/departments/${item.id}/`;
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
|
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
|
||||||
|
@@ -5,7 +5,7 @@ import { siteRoot, gettext } from '../../../utils/constants';
|
|||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
email: PropTypes.string,
|
email: PropTypes.string,
|
||||||
userName: PropTypes.string.isRequired,
|
userName: PropTypes.string,
|
||||||
currentItem: PropTypes.string.isRequired
|
currentItem: PropTypes.string.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -24,27 +24,25 @@ class Content extends Component {
|
|||||||
return <p className="error text-center mt-4">{errorMsg}</p>;
|
return <p className="error text-center mt-4">{errorMsg}</p>;
|
||||||
} else {
|
} else {
|
||||||
const table = (
|
const table = (
|
||||||
<Fragment>
|
<table className="table-hover">
|
||||||
<table className="table-hover">
|
<thead>
|
||||||
<thead>
|
<tr>
|
||||||
<tr>
|
<th width="5%"></th>
|
||||||
<th width="5%"></th>
|
<th width="35%">{gettext('Name')}</th>
|
||||||
<th width="35%">{gettext('Name')}</th>
|
<th width="20%">{gettext('Share From')}</th>
|
||||||
<th width="20%">{gettext('Share From')}</th>
|
<th width="20%">{gettext('Size')}</th>
|
||||||
<th width="20%">{gettext('Size')}</th>
|
<th width="20%">{gettext('Last Update')}</th>
|
||||||
<th width="20%">{gettext('Last Update')}</th>
|
</tr>
|
||||||
</tr>
|
</thead>
|
||||||
</thead>
|
<tbody>
|
||||||
<tbody>
|
{items.map((item, index) => {
|
||||||
{items.map((item, index) => {
|
return (<Item
|
||||||
return (<Item
|
key={index}
|
||||||
key={index}
|
item={item}
|
||||||
item={item}
|
/>);
|
||||||
/>);
|
})}
|
||||||
})}
|
</tbody>
|
||||||
</tbody>
|
</table>
|
||||||
</table>
|
|
||||||
</Fragment>
|
|
||||||
);
|
);
|
||||||
return items.length ? table : <EmptyTip text={gettext('No libraries')} />;
|
return items.length ? table : <EmptyTip text={gettext('No libraries')} />;
|
||||||
}
|
}
|
||||||
@@ -82,7 +80,7 @@ class Item extends Component {
|
|||||||
link = <UserLink email={item.owner_email} name={item.owner_name} />;
|
link = <UserLink email={item.owner_email} name={item.owner_name} />;
|
||||||
} else {
|
} else {
|
||||||
const groupID = item.owner_email.substring(0, index);
|
const groupID = item.owner_email.substring(0, index);
|
||||||
link = <Link to={`${siteRoot}sys/departments/${groupID}/`}>{item.owner_name}</Link>;
|
link = <Link to={`${siteRoot}sys/groups/${groupID}/libraries/`}>{item.owner_name}</Link>;
|
||||||
}
|
}
|
||||||
return link;
|
return link;
|
||||||
};
|
};
|
||||||
@@ -92,15 +90,13 @@ class Item extends Component {
|
|||||||
const iconUrl = Utils.getLibIconUrl(item);
|
const iconUrl = Utils.getLibIconUrl(item);
|
||||||
const iconTitle = Utils.getLibIconTitle(item);
|
const iconTitle = Utils.getLibIconTitle(item);
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<tr>
|
||||||
<tr>
|
<td><img src={iconUrl} title={iconTitle} alt={iconTitle} width="24" /></td>
|
||||||
<td><img src={iconUrl} title={iconTitle} alt={iconTitle} width="24" /></td>
|
<td>{this.renderRepoName()}</td>
|
||||||
<td>{this.renderRepoName()}</td>
|
<td>{this.getOwnerLink()}</td>
|
||||||
<td>{this.getOwnerLink()}</td>
|
<td>{Utils.bytesToSize(item.size)}</td>
|
||||||
<td>{Utils.bytesToSize(item.size)}</td>
|
<td>{dayjs(item.last_modify).fromNow()}</td>
|
||||||
<td>{dayjs(item.last_modify).fromNow()}</td>
|
</tr>
|
||||||
</tr>
|
|
||||||
</Fragment>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user