From 4ee6f766858cbe82ed26876e67e3b4ef8d66fe8a Mon Sep 17 00:00:00 2001 From: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com> Date: Tue, 9 Mar 2021 16:34:07 -0500 Subject: [PATCH] Squashed commit of the following: commit bcca11cc6c04396dcd9b4fa27ca84622d49e8956 Merge: 76231df a945aca Author: Josh Salisbury Date: Tue Mar 9 15:18:13 2021 -0600 Merge pull request #205 from adhocteam/js-283-frontend-updates Frontend updates commit a945aca80f1e56fe1b903315508fa302e8fa9c2d Merge: 3050a42 76231df Author: Josh Salisbury Date: Tue Mar 9 13:21:40 2021 -0600 Merge branch 'main' into js-283-frontend-updates commit 3050a42acd8791a4749ea8e7219faba51afef883 Author: Josh Salisbury Date: Tue Mar 9 13:20:23 2021 -0600 Feedback from PR * Deploy to sandbox * Attachments edit link goes to correct page * Resources data types change to array of text instead of array of strings commit 76231dfeb1ca8ac44aad40604852708037dc1d3d Merge: d694b96 64bf3cd Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com> Date: Tue Mar 9 19:16:27 2021 +0000 Merge pull request #218 from adhocteam/cm-302-create-mainenance-page Cm 302 create mainenance page commit d694b9650bb3993bef89f0edf5fdaa60d41f6d9f Merge: a35691d 74ee33f Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com> Date: Tue Mar 9 16:47:39 2021 +0000 Merge pull request #220 from adhocteam/fix-double-import clean up double import commit 74ee33f4a49f232c7824e5f3473de7bc209dd55f Merge: 275e472 a35691d Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com> Date: Tue Mar 9 16:36:10 2021 +0000 Merge branch 'main' into fix-double-import commit 275e472be5bc62eabb660cef2ad88ce4bdede526 Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com> Date: Tue Mar 9 11:32:11 2021 -0500 clean up double import commit a35691dc506c285df40c78c345e6c180a283697c Merge: 5956089 ff1c224 Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com> Date: Tue Mar 9 16:04:41 2021 +0000 Merge pull request #219 from adhocteam/cm-add-new-relic-to-worker add new relic to worker.js commit ff1c224150ef28afd4e442957fc4660fe5c5eb95 Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com> Date: Tue Mar 9 10:50:47 2021 -0500 move require to start of file. commit 77173a4ec5a4d130a44d23394da264da170df930 Merge: eadf312 5956089 Author: Josh Salisbury Date: Tue Mar 9 09:35:09 2021 -0600 Merge branch 'main' into js-283-frontend-updates commit 49314662862d87ab6702e9238749788009adae1f Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com> Date: Tue Mar 9 09:49:04 2021 -0500 add new relic to worker.js commit eadf3120f26661497babb868bfdc435487b8560c Merge: 64db2a9 e7db658 Author: Josh Salisbury Date: Mon Mar 8 13:22:32 2021 -0600 Merge branch 'main' into js-283-frontend-updates Conflicts: frontend/src/pages/ActivityReport/Pages/components/Goal.js src/seeders/20201124160449-users.js commit 64db2a9bdabb5eb9bb0a93c686b5d0b0db7ea697 Author: Josh Salisbury Date: Fri Mar 5 12:12:07 2021 -0600 PR feedback * Set required font-family/size via uswds class * Use uswds margin classes instead of `smart-hub--*` classes * Wrap group of `await` calls in `Promise.all` inside resource migration * Remove File `attachmentType` field * Change trashcan icon's color to black to match other trashcan icons commit 9438d3fb3170e7ea448a7091c5f734c162edc4f6 Merge: 0cf6743 92a929b Author: Josh Salisbury Date: Thu Mar 4 11:17:37 2021 -0600 Merge branch 'main' into js-283-frontend-updates Conflicts: .circleci/config.yml frontend/src/pages/ActivityReport/Pages/topicsResources.js commit 0cf67439ed0437d819afd2be8fc3e6994fa0fa0b Author: Josh Salisbury Date: Wed Mar 3 13:33:22 2021 -0600 Dev/stagging now only forward migrate commit e8b33b91172c6d0f15d14afc5557067d8611c5ab Author: Josh Salisbury Date: Wed Mar 3 12:19:24 2021 -0600 Remove josh as a user in the seeders commit 642917c1cb43a079fa09ba4b2a9d072f3f7e4f63 Author: Josh Salisbury Date: Wed Mar 3 11:20:24 2021 -0600 Update HSES id for josh commit 68be3b043fe53d802606146da9881b3f1398b2d5 Merge: 354ab9f 36f3803 Author: Josh Salisbury Date: Wed Mar 3 09:57:32 2021 -0600 Merge branch 'main' into js-283-frontend-updates commit 354ab9f96c3433797e3d2a2ea14e0d635d29d721 Merge: eeef66a 079fc8b Author: Josh Salisbury Date: Tue Mar 2 16:57:42 2021 -0600 Merge branch 'js-283-frontend-updates' of github.com:adhocteam/Head-Start-TTADP into js-283-frontend-updates commit eeef66a895a67ad6a43083b071b1dae671bb28aa Author: Josh Salisbury Date: Tue Mar 2 16:57:13 2021 -0600 Lint fix commit 079fc8b728f8cbe1f2b862e0f2ad1fa1b759092f Merge: 01a6806 d0f5a95 Author: Josh Salisbury Date: Tue Mar 2 16:55:12 2021 -0600 Merge branch 'main' into js-283-frontend-updates commit 01a680663227c1901a2937777f13b03ab5c86296 Author: Josh Salisbury Date: Tue Mar 2 16:34:57 2021 -0600 Update sandbox branch commit 0603eb0144fbb19ab8ca68838bd0524fe1a40e36 Author: Josh Salisbury Date: Tue Mar 2 16:33:14 2021 -0600 Various frontend changes to better match design * Add resource selector * Virtual delivery method field added * Fix styling (margins colors etc) * Copy updates --- .circleci/config.yml | 10 +- docs/openapi/index.yaml | 3 - frontend/package.json | 1 + frontend/src/App.css | 4 + frontend/src/components/FileUploader.js | 15 +-- frontend/src/components/FormItem.css | 2 - frontend/src/components/FormItem.js | 2 +- .../src/components/__tests__/FileUploader.js | 2 +- .../Pages/Review/Approver/Review.js | 2 +- .../Pages/Review/Submitter/Draft.js | 4 +- .../Pages/__tests__/topicsResources.js | 8 +- .../ActivityReport/Pages/activitySummary.js | 61 ++++++++--- .../ActivityReport/Pages/components/Goal.js | 2 +- .../Pages/components/GoalPicker.js | 2 +- .../Pages/components/ResourceSelector.js | 67 ++++++++++++ .../components/__tests__/ResourceSelector.js | 63 +++++++++++ .../ActivityReport/Pages/goalsObjectives.js | 4 +- .../ActivityReport/Pages/topicsResources.js | 102 ++++++++++-------- frontend/src/pages/ActivityReport/index.css | 29 ++++- frontend/src/pages/ActivityReport/index.js | 16 ++- frontend/yarn.lock | 12 +++ ...170502-add-resources-to-activity-report.js | 29 +++++ ...0210302215921-add-virtual-delivery-type.js | 13 +++ .../20210305174257-remove-attachment-type.js | 18 ++++ src/models/activityReport.js | 11 +- src/models/file.js | 4 - src/routes/files/handlers.js | 14 +-- src/routes/files/handlers.test.js | 27 ----- src/seeders/20201124160449-users.js | 10 -- src/services/activityReports.js | 25 ++--- src/services/activityReports.test.js | 8 +- src/services/files.js | 2 - 32 files changed, 392 insertions(+), 180 deletions(-) create mode 100644 frontend/src/pages/ActivityReport/Pages/components/ResourceSelector.js create mode 100644 frontend/src/pages/ActivityReport/Pages/components/__tests__/ResourceSelector.js create mode 100644 src/migrations/20210302170502-add-resources-to-activity-report.js create mode 100644 src/migrations/20210302215921-add-virtual-delivery-type.js create mode 100644 src/migrations/20210305174257-remove-attachment-type.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 20f1d1245b..6d77a324bb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -133,7 +133,7 @@ parameters: default: "main" type: string sandbox_git_branch: # change to feature branch to test deployment - default: "cm-302-create-mainenance-page" + default: "js-283-frontend-updates" type: string jobs: build_and_lint: @@ -314,10 +314,10 @@ jobs: hses_data_username: HSES_DATA_USERNAME hses_data_password: HSES_DATA_PASSWORD - run: - name: Return database to neutral, then migrate and seed + name: Migrate database command: | cf run-task tta-smarthub-sandbox \ - --command "yarn db:migrate:undo:prod && yarn db:migrate:prod && yarn db:seed:prod" \ + --command "yarn db:migrate:prod" \ --name "Reset DB" - when: # dev condition: @@ -339,10 +339,10 @@ jobs: hses_data_username: HSES_DATA_USERNAME hses_data_password: HSES_DATA_PASSWORD - run: - name: Undo database seeding, then migrate and seed + name: Migrate database command: | cf run-task tta-smarthub-dev \ - --command "yarn db:migrate:prod && yarn db:seed:undo:prod && yarn db:seed:prod" \ + --command "yarn db:migrate:prod" \ --name "Reset DB" - when: # staging condition: diff --git a/docs/openapi/index.yaml b/docs/openapi/index.yaml index 4f60ad4636..a6d91bddfb 100644 --- a/docs/openapi/index.yaml +++ b/docs/openapi/index.yaml @@ -179,9 +179,6 @@ components: fileUpload: type: object properties: - attachmentType: - type: string - description: "Type of attachment. Acceptable values are ATTACHMENT or RESOURCE" reportId: type: number description: "id of the Activity report the file is associated with" diff --git a/frontend/package.json b/frontend/package.json index 43d49dd25e..c7aeb40326 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -6,6 +6,7 @@ "@babel/runtime": "^7.12.1", "@fortawesome/fontawesome-free": "^5.15.1", "@fortawesome/fontawesome-svg-core": "^1.2.32", + "@fortawesome/free-regular-svg-icons": "^5.15.2", "@fortawesome/free-solid-svg-icons": "^5.15.1", "@fortawesome/react-fontawesome": "^0.1.11", "@hookform/error-message": "^0.0.5", diff --git a/frontend/src/App.css b/frontend/src/App.css index 2ffa03179d..29123b2c96 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -30,6 +30,10 @@ body { background-color: #f8f8f8; } +.text-ink { + color: #21272D +} + .smart-hub-bg-blue-primary { background-color: #0166ab; } diff --git a/frontend/src/components/FileUploader.js b/frontend/src/components/FileUploader.js index 0ce8a61435..228a651f9a 100644 --- a/frontend/src/components/FileUploader.js +++ b/frontend/src/components/FileUploader.js @@ -17,12 +17,11 @@ import { uploadFile, deleteFile } from '../fetchers/File'; import './FileUploader.css'; -export const upload = async (file, reportId, attachmentType, setErrorMessage) => { +export const upload = async (file, reportId, setErrorMessage) => { let res; try { const data = new FormData(); data.append('reportId', reportId); - data.append('attachmentType', attachmentType); data.append('file', file); res = await uploadFile(data); } catch (error) { @@ -42,13 +41,7 @@ export const handleDrop = async (e, reportId, id, onChange, setErrorMessage) => setErrorMessage('Cannot save attachments without a Grantee or Non-Grantee selected'); return; } - let attachmentType; - if (id === 'attachments') { - attachmentType = 'ATTACHMENT'; - } else if (id === 'otherResources') { - attachmentType = 'RESOURCE'; - } - const newFiles = e.map((file) => upload(file, reportId, attachmentType, setErrorMessage)); + const newFiles = e.map((file) => upload(file, reportId, setErrorMessage)); Promise.all(newFiles).then((values) => { onChange(values); }); @@ -66,8 +59,8 @@ function Dropzone(props) { {...getRootProps()} > - {errorMessage && ( diff --git a/frontend/src/components/FormItem.css b/frontend/src/components/FormItem.css index f2ddc3bd1e..73f211d96d 100644 --- a/frontend/src/components/FormItem.css +++ b/frontend/src/components/FormItem.css @@ -1,5 +1,3 @@ .smart-hub--form-required { - font-family: SourceSansPro; - font-size: 16px; color: #d42240; } diff --git a/frontend/src/components/FormItem.js b/frontend/src/components/FormItem.js index 7060e5b02b..70d6635de4 100644 --- a/frontend/src/components/FormItem.js +++ b/frontend/src/components/FormItem.js @@ -44,7 +44,7 @@ function FormItem({ const labelWithRequiredTag = ( <> {label} - {required && ( (Required))} + {required && ( (Required))} ); diff --git a/frontend/src/components/__tests__/FileUploader.js b/frontend/src/components/__tests__/FileUploader.js index 961714bb06..b47d4c9d16 100644 --- a/frontend/src/components/__tests__/FileUploader.js +++ b/frontend/src/components/__tests__/FileUploader.js @@ -33,7 +33,7 @@ describe('upload tests', () => { const mockSetErrorMessage = jest.fn(); it('can upload a file and return the correct information', async () => { const mockFileUpload = jest.spyOn(fileFetcher, 'uploadFile').mockImplementation(async () => ({ id: 1, url: 'url' })); - const got = await upload(mockFile, 1, 'fakeAttachment', mockSetErrorMessage); + const got = await upload(mockFile, 1, mockSetErrorMessage); expect(got).toStrictEqual({ id: 1, originalFileName: mockFile.name, fileSize: mockFile.size, status: 'UPLOADED', url: 'url', }); diff --git a/frontend/src/pages/ActivityReport/Pages/Review/Approver/Review.js b/frontend/src/pages/ActivityReport/Pages/Review/Approver/Review.js index 3ed908fc00..b741cd770a 100644 --- a/frontend/src/pages/ActivityReport/Pages/Review/Approver/Review.js +++ b/frontend/src/pages/ActivityReport/Pages/Review/Approver/Review.js @@ -38,7 +38,7 @@ const Review = ({

-
+