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

Show tta overview widget to admins only #494

Merged
merged 9 commits into from
Jul 8, 2021
16 changes: 16 additions & 0 deletions frontend/src/pages/Landing/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ describe('Landing Page sorting', () => {
scopeId: 3,
regionId: 1,
},
{
scopeId: 2,
regionId: 1,
},
],
};

Expand Down Expand Up @@ -474,6 +478,10 @@ describe('Landing page table menus & selections', () => {
scopeId: 3,
regionId: 1,
},
{
scopeId: 2,
regionId: 1,
},
],
};

Expand Down Expand Up @@ -682,6 +690,10 @@ describe('Landing page table menus & selections', () => {
scopeId: 3,
regionId: 1,
},
{
scopeId: 2,
regionId: 1,
},
],
};

Expand Down Expand Up @@ -743,6 +755,10 @@ describe('My alerts sorting', () => {
scopeId: 3,
regionId: 1,
},
{
scopeId: 2,
regionId: 1,
},
],
};

Expand Down
6 changes: 4 additions & 2 deletions frontend/src/pages/Landing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import 'uswds/dist/css/uswds.css';
import '@trussworks/react-uswds/lib/index.css';
import './index.css';
import MyAlerts from './MyAlerts';
import { hasReadWrite, allRegionsUserHasPermissionTo } from '../../permissions';
import isAdmin, { hasReadWrite, allRegionsUserHasPermissionTo } from '../../permissions';
import { REPORTS_PER_PAGE, ALERTS_PER_PAGE } from '../../Constants';
import Filter, { filtersToQueryString } from './Filter';
import ReportMenu from './ReportMenu';
Expand Down Expand Up @@ -493,7 +493,7 @@ function Landing() {
<h1 className="landing">Activity Reports</h1>
</Grid>
<Grid col={2} className="flex-align-self-center">
{getUserRegions(user).length > 1
{isAdmin(user) && getUserRegions(user).length > 1
&& (
<RegionalSelect
regions={allRegionsUserHasPermissionTo(user)}
Expand All @@ -509,12 +509,14 @@ function Landing() {
</Grid>
<Grid row gap className="smart-hub--overview">
<Grid col={10}>
{isAdmin(user) && (
<Overview
filters={filters}
region={appliedRegion}
allRegions={getUserRegions(user)}
skipLoading
/>
)}
</Grid>
</Grid>
<Grid row>
Expand Down