Skip to content

Commit 84133ad

Browse files
Venkataramanan VenkateswaranVenkataramanan Venkateswaran
authored andcommitted
fix: user management people report tab opening bug
1 parent 9bfc8dc commit 84133ad

1 file changed

Lines changed: 22 additions & 13 deletions

File tree

src/components/UserManagement/UserTableData.jsx

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,41 +181,50 @@ const UserTableData = React.memo(props => {
181181
''
182182
)}
183183
<span style={{ position: 'absolute', top: 0, right: 0 }}>
184-
<button
185-
type="button"
184+
<a
185+
href={`/peoplereport/${props.user._id}`}
186+
id={`report-icon-${props.user._id}`}
186187
className="team-member-tasks-user-report-link"
188+
target="_blank"
189+
rel="noopener noreferrer"
187190
style={{
188191
fontSize: 18,
189192
opacity: canSeeReports ? 1 : 0.7,
190193
background: 'none',
191194
border: 'none',
192195
padding: 0,
196+
display: 'inline-block',
197+
cursor: canSeeReports ? 'pointer' : 'not-allowed',
193198
}}
194199
onClick={(event) => {
195200
if (!canSeeReports) {
196201
event.preventDefault();
197202
return;
198203
}
199204

200-
if (event.metaKey || event.ctrlKey || event.button === 1) {
201-
window.open(`/peoplereport/${props.user._id}`, '_blank');
202-
return;
205+
const isModified = event.metaKey || event.ctrlKey || event.button === 1;
206+
if (!isModified) {
207+
event.preventDefault();
208+
history.push(`/peoplereport/${props.user._id}`);
203209
}
204-
205-
event.preventDefault(); // prevent full reload
206-
history.push(`/peoplereport/${props.user._id}`);
207210
}}
208211
>
209212
<img
210213
src="/report_icon.png"
211214
alt="reportsicon"
212215
className="team-member-tasks-user-report-link-image"
213-
id={`report-icon-${props.user._id}`}
214-
style={{
215-
cursor: canSeeReports ? 'pointer' : 'not-allowed', // Change cursor style to indicate the disabled state
216-
}}
217216
/>
218-
</button>
217+
</a>
218+
{!canSeeReports && (
219+
<Tooltip
220+
placement="bottom"
221+
isOpen={tooltipReportsOpen}
222+
target={`report-icon-${props.user._id}`}
223+
toggle={toggleReportsTooltip}
224+
>
225+
You don&apos;t have permission to view user reports
226+
</Tooltip>
227+
)}
219228
</span>
220229

221230
<span style={{ position: 'absolute', bottom: 0, right: 0 }}>

0 commit comments

Comments
 (0)