Skip to content
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

[Prod] Update README; Smartsheet integration prototype, updated side navigation #2198

Merged
merged 68 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c26d044
New side navigation
thewatermethod May 29, 2024
e642a99
Update readme.md
thewatermethod May 31, 2024
ec2162d
Smartsheet integration prototype
kryswisnaskas May 31, 2024
bbc7816
Fix lint errors
kryswisnaskas Jun 3, 2024
3ff1425
One more file
kryswisnaskas Jun 3, 2024
9dda83e
Frontend
kryswisnaskas Jun 3, 2024
92158c4
Merge remote-tracking branch origin/main into mb/TTAHUB-2396/side-nav
thewatermethod Jun 4, 2024
f7985b1
Fix lint errors (frontend)
kryswisnaskas Jun 4, 2024
444c630
More errors
kryswisnaskas Jun 4, 2024
bd3a867
Fix frontend test
kryswisnaskas Jun 4, 2024
83a4d64
Fix missing export
kryswisnaskas Jun 4, 2024
bdc5b7f
fix other tests
kryswisnaskas Jun 4, 2024
4ba8207
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2396/side-nav
thewatermethod Jun 4, 2024
5153a83
Deploy to dev
thewatermethod Jun 4, 2024
16a485c
Add local access
kryswisnaskas Jun 5, 2024
6c75f15
Fix parens
kryswisnaskas Jun 5, 2024
f6d3fa6
Deploy to sandbox
kryswisnaskas Jun 5, 2024
20458e3
Merge branch 'main' into kw-smartsheet
kryswisnaskas Jun 5, 2024
59aeb46
Save even without name
thewatermethod Jun 6, 2024
0bb5333
Update README.md
thewatermethod Jun 6, 2024
600d022
Merge remote-tracking branch 'origin/main' into mb/TTAHUB/documentati…
thewatermethod Jun 6, 2024
3b608a7
Update readme given programmaticTransaction additions
thewatermethod Jun 6, 2024
2d6f699
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2982/fix-re…
thewatermethod Jun 6, 2024
adda6ad
Merge pull request #2179 from HHS/mb/TTAHUB/documentation-updates
thewatermethod Jun 6, 2024
3e7a862
update goals review and tests
AdamAdHocTeam Jun 6, 2024
b01f923
fix tests
AdamAdHocTeam Jun 6, 2024
97c60ec
fix e2e test
AdamAdHocTeam Jun 6, 2024
45b6a50
test updates
AdamAdHocTeam Jun 6, 2024
932651c
see if this fixes it
AdamAdHocTeam Jun 6, 2024
8b44115
Debugging
kryswisnaskas Jun 6, 2024
bda3db1
Remove commented out t ests
kryswisnaskas Jun 6, 2024
3be4e10
Add SMARTSHEET_ENDPOINT to manifest
kryswisnaskas Jun 6, 2024
a20d9a0
e2e fun
AdamAdHocTeam Jun 7, 2024
b88c1b1
try another fix
AdamAdHocTeam Jun 7, 2024
943a7ea
passes locally
AdamAdHocTeam Jun 7, 2024
a73343e
fixes per Matt
AdamAdHocTeam Jun 7, 2024
767a63a
handle arrays of enums when creating timeseries
Jun 7, 2024
76e7a99
Re-add the tests.
kryswisnaskas Jun 7, 2024
1c3c02d
Remove accidental addition
kryswisnaskas Jun 7, 2024
e0703b1
Clear mocks
kryswisnaskas Jun 10, 2024
5ffc575
Remove extra space
kryswisnaskas Jun 10, 2024
b4df123
migration to remove unwanted objectives
AdamAdHocTeam Jun 10, 2024
dfe0efa
clean topics and resources others were empty
AdamAdHocTeam Jun 10, 2024
42c2f64
Merge branch 'main' into al-ttahub-2726-goals-and-objectives-review-r…
AdamAdHocTeam Jun 10, 2024
cf1ff88
push to sandbox
AdamAdHocTeam Jun 10, 2024
4607eef
Merge pull request #2183 from HHS/kw-smartsheet
kryswisnaskas Jun 10, 2024
9c34413
Bump pug from 3.0.2 to 3.0.3
dependabot[bot] Jun 10, 2024
7473b3c
Update known vulnerabilities
kryswisnaskas Jun 10, 2024
cf36dfe
Merge pull request #2197 from HHS/dependabot/npm_and_yarn/pug-3.0.3
dependabot[bot] Jun 10, 2024
8230547
updates per Garrett
AdamAdHocTeam Jun 10, 2024
5060031
Merge pull request #2195 from HHS/timeseries_enum_array_fix
GarrettEHill Jun 10, 2024
e45dd8e
updates per Garrett rnd 2
AdamAdHocTeam Jun 10, 2024
f9f3436
allow multi select for accordions on review and submit
AdamAdHocTeam Jun 10, 2024
fb46612
audit
AdamAdHocTeam Jun 10, 2024
3aaec8e
audit
AdamAdHocTeam Jun 10, 2024
7dab799
merge main
AdamAdHocTeam Jun 11, 2024
e991944
rollback audit to main
AdamAdHocTeam Jun 11, 2024
d85a1d4
braces
AdamAdHocTeam Jun 11, 2024
33e3b05
ignore no fix for hoek
AdamAdHocTeam Jun 11, 2024
71d831a
fe audit
AdamAdHocTeam Jun 11, 2024
28eaeb2
Merge pull request #2196 from HHS/al-ttahub-3057-remove-unwanted-obje…
AdamAdHocTeam Jun 11, 2024
a73f173
Merge pull request #2192 from HHS/mb/TTAHUB-2982/fix-remove-goal-save…
thewatermethod Jun 11, 2024
25f959d
pluck the audit fixes
thewatermethod Jun 11, 2024
b7a9648
Update known issues
thewatermethod Jun 11, 2024
48c0f18
Update known issues, backend
thewatermethod Jun 11, 2024
d6966e6
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-2396/side-nav
thewatermethod Jun 11, 2024
24b6f95
Merge pull request #2173 from HHS/mb/TTAHUB-2396/side-nav
thewatermethod Jun 11, 2024
27f6f97
Merge pull request #2194 from HHS/al-ttahub-2726-goals-and-objectives…
AdamAdHocTeam Jun 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ commands:
itams_md_password:
description: "password for itams monitoring data"
type: env_var_name
smartsheet_access_token:
description: "non-production smartsheet access token"
type: env_var_name
steps:
- run:
name: Login with service account
Expand Down Expand Up @@ -278,7 +281,8 @@ commands:
--var ITAMS_MD_HOST=${<< parameters.itams_md_host >>} \
--var ITAMS_MD_PORT=${<< parameters.itams_md_port >>} \
--var ITAMS_MD_USERNAME=${<< parameters.itams_md_username >>} \
--var ITAMS_MD_PASSWORD=${<< parameters.itams_md_password >>}
--var ITAMS_MD_PASSWORD=${<< parameters.itams_md_password >>} \
--var SMARTSHEET_ACCESS_TOKEN=${<< parameters.smartsheet_access_token >>}
# - run:
# name: Push maintenance application
# command: |
Expand Down Expand Up @@ -420,10 +424,10 @@ parameters:
type: string
dev_git_branch: # change to feature branch to test deployment
description: "Name of github branch that will deploy to dev"
default: "mb/TTAHUB-2943/remove-models"
default: "lr/ttahub-1521/display-regions-in-AR-header"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "al-ttahub-2942-fix-number-of-goals"
default: "al-ttahub-2726-goals-and-objectives-review-redesign"
type: string
prod_new_relic_app_id:
default: "877570491"
Expand Down Expand Up @@ -864,6 +868,7 @@ jobs:
itams_md_port: ITAMS_MD_PORT
itams_md_username: ITAMS_MD_USERNAME
itams_md_password: ITAMS_MD_PASSWORD
smartsheet_access_token: SMARTSHEET_ACCESS_TOKEN
- run:
name: Migrate database
command: |
Expand Down Expand Up @@ -917,6 +922,7 @@ jobs:
itams_md_port: ITAMS_MD_PORT
itams_md_username: ITAMS_MD_USERNAME
itams_md_password: ITAMS_MD_PASSWORD
smartsheet_access_token: SMARTSHEET_ACCESS_TOKEN
- run:
name: Migrate database
command: |
Expand Down Expand Up @@ -970,6 +976,7 @@ jobs:
itams_md_port: ITAMS_MD_PORT
itams_md_username: ITAMS_MD_USERNAME
itams_md_password: ITAMS_MD_PASSWORD
smartsheet_access_token: SMARTSHEET_ACCESS_TOKEN
- run:
name: Run database migrations
command: |
Expand Down Expand Up @@ -1021,6 +1028,7 @@ jobs:
itams_md_port: ITAMS_MD_PORT
itams_md_username: ITAMS_MD_USERNAME
itams_md_password: ITAMS_MD_PASSWORD
smartsheet_access_token: SMARTSHEET_ACCESS_TOKEN
- run:
name: Run database migrations
command: |
Expand Down
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,9 @@ ITAMS_MD_PORT=22
ITAMS_MD_USERNAME=tta_ro
ITAMS_MD_PASSWORD=password

# Smartsheet integration
SMARTSHEET_ACCESS_TOKEN=secrettoken
SMARTSHEET_ENDPOINT=https://api.smartsheetgov.com/2.0/
SMARTSHEET_LOCAL=false

SFTP_EXPOSED_PORT=2200
15 changes: 0 additions & 15 deletions .vscode/launch.json

This file was deleted.

17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,20 @@ git config core.hooksPath .githooks
If you are already using git hooks, add the .githooks/pre-commit contents to your hooks directory or current pre-commit hook. Remember to make the file executable.

### Building Tests

#### Helpful notes on writing (backend) tests
It's important that our tests fully clean up after themselves if they interact with the database. This way, tests do not conflict when run on the CI and remain as deterministic as possible.The best way to do this is to run them locally in an isolated environment and confirm that they are sanitary.

With that in mind, there a few "gotchas" to remember to help write sanitary tests.
- ```Grant.destroy``` needs to run with ```individualHooks: true``` or the related GrantNumberLink model prevents delete.
- When you call ```Model.destroy``` you should be adding ```individualHooks: true``` to the Sequelize options. Often this is required for proper cleanup. There may be times when this is undesirable; this should be indicated with a comment.
- Be aware of paranoid models. For those models: force: true gets around the soft delete. If they are already soft-deleted though, you need to remove the default scopes paranoid: true does it, as well as Model.unscoped()
- There are excellent helpers for creating and destroying common Model mocks in ```testUtils.js```. Be aware that they take a scorched earth approach to cleanup. For example, when debugging a flaky test, it was discovered that ```destroyReport``` was removing a commonly used region.
- The next section details additional tools, found in `src/lib/programmaticTransaction.ts`, which make maintaining a clean database state when writing tests a breeze.

#### Database State Management in Tests

The guidance on using the `captureSnapshot` and `rollbackToSnapshot` functions from `src/lib/programmaticTransaction.ts` to manage database state during automated testing with Jest. These functions ensure that each test is executed in a clean state, preventing tests from affecting each other and improving test reliability.
The guidance is on using the `captureSnapshot` and `rollbackToSnapshot` functions from `src/lib/programmaticTransaction.ts` to manage database state during automated testing with Jest. These functions ensure that each test is executed in a clean state, preventing tests from affecting each other and improving test reliability.

##### Functions Overview

Expand Down Expand Up @@ -168,6 +179,7 @@ On the frontend, the lcov and HTML files are generated as normal, however on the

Another important note for running tests on the backend - we specifically exclude files on the backend that follow the ```*CLI.js``` naming convention (for example, ```adminToolsCLI.js```) from test coverage. This is meant to exclude files intended to be run in the shell. Any functionality in theses files should be imported from a file that is tested. The ```src/tools folder``` is where these files have usually lived and there are lots of great examples of the desired pattern in that folder.


## Yarn Commands

| Docker Command | Description| Host Command | Local only Command |
Expand Down Expand Up @@ -477,6 +489,9 @@ Our project includes four deployed Postgres databases, one to interact with each
cf disallow-space-ssh ttahub-prod
```

### Taking a production backup via CircleCI
We can quickly take a production backup via the CircleCI web interface. To do so, go to the ```production``` branch there and trigger a pipeline with the variable ```manual-trigger``` set to true. You can then retrieve this backup with the script ```bin/latest_backup.sh```.

### Refreshing data in non-production environments

In order to keep the non-production environments as close to production as possible we developed a way to transform a restored
Expand Down
1 change: 1 addition & 0 deletions deployment_config/dev_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ CLAMAV_ENDPOINT: https://clamapi-ttahub-dev.apps.internal:9443
SEND_NOTIFICATIONS: "true"
SUPPRESS_ERROR_LOGGING: "false"
SIMILARITY_ENDPOINT: https://tta-similarity-api-dev.app.cloud.gov/compute
SMARTSHEET_ENDPOINT: https://api.smartsheetgov.com/2.0/
1 change: 1 addition & 0 deletions deployment_config/sandbox_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ CLAMAV_ENDPOINT: https://clamapi-ttahub-dev.apps.internal:9443
SEND_NOTIFICATIONS: "true"
SUPPRESS_ERROR_LOGGING: "false"
SIMILARITY_ENDPOINT: https://tta-similarity-api-sandbox.app.cloud.gov/compute
SMARTSHEET_ENDPOINT: https://api.smartsheetgov.com/2.0/
1 change: 1 addition & 0 deletions deployment_config/staging_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ CLAMAV_ENDPOINT: https://clamapi-ttahub-dev.apps.internal:9443
SEND_NOTIFICATIONS: "true"
SUPPRESS_ERROR_LOGGING: "false"
SIMILARITY_ENDPOINT: https://tta-similarity-api-staging.app.cloud.gov/compute
SMARTSHEET_ENDPOINT: https://api.smartsheetgov.com/2.0/
6 changes: 4 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@hookform/error-message": "^0.0.5",
"@silevis/reactgrid": "3.1",
"@react-hook/resize-observer": "^1.2.6",
"@trussworks/react-uswds": "4.1.1",
"@ttahub/common": "^2.1.3",
Expand Down Expand Up @@ -98,7 +99,8 @@
"webpack": "^5.76.1",
"yaml": "^2.2.2",
"semver": "^7.5.3",
"es5-ext": "^0.10.63"
"es5-ext": "^0.10.63",
"braces": "^3.0.3"
},
"eslintConfig": {
"root": true,
Expand Down Expand Up @@ -211,4 +213,4 @@
}
}
}
}
}
52 changes: 29 additions & 23 deletions frontend/src/components/Navigator/ActivityReportNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,27 @@ export function getPromptErrors(promptTitles, errors) {

export const formatEndDate = (formEndDate) => ((formEndDate && formEndDate.toLowerCase() !== 'invalid date') ? formEndDate : '');

export const packageGoals = (goals, goal, grantIds, prompts) => [
// we make sure to mark all the read only goals as "ActivelyEdited: false"
...goals.map((g) => ({
...g,
grantIds,
isActivelyBeingEditing: false,
prompts: grantIds.length < 2 ? g.prompts : [],
})),
{
...goal,
grantIds,
prompts: grantIds.length < 2 ? prompts : [],
},
];
export const packageGoals = (goals, goal, grantIds, prompts) => {
const packagedGoals = [
// we make sure to mark all the read only goals as "ActivelyEdited: false"
...goals.map((g) => ({
...g,
grantIds,
isActivelyBeingEditing: false,
prompts: grantIds.length < 2 ? g.prompts : [],
})),
];

if (goal && goal.name) {
packagedGoals.push({
...goal,
grantIds,
prompts: grantIds.length < 2 ? prompts : [],
});
}

return packagedGoals;
};

/**
* @summary checks to see if the tta provided field contains the cursor
Expand Down Expand Up @@ -364,15 +371,14 @@ const ActivityReportNavigator = ({
// save goal to api, come back with new ids for goal and objectives
try {
// we only need save goal if we have a goal name
if (name) {
allGoals = await saveGoalsForReport(
{
goals: allGoals,
activityReportId: reportId,
regionId: formData.regionId,
},
);
}

allGoals = await saveGoalsForReport(
{
goals: allGoals,
activityReportId: reportId,
regionId: formData.regionId,
},
);

/**
* If we are autosaving, and we are currently editing a rich text editor component, do not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,4 +551,58 @@ describe('packageGoals', () => {
},
]);
});
it('skips returning edited goal if edited goal is null', () => {
const grantIds = [1];
const packagedGoals = packageGoals(
[
{
name: 'goal name',
endDate: '09/01/2020',
prompts: [{ fieldName: 'prompt' }],
},
],
null,
grantIds,
[{ fieldName: 'prompt2' }],
);

expect(packagedGoals).toEqual([
{
name: 'goal name',
endDate: '09/01/2020',
prompts: [{ fieldName: 'prompt' }],
grantIds,
isActivelyBeingEditing: false,
},
]);
});
it('skips returning edited goal if edited goal has no name', () => {
const grantIds = [1];
const packagedGoals = packageGoals(
[
{
name: 'goal name',
endDate: '09/01/2020',
prompts: [{ fieldName: 'prompt' }],
},
],
{
name: '',
endDate: '',
isActivelyBeingEditing: true,
},
grantIds,
[{ fieldName: 'prompt2' }],
);

expect(packagedGoals).toEqual([
{
name: 'goal name',
endDate: '09/01/2020',
prompts: [{ fieldName: 'prompt' }],
grantIds,
isActivelyBeingEditing: false,
},
]);
});
});
29 changes: 26 additions & 3 deletions frontend/src/components/SiteNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React, { useState, useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import { NavLink as Link, withRouter } from 'react-router-dom';
import SiteNavDisclosureGroup from './SiteNavDisclosureGroup';
import './SiteNav.scss';
import FeatureFlag from './FeatureFlag';

Expand All @@ -21,11 +22,24 @@ const navLinkClasses = [
].join(' ');

const activeNavLinkClasses = 'border-left-05 border-white text-bold';
const disclosureActiveLinkClasses = 'text-bold';

const NavLink = (props) => (
<Link activeClassName={activeNavLinkClasses} className={navLinkClasses} {...props} />
const NavLink = ({ withinDisclosure, ...props }) => (
<Link
activeClassName={withinDisclosure ? disclosureActiveLinkClasses : activeNavLinkClasses}
className={navLinkClasses}
{...props}
/>
);

NavLink.propTypes = {
withinDisclosure: PropTypes.bool,
};

NavLink.defaultProps = {
withinDisclosure: false,
};

const SiteNav = ({
authenticated,
user,
Expand Down Expand Up @@ -81,23 +95,28 @@ const SiteNav = ({
</div>
<nav className="display-flex flex-column flex-justify flex-1" aria-label="main navigation">
<div className="width-full margin-bottom-2 margin-top-2 desktop:margin-top-6">
<ul className="add-list-reset">
<SiteNavDisclosureGroup title="TTA Reporting">
<li>
<NavLink
withinDisclosure
to="/activity-reports"
>
Activity Reports
</NavLink>
</li>
<li>
<NavLink
withinDisclosure
to="/training-reports/not-started"
>
Training Reports
</NavLink>
</li>
</SiteNavDisclosureGroup>
<SiteNavDisclosureGroup title="Dashboards">
<li>
<NavLink
withinDisclosure
to="/dashboards/regional-dashboard/activity-reports"
>
Regional Dashboard
Expand All @@ -106,6 +125,7 @@ const SiteNav = ({
<FeatureFlag flag="regional_goal_dashboard">
<li>
<NavLink
withinDisclosure
to="/regional-goal-dashboard"
>
Regional Goal Dashboard
Expand All @@ -114,6 +134,7 @@ const SiteNav = ({
</FeatureFlag>
<li>
<NavLink
withinDisclosure
to="/dashboards/resources-dashboard"
>
Resource Dashboard
Expand All @@ -128,6 +149,8 @@ const SiteNav = ({
</NavLink>
</li>
</FeatureFlag>
</SiteNavDisclosureGroup>
<ul className="add-list-reset">
<li>
<NavLink
to="/recipient-tta-records"
Expand Down
Loading