Skip to content

Commit

Permalink
Merge pull request #2310 from OneCommunityGlobal/Carlos_Add_Hours_by_…
Browse files Browse the repository at this point in the history
…Team_Member_Visualization_Project_Reports

Carlos add hours by team member visualization project reports
  • Loading branch information
one-community authored Jun 26, 2024
2 parents 2ae77d2 + c804dcb commit ddfbd47
Show file tree
Hide file tree
Showing 54 changed files with 3,713 additions and 3,486 deletions.
1 change: 1 addition & 0 deletions __mocks__/styleMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ module.exports = {
d3: '<rootDir>/node_modules/d3/dist/d3.min.js',
'react-leaflet': '<rootDir>/src/_tests_/__mocks__/react-leaflet.js',
'marker-cluster-group': '<rootDir>/src/_tests_/__mocks__/react-leaflet-cluster.js',
'\\.(css|less|scss)$': '<rootDir>/__mocks__/styleMock.js',
},

// The paths to modules that run some code to configure or set up the testing environment before each test
setupFiles: ['<rootDir>src/setupTests.js'],
setupFiles: ['jest-localstorage-mock'],

setupFilesAfterEnv: ['<rootDir>/src/setupTests.js'],

// The test environment that will be used for testing
testEnvironment: 'jsdom',
Expand Down
5,734 changes: 2,661 additions & 3,073 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@fortawesome/free-regular-svg-icons": "^5.12.1",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/react-fontawesome": "^0.1.19",
"@reduxjs/toolkit": "^2.2.5",
"@sentry/browser": "^4.6.6",
"@tinymce/tinymce-react": "^3.14.0",
"axios": "^0.21.2",
Expand Down Expand Up @@ -63,6 +64,7 @@
"reactjs-popup": "^2.0.5",
"reactstrap": "^8.4.1",
"read-excel-file": "^5.5.3",
"recharts": "^2.12.1",
"redux": "^4.0.5",
"redux-actions": "^2.6.5",
"redux-concatenate-reducers": "^1.0.0",
Expand Down Expand Up @@ -101,6 +103,7 @@
"cross-env": "^5.2.1",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-to-json": "^3.6.2",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^5.1.0",
Expand All @@ -110,14 +113,15 @@
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-testing-library": "^3.6.0",
"husky": "^8.0.0",
"jest-environment-jsdom-sixteen": "^1.0.3",
"jest-localstorage-mock": "^2.4.26",
"msw": "^0.19.5",
"node-fetch": "^3.1.1",
"node-sass": "^8.0.0",
"prettier": "^1.19.1",
"redux-mock-store": "^1.5.4",
"husky": "^8.0.0",
"sinon": "^7.3.2",
"surge": "^0.21.6",
"jest-environment-jsdom-sixteen": "^1.0.3",
"node-fetch": "^3.1.1"
"surge": "^0.21.6"
}
}
18 changes: 18 additions & 0 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,21 @@ export function postTimeEntry(timeEntryObj) {
);
};
};

export function getTimeEntryByProjectSpecifiedPeriod(projectId, fromDate, toDate) {
const request = httpService.get(`${APIEndpoint}/TimeEntry/projects/${projectId}/${fromDate}/${toDate}`);

return dispatch => {
return new Promise((resolve, reject) => {
request.then(({ data }) => {
dispatch({
type: 'GET_TIME_ENTRY_By_Project_FOR_SPECIFIED_PERIOD',
payload: data,
});
resolve(data);
}).catch(error => {
reject(error);
});
});
};
};
2 changes: 1 addition & 1 deletion src/actions/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const getProjectDetail = projectId => {
}
});
if (!loggedOut) {
await dispatch(setProjectDetail(res.data));
return dispatch(setProjectDetail(res.data));
}
};
};
Expand Down
2 changes: 1 addition & 1 deletion src/actions/projectMembers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
******************************************************************************* */
import axios from 'axios';
import * as types from '../constants/projectMembership';
import { searchWithAccent } from 'utils/search';

import { ENDPOINTS } from '../utils/URL';
/** *****************************************
* ACTION CREATORS
Expand Down
16 changes: 8 additions & 8 deletions src/actions/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
fetchTeamMembersDataError,
deleteTaskNotificationSuccess,
deleteTaskNotificationBegin,
} from 'components/TeamMemberTasks/actions';
import { createTaskEditSuggestionHTTP } from 'components/TaskEditSuggestions/service';
} from '../components/TeamMemberTasks/actions';
import { createTaskEditSuggestionHTTP } from '../components/TaskEditSuggestions/service';
import * as types from '../constants/task';
import { ENDPOINTS } from '../utils/URL';
import { createOrUpdateTaskNotificationHTTP } from './taskNotification';
Expand Down Expand Up @@ -54,8 +54,8 @@ export const fetchTeamMembersTimeEntries = () => async (dispatch, getState) => {
const userIds = teamMemberTasks.usersWithTasks.map(user => user.personId)

const { data: usersWithTimeEntries } = await axios.post(ENDPOINTS.TIME_ENTRIES_USER_LIST, {
users: userIds,
fromDate,
users: userIds,
fromDate,
toDate
});

Expand Down Expand Up @@ -130,18 +130,18 @@ export const updateTask = (taskId, updatedTask, hasPermission, prevTask) => asyn
let status = 200;
try {
const state = getState();
let oldTask

let oldTask
if(prevTask){
oldTask = prevTask
}else{
oldTask = selectUpdateTaskData(state, taskId);
}

if (hasPermission) {
await axios.put(ENDPOINTS.TASK_UPDATE(taskId), updatedTask);
const userIds = updatedTask.resources.map(resource => resource.userID);
await createOrUpdateTaskNotificationHTTP(taskId, oldTask, userIds);
await createOrUpdateTaskNotificationHTTP(taskId, oldTask, userIds);
} else {
await createTaskEditSuggestionHTTP(taskId, selectUserId(state), oldTask, updatedTask);
}
Expand Down
7 changes: 6 additions & 1 deletion src/components/BMDashboard/ItemList/ItemsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ export default function ItemsTable({
<td key={label}>{getNestedValue(el, key)}</td>
))}
<td className="items_cell">
<button type="button" onClick={() => handleEditRecordsClick(el, 'Update')}>
<button
type="button"
onClick={() => handleEditRecordsClick(el, 'Update')}
aria-label="Update record"
>
{' '}
<BiPencil />
</button>
<Button
Expand Down
1 change: 1 addition & 0 deletions src/components/BMDashboard/LogTools/LogTools.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ function LogTools() {
<td>{toolType.using}</td>
<td>
<Select
aria-label="Select Tool"
ref={selectRefs.current[index]}
options={toolType.items}
isMulti
Expand Down
6 changes: 5 additions & 1 deletion src/components/BMDashboard/ToolItemList/ToolItemsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ export default function ToolItemsTable({
</td>
<td>{el.code}</td>
<td className="items_cell">
<button type="button" onClick={() => handleEditRecordsClick(el, 'Update')}>
<button
type="button"
onClick={() => handleEditRecordsClick(el, 'Update')}
aria-label="Update record"
>
<BiPencil />
</button>
<Button
Expand Down
7 changes: 5 additions & 2 deletions src/components/LeaderBoard/Leaderboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function LeaderBoard({
</thead>
<tbody className="my-custome-scrollbar">
<tr className={darkMode ? 'bg-yinmn-blue' : ''}>
<td />
<td aria-label="Empty cell" />
<th scope="row" className="leaderboard-totals-container">
<span>{organizationData.name}</span>
{viewZeroHouraMembers(loggedInUser.role) && (
Expand All @@ -234,12 +234,13 @@ function LeaderBoard({
</span>
)}
</th>
<td className="align-middle" />
<td className="align-middle" aria-label="Empty cell" />
<td className="align-middle">
<span title="Tangible time">{organizationData.tangibletime || ''}</span>
</td>
<td className="align-middle">
<Progress
aria-label={`TangibleEffort: ${organizationData.tangibletime} hours`}
title={`TangibleEffort: ${organizationData.tangibletime} hours`}
value={organizationData.barprogress}
color={organizationData.barcolor}
Expand Down Expand Up @@ -395,6 +396,7 @@ function LeaderBoard({
<div>
<button
type="button"
aria-label="Open time off modal"
onClick={() => {
const data = {
requests: [...allRequests[item.personId]],
Expand Down Expand Up @@ -437,6 +439,7 @@ function LeaderBoard({
<Link
to={`/timelog/${item.personId}`}
title={`TangibleEffort: ${item.tangibletime} hours`}
aria-label={`TangibleEffort: ${item.tangibletime} hours`}
>
<Progress value={item.barprogress} color={item.barcolor} />
</Link>
Expand Down
18 changes: 9 additions & 9 deletions src/components/Projects/WBS/WBSDetail/EditTask/EditTaskModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import React, { useState, useEffect } from 'react';
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { connect } from 'react-redux';
import ReactTooltip from 'react-tooltip';
import { DUE_DATE_MUST_GREATER_THAN_START_DATE } from 'languages/en/messages';
import { DUE_DATE_MUST_GREATER_THAN_START_DATE } from '../../../../../../src/languages/en/messages';
import DayPickerInput from 'react-day-picker/DayPickerInput';
import { DateUtils } from 'react-day-picker';
import 'react-day-picker/lib/style.css';
import dateFnsFormat from 'date-fns/format';
import dateFnsParse from 'date-fns/parse';
import { updateTask } from 'actions/task';
import { updateTask } from '../../../../../../src/actions/task';
import { Editor } from '@tinymce/tinymce-react';
import hasPermission from 'utils/permissions';
import hasPermission from '../../../../../../src/utils/permissions';
import axios from 'axios';
import { ENDPOINTS } from 'utils/URL';
import { boxStyle, boxStyleDark } from 'styles';
import { ENDPOINTS } from '../../../../../../src/utils/URL';
import { boxStyle, boxStyleDark } from '../../../../../../src/styles';
import { toast } from 'react-toastify';
import TagsSearch from '../components/TagsSearch';
import ReadOnlySectionWrapper from './ReadOnlySectionWrapper';
Expand Down Expand Up @@ -70,7 +70,7 @@ function EditTaskModal(props) {
{ value: 'Other', label: 'Other' },
];
const FORMAT = 'MM/dd/yy';

const EditorInit = {
license_key: 'gpl',
menubar: false,
Expand All @@ -88,7 +88,7 @@ function EditTaskModal(props) {
* -------------------------------- functions --------------------------------
*/
const toggle = () => setModal(!modal);

// set different mode while show modal through different button
const handleModalShow = (mode) => {
setCurrentMode(mode);
Expand Down Expand Up @@ -284,7 +284,7 @@ function EditTaskModal(props) {
<ModalBody className={darkMode ? 'bg-yinmn-blue' : ''}>
<table
className={`table table-bordered responsive
${canUpdateTask || canSuggestTask ? null : 'disable-div'}
${canUpdateTask || canSuggestTask ? null : 'disable-div'}
${darkMode ? 'text-light' : ''}`}
>
<tbody>
Expand All @@ -304,7 +304,7 @@ function EditTaskModal(props) {
onChange={e => setTaskName(e.target.value)}
onKeyPress={e => setTaskName(e.target.value)}
value={taskName}
/>,
/>,
editable,
taskName
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

.pie-chart-title{
text-align: left;
margin-bottom: 24px;

}
.pie-chart-description{
display: flex;
justify-content: space-around;
alignItems: center;
backgroundColor: white;
overflow: auto;
flex-direction: column;
align-items: flex-start;
width: 100%;

}



Loading

0 comments on commit ddfbd47

Please sign in to comment.