Skip to content

Commit

Permalink
Merge pull request #528 from Enterprise-CMCS/master
Browse files Browse the repository at this point in the history
Release to val
  • Loading branch information
mdial89f authored Apr 29, 2024
2 parents a80717f + f112cfe commit f885c6c
Show file tree
Hide file tree
Showing 36 changed files with 165 additions and 224 deletions.
18 changes: 7 additions & 11 deletions src/packages/shared-types/attachments.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { z } from "zod";
import { s3ParseUrl } from "shared-utils/s3-url-parser";
import { Authority } from "./authority";

export const attachmentTitleMap = (
authority: Authority,
): Record<string, string> => ({
export const attachmentTitleMap = {
// SPA
cmsForm179: "CMS Form 179",
currentStatePlan: "Current State Plan",
Expand All @@ -17,15 +14,14 @@ export const attachmentTitleMap = (
tribalConsultation: "Tribal Consultation",
amendedLanguage: "Amended State Plan Language",
budgetDocuments: "Budget Documents",
officialWithdrawalLetter: "Official Withdrawal Letter",
// ISSUE RAI
formalRaiLetter: "Formal RAI Letter",
// RAI RESPONSE
raiResponseLetter: (() => {
if (authority === Authority["1915b"]) {
return "Waiver RAI Response";
}
return "RAI Response Letter";
})(),
raiResponseLetter: "RAI Response Letter",
raiResponseLetterWaiver: "Waiver RAI Response",
revisedAmendedStatePlanLanguage: "Revised Amended State Plan Language",
officialRaiResponse: "Official RAI Response",
// MISC
other: "Other",
// RAI WITHDRAW
Expand All @@ -42,7 +38,7 @@ export const attachmentTitleMap = (
"1915(b)(4) FFS Selective Contracting (Streamlined) Independent Assessment (first two renewals only)",
appk: "1915(c) Appendix K Amendment Waiver Template",
waiverExtensionRequest: "Waiver Extension Request",
});
};
export type AttachmentKey = keyof typeof attachmentTitleMap;
export type AttachmentTitle = (typeof attachmentTitleMap)[AttachmentKey];

Expand Down
2 changes: 1 addition & 1 deletion src/services/auth/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ custom:
bootstrapUsers: ${ssm:/aws/reference/secretsmanager/${self:custom.project}/${sls:stage}/bootstrapUsers, param:bootstrapUsers}
bootstrapUsersPassword: ${ssm:/aws/reference/secretsmanager/${self:custom.project}/${sls:stage}/bootstrapUsersPassword, ssm:/aws/reference/secretsmanager/${self:custom.project}/default/bootstrapUsersPassword}
idmInfo: ${ssm:/aws/reference/secretsmanager/${self:custom.project}/${sls:stage}/idmInfo, ""}
vpc: ${ssm:/aws/reference/secretsmanager/${self:custom.project}/${sls:stage}/authzbandaid/vpc, ssm:/aws/reference/secretsmanager/${self:custom.project}/${sls:stage}/vpc, ssm:/aws/reference/secretsmanager/${self:custom.project}/default/vpc}
vpc: ${ssm:/aws/reference/secretsmanager/${self:custom.project}/${sls:stage}/vpc, ssm:/aws/reference/secretsmanager/${self:custom.project}/default/vpc}
scripts:
hooks:
deploy:finalize: |
Expand Down
14 changes: 6 additions & 8 deletions src/services/ui/src/api/submissionService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { describe, expect, it } from "vitest";
import * as unit from "./submissionService";
import { OneMacUser } from "@/api/useGetUser";
import { SubmissionServiceEndpoint } from "@/utils";
import { Authority } from "shared-types";

const mockFormData = {
test: "data",
Expand All @@ -21,7 +20,7 @@ const mockUploadRecipes = (n: number) => {
url: `/upload/${n}`,
bucket: `bucket-${n}`,
data: new File([""], `test-${n}.pdf`),
title: `title-${n}`,
title: "other",
name: `name-${n}`,
});
n--;
Expand Down Expand Up @@ -65,16 +64,15 @@ describe("helpers", () => {
const testFile = new File([""], "test.pdf");
const res = unit.urlsToRecipes(
[{ url: "/test", key: "test", bucket: "test-bucket" }],
[{ attachmentKey: "test", file: testFile }],
Authority.MED_SPA
[{ attachmentKey: "other", file: testFile }],
);
expect(res).toStrictEqual([
{
url: "/test",
key: "test",
bucket: "test-bucket",
data: testFile,
title: "test",
title: "other",
name: "test.pdf",
},
]);
Expand All @@ -88,7 +86,7 @@ describe("helpers", () => {
expect(attachments).toHaveLength(3);
expect(attachments![0].key).toEqual("test-3");
expect(attachments![0].filename).toEqual("name-3");
expect(attachments![0].title).toEqual("title-3");
expect(attachments![0].title).toEqual("other");
expect(attachments![0].bucket).toEqual("bucket-3");
expect(attachments![0].uploadDate).not.toBeUndefined();
});
Expand All @@ -102,7 +100,7 @@ describe("helpers", () => {
mockGeorge,
"/default" as SubmissionServiceEndpoint,
"MEDICAID",
mockUploadRecipes(3)
mockUploadRecipes(3),
);
expect(payload.authority).toEqual("MEDICAID");
expect(payload.origin).toEqual("micro");
Expand All @@ -118,7 +116,7 @@ describe("helpers", () => {
mockGeorge,
"/submit",
"MEDICAID",
mockUploadRecipes(3)
mockUploadRecipes(3),
);
expect(payload.authority).toEqual("MEDICAID");
expect(payload.origin).toEqual("micro");
Expand Down
15 changes: 5 additions & 10 deletions src/services/ui/src/api/submissionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Authority,
ReactQueryApiError,
Action,
attachmentTitleMap,
AttachmentKey,
} from "shared-types";
import { buildActionUrl, SubmissionServiceEndpoint } from "@/utils";
import { OneMacUser } from "@/api";
Expand All @@ -29,10 +29,10 @@ type PreSignedURL = {
};
export type UploadRecipe = PreSignedURL & {
data: File;
title: string;
title: AttachmentKey;
name: string;
};
type AttachmentKeyValue = { attachmentKey: string; file: File };
type AttachmentKeyValue = { attachmentKey: AttachmentKey; file: File };

/** Pass in an array of UploadRecipes and get a back-end compatible object
* to store attachment data */
Expand Down Expand Up @@ -133,7 +133,7 @@ export const buildAttachmentKeyValueArr = (
.filter(([, val]) => val !== undefined && (val as File[]).length)
.map(([key, value]) => {
return (value as File[]).map((file) => ({
attachmentKey: key,
attachmentKey: key as AttachmentKey,
file: file,
}));
})
Expand All @@ -142,16 +142,13 @@ export const buildAttachmentKeyValueArr = (
export const urlsToRecipes = (
urls: PreSignedURL[],
attachments: AttachmentKeyValue[],
authority: Authority,
): UploadRecipe[] =>
urls.map((obj, idx) => ({
...obj, // Spreading the presigned url
data: attachments[idx].file, // The attachment file object
// Add your attachments object key and file label value to the attachmentTitleMap
// for this transform to work. Else the title will just be the object key.
title:
attachmentTitleMap(authority)?.[attachments[idx].attachmentKey] ||
attachments[idx].attachmentKey,
title: attachments[idx].attachmentKey,
name: attachments[idx].file.name,
}));

Expand Down Expand Up @@ -181,8 +178,6 @@ export const submit = async <T extends Record<string, unknown>>({
const uploadRecipes: UploadRecipe[] = urlsToRecipes(
preSignedURLs,
attachments,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
authority!,
);
// Upload attachments
await Promise.all(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,32 @@ import {
RequiredIndicator,
Upload,
} from "@/components";
import { attachmentTitleMap } from "shared-types";

export const AttachmentsSection = ({
attachments,
instructions,
faqLink,
faqAttLink,
}: {
attachments: AttachmentRecipe<any>[];
attachments: AttachmentRecipe[];
instructions?: string;
faqLink: string;
faqAttLink: string;
}) => {
const form = useFormContext();
return (
<section className={"mb-8"}>
<h2 className="font-bold text-2xl font-sans mb-2">Attachments</h2>
{instructions && <p>{instructions}</p>}
<AttachmentsSizeTypesDesc faqLink={faqLink} />
{attachments.map(({ name, label, required }) => (
<AttachmentsSizeTypesDesc faqAttLink={faqAttLink} />
{attachments.map(({ name, required }) => (
<FormField
key={String(name) + "-field"}
control={form.control}
name={`attachments.${String(name)}`}
render={({ field }) => (
<FormItem key={String(name) + "-render"} className="my-4 space-y-2">
<FormLabel>{label}</FormLabel> {required && <RequiredIndicator />}
<FormLabel>{attachmentTitleMap[name] ?? name}</FormLabel>{" "}
{required && <RequiredIndicator />}
<Upload files={field?.value ?? []} setFiles={field.onChange} />
<FormMessage />
</FormItem>
Expand Down
15 changes: 8 additions & 7 deletions src/services/ui/src/components/Form/old-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ export const SpaIdFormattingDesc = () => (
);

export const AttachmentsSizeTypesDesc = ({
faqLink,
faqAttLink,
includeCMS179 = false,
}: {
faqLink: string;
faqAttLink: string;
includeCMS179?: boolean;
}) => (
<div className="text-gray-700 font-light">
Expand All @@ -58,7 +58,7 @@ export const AttachmentsSizeTypesDesc = ({
for each of the attachment types on the{" "}
{
<Link
to={faqLink}
to={faqAttLink}
target={FAQ_TAB}
rel="noopener noreferrer"
className="text-blue-700 hover:underline"
Expand All @@ -71,16 +71,17 @@ export const AttachmentsSizeTypesDesc = ({
<br />
<p>
We accept the following file formats:{" "}
<strong className="bold">.docx, .jpg, .pdf, .png, .xlsx.</strong> See the
full list on the{" "}
<strong className="bold">
.docx, .docx, .pdf, .jpg, .opd, and more.{" "}
</strong>{" "}
{
<Link
to="/faq/acceptable-file-formats"
to={"/faq/acceptable-file-formats"}
target={FAQ_TAB}
rel="noopener noreferrer"
className="text-blue-700 hover:underline"
>
FAQ Page
See the full list
</Link>
}
.
Expand Down
4 changes: 2 additions & 2 deletions src/services/ui/src/components/Routing/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const useNavigate = () => {
query?: Record<string, string>;
hash?: string;
} & Params<T>,
options?: NavigateOptions
options?: NavigateOptions,
) => {
const to = (() => {
let url: string = props.path;
Expand Down Expand Up @@ -50,7 +50,7 @@ export const redirect = <T extends Route>(
path: T;
query?: Record<string, string>;
hash?: string;
} & Params<T>
} & Params<T>,
) => {
const to = (() => {
let url: string = props.path;
Expand Down
26 changes: 13 additions & 13 deletions src/services/ui/src/features/dashboard/Lists/spas/consts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ export const useSpaTableColumns = (): OsTableColumn[] => {
if (!props?.user) return [];

return [
// hide actions column for: readonly,help desk
...(!CMS_READ_ONLY_ROLES.some((UR) =>
props.user?.["custom:cms-roles"].includes(UR),
)
? [
{
locked: true,
isSystem: true,
label: "Actions",
cell: renderCellActions(props.user),
},
]
: []),
{
props: { className: "w-[150px]" },
field: "id.keyword",
Expand Down Expand Up @@ -146,18 +159,5 @@ export const useSpaTableColumns = (): OsTableColumn[] => {
transform: (data) => data.submitterName ?? BLANK_VALUE,
cell: (data) => data.submitterName,
},
// hide actions column for: readonly,help desk
...(!CMS_READ_ONLY_ROLES.some((UR) =>
props.user?.["custom:cms-roles"].includes(UR),
)
? [
{
locked: true,
isSystem: true,
label: "Actions",
cell: renderCellActions(props.user),
},
]
: []),
];
};
26 changes: 13 additions & 13 deletions src/services/ui/src/features/dashboard/Lists/waivers/consts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ export const useWaiverTableColumns = (): OsTableColumn[] => {
if (!props?.user) return [];

return [
// hide actions column for: readonly,help desk
...(!CMS_READ_ONLY_ROLES.some((UR) =>
props.user?.["custom:cms-roles"].includes(UR),
)
? [
{
locked: true,
isSystem: true,
label: "Actions",
cell: renderCellActions(props.user),
},
]
: []),
{
props: { className: "w-[150px]" },
field: "id.keyword",
Expand Down Expand Up @@ -162,18 +175,5 @@ export const useWaiverTableColumns = (): OsTableColumn[] => {
transform: (data) => data.submitterName ?? BLANK_VALUE,
cell: (data) => data.submitterName,
},
// hide actions column for: readonly,help desk
...(!CMS_READ_ONLY_ROLES.some((UR) =>
props.user?.["custom:cms-roles"].includes(UR),
)
? [
{
locked: true,
isSystem: true,
label: "Actions",
cell: renderCellActions(props.user),
},
]
: []),
];
};
12 changes: 6 additions & 6 deletions src/services/ui/src/features/faq/content/oneMACFAQContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export const oneMACFAQContent: FAQContent[] = [
sectionTitle: "General",
qanda: [
{
anchorText: "system",
anchorText: "crosswalk-system",
question: "Which system should I use for my state’s submission?",
answerJSX: (
<section id={"system"}>
<section>
<p>
Check which system to submit your state plan in with this
crosswalk training document.
Expand Down Expand Up @@ -414,7 +414,7 @@ export const oneMACFAQContent: FAQContent[] = [
<tbody>
<tr>
<td className="border border-gray-300 px-4 py-2">
RAI Response*
RAI Response Letter*
</td>
<td className="border border-gray-300 px-4 py-2">
Letter responding to RAI questions, any updated SPA pages,
Expand Down Expand Up @@ -916,7 +916,7 @@ export const oneMACFAQContent: FAQContent[] = [
),
},
{
anchorText: "1915(b)-waiver-extension-attachments",
anchorText: "temporary-extensions-b-attachments",
question:
"What are the attachments for a 1915(b) Waiver - Request for Temporary Extension?",
answerJSX: (
Expand Down Expand Up @@ -957,9 +957,9 @@ export const oneMACFAQContent: FAQContent[] = [
),
},
{
anchorText: "1915(c)-waiver-extension-attachments",
anchorText: "temporary-extensions-b-attachments",
question:
"What are the attachments for a 1915(c) Waiver - Request for Temporary Extension",
"What are the attachments for a 1915(c) Waiver - Request for Temporary Extension?",
answerJSX: (
<>
<p>Note: “*” indicates a required attachment.</p>
Expand Down
Loading

0 comments on commit f885c6c

Please sign in to comment.