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

Add secureProxy option to the cookie session #294

Merged
merged 52 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
cedfeb0
Landing page checkpoint commit
kryswisnaskas Jan 27, 2021
a716599
Added sorting
kryswisnaskas Jan 29, 2021
a2bd6c0
Merge branch 'main' of https://github.com/adhocteam/Head-Start-TTADP …
kryswisnaskas Jan 30, 2021
69ccf13
Merge branch 'main' of https://github.com/adhocteam/Head-Start-TTADP …
kryswisnaskas Feb 3, 2021
75f7639
Added tests, empty report
kryswisnaskas Feb 5, 2021
6431825
Correct merge error
kryswisnaskas Feb 5, 2021
6de8f8e
Fix merge issue
kryswisnaskas Feb 5, 2021
67566d3
Fix lint errors
kryswisnaskas Feb 5, 2021
4b6a542
Remove unused module
kryswisnaskas Feb 5, 2021
7d9805f
Merge branch 'main' of https://github.com/adhocteam/Head-Start-TTADP …
kryswisnaskas Feb 5, 2021
95b3a38
Fix merge conflict
kryswisnaskas Feb 5, 2021
04bba1c
Fix lint errors
kryswisnaskas Feb 5, 2021
e4dae31
Added more tests
kryswisnaskas Feb 8, 2021
158b2cd
Fix lint errors
kryswisnaskas Feb 9, 2021
a99fe60
Merge branch 'main' into kw-display-reports
kryswisnaskas Feb 9, 2021
664b52f
Merge branch 'js-282-fix-cucumber-tests' of https://github.com/adhoct…
kryswisnaskas Feb 9, 2021
0561da4
Merge branch 'kw-display-reports' of https://github.com/adhocteam/Hea…
kryswisnaskas Feb 9, 2021
a21b9d2
Modified cucumber test
kryswisnaskas Feb 9, 2021
f106cc2
Modified cucumber test
kryswisnaskas Feb 9, 2021
55c78db
Fix cucumber test
kryswisnaskas Feb 9, 2021
809a57b
Update open api doc
kryswisnaskas Feb 9, 2021
4b8a95d
Add role acronyms to display
kryswisnaskas Feb 9, 2021
e4e51ec
Fix new eslint errors
kryswisnaskas Feb 9, 2021
23cf654
Fix new eslint errors
kryswisnaskas Feb 9, 2021
253e568
Combine values from multiples
kryswisnaskas Feb 9, 2021
4af7bd8
Remove whitespace to satisfy eslint
kryswisnaskas Feb 9, 2021
c3b37b4
Adjust test
kryswisnaskas Feb 9, 2021
1da28b0
Merge branch 'main' of https://github.com/adhocteam/Head-Start-TTADP …
kryswisnaskas Feb 10, 2021
ff3b8b5
Remove sorting
kryswisnaskas Feb 10, 2021
6c5e287
Remove blank lines
kryswisnaskas Feb 10, 2021
3d4b1ac
Merge branch 'main' of https://github.com/adhocteam/Head-Start-TTADP …
kryswisnaskas Feb 10, 2021
3d8382b
Fix merge issue
kryswisnaskas Feb 10, 2021
8751dcf
Merge branch 'main' into kw-display-reports
kryswisnaskas Feb 10, 2021
fa3f81e
Add explicit cookie session options
kryswisnaskas Feb 10, 2021
1b1ce8c
Added scrollbars; removed test; modified styles
kryswisnaskas Feb 12, 2021
cdc95f1
Merge branch 'kw-display-reports' of https://github.com/adhocteam/Hea…
kryswisnaskas Feb 12, 2021
112ccd6
Update yarn.lock
kryswisnaskas Feb 12, 2021
f3881d1
Fix lint errors
kryswisnaskas Feb 12, 2021
c1f7ba4
Merge branch 'main' into kw-display-reports
kryswisnaskas Feb 12, 2021
9189f61
Merge branch 'main' into kw-display-reports
rahearn Feb 12, 2021
6740fd5
Merge branch 'main' into kw-secure-cookie
kryswisnaskas Feb 12, 2021
4ba76a9
Remove one of secure cookie settings
kryswisnaskas Feb 12, 2021
61cb04e
Merge branch 'kw-secure-cookie' of https://github.com/adhocteam/Head-…
kryswisnaskas Feb 12, 2021
55a2a37
Merge pull request #163 from adhocteam/kw-secure-cookie
kryswisnaskas Feb 12, 2021
c0394f1
Merge branch 'main' into kw-display-reports
kryswisnaskas Feb 12, 2021
5896310
Merge pull request #150 from adhocteam/kw-display-reports
kryswisnaskas Feb 12, 2021
027759a
Try limiting workers for frontend tests
Feb 15, 2021
2524544
Merge pull request #168 from adhocteam/cm-limit-workers-for-frontend-…
dcmcand Feb 15, 2021
8eb824d
Extend yarn commands and add resources for backend
Feb 16, 2021
5d53681
Merge pull request #172 from adhocteam/new-cmds-and-info
gopar Feb 16, 2021
eda8c73
Make secureProxy setting conditional
kryswisnaskas Feb 16, 2021
6f2a3f4
Merge pull request #174 from adhocteam/conditional-setting
kryswisnaskas Feb 16, 2021
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:
./run-yarn-audit.sh;
- run:
name: Test frontend
command: yarn --cwd frontend run test:ci
command: yarn --cwd frontend run test:ci --maxWorkers=50%
- store_test_results:
path: frontend/reports/
- store_artifacts:
Expand Down
2 changes: 1 addition & 1 deletion cucumber/features/activityReport.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: TTA Smarthub Activity Report
Scenario: Report can be filled out
Given I am logged in
And I am on the activity reports page
And I am on the landing page
Then I see "New activity report for Region 14" message
When I select "Non-Grantee"
Then I see "QRIS System" as an option in the "Non-grantee name(s)" multiselect
11 changes: 9 additions & 2 deletions cucumber/features/steps/activityReportSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ const {
const assertTrue = require('assert');
const scope = require('../support/scope');

Given('I am on the activity reports page', async () => {
Given('I am on the landing page', async () => {
const page = scope.context.currentPage;
const selector = 'a[href$="activity-reports/new"]';
const selector = 'a[href$="activity-reports"]';
await Promise.all([
page.waitForNavigation(),
page.click(selector),
]);
await scope.context.currentPage.waitForSelector('h1');

const selectorNewReport = 'a[href$="activity-reports/new"]';
await Promise.all([
page.waitForNavigation(),
page.click(selectorNewReport),
]);
await scope.context.currentPage.waitForSelector('h1');
});

When('I select {string}', async (inputLabel) => {
Expand Down
4 changes: 2 additions & 2 deletions cucumber/features/steps/homePageSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Given('I am logged in', async () => {

const loginLinkSelector = 'a[href$="api/login"]';
// const homeLinkSelector = 'a[href$="/"]';
const activityReportsSelector = 'a[href$="activity-reports/new"]';
const activityReportsSelector = 'a[href$="activity-reports"]';

await page.goto(scope.uri);
await page.waitForSelector('em'); // Page title
Expand Down Expand Up @@ -52,7 +52,7 @@ Then('I see {string} message', async (string) => {

Then('I see {string} link', async (string) => {
const page = scope.context.currentPage;
const selector = 'a[href$="activity-reports/new"]';
const selector = 'a[href$="activity-reports"]';

await page.waitForSelector(selector);
const value = await page.$eval(selector, (el) => el.textContent);
Expand Down
34 changes: 34 additions & 0 deletions docs/openapi/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,40 @@ components:
description: The type of the activity, Training or Technical Assistance (or both)
items:
type: string
shortActivityReport:
type: object
description: >
This object represents a shorter version of a report on an activity that a specialist has completed
with 1 to many grants or non-grantees
properties:
id:
type: number
regionId:
type: number
description: Home region id of the activity report user
startDate:
type: string
lastSaved:
type: string
topics:
type: array
description: Topics covered during the TTA
items:
type: string
activityRecipients:
type: array
description: Activity recipients - grantees or non-grantees
items:
type: object
collaborators:
type: array
description: Collaborating user names
items:
type: object
status:
type: string
enum: ['approved', 'draft', 'submitted']
description: The current state of the report
selectableUser:
type: object
description: >
Expand Down
12 changes: 12 additions & 0 deletions docs/openapi/paths/activity-reports/activity-reports.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
get:
tags:
- activity-reports
description: Gets activity reports from the database.
responses:
200:
description: Successfully retrieved activity reports
content:
application/json:
schema:
type: object
$ref: '../../index.yaml#/components/schemas/shortActivityReport'
post:
tags:
- activity-reports
Expand Down
2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"react-select": "^3.1.0",
"react-stickynode": "^3.0.4",
"react-with-direction": "^1.3.1",
"simplebar": "^5.3.0",
"simplebar-react": "^2.3.0",
"url-join": "^4.0.1",
"use-deep-compare-effect": "^1.6.1",
"uswds": "^2.9.0"
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
top: 0;
z-index: -1;
left: 0;
width: 100%;
height: 345px;
width: 200px;
height: 100%;
content: "";
background-color: #264a64;
}
Expand Down Expand Up @@ -38,3 +38,4 @@ body {
.SingleDatePickerInput__disabled {
opacity: 0.7;
}

58 changes: 37 additions & 21 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'uswds/dist/css/uswds.css';
import '@trussworks/react-uswds/lib/index.css';

import { BrowserRouter, Route, Switch } from 'react-router-dom';
import { GridContainer } from '@trussworks/react-uswds';
import { Helmet } from 'react-helmet';

import { fetchUser, fetchLogout } from './fetchers/Auth';
Expand All @@ -15,11 +14,14 @@ import Admin from './pages/Admin';
import Unauthenticated from './pages/Unauthenticated';
import NotFound from './pages/NotFound';
import Home from './pages/Home';
import Landing from './pages/Landing';
import ActivityReport from './pages/ActivityReport';
import isAdmin from './permissions';
import 'react-dates/initialize';
import 'react-dates/lib/css/_datepicker.css';
import './App.css';
import MainLayout from './components/MainLayout';
import LandingLayout from './components/LandingLayout';

function App() {
const [user, updateUser] = useState();
Expand Down Expand Up @@ -58,6 +60,7 @@ function App() {
}

const admin = isAdmin(user);

const renderAuthenticatedRoutes = () => (
<div role="main" id="main-content">
<IdleModal
Expand All @@ -66,33 +69,42 @@ function App() {
logoutUser={logout}
/>
<Switch>
<Route
exact
path="/activity-reports"
render={({ match }) => (
<LandingLayout><Landing match={match} /></LandingLayout>
)}
/>

<Route
exact
path="/"
render={() => (
<Home />
<MainLayout><Home /></MainLayout>
)}
/>

<Route
path="/activity-reports/:activityReportId/:currentPage?"
render={({ match, location }) => (
<ActivityReport location={location} match={match} user={user} />
)}
/>
{admin
&& (
<Route
path="/admin/:userId?"
render={({ match }) => (
<Admin match={match} />
<MainLayout>
<ActivityReport location={location} match={match} user={user} />
</MainLayout>
)}
/>

{admin && (
<Route
path="/admin/:userId?"
render={({ match }) => <MainLayout><Admin match={match} /></MainLayout>}
/>
)}

<Route
render={() => (
<NotFound />
)}
render={() => <MainLayout><NotFound /></MainLayout>}
/>

</Switch>
</div>
);
Expand All @@ -103,17 +115,21 @@ function App() {
<meta charSet="utf-8" />
</Helmet>
<BrowserRouter>
{authenticated && <a className="usa-skipnav" href="#main-content">Skip to main content</a>}
{authenticated && (
<a className="usa-skipnav" href="#main-content">
Skip to main content
</a>
)}
<UserContext.Provider value={{ user, authenticated, logout }}>
<Header authenticated={authenticated} admin={admin} />
<div className="background-stripe" />
<section className="usa-section">
<GridContainer>
{!authenticated
&& <Unauthenticated loggedOut={loggedOut} timedOut={timedOut} />}
{authenticated
&& renderAuthenticatedRoutes()}
</GridContainer>

{!authenticated && (
<Unauthenticated loggedOut={loggedOut} timedOut={timedOut} />
)}
{authenticated && renderAuthenticatedRoutes()}

</section>
</UserContext.Provider>
</BrowserRouter>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Header({ authenticated, admin }) {
<NavLink exact to="/">
Home
</NavLink>,
<NavLink to="/activity-reports/new">
<NavLink to="/activity-reports">
Activity Reports
</NavLink>,
];
Expand Down
17 changes: 17 additions & 0 deletions frontend/src/components/LandingLayout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Grid } from '@trussworks/react-uswds';

function LandingLayout({ children }) {
return (
<Grid row>
<Grid tablet={{ col: true }} className="smart-hub--fit-content">{children}</Grid>
</Grid>
);
}

LandingLayout.propTypes = {
children: PropTypes.node.isRequired,
};

export default LandingLayout;
17 changes: 17 additions & 0 deletions frontend/src/components/MainLayout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import { GridContainer } from '@trussworks/react-uswds';

function MainLayout({ children }) {
return (
<GridContainer>
{children}
</GridContainer>
);
}

MainLayout.propTypes = {
children: PropTypes.node.isRequired,
};

export default MainLayout;
5 changes: 5 additions & 0 deletions frontend/src/fetchers/activityReports.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export const getReport = async (reportId) => {
return report.json();
};

export const getReports = async () => {
const reports = await get(activityReportUrl);
return reports.json();
};

export const getRecipients = async () => {
const recipients = await get(join(activityReportUrl, 'activity-recipients'));
return recipients.json();
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/pages/ActivityReport/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
font-style: normal;
line-height: normal;
letter-spacing: normal;
color: #ffffff;
margin-bottom: 40px;
margin-top: 40px;
}

.smart-hub--form-section {
Expand Down Expand Up @@ -66,4 +64,4 @@
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
}
}
Loading