Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion web-ui/src/api/birthdayanniversary.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export const getAnniversaries = async (months, cookie) => {
url: `${anniversaryReportUrl}?month=${month}`,
headers: { 'X-CSRF-Header': cookie, Accept: 'application/json' }
});
results.push(...res.payload.data);
if (res.error) {
console.error(res.error);
} else {
results.push(...res.payload.data);
}
}
return results;
};
Expand Down
1 change: 0 additions & 1 deletion web-ui/src/components/team-results/TeamsActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const TeamsActions = ({ isOpen, onOpen }) => {
if (data) {
dispatch({ type: ADD_TEAM, payload: data });
}
handleClose();
}
}}
headerText="Add A New Team"
Expand Down
8 changes: 8 additions & 0 deletions web-ui/src/context/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ export const selectHasAdministerKudosPermission = hasPermission(
'CAN_ADMINISTER_KUDOS'
);

export const selectHasCreateKudosPermission = hasPermission(
'CAN_CREATE_KUDOS'
);

export const selectHasDeleteMembersPermission = hasPermission(
'CAN_DELETE_ORGANIZATION_MEMBERS'
);
Expand Down Expand Up @@ -198,6 +202,10 @@ export const selectCanViewCheckinsPermission = hasPermission(
'CAN_VIEW_CHECKINS'
);

export const selectCanUpdateCheckinsPermission = hasPermission(
'CAN_UPDATE_CHECKINS'
);

export const selectCanEditSkills = hasPermission(
'CAN_EDIT_SKILLS'
);
Expand Down
3 changes: 2 additions & 1 deletion web-ui/src/pages/CheckinsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
selectProfile,
selectCheckinsForMember,
selectCanViewCheckinsPermission,
selectCanUpdateCheckinsPermission,
selectCanViewPrivateNotesPermission,
} from '../context/selectors';
import { getCheckins, createNewCheckin } from '../context/thunks';
Expand Down Expand Up @@ -101,7 +102,7 @@ const CheckinsPage = () => {
const handleClose = () => setOpen(false);

const completeCheckin = async () => {
if (csrf) {
if (csrf && selectCanUpdateCheckinsPermission(state)) {
const res = await updateCheckin(
{ ...currentCheckin, pdlId: selectedProfile.pdlId, completed: true },
csrf
Expand Down
10 changes: 7 additions & 3 deletions web-ui/src/pages/KudosPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { styled } from "@mui/material/styles";
import { Button, Tab, Typography } from "@mui/material";
import { TabContext, TabList, TabPanel } from "@mui/lab";
import { AppContext } from "../context/AppContext";
import { selectCsrfToken, selectCurrentUser } from "../context/selectors";
import {
selectCsrfToken,
selectCurrentUser,
selectHasCreateKudosPermission,
} from "../context/selectors";
import { getReceivedKudos, getSentKudos } from "../api/kudos";
import { UPDATE_TOAST } from "../context/actions";
import KudosCard from "../components/kudos_card/KudosCard";
Expand Down Expand Up @@ -116,14 +120,14 @@ const KudosPage = () => {
open={kudosDialogOpen}
onClose={() => setKudosDialogOpen(false)}
/>
<Button
{selectHasCreateKudosPermission(state) && <Button
className="kudos-dialog-open"
variant="outlined"
startIcon={<StarIcon />}
onClick={() => setKudosDialogOpen(true)}
>
Give Kudos
</Button>
</Button>}
</div>
<TabContext value={kudosTab}>
<div className="kudos-tab-container">
Expand Down
4 changes: 2 additions & 2 deletions web-ui/src/pages/SkillReportPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ const SkillReportPage = props => {
let memberSkillsFound;
if (res && res.payload) {
memberSkillsFound =
res.payload.data.teamMembers && !res.error
!res.error && res.payload.data.teamMembers
? res.payload.data.teamMembers
: undefined;
}
// Filter out skills of terminated members
memberSkillsFound = memberSkillsFound.filter(memberSkill =>
memberSkillsFound = memberSkillsFound?.filter(memberSkill =>
memberIds.includes(memberSkill.id)
);
if (memberSkillsFound && memberIds) {
Expand Down
2 changes: 1 addition & 1 deletion web-ui/src/pages/TeamSkillReportPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const TeamSkillReportPage = () => {
let memberSkillsFound;
if (res && res.payload) {
memberSkillsFound =
res.payload.data.teamMembers && !res.error
!res.error && res.payload.data.teamMembers
? res.payload.data.teamMembers
: undefined;
}
Expand Down
12 changes: 7 additions & 5 deletions web-ui/src/pages/ViewFeedbackPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,20 @@ const ViewFeedbackPage = () => {
//and associated template info together
const templateReqs = [];
const templateIds = [];
for (let i = 0; i < feedbackRequests.length; i++) {
if (!templateIds.includes(feedbackRequests[i].templateId)) {
templateIds.push(feedbackRequests[i].templateId);
templateReqs.push(getTemplateInfo(feedbackRequests[i].templateId));
if (feedbackRequests) {
for (let i = 0; i < feedbackRequests.length; i++) {
if (!templateIds.includes(feedbackRequests[i].templateId)) {
templateIds.push(feedbackRequests[i].templateId);
templateReqs.push(getTemplateInfo(feedbackRequests[i].templateId));
}
}
}
let templates = await Promise.all(templateReqs);
templates = templates.reduce((map, template) => {
map[template.id] = template;
return map;
}, {});
feedbackRequests.forEach(request => {
feedbackRequests?.forEach(request => {
request.templateInfo = templates[request.templateId];
});
return feedbackRequests;
Expand Down
Loading