Skip to content

Commit 7a06d3f

Browse files
author
vikasrohit
authored
Merge pull request #3350 from appirio-tech/hotfix/post-release-2.4.15.2
[HOTFIX] [PROD] Post-release 2.4.15.2
2 parents 3b416e4 + 24b28e7 commit 7a06d3f

File tree

12 files changed

+366
-42
lines changed

12 files changed

+366
-42
lines changed

src/components/TeamManagement/TeamManagement.scss

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,45 @@
453453
}
454454
}
455455

456+
.decline-btn {
457+
@include roboto;
458+
cursor: pointer;
459+
padding: $base-unit*2 $base-unit*3;
460+
display: flex;
461+
align-items: center;
462+
height: 40px;
463+
border: 1px solid $tc-gray-10;
464+
border-radius: 20px !important;
465+
margin: $base-unit*2 0 $base-unit 0;
466+
color: $tc-gray-70;
467+
font-size: $tc-label-md;
468+
text-align: center;
469+
justify-content: center;
470+
width: 130px;
471+
margin: 5px;
472+
473+
svg {
474+
margin-right: $base-unit * 0.5;
475+
transform: scale(.6);
476+
fill: $tc-gray-90;
477+
}
478+
479+
&.in-grid {
480+
width: 103px;
481+
margin: 0 5px 5px 5px;
482+
}
483+
}
484+
485+
.accept-btn {
486+
border-radius: 20px !important;
487+
white-space: nowrap;
488+
margin: 5px;
489+
490+
&.in-grid {
491+
padding: 0px 11px !important;
492+
}
493+
}
494+
456495
.join-btn {
457496
@include roboto;
458497
cursor: pointer;
@@ -472,6 +511,7 @@
472511
fill: $tc-gray-90;
473512
}
474513
}
514+
475515
}
476516

477517
.separator {

src/config/constants.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,21 @@ export const ROLE_PROGRAM_MANAGER = 'Program Manager'
652652
export const ROLE_SOLUTION_ARCHITECT = 'Solution Architect'
653653
export const ROLE_PROJECT_MANAGER = 'Project Manager'
654654

655+
export const ADMIN_ROLES = [ROLE_ADMINISTRATOR, ROLE_CONNECT_ADMIN]
656+
657+
export const MANAGER_ROLES = [
658+
...ADMIN_ROLES,
659+
ROLE_CONNECT_MANAGER,
660+
ROLE_CONNECT_ACCOUNT_MANAGER,
661+
ROLE_CONNECT_COPILOT_MANAGER,
662+
ROLE_BUSINESS_DEVELOPMENT_REPRESENTATIVE,
663+
ROLE_PRESALES,
664+
ROLE_ACCOUNT_EXECUTIVE,
665+
ROLE_PROGRAM_MANAGER,
666+
ROLE_SOLUTION_ARCHITECT,
667+
ROLE_PROJECT_MANAGER,
668+
]
669+
655670
// to be able to start the Connect App we should pass at least the dummy value for `FILE_PICKER_API_KEY`
656671
// but if we want to test file uploading we should provide the real value in `FILE_PICKER_API_KEY` env variable
657672
export const FILE_PICKER_API_KEY = process.env.FILE_PICKER_API_KEY || 'DUMMY'

src/helpers/utils.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,20 @@ export const compareEmail = (email1, email2, options = { UNIQUE_GMAIL_VALIDATION
5353
*
5454
* @returns {Boolean} true if two user handles are same
5555
*/
56-
export const compareHandles = (handle1, handle2) => (
57-
(handle1 || '').toLowerCase() === (handle2 || '').toLowerCase()
58-
)
56+
export const compareHandles = (handle1, handle2) => {
57+
if (handle1 === undefined || handle2 === undefined) {
58+
return false
59+
}
60+
let h1 = handle1
61+
let h2 = handle2
62+
if (handle2.indexOf('@') === 0) {
63+
h2 = (handle2 || '').substring(1)
64+
}
65+
if (handle1.indexOf('@') === 0) {
66+
h1 = (handle1 || '').substring(1)
67+
}
68+
return h1.toLowerCase() === h2.toLowerCase()
69+
}
5970

6071
// remove empty object, null/undefined value and empty string recursively from passed obj
6172
const deepClean = obj => _.transform(obj, (result, value, key) => {
@@ -90,4 +101,4 @@ export const createEvent = (eventName) => {
90101
event.initEvent(eventName, true, true)
91102
}
92103
return event
93-
}
104+
}

src/projects/actions/projectMember.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ import {ADD_PROJECT_MEMBER, REMOVE_PROJECT_MEMBER, UPDATE_PROJECT_MEMBER,
1919
PROJECT_ROLE_CUSTOMER,
2020
PROJECT_MEMBER_INVITE_STATUS_CANCELED,
2121
RELOAD_PROJECT_MEMBERS,
22-
CLEAR_MEMBER_SUGGESTIONS
22+
CLEAR_MEMBER_SUGGESTIONS,
23+
ACCEPT_OR_REFUSE_INVITE_FAILURE
2324
} from '../../config/constants'
2425

2526

@@ -160,15 +161,32 @@ export function inviteProjectMembers(projectId, emailIds, handles) {
160161
}
161162
}
162163

163-
export function acceptOrRefuseInvite(projectId, item) {
164+
/**
165+
* Accept or refuse invite
166+
* @param {Number} projectId project id
167+
* @param {Object} item accept or refuse invite info
168+
* @param {Object} currentUser current user info
169+
*/
170+
export function acceptOrRefuseInvite(projectId, item, currentUser) {
164171
return (dispatch) => {
165172
return dispatch({
166173
type: ACCEPT_OR_REFUSE_INVITE,
167-
payload: updateProjectMemberInvite(projectId, item)
174+
payload: updateProjectMemberInvite(projectId, item),
175+
meta: { projectId, currentUser },
168176
})
169177
}
170178
}
171179

180+
/**
181+
* Accept or refuse invite request fail
182+
* @param {Object} error error object
183+
*/
184+
export function acceptOrRefuseInviteFail(error) {
185+
return (dispatch) => {
186+
return dispatch({ type: ACCEPT_OR_REFUSE_INVITE_FAILURE, payload: error })
187+
}
188+
}
189+
172190
export function reloadProjectMembers(projectId) {
173191
return (dispatch) => {
174192
return dispatch({

src/projects/components/projectsCard/ProjectCard.jsx

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import React from 'react'
22
import PT from 'prop-types'
33
import _ from 'lodash'
4-
import { withRouter, Link } from 'react-router-dom'
4+
import { withRouter } from 'react-router-dom'
55
import { getProjectRoleForCurrentUser } from '../../../helpers/projectHelper'
66
import ProjectCardHeader from './ProjectCardHeader'
77
import ProjectCardBody from './ProjectCardBody'
88
import ProjectManagerAvatars from '../../list/components/Projects/ProjectManagerAvatars'
9+
import LoadingIndicator from '../../../components/LoadingIndicator/LoadingIndicator'
910
import './ProjectCard.scss'
1011

11-
function ProjectCard({ project, duration, disabled, currentUser, history, onChangeStatus, projectTemplates, unreadMentionsCount }) {
12+
function ProjectCard({ project, duration, disabled, currentUser, history, onChangeStatus, projectTemplates, unreadMentionsCount, callInviteRequest, isAcceptingInvite }) {
1213
const className = `ProjectCard ${ disabled ? 'disabled' : 'enabled'}`
1314
if (!project) return null
1415
const currentMemberRole = getProjectRoleForCurrentUser({ project, currentUserId: currentUser.userId})
@@ -41,11 +42,27 @@ function ProjectCard({ project, duration, disabled, currentUser, history, onChan
4142
<ProjectManagerAvatars managers={project.members} maxShownNum={10} />
4243
<div>
4344
{(!isMember && isInvited) &&
44-
<Link to={`/projects/${project.id}`} className="spacing">
45-
<div className="join-btn" style={{margin: '5px'}}>
46-
Join project
47-
</div>
48-
</Link>
45+
<div className="spacing join-btn-container">
46+
{(!isAcceptingInvite) && (
47+
<button
48+
onClick={(event) => {
49+
event.stopPropagation()
50+
callInviteRequest(project, true)
51+
}}
52+
className={'tc-btn tc-btn-primary tc-btn-md blue accept-btn'}
53+
>
54+
Join project
55+
</button>)}
56+
{(!isAcceptingInvite) && (
57+
<button
58+
onClick={(event) => {
59+
event.stopPropagation()
60+
callInviteRequest(project, false)
61+
}}
62+
className="decline-btn"
63+
>Decline</button>)}
64+
{isAcceptingInvite && (<LoadingIndicator isSmall />)}
65+
</div>
4966
}
5067
</div>
5168
</div>
@@ -54,13 +71,17 @@ function ProjectCard({ project, duration, disabled, currentUser, history, onChan
5471
}
5572

5673
ProjectCard.defaultTypes = {
74+
callInviteRequest: () => {},
75+
isAcceptingInvite: false,
5776
}
5877

5978
ProjectCard.propTypes = {
6079
project: PT.object.isRequired,
6180
currentMemberRole: PT.string,
6281
projectTemplates: PT.array.isRequired,
63-
unreadMentionsCount: PT.number.isRequired
82+
unreadMentionsCount: PT.number.isRequired,
83+
callInviteRequest: PT.func,
84+
isAcceptingInvite: PT.bool
6485
// duration: PT.object.isRequired,
6586
}
6687

src/projects/components/projectsCard/ProjectCard.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,15 @@
8484

8585
.card-footer {
8686
// padding-top: 4 * $base_unit;
87+
display: flex;
88+
justify-content: space-between;
89+
align-items: flex-end;
8790
}
8891

89-
.join-btn {
90-
float: right;
92+
.join-btn-container {
93+
display: flex;
94+
align-items: flex-end;
95+
flex-direction: column;
9196
}
9297
}
9398
}

src/projects/components/projectsCard/ProjectsCardView.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const ProjectsCardView = props => {
2020
//const { projects, members, totalCount, criteria, pageNum, applyFilters, sortHandler, onPageChange, error, isLoading, onNewProjectIntent } = props
2121
// TODO: use applyFilters and onNewProjectIntent. Temporary delete to avoid lint errors.
2222
const { projects, members, currentUser, onPageChange, pageNum, totalCount, infiniteAutoload, newProjectLink,
23-
setInfiniteAutoload, isLoading, onChangeStatus, projectsStatus, projectTemplates, applyFilters, notifications } = props
23+
setInfiniteAutoload, isLoading, onChangeStatus, projectsStatus, projectTemplates, applyFilters, notifications,
24+
callInviteRequest, isAcceptingInvite } = props
2425
// const currentSortField = _.get(criteria, 'sort', '')
2526

2627
// annotate projects with member data
@@ -50,6 +51,8 @@ const ProjectsCardView = props => {
5051
onChangeStatus={onChangeStatus}
5152
projectTemplates={projectTemplates}
5253
unreadMentionsCount={unreadMentionsCount}
54+
callInviteRequest={callInviteRequest}
55+
isAcceptingInvite={isAcceptingInvite[project.id]}
5356
/>
5457
</div>)
5558
}
@@ -97,7 +100,7 @@ const ProjectsCardView = props => {
97100
hasMore={hasMore}
98101
threshold={500}
99102
>
100-
{ [...projects, ...placeholders].map(renderProject)}
103+
{ [...projects, ...placeholders].map((project) => renderProject(project))}
101104
{moreProject(true)}
102105
<div className="project-card project-card-new">
103106
<NewProjectCard link={newProjectLink} />
@@ -129,6 +132,8 @@ ProjectsCardView.propTypes = {
129132
applyFilters: PropTypes.func,
130133
isLoading: PropTypes.bool,
131134
projectTemplates: PropTypes.array.isRequired,
135+
callInviteRequest: PropTypes.func,
136+
isAcceptingInvite: PropTypes.object,
132137
}
133138

134139

0 commit comments

Comments
 (0)