Skip to content

Commit

Permalink
Merge branch '5512-story-updates' into 10339-story
Browse files Browse the repository at this point in the history
  • Loading branch information
nechama-krigsman committed Aug 15, 2024
2 parents f194a16 + 8a039f8 commit 13b9594
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('generatePetitionPdfInteractor', () => {
applicationContext.getCurrentUser.mockImplementation(() => ({}));

await expect(
generatePetitionPdfInteractor(applicationContext, {}),
generatePetitionPdfInteractor(applicationContext, {} as any),
).rejects.toThrow('Unauthorized');
});

Expand Down
9 changes: 4 additions & 5 deletions web-api/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ const console = () =>
handleRejections: true,
}));

export const logger =
(transport = console()) =>
(req, res, next) => {
const createdLogger = createLogger({ transports: [transport] });

export const logger = (transport = console()) => {
const createdLogger = createLogger({ transports: [transport] });
return (req, res, next) => {
if (process.env.NODE_ENV === 'production') {
const requestBody = cloneDeep(req.body);

Expand Down Expand Up @@ -66,6 +64,7 @@ export const logger =

return next();
};
};

function redactPasswordFields(obj) {
const passwordRegex = /password/i;
Expand Down
18 changes: 0 additions & 18 deletions web-client/src/presenter/actions/cancelUploadsAction.test.ts

This file was deleted.

7 changes: 0 additions & 7 deletions web-client/src/presenter/actions/cancelUploadsAction.ts

This file was deleted.

4 changes: 0 additions & 4 deletions web-client/src/presenter/computeds/fileUploadStatusHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ export const fileUploadStatusHelper = (get: Get): any => {
);
const shouldThrottle = !get(state.fileUploadProgress.noThrottle); // results WILL be throttled unless explicitly set to false

const isCancelable = !!(
Number.isFinite(timeRemaining) && percentComplete < 100
);
let statusMessage;

if (percentComplete === 100) {
Expand All @@ -39,7 +36,6 @@ export const fileUploadStatusHelper = (get: Get): any => {
}

return {
isCancelable,
isHavingSystemIssues,
statusMessage: shouldThrottle
? throttledStatus(statusMessage)
Expand Down
22 changes: 14 additions & 8 deletions web-client/src/presenter/computeds/validationHelper.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { collectInputElements } from '@web-client/presenter/computeds/validationHelper';

describe('validationHelper', () => {
const element1 = (window.document.createElement('input').id = 'test-element');
const element1 = (window.document.createElement('input').id =
'test-element') as unknown as HTMLElement;
const element2 = (window.document.createElement('input').id =
'test-element2');
'test-element2') as unknown as HTMLElement;
const element3 = (window.document.createElement('input').id =
'test-element3');
'test-element3') as unknown as HTMLElement;

it('should return an array of elements needing focus due to errors', () => {
const errors = {
Expand Down Expand Up @@ -55,8 +56,11 @@ describe('validationHelper', () => {
elementsToFocus,
errorKey,
) => {
if (errorValue === 'Specific error' && refs[errorKey.slice(0, -1)]) {
elementsToFocus.push(refs[errorKey.slice(0, -1)]);
if (
errorValue === 'Specific error' &&
refs.current[errorKey.slice(0, -1)]
) {
elementsToFocus.push(refs.current[errorKey.slice(0, -1)]);
}
};

Expand All @@ -67,9 +71,11 @@ describe('validationHelper', () => {
};

const refs = {
test1: element1,
test2: element2,
test3: element3,
current: {
test1: element1,
test2: element2,
test3: element3,
},
};

const elements = collectInputElements(errors, refs, specificCustomFunction);
Expand Down
2 changes: 0 additions & 2 deletions web-client/src/presenter/presenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import { canEditContactInformationSequence } from './sequences/canEditContactInf
import { cancelAddDraftDocumentSequence } from './sequences/cancelAddDraftDocumentSequence';
import { cancelAddStatisticSequence } from './sequences/cancelAddStatisticSequence';
import { cancelAndNavigateToCorrespondenceSequence } from './sequences/cancelAndNavigateToCorrespondenceSequence';
import { cancelFileUploadSequence } from './sequences/cancelFileUploadSequence';
import { cancelRemovePetitionerSequence } from './sequences/cancelRemovePetitionerSequence';
import { caseDetailPrimaryTabChangeSequence } from './sequences/caseDetailPrimaryTabChangeSequence';
import { caseInventoryReportLoadMoreSequence } from './sequences/caseInventoryReportLoadMoreSequence';
Expand Down Expand Up @@ -661,7 +660,6 @@ export const presenterSequences = {
cancelAddStatisticSequence: cancelAddStatisticSequence as unknown as Function,
cancelAndNavigateToCorrespondenceSequence:
cancelAndNavigateToCorrespondenceSequence as unknown as Function,
cancelFileUploadSequence: cancelFileUploadSequence as unknown as Function,
cancelRemovePetitionerSequence:
cancelRemovePetitionerSequence as unknown as Function,
caseDetailPrimaryTabChangeSequence:
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions web-client/src/views/DocketEntryQc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { CreateMessageModalDialog } from './Messages/CreateMessageModalDialog';
import { DocumentDisplayIframe } from './DocumentDisplayIframe';
import { ErrorNotification } from './ErrorNotification';
import { FileUploadErrorModal } from './FileUploadErrorModal';
import { FileUploadStatusModal } from './FileUploadStatusModal';
import { FormCancelModalDialog } from './FormCancelModalDialog';
import { Hint } from '../ustc-ui/Hint/Hint';
import { PrimaryDocumentForm } from './EditDocketEntry/PrimaryDocumentForm';
Expand Down Expand Up @@ -125,7 +124,6 @@ export const DocketEntryQc = connect(
onConfirmSequence={completeDocketEntryQCAndSendMessageSequence}
/>
)}
{showModal === 'FileUploadStatusModal' && <FileUploadStatusModal />}
{showModal === 'FileUploadErrorModal' && (
<FileUploadErrorModal
confirmSequence={completeDocketEntryQCSequence}
Expand Down
28 changes: 6 additions & 22 deletions web-client/src/views/FileUploadStatusModal.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import { Button } from '../ustc-ui/Button/Button';
import { Focus } from '../ustc-ui/Focus/Focus';
import { ModalDialog } from './ModalDialog';
import { ProgressBar } from '../ustc-ui/ProgressBar/ProgressBar';
import { connect } from '@web-client/presenter/shared.cerebral';
import { sequences } from '@web-client/presenter/app.cerebral';
import { state } from '@web-client/presenter/app.cerebral';
import React from 'react';

export const FileUploadStatusModal = connect(
{
cancelUploadSequence: sequences.cancelFileUploadSequence,
helper: state.fileUploadStatusHelper,
percentComplete: state.fileUploadProgress.percentComplete,
},
function FileUploadStatusModal({
cancelUploadSequence,
helper,
percentComplete,
}) {
function FileUploadStatusModal({ helper, percentComplete }) {
return (
<ModalDialog className="file-upload-status-modal" showButtons={false}>
<ModalDialog
className="file-upload-status-modal"
closeLink={false}
showButtons={false}
>
<Focus>
<ProgressBar
aria-labelledby="progress-description"
Expand All @@ -42,19 +39,6 @@ export const FileUploadStatusModal = connect(
/>
</div>
{helper.isHavingSystemIssues && <div>Still processing...</div>}
{helper.isCancelable && (
<div className="cancel">
<Button
link
onClick={e => {
e.stopPropagation();
cancelUploadSequence();
}}
>
Cancel Upload
</Button>
</div>
)}
</div>
</ModalDialog>
);
Expand Down
21 changes: 11 additions & 10 deletions web-client/src/views/StartCaseUpdated/CardHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { Button } from '@web-client/ustc-ui/Button/Button';
import { props as cerebralProps } from 'cerebral';
import { connect } from '@web-client/presenter/shared.cerebral';
import { sequences } from '@web-client/presenter/app.cerebral';
import React from 'react';

const props = cerebralProps as unknown as {
type CardHeaderType = {
showEditButton?: boolean;
step?: number;
title: string;
};

export const CardHeader = connect(
{
showEditButton: props.showEditButton,
step: props.step,
title: props.title,
updateStepIndicatorSequence: sequences.updateStepIndicatorSequence,
},
const cardHeaderDependencies = {
updateStepIndicatorSequence: sequences.updateStepIndicatorSequence,
};

export const CardHeader = connect<
CardHeaderType,
typeof cardHeaderDependencies
>(
cardHeaderDependencies,
function CardHeader({
showEditButton = true,
step,
Expand All @@ -29,7 +30,7 @@ export const CardHeader = connect(
{step && <span>{step}. </span>}
{title}
</div>
{showEditButton && (
{showEditButton && step && (
<div>
<Button
link
Expand Down

0 comments on commit 13b9594

Please sign in to comment.