Skip to content

Commit

Permalink
Share to user support select user from department (#7361)
Browse files Browse the repository at this point in the history
* update

* remove 'All users' in org user department

* change style

---------

Co-authored-by: lian <[email protected]>
  • Loading branch information
Michael18811380328 and imwhatiam authored Jan 15, 2025
1 parent 3a4ce4e commit 019cf75
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 186 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ class Item extends Component {
<td width="13%">
<input type="checkbox" className="vam" checked='checked' disabled/>
</td>
<td width="11%"><img className="avatar" src={member.avatar_url} alt=""/></td>
<td width="12%"><img className="avatar" src={member.avatar_url} alt=""/></td>
<td width="60%">{member.name}</td>
<td width="16%" className={this.state.highlight ? 'visible' : 'invisible' }>
<i className="sf3-font-help sf3-font" id={`no-select-${index}`}></i>
<td width="15%" className={this.state.highlight ? 'visible' : 'invisible' } id={`no-select-${index}`}>
<i className="sf3-font-help sf3-font"></i>
<Tooltip placement='bottom' isOpen={this.state.tooltipOpen} toggle={this.toggleTooltip} target={`no-select-${index}`} delay={{ show: 0, hide: 0 }} fade={false}>
{tip}
</Tooltip>
Expand Down Expand Up @@ -107,12 +107,7 @@ class DepartmentGroupMembers extends Component {

render() {
const { members, memberSelected, loading, selectedMemberMap, currentDepartment, usedFor } = this.props;
let headerTitle;
if (currentDepartment.id === -1) {
headerTitle = gettext('All users');
} else {
headerTitle = currentDepartment.name + ' ' + gettext('members');
}
let headerTitle = (currentDepartment.name || '') + ' ' + gettext('members');
if (loading) {
return (
<div className="department-dialog-member pt-4">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Loading from '../../../components/loading';
import { gettext, isOrgContext } from '../../../utils/constants';
import { isOrgContext } from '../../../utils/constants';

const ItemPropTypes = {
department: PropTypes.object,
Expand Down Expand Up @@ -30,7 +30,7 @@ class Item extends Component {
renderSubDepartments = () => {
const { departments } = this.props;
return (
<div style={{ paddingLeft: '10px' }}>
<div>
{departments.map((department, index) => {
if (department.parent_group_id !== this.props.department.id) return null;
return (
Expand All @@ -43,6 +43,7 @@ class Item extends Component {
toggleExpanded={this.props.toggleExpanded}
currentDepartment={this.props.currentDepartment}
allMembersClick={this.props.allMembersClick}
padding={this.props.padding + 10}
/>
);
})}
Expand All @@ -56,12 +57,12 @@ class Item extends Component {
const { hasChild, isExpanded } = department;
return (
<>
<div className={isCurrent ? 'tr-highlight group-item' : 'group-item'} onClick={this.getMembers}>
<div className={isCurrent ? 'tr-highlight group-item' : 'group-item'} onClick={this.getMembers} style={{ paddingLeft: `${this.props.padding}px` }}>
{hasChild &&
<span
className={`sf3-font sf3-font-down ${isExpanded ? '' : 'rotate-270'} d-inline-block`}
onClick={this.toggleExpanded}
style={{ color: isCurrent ? '#fff' : '#999', fontSize: '12px' }}
style={{ color: '#666' }}
>
</span>
}
Expand Down Expand Up @@ -112,19 +113,9 @@ class DepartmentGroup extends Component {
if (loading) {
return (<Loading/>);
}
const { allMembersClick } = this.state;
return (
<div className="department-dialog-group">
<div>
{isOrgContext &&
<div className={allMembersClick ? 'tr-highlight group-item' : 'group-item'}>
<span
className={'pr-2'}
style={{ color: allMembersClick ? '#fff' : '#999', fontSize: '12px' }}
/>
<span>{gettext('All users')}</span>
</div>
}
{departments.length > 0 && departments.map((department, index) => {
if (department.parent_group_id !== -1) return null;
return (
Expand All @@ -137,6 +128,7 @@ class DepartmentGroup extends Component {
toggleExpanded={this.toggleExpanded}
currentDepartment={this.props.currentDepartment}
allMembersClick={this.state.allMembersClick}
padding={10}
/>
);
})}
Expand Down
129 changes: 0 additions & 129 deletions frontend/src/css/add-user-to-departments.css

This file was deleted.

64 changes: 37 additions & 27 deletions frontend/src/css/group-departments.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
flex-direction: row;
}

.department-dialog .department-dialog-content>div {
.department-dialog .department-dialog-content > div {
max-height: calc(100vh - 120px);
overflow-y: auto;
}
Expand All @@ -20,16 +20,6 @@
border-right: 1px solid #eee;
}

.department-dialog-content .department-dialog-group .tr-highlight .dtable-icon-groups {
padding-right: 10px;
color: #ffffff;
}

.department-dialog-content .department-dialog-group .dtable-icon-groups {
padding-right: 10px;
color: #9c9c9c;
}

.department-dialog-content .department-dialog-member {
display: flex;
flex: 0 0 35%;
Expand All @@ -48,9 +38,9 @@
border-top: none;
}

.department-dialog-content .department-dialog-member-selected .dtable-icon-cancel {
.department-dialog-content .department-dialog-member-selected .sf3-font-close {
cursor: pointer;
color: #959595;
color: #666;
}

.department-dialog-content .department-dialog-group .group-item {
Expand All @@ -65,8 +55,22 @@

.department-dialog-content .department-dialog-group .group-item.tr-highlight:hover,
.department-dialog-content .department-dialog-group .tr-highlight {
background-color: #FF8000;
color: #ffffff;
background-color: #f0f0f0;
color: inherit;
position: relative;
}

.department-dialog-content .department-dialog-group .group-item.tr-highlight::before {
content: '';
display: block;
width: 4px;
background-color: #ff9800;
border-radius: 2px;
position: absolute;
top: 4px;
bottom: 4px;
left: -8px;
z-index: 0;
}

.department-dialog-member-head {
Expand All @@ -77,13 +81,13 @@

.department-dialog-member-head .department-name {
font-size: 0.8125rem;
color: #9c9c9c;
color: #666;
}

.department-dialog-member-head .select-all {
cursor: pointer;
font-size: 0.8125rem;
color: #ea7500;;
color: #ED7109;
}

.department-dialog-member-head .select-all-disable {
Expand All @@ -104,6 +108,7 @@
max-height: calc(100% - 32px);
overflow-y: auto;
-webkit-overflow-scrolling: touch;
padding-bottom: 30px;
}

.department-dialog-member-table tr {
Expand All @@ -115,6 +120,13 @@

.department-dialog-member-table .sf3-font-help {
color: #999;
padding-right: 16px;
float: right;
}

.department-dialog-member-table .sf3-font-help:hover {
color: #666;
cursor: pointer;
}

.department-dialog-member .empty-tip {
Expand All @@ -127,7 +139,7 @@
}

.department-dialog-member .empty-tip h2 {
color: #999;
color: #666;
font-weight: normal;
font-size: 1rem;
}
Expand All @@ -146,22 +158,20 @@
padding-bottom: 2px;
}

.department-dialog-member-table tr td .dtable-icon-use-help {
color: #bdbdbd;
}

.department-dialog-member-table tr td .dtable-icon-use-help:hover {
color: #888;
}

.tooltip-inner {
font-size: 13px;
font-weight: lighter;
text-align: justify;
color: #FFF;
color: #fff;
background-color: #303133;
}

.bs-tooltip-top .arrow::before,
.bs-tooltip-auto[x-placement^="bottom"] .arrow::before,
.bs-tooltip-auto[x-placement^="top"] .arrow::before {
border-top-color: #303133;
}

.department-dialog-member-selected tr td:last-child {
padding-right: 16px;
}
Expand Down
8 changes: 1 addition & 7 deletions seahub/api2/endpoints/address_book/departments.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,7 @@ def _check_department_permission(self, org_id, department_id):
'''
check if the department belongs to the org
'''
# TODO
# owner = "%s@seafile_group" % department_id
# ws = Workspaces.objects.get_workspace_by_owner(owner)
# if ws and ws.org_id == org_id:
# return True
return False
return org_id == ccnet_api.get_org_id_by_group(department_id)

def get(self, request, department_id):
""" List members of a group in address book.
Expand All @@ -118,7 +113,6 @@ def get(self, request, department_id):
members = ccnet_api.get_group_members(department_id)
for m in members:
member_info = get_address_book_group_memeber_info(m)
# filter empty-user from bug that made an empty-group-owner when creating department
if m.user_name == '':
continue
return_results.append(member_info)
Expand Down

0 comments on commit 019cf75

Please sign in to comment.