forked from HHS/TANF-app
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3398 - FRA Reports - search and upload #3445
Open
jtimpe
wants to merge
63
commits into
develop
Choose a base branch
from
3398-fra-frontend
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 58 commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
bca4311
boilerplate + nav (with wrong permissions)
jtimpe 96b469b
search form components + state
jtimpe c8ad478
search + upload form components
jtimpe 7996526
redux, frontend api setup for fra reports
jtimpe 7025dab
add error modal
jtimpe bfd1dc1
fix sttList and class names
jtimpe c6694b0
fix vars
jtimpe 71e1e6e
reorg + fix unreferenced var
jtimpe 8c36164
search form tests
jtimpe e25ca72
temp comment two tests
jtimpe dedee58
fix aria
jtimpe e2eb9ac
Merge branch 'develop' into 3398-fra-frontend
jtimpe 902ca31
fix test
jtimpe f2f42d6
fix tests and stub future work
jtimpe dc4b650
add extra test cov
jtimpe ba40b4e
Merge branch 'develop' into 3398-fra-frontend
jtimpe a8e4672
Merge branch 'develop' into 3398-fra-frontend
jtimpe 37f8a4a
implement upload api
jtimpe 691d413
handle upload errors and no file selected
jtimpe 9dfad44
fix test
jtimpe 16da0a2
update errors count on input change
jtimpe 556d89f
fix test
jtimpe 5254494
Merge branch 'develop' into 3398-fra-frontend
jtimpe 5816e4f
create + implement reusable form input components
jtimpe 1d347f9
implement conditional classNames
jtimpe cd9f375
remove comments and console.logs
jtimpe 40e5f0a
Merge branch 'develop' into 3398-fra-frontend
jtimpe b808d26
unused import
jtimpe 91ce6f3
additional tests
jtimpe 72e90a5
implement fra reports feature flag
jtimpe 97271f6
implement file encoding check
jtimpe 641f999
return
jtimpe 0b0be2f
show message on no file selected
jtimpe 16fc35d
clear alert on search
jtimpe 6b3a133
add backend feat flag check
jtimpe 84dd282
fix tests
jtimpe fe16f4e
fix test
jtimpe c4eb8e4
change page title
jtimpe b46b1f6
change Data Files -> TANF Data Files
jtimpe 60998a7
Merge branch 'develop' into 3398-fra-frontend
jtimpe e538493
fix tests
jtimpe 0398d05
disable other report types
jtimpe 6862582
add report description
jtimpe a71d996
fix tests
jtimpe d6db5ff
add cov
jtimpe 903134a
for -> of
jtimpe 7f8d4b2
test
jtimpe 39e8488
focus header
jtimpe 2795258
add cov
jtimpe cf82ab6
change allowed extensions
jtimpe 630cc1e
lint
jtimpe bedb71d
fix file encoding
jtimpe 8d81d34
test
jtimpe 81c5130
tests
jtimpe 247a477
code style
jtimpe becad93
Merge branch 'develop' into 3398-fra-frontend
jtimpe 7ba7424
conflicting migrations
jtimpe ab11234
comment unused
jtimpe f03c57e
update mock csv data file
jtimpe e0fd2d4
missed links
jtimpe 087d536
add required field indicator
jtimpe 1880977
Merge branch 'develop' into 3398-fra-frontend
jtimpe 2fab63c
update fiscal quarter explainers
jtimpe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tdrs-backend/tdpservice/data_files/migrations/0018_alter_datafile_section.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.2.15 on 2025-02-11 22:04 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('data_files', '0017_alter_datafile_section'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='datafile', | ||
name='section', | ||
field=models.CharField(choices=[('Tribal Closed Case Data', 'Tribal Closed Case Data'), ('Tribal Active Case Data', 'Tribal Active Case Data'), ('Tribal Aggregate Data', 'Tribal Aggregate Data'), ('Tribal Stratum Data', 'Tribal Stratum Data'), ('SSP Aggregate Data', 'Ssp Aggregate Data'), ('SSP Closed Case Data', 'Ssp Closed Case Data'), ('SSP Active Case Data', 'Ssp Active Case Data'), ('SSP Stratum Data', 'Ssp Stratum Data'), ('Active Case Data', 'Active Case Data'), ('Closed Case Data', 'Closed Case Data'), ('Aggregate Data', 'Aggregate Data'), ('Stratum Data', 'Stratum Data'), ('Work Outcomes of TANF Exiters', 'Fra Work Outcome Tanf Exiters'), ('Secondary School Attainment', 'Fra Secondry School Attainment'), ('Supplemental Work Outcomes', 'Fra Supplement Work Outcomes')], max_length=32), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tdrs-backend/tdpservice/users/migrations/0044_alter_user_feature_flags.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.2.15 on 2025-02-11 13:40 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0043_create_regions_m2m_del_region'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='user', | ||
name='feature_flags', | ||
field=models.JSONField(blank=True, default=dict, help_text='Feature flags for this user. This is a JSON field that can be used to store key-value pairs. E.g: {"fra_reports": true}'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i accidentally changed the feature flag from |
||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import { v4 as uuidv4 } from 'uuid' | ||
import axios from 'axios' | ||
import axiosInstance from '../axios-instance' | ||
import { objectToUrlParams } from '../utils/stringUtils' | ||
|
||
const BACKEND_URL = process.env.REACT_APP_BACKEND_URL | ||
|
||
export const SET_IS_LOADING_SUBMISSION_HISTORY = | ||
'SET_IS_LOADING_SUBMISSION_HISTORY' | ||
export const SET_FRA_SUBMISSION_HISTORY = 'SET_FRA_SUBMISSION_HISTORY' | ||
export const SET_IS_UPLOADING_FRA_REPORT = 'SET_IS_UPLOADING_FRA_REPORT' | ||
|
||
export const getFraSubmissionHistory = | ||
( | ||
{ stt, reportType, fiscalQuarter, fiscalYear }, | ||
onSuccess = () => null, | ||
onError = () => null | ||
) => | ||
async (dispatch) => { | ||
dispatch({ | ||
type: SET_IS_LOADING_SUBMISSION_HISTORY, | ||
payload: { isLoadingSubmissionHistory: true }, | ||
}) | ||
|
||
try { | ||
const requestParams = { | ||
stt: stt.id, | ||
file_type: reportType, | ||
year: fiscalYear, | ||
quarter: fiscalQuarter, | ||
} | ||
|
||
const response = await axios.get( | ||
`${BACKEND_URL}/data_files/?${objectToUrlParams(requestParams)}`, | ||
{ | ||
responseType: 'json', | ||
} | ||
) | ||
|
||
dispatch({ | ||
type: SET_FRA_SUBMISSION_HISTORY, | ||
payload: { submissionHistory: response?.data }, | ||
}) | ||
|
||
onSuccess() | ||
} catch (error) { | ||
onError(error) | ||
} finally { | ||
dispatch({ | ||
type: SET_IS_LOADING_SUBMISSION_HISTORY, | ||
payload: { isLoadingSubmissionHistory: false }, | ||
}) | ||
} | ||
} | ||
|
||
export const uploadFraReport = | ||
( | ||
{ stt, reportType, fiscalQuarter, fiscalYear, file, user }, | ||
onSuccess = () => null, | ||
onError = () => null | ||
) => | ||
async (dispatch) => { | ||
dispatch({ | ||
type: SET_IS_UPLOADING_FRA_REPORT, | ||
payload: { isUploadingFraReport: true }, | ||
}) | ||
|
||
const formData = new FormData() | ||
const fraReportData = { | ||
file: file, | ||
original_filename: file.name, | ||
slug: uuidv4(), | ||
user: user.id, | ||
section: reportType, | ||
year: fiscalYear, | ||
stt: stt.id, | ||
quarter: fiscalQuarter, | ||
ssp: false, | ||
} | ||
for (const [key, value] of Object.entries(fraReportData)) { | ||
formData.append(key, value) | ||
} | ||
|
||
try { | ||
const response = await axiosInstance.post( | ||
`${process.env.REACT_APP_BACKEND_URL}/data_files/`, | ||
formData, | ||
{ | ||
headers: { 'Content-Type': 'multipart/form-data' }, | ||
withCredentials: true, | ||
} | ||
) | ||
|
||
// dispatch( | ||
// getFraSubmissionHistory({ | ||
// stt, | ||
// reportType, | ||
// fiscalQuarter, | ||
// fiscalYear, | ||
// }) | ||
// ) | ||
// or, dispatch the state update if response from upload can contain updated submission history | ||
onSuccess() | ||
} catch (error) { | ||
onError(error) | ||
} finally { | ||
dispatch({ | ||
type: SET_IS_UPLOADING_FRA_REPORT, | ||
payload: { isUploadingFraReport: false }, | ||
}) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be "csv"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, should the section and group be different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated! good catch