-
Notifications
You must be signed in to change notification settings - Fork 51
[PROD] release - Minor navigation enhancement & search fix #1671
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
Changes from all commits
15f3784
7a1ed52
7c76389
16fea50
8e91f82
9cd8413
de10459
0110fb3
c807031
94cdb18
48346d2
5fff264
506c195
184e715
754a730
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,7 @@ export function searchUserProjects (isAdmin = true, keyword) { | |
sort: 'updatedAt desc', | ||
perPage: 20, | ||
page: 1, | ||
keyword | ||
keyword: `"${keyword}"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrapping the |
||
} | ||
if (!isAdmin) { | ||
filters['memberOnly'] = true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ const OutlineButton = ({ type, text, link, onClick, url, className, submit, disa | |
|
||
if (!_.isEmpty(link)) { | ||
return ( | ||
<Link className={cn(styles.container, styles[type], className)} to={`${link}`}> | ||
<Link className={cn(styles.container, styles[type], className)} to={link}> | ||
<span>{text}</span> | ||
</Link> | ||
) | ||
|
@@ -38,7 +38,7 @@ const OutlineButton = ({ type, text, link, onClick, url, className, submit, disa | |
OutlineButton.propTypes = { | ||
type: PropTypes.string.isRequired, | ||
text: PropTypes.string.isRequired, | ||
link: PropTypes.string, | ||
link: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change from |
||
url: PropTypes.string, | ||
className: PropTypes.string, | ||
onClick: PropTypes.func, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,16 @@ const ChallengesComponent = ({ | |
</div> | ||
{activeProject && activeProject.id && !isReadOnly ? ( | ||
<div className={styles.projectActionButtonWrapper}> | ||
<OutlineButton | ||
text={'Users'} | ||
type='info' | ||
submit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
link={{ | ||
pathname: '/users', | ||
state: { projectId: activeProjectId, projectName: activeProject.name } | ||
}} | ||
className={styles.btnOutline} | ||
/> | ||
{isAdminOrCopilot && ( | ||
<OutlineButton | ||
text={'Assets Library'} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,9 @@ export default { | |
paddingRight: '6px', | ||
paddingLeft: '10px', | ||
border: 'none', | ||
width: '100%', | ||
display: 'grid', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using |
||
gridTemplateColumns: '1fr', | ||
input: { | ||
width: '100% !important', | ||
height: 'auto !important', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,14 @@ class Users extends Component { | |
|
||
this.debouncedOnInputChange = _.debounce(this.onInputChange, AUTOCOMPLETE_DEBOUNCE_TIME_MS) | ||
} | ||
componentDidMount () { | ||
if (this.props.initialProject && this.props.initialProject.id) { | ||
this.setProjectOption({ | ||
value: this.props.initialProject.id, | ||
label: this.props.initialProject.name | ||
}) | ||
} | ||
} | ||
|
||
setProjectOption (projectOption) { | ||
this.setState({ projectOption }) | ||
|
@@ -165,7 +173,8 @@ class Users extends Component { | |
isLoadingProject | ||
} = this.props | ||
const { | ||
searchKey | ||
searchKey, | ||
projectOption | ||
} = this.state | ||
const projectOptions = ((searchKey ? resultSearchUserProjects : projects) || []).map(p => { | ||
return { | ||
|
@@ -204,20 +213,28 @@ class Users extends Component { | |
</div> | ||
</div> | ||
|
||
{ | ||
showAddUser && ( | ||
<div className={styles.addButtonContainer}> | ||
<PrimaryButton | ||
text={'Add User'} | ||
type={'info'} | ||
onClick={() => this.onAddUserClick()} /> | ||
<PrimaryButton | ||
text={'Invite User'} | ||
type={'info'} | ||
onClick={() => this.onInviteUserClick()} /> | ||
</div> | ||
) | ||
} | ||
<div className={styles.addButtonContainer}> | ||
{ | ||
showAddUser && ( | ||
<> | ||
<PrimaryButton | ||
text={'Add User'} | ||
type={'info'} | ||
onClick={() => this.onAddUserClick()} /> | ||
<PrimaryButton | ||
text={'Invite User'} | ||
type={'info'} | ||
onClick={() => this.onInviteUserClick()} /> | ||
</> | ||
) | ||
} | ||
{projectOption && ( | ||
<PrimaryButton | ||
text={'Go To Project'} | ||
type={'info'} | ||
link={`/projects/${projectOption.value}/challenges`} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
)} | ||
</div> | ||
{ | ||
this.state.showAddUserModal && ( | ||
<UserAddModalContent | ||
|
@@ -318,6 +335,10 @@ class Users extends Component { | |
} | ||
|
||
Users.propTypes = { | ||
initialProject: PropTypes.shape({ | ||
id: PropTypes.string, | ||
name: PropTypes.string | ||
}), | ||
loadProject: PropTypes.func.isRequired, | ||
updateProjectMember: PropTypes.func.isRequired, | ||
removeProjectMember: PropTypes.func.isRequired, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ export const FILE_PICKER_PROGRESS_INTERVAL = 100 | |
export const FILE_PICKER_UPLOAD_RETRY = 2 | ||
export const FILE_PICKER_UPLOAD_TIMEOUT = 30 * 60 * 1000 // 30 minutes | ||
export const SPECIFICATION_ATTACHMENTS_FOLDER = 'SPECIFICATION_ATTACHMENTS' | ||
export const MEMBERS_API_URL = process.env.MEMBERS_API_URL | ||
export const MEMBERS_API_URL = process.env.MEMBER_API_URL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The environment variable name has been changed from |
||
|
||
export const getAWSContainerFileURL = (key) => `https://${FILE_PICKER_CONTAINER_NAME}.s3.amazonaws.com/${key}` | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import React, { Component } from 'react' | |
import { connect } from 'react-redux' | ||
import _ from 'lodash' | ||
import PT from 'prop-types' | ||
import { withRouter } from 'react-router-dom' | ||
import UsersComponent from '../../components/Users' | ||
import { PROJECT_ROLES } from '../../config/constants' | ||
import { fetchInviteMembers, fetchProjectById } from '../../services/projects' | ||
|
@@ -22,7 +23,11 @@ class Users extends Component { | |
projectMembers: null, | ||
invitedMembers: null, | ||
isAdmin: false, | ||
isLoadingProject: false | ||
isLoadingProject: false, | ||
project: props.location.state && props.location.state.projectId ? { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider simplifying the conditional logic by using optional chaining and nullish coalescing. For example: |
||
id: props.location.state && props.location.state.projectId, | ||
name: props.location.state && props.location.state.projectName | ||
} : null | ||
} | ||
this.loadProject = this.loadProject.bind(this) | ||
this.updateProjectMember = this.updateProjectMember.bind(this) | ||
|
@@ -33,7 +38,7 @@ class Users extends Component { | |
} | ||
|
||
componentDidMount () { | ||
const { token, isLoading, loadAllUserProjects, page } = this.props | ||
const { token, isLoading, loadAllUserProjects, page, location } = this.props | ||
if (!isLoading) { | ||
const isAdmin = checkAdmin(token) | ||
const isManager = checkManager(token) | ||
|
@@ -44,6 +49,10 @@ class Users extends Component { | |
this.setState({ | ||
isAdmin | ||
}) | ||
|
||
if (location.state && location.state.projectId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider checking if |
||
this.loadProject(location.state.projectId) | ||
} | ||
} | ||
} | ||
|
||
|
@@ -157,13 +166,15 @@ class Users extends Component { | |
isSearchingUserProjects | ||
} = this.props | ||
const { | ||
project, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like the |
||
projectMembers, | ||
invitedMembers, | ||
isAdmin, | ||
isLoadingProject | ||
} = this.state | ||
return ( | ||
<UsersComponent | ||
initialProject={project} | ||
projects={projects} | ||
loadProject={this.loadProject} | ||
updateProjectMember={this.updateProjectMember} | ||
|
@@ -201,6 +212,7 @@ const mapStateToProps = ({ users, auth }) => { | |
} | ||
|
||
Users.propTypes = { | ||
location: PT.object.isRequired, | ||
projects: PT.arrayOf(PT.object), | ||
resultSearchUserProjects: PT.arrayOf(PT.object), | ||
auth: PT.object, | ||
|
@@ -220,4 +232,4 @@ const mapDispatchToProps = { | |
loadNextProjects | ||
} | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(Users) | ||
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Users)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SuggestionConsider verifying that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrapping the decoded project name or ID filter in quotes may affect the search functionality. Ensure that the search backend can handle quoted keywords correctly, as this might change the search results or cause unexpected behavior.