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 {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isOpIconShown: false,
|
||||
};
|
||||
}
|
||||
|
||||
handleMouseOver = () => {
|
||||
this.setState({
|
||||
isOpIconShown: true
|
||||
});
|
||||
};
|
||||
|
||||
handleMouseOut = () => {
|
||||
this.setState({
|
||||
isOpIconShown: false
|
||||
});
|
||||
};
|
||||
|
||||
getActionTextByEType = (etype) => {
|
||||
if (etype.indexOf('add') != -1) {
|
||||
return gettext('Add');
|
||||
@@ -129,9 +110,8 @@ class Item extends Component {
|
||||
case 'user':
|
||||
return <UserLink email={item.to_user_email} name={item.to_user_name} />;
|
||||
case 'group':
|
||||
return <Link to={`${siteRoot}sys/groups/${item.to_group_id}/libraries/`}>{item.to_group_name}</Link>;
|
||||
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':
|
||||
return <Link to={`${siteRoot}org/`}>{gettext('All')}</Link>;
|
||||
default:
|
||||
@@ -142,7 +122,7 @@ class Item extends Component {
|
||||
render() {
|
||||
let { item } = this.props;
|
||||
return (
|
||||
<tr onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}>
|
||||
<tr>
|
||||
<td><UserLink email={item.from_user_email} name={item.from_user_name} /></td>
|
||||
<td>{this.getShareTo(item)}</td>
|
||||
<td>{this.getActionTextByEType(item.etype)}</td>
|
||||
|
@@ -79,7 +79,6 @@ class Item extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isOpIconShown: false,
|
||||
highlight: false,
|
||||
};
|
||||
}
|
||||
@@ -87,7 +86,6 @@ class Item extends Component {
|
||||
handleMouseEnter = () => {
|
||||
if (!this.props.isItemFreezed) {
|
||||
this.setState({
|
||||
isOpIconShown: true,
|
||||
highlight: true
|
||||
});
|
||||
}
|
||||
@@ -96,7 +94,6 @@ class Item extends Component {
|
||||
handleMouseLeave = () => {
|
||||
if (!this.props.isItemFreezed) {
|
||||
this.setState({
|
||||
isOpIconShown: false,
|
||||
highlight: false
|
||||
});
|
||||
}
|
||||
@@ -129,9 +126,7 @@ class Item extends Component {
|
||||
|
||||
render() {
|
||||
const { item } = this.props;
|
||||
const url = item.parent_group_id == 0 ?
|
||||
`${siteRoot}sys/groups/${item.id}/libraries/` :
|
||||
`${siteRoot}sys/departments/${item.id}/`;
|
||||
const url = `${siteRoot}sys/groups/${item.id}/libraries/`;
|
||||
return (
|
||||
<Fragment>
|
||||
<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 = {
|
||||
email: PropTypes.string,
|
||||
userName: PropTypes.string.isRequired,
|
||||
userName: PropTypes.string,
|
||||
currentItem: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
|
@@ -24,27 +24,25 @@ class Content extends Component {
|
||||
return <p className="error text-center mt-4">{errorMsg}</p>;
|
||||
} else {
|
||||
const table = (
|
||||
<Fragment>
|
||||
<table className="table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"></th>
|
||||
<th width="35%">{gettext('Name')}</th>
|
||||
<th width="20%">{gettext('Share From')}</th>
|
||||
<th width="20%">{gettext('Size')}</th>
|
||||
<th width="20%">{gettext('Last Update')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{items.map((item, index) => {
|
||||
return (<Item
|
||||
key={index}
|
||||
item={item}
|
||||
/>);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</Fragment>
|
||||
<table className="table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"></th>
|
||||
<th width="35%">{gettext('Name')}</th>
|
||||
<th width="20%">{gettext('Share From')}</th>
|
||||
<th width="20%">{gettext('Size')}</th>
|
||||
<th width="20%">{gettext('Last Update')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{items.map((item, index) => {
|
||||
return (<Item
|
||||
key={index}
|
||||
item={item}
|
||||
/>);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
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} />;
|
||||
} else {
|
||||
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;
|
||||
};
|
||||
@@ -92,15 +90,13 @@ class Item extends Component {
|
||||
const iconUrl = Utils.getLibIconUrl(item);
|
||||
const iconTitle = Utils.getLibIconTitle(item);
|
||||
return (
|
||||
<Fragment>
|
||||
<tr>
|
||||
<td><img src={iconUrl} title={iconTitle} alt={iconTitle} width="24" /></td>
|
||||
<td>{this.renderRepoName()}</td>
|
||||
<td>{this.getOwnerLink()}</td>
|
||||
<td>{Utils.bytesToSize(item.size)}</td>
|
||||
<td>{dayjs(item.last_modify).fromNow()}</td>
|
||||
</tr>
|
||||
</Fragment>
|
||||
<tr>
|
||||
<td><img src={iconUrl} title={iconTitle} alt={iconTitle} width="24" /></td>
|
||||
<td>{this.renderRepoName()}</td>
|
||||
<td>{this.getOwnerLink()}</td>
|
||||
<td>{Utils.bytesToSize(item.size)}</td>
|
||||
<td>{dayjs(item.last_modify).fromNow()}</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user