Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix system admin department link #7484

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions frontend/src/pages/sys-admin/logs-page/share-permission-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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:
Expand All @@ -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>
Expand Down
7 changes: 1 addition & 6 deletions frontend/src/pages/sys-admin/users/user-groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,13 @@ class Item extends Component {
constructor(props) {
super(props);
this.state = {
isOpIconShown: false,
highlight: false,
};
}

handleMouseEnter = () => {
if (!this.props.isItemFreezed) {
this.setState({
isOpIconShown: true,
highlight: true
});
}
Expand All @@ -96,7 +94,6 @@ class Item extends Component {
handleMouseLeave = () => {
if (!this.props.isItemFreezed) {
this.setState({
isOpIconShown: false,
highlight: false
});
}
Expand Down Expand Up @@ -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}>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/sys-admin/users/user-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
58 changes: 27 additions & 31 deletions frontend/src/pages/sys-admin/users/user-shared-repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')} />;
}
Expand Down Expand Up @@ -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;
};
Expand All @@ -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>
);
}
}
Expand Down