From 08678b3dd7f80e6fbae258b3d23cb70bccb187f7 Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Tue, 1 Oct 2024 17:01:31 +0000 Subject: [PATCH 1/3] initial commit, checking role type prior to using state function we removed for SC --- src/pages/Office/MoveTaskOrder/MoveTaskOrder.jsx | 6 ++++-- .../ServicesCounselingMoveInfo.jsx | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/Office/MoveTaskOrder/MoveTaskOrder.jsx b/src/pages/Office/MoveTaskOrder/MoveTaskOrder.jsx index 11d670add7f..97c119a8825 100644 --- a/src/pages/Office/MoveTaskOrder/MoveTaskOrder.jsx +++ b/src/pages/Office/MoveTaskOrder/MoveTaskOrder.jsx @@ -67,6 +67,7 @@ import { tooRoutes } from 'constants/routes'; import { formatDateForSwagger } from 'shared/dates'; import EditSitEntryDateModal from 'components/Office/EditSitEntryDateModal/EditSitEntryDateModal'; import { formatWeight } from 'utils/formatters'; +import { roleTypes } from 'constants/userRoles'; const nonShipmentSectionLabels = { 'move-weights': 'Move weights', @@ -139,6 +140,7 @@ export const MoveTaskOrder = (props) => { setExcessWeightRiskCount, setMessage, setUnapprovedSITExtensionCount, + userRole, isMoveLocked, } = props; @@ -803,7 +805,7 @@ export const MoveTaskOrder = (props) => { /* ------------------ Update Shipment approvals ------------------------- */ useEffect(() => { - if (mtoShipments) { + if (mtoShipments && userRole !== roleTypes.SERVICES_COUNSELOR) { const shipmentCount = mtoShipments?.length ? mtoShipments.filter((shipment) => shipment.status === shipmentStatuses.SUBMITTED).length : 0; @@ -814,7 +816,7 @@ export const MoveTaskOrder = (props) => { : 0; setExternalVendorShipmentCount(externalVendorShipments); } - }, [mtoShipments, setUnapprovedShipmentCount]); + }, [mtoShipments, setUnapprovedShipmentCount, userRole]); /* ------------------ Update Weight related alerts and estimates ------------------------- */ useEffect(() => { diff --git a/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx b/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx index 1f46fdb4aa2..fb7b11e8c30 100644 --- a/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx +++ b/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx @@ -246,6 +246,7 @@ const ServicesCounselingMoveInfo = () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnApprovedSITExtensionCount} + userRole={roleTypes.SERVICES_COUNSELOR} isMoveLocked={isMoveLocked} /> } From ee39b06e1748a6e2da34cf576465e619f9f1b798 Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Tue, 1 Oct 2024 19:30:22 +0000 Subject: [PATCH 2/3] updated test file that got past me --- eslint-plugin-ato/tests/no-unapproved-annotation.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint-plugin-ato/tests/no-unapproved-annotation.test.js b/eslint-plugin-ato/tests/no-unapproved-annotation.test.js index 562775d43b4..8fe252fc5fc 100644 --- a/eslint-plugin-ato/tests/no-unapproved-annotation.test.js +++ b/eslint-plugin-ato/tests/no-unapproved-annotation.test.js @@ -6,7 +6,7 @@ const ruleTester = new RuleTester(); const ERRORS = { REQUIRES_APPROVAL_MSG: - 'Please add the truss-is3 team as reviewers for this PR and ping the ISSO in #static-code-review Slack. Add label ‘needs-is3-review’ to this PR. For more information, please visit https://dp3.atlassian.net/wiki/spaces/MT/pages/1920991340/Guide+to+Static+Analysis+Security+Workflow', + 'Due to an added annotation, this PR requires approval from a codeowner. Once a codeowner has reviewed/approved your PR, you will need to change the RA Validator Status to CODEOWNER ACCEPTED. For more information, please visit https://dp3.atlassian.net/wiki/spaces/MT/pages/1920991340/Guide+to+Static+Analysis+Security+Workflow', REQUIRES_ANNOTATION_MSG: 'Disabling of this rule requires an annotation. Please visit https://dp3.atlassian.net/wiki/spaces/MT/pages/1921122376/Guide+to+Static+Analysis+Annotations+for+Disabled+Linters', NO_INLINE_DISABLE_MSG: 'Please use eslint-disable-next-line instead of eslint-disable-line', From a7d8798329b58b88a6f2a25dd6cfece740510b3b Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Mon, 7 Oct 2024 13:54:05 +0000 Subject: [PATCH 3/3] adding error count to move details count --- .../ServicesCounselingTabNav.jsx | 10 +++++++++- .../ServicesCounselingTabNav.test.jsx | 13 +++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx index 572353e245b..19603a2ebc7 100644 --- a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx +++ b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx @@ -10,7 +10,12 @@ import 'styles/office.scss'; import TabNav from 'components/TabNav'; import { isBooleanFlagEnabled } from 'utils/featureFlags'; -const ServicesCounselingTabNav = ({ shipmentWarnConcernCount = 0, missingOrdersInfoCount, moveCode }) => { +const ServicesCounselingTabNav = ({ + shipmentWarnConcernCount = 0, + shipmentErrorConcernCount, + missingOrdersInfoCount, + moveCode, +}) => { const [supportingDocsFF, setSupportingDocsFF] = React.useState(false); React.useEffect(() => { const fetchData = async () => { @@ -23,6 +28,9 @@ const ServicesCounselingTabNav = ({ shipmentWarnConcernCount = 0, missingOrdersI if (shipmentWarnConcernCount > 0) { moveDetailsTagCount += shipmentWarnConcernCount; } + if (shipmentErrorConcernCount > 0) { + moveDetailsTagCount += shipmentErrorConcernCount; + } if (missingOrdersInfoCount > 0) { moveDetailsTagCount += missingOrdersInfoCount; } diff --git a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx index bba8ebeb7f6..acc5267f0a1 100644 --- a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx +++ b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx @@ -35,6 +35,19 @@ describe('Move details tag rendering', () => { const moveDetailsTab = screen.getByTestId('MoveDetails-Tab'); expect(within(moveDetailsTab).getByTestId('tag')).toHaveTextContent('4'); }); + + it('should render the move details tab container with a tag that shows the count of an warn and error count', () => { + const moveDetailsShipmentAndAmendedOrders = { + ...basicNavProps, + missingOrdersInfoCount: 4, + shipmentWarnConcernCount: 2, + shipmentErrorConcernCount: 1, + }; + render(, { wrapper: MemoryRouter }); + + const moveDetailsTab = screen.getByTestId('MoveDetails-Tab'); + expect(within(moveDetailsTab).getByTestId('tag')).toHaveTextContent('7'); + }); }); describe('MTO tag rendering', () => {