Skip to content

Commit

Permalink
Merge pull request #2656 from objectcomputing/ad-hoc-template-and-vie…
Browse files Browse the repository at this point in the history
…w-checkins

Ad hoc template and view checkins
  • Loading branch information
mkimberlin authored Oct 22, 2024
2 parents c07574a + 77040ff commit 9210c3b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ const FeedbackTemplateSelector = ({ query, changeQuery }) => {
creatorId: currentUserId,
active: true,
isAdHoc: true,
isPublic: false
isPublic: false,
isReview: false,
};

const newTemplateQuestion = {
Expand Down Expand Up @@ -187,6 +188,7 @@ const FeedbackTemplateSelector = ({ query, changeQuery }) => {
description={template.description}
isAdHoc={template.isAdHoc}
isPublic={template.isPublic}
isReview={template.isReview}
isSelected={query === template.id}
questions={template.questions}
expanded={preview.open}
Expand Down
5 changes: 3 additions & 2 deletions web-ui/src/components/personnel/Personnel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { UPDATE_CHECKINS } from '../../context/actions';
import {
selectCurrentUserId,
selectMostRecentCheckin,
selectCsrfToken
selectCsrfToken,
selectCanViewCheckinsPermission,
} from '../../context/selectors';
import Card from '@mui/material/Card';
import CardHeader from '@mui/material/CardHeader';
Expand Down Expand Up @@ -53,7 +54,7 @@ const Personnel = () => {
// Get checkins per personnel
useEffect(() => {
async function updateCheckins() {
if (personnel) {
if (personnel && selectCanViewCheckinsPermission(state)) {
for (const person of personnel) {
let res = await getCheckinByMemberId(person.id, csrf);
let data =
Expand Down
5 changes: 4 additions & 1 deletion web-ui/src/context/AppContext.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import {
getAllMembers,
getAllTerminatedMembers
} from '../api/member';
import {
selectCanViewCheckinsPermission,
} from './selectors';
import { getAllRoles, getAllUserRoles } from '../api/roles';
import { getMemberSkills } from '../api/memberskill';
import { BASE_API_URL } from '../api/api';
Expand Down Expand Up @@ -188,7 +191,7 @@ const AppContextProvider = props => {
csrf
) {
getAllCheckinsForAdmin(dispatch, csrf);
} else if (id && csrf) {
} else if (id && csrf && selectCanViewCheckinsPermission(state)) {
getCheckins(id, pdlId, dispatch, csrf);
}
}
Expand Down
4 changes: 4 additions & 0 deletions web-ui/src/context/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ export const selectHasSendEmailPermission = hasPermission(
'CAN_SEND_EMAIL'
);

export const selectCanViewCheckinsPermission = hasPermission(
'CAN_VIEW_CHECKINS'
);

export const selectIsPDL = createSelector(
selectUserProfile,
userProfile =>
Expand Down
5 changes: 3 additions & 2 deletions web-ui/src/pages/CheckinsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
selectCsrfToken,
selectCheckin,
selectProfile,
selectCheckinsForMember
selectCheckinsForMember,
selectCanViewCheckinsPermission,
} from '../context/selectors';
import { getCheckins, createNewCheckin } from '../context/thunks';
import { UPDATE_CHECKIN, UPDATE_TOAST } from '../context/actions';
Expand Down Expand Up @@ -72,7 +73,7 @@ const CheckinsPage = () => {
const [tooltipIsOpen, setTooltipIsOpen] = useState(false);

useEffect(() => {
if (selectedProfile) {
if (selectedProfile && selectCanViewCheckinsPermission(state)) {
getCheckins(memberId, selectedProfile.pdlId, dispatch, csrf);
}
}, [memberId, selectedProfile, csrf, dispatch]);
Expand Down

0 comments on commit 9210c3b

Please sign in to comment.