Skip to content

Commit

Permalink
feat:(roles) add roles in memberlist edp963#1707
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanhan committed May 21, 2020
1 parent 03ac32b commit 72afab6
Show file tree
Hide file tree
Showing 12 changed files with 684 additions and 381 deletions.
4 changes: 4 additions & 0 deletions webapp/app/containers/Organizations/Organization.less
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@
font-size: 24px;
color:@rich-text;
font-weight: 600;
.orgName {
font-size: 20px;
color: @blue;
}
}
.desc{
margin-top: 4px;
Expand Down
38 changes: 10 additions & 28 deletions webapp/app/containers/Organizations/Organization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,16 @@ import {
makeSelectCurrentOrganizations,
makeSelectCurrentOrganizationProjects,
makeSelectCurrentOrganizationProjectsDetail,
makeSelectCurrentOrganizationRole,
makeSelectCurrentOrganizationMembers,
makeSelectInviteMemberList
} from './selectors'
import { createStructuredSelector } from 'reselect'
import { ProjectActions } from 'containers/Projects/actions'
import { makeSelectStarUserList, makeSelectCollectProjects } from '../Projects/selectors'
import { RouteComponentWithParams } from 'utils/types'
import { IOrganization, IOrganizationMember } from './types'
import { IStarUser, IProject } from '../Projects/types'

interface IOrganizationProps {
loginUser: any
organizations: any
starUserList: IStarUser[]
inviteMemberList: any
currentOrganization: IOrganization
collectProjects: IProject[]
onLoadOrganizationProjects: (param: {id: number, pageNum?: number, pageSize?: number}) => any
onLoadOrganizationMembers: (id: number) => any
onLoadOrganizationDetail: (id: number) => any
onDeleteOrganizationMember: (id: number, resolve: () => any) => any
onChangeOrganizationMemberRole: (id: number, role: number, resolve: () => any) => any
currentOrganizationProjects: IProject[]
currentOrganizationProjectsDetail: {total?: number, list: IProject[]}
currentOrganizationMembers: IOrganizationMember[]
onInviteMember: (ordId: number, memId: number) => any
onSearchMember: (keywords: string) => any
onClickCollectProjects: (formType: string, project: object, resolve: (id: number) => any) => any
onLoadCollectProjects: () => any
onEditOrganization: (organization: IOrganization) => any
onDeleteOrganization: (id: number, resolve: () => any) => any
onCheckUniqueName: (pathname: any, data: any, resolve: () => any, reject: (error: string) => any) => any
}
import { IOrganization, IOrganizationProps } from './types'



export class Organization extends React.PureComponent <IOrganizationProps & RouteComponentWithParams, {}> {
constructor (props) {
Expand Down Expand Up @@ -155,6 +131,8 @@ export class Organization extends React.PureComponent <IOrganizationProps & Rout
handleSearchMember={this.props.onSearchMember}
deleteOrganizationMember={this.props.onDeleteOrganizationMember}
changeOrganizationMemberRole={this.props.onChangeOrganizationMemberRole}
onGetRoleListByMemberId={this.props.onGetRoleListByMemberId}
onGetRoleListByMemberList={this.props.onGetRoleListByMemberList}
/>
</TabPane>
<TabPane tab={<span><Icon type="usergroup-add" />角色<span className={styles.badge}>{roleNum}</span></span>} key="roles">
Expand Down Expand Up @@ -203,8 +181,12 @@ export function mapDispatchToProps (dispatch) {
onSearchMember: (keyword) => dispatch(OrganizationActions.searchMember(keyword)),
onInviteMember: (orgId, memId) => dispatch(OrganizationActions.inviteMember(orgId, memId)),
onDeleteOrganizationMember: (id, resolve) => dispatch(OrganizationActions.deleteOrganizationMember(id, resolve)),
onChangeOrganizationMemberRole: (id, role, resolve) => dispatch(OrganizationActions.changeOrganizationMemberRole(id, role, resolve))
onChangeOrganizationMemberRole: (id, role, resolve) => dispatch(OrganizationActions.changeOrganizationMemberRole(id, role, resolve)),
onGetRoleListByMemberId: (orgId, memberId, resolve) => dispatch(OrganizationActions.getRoleListByMemberId(orgId, memberId, resolve)),
onGetRoleListByMemberList: (orgId, memberList, resolve) => dispatch(OrganizationActions.getRoleListByMemberList(orgId, memberList, resolve))
}


}

const withConnect = connect(mapStateToProps, mapDispatchToProps)
Expand Down
29 changes: 29 additions & 0 deletions webapp/app/containers/Organizations/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,35 @@ export const OrganizationActions = {
permission
}
}
},

getRoleListByMemberId (orgId: number, memberId: number, resolve: (res: any) => void) {
return {
type: ActionTypes.GET_ROLELISTS_BY_MEMBERID,
payload: {
orgId,
memberId,
resolve
}
}
},
getRoleListByMemberIdSuccess (result, memberId: number) {
return {
type: ActionTypes.GET_ROLELISTS_BY_MEMBERID_SUCCESS,
payload: {
result,
memberId
}
}
},
getRoleListByMemberIdFail (error, memberId: number) {
return {
type: ActionTypes.GET_ROLELISTS_BY_MEMBERID_ERROR,
payload: {
error,
memberId
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class ChangeRoleForm extends React.PureComponent<IChangeRoleProps & FormC
private tips = (type: string) => {
switch (type) {
case 'orgMember':
return '选择一个新角色'
return '选择一个新成员类型'
case 'teamMember':
return ''
}
Expand Down Expand Up @@ -89,7 +89,7 @@ export class ChangeRoleForm extends React.PureComponent<IChangeRoleProps & FormC
<div className={styles.formWrapper}>
<div className={styles.header}>
<div className={styles.title}>
改变 {member.user.username}<span className={styles.orgName}>{orgOrTeamName}</span> 的角色
改变 {member.user.username}<span className={styles.orgName}>{orgOrTeamName}</span> 的成员类型
</div>
<div className={styles.desc}>
<b>{this.tips(category)}</b>
Expand Down
Loading

0 comments on commit 72afab6

Please sign in to comment.