File tree Expand file tree Collapse file tree 3 files changed +38
-29
lines changed
Expand file tree Collapse file tree 3 files changed +38
-29
lines changed Original file line number Diff line number Diff line change 77 accountStatusIsApproved ,
88 accountIsInReview ,
99 accountCanViewAdmin ,
10- accountCanViewPlg ,
10+ accountCanViewGrafana ,
11+ accountCanViewAlerts ,
1112} from '../../selectors/auth'
1213
1314import NavItem from '../NavItem/NavItem'
@@ -30,7 +31,8 @@ function Header() {
3031 const userAccessRequestPending = useSelector ( accountIsInReview )
3132 const userAccessRequestApproved = useSelector ( accountStatusIsApproved )
3233 const userIsAdmin = useSelector ( accountCanViewAdmin )
33- const userViewPlg = useSelector ( accountCanViewPlg )
34+ const userViewGrafana = useSelector ( accountCanViewGrafana )
35+ const userViewAlerts = useSelector ( accountCanViewAlerts )
3436
3537 const menuRef = useRef ( )
3638
@@ -153,19 +155,19 @@ function Header() {
153155 href = { `${ process . env . REACT_APP_BACKEND_HOST } /admin/` }
154156 />
155157 ) }
156- { userViewPlg && (
157- < >
158- < NavItem
159- pathname = { pathname }
160- tabTitle = "Grafana"
161- href = { ` ${ process . env . REACT_APP_BACKEND_HOST } /grafana/` }
162- />
163- < NavItem
164- pathname = { pathname }
165- tabTitle = "Alerts"
166- href = { ` ${ process . env . REACT_APP_BACKEND_HOST } /alerts/` }
167- />
168- < />
158+ { userViewGrafana && (
159+ < NavItem
160+ pathname = { pathname }
161+ tabTitle = "Grafana"
162+ href = { ` ${ process . env . REACT_APP_BACKEND_HOST } /grafana/` }
163+ />
164+ ) }
165+ { userViewAlerts && (
166+ < NavItem
167+ pathname = { pathname }
168+ tabTitle = "Alerts"
169+ href = { ` ${ process . env . REACT_APP_BACKEND_HOST } /alerts/` }
170+ />
169171 ) }
170172 </ >
171173 ) }
Original file line number Diff line number Diff line change @@ -3,14 +3,16 @@ import { useSelector } from 'react-redux'
33import {
44 accountStatusIsApproved ,
55 accountCanViewAdmin ,
6- accountCanViewPlg ,
76 selectUserPermissions ,
7+ accountCanViewGrafana ,
8+ accountCanViewAlerts ,
89} from '../../selectors/auth'
910
1011const SiteMap = ( { user } ) => {
1112 const userIsApproved = useSelector ( accountStatusIsApproved )
1213 const userIsAdmin = useSelector ( accountCanViewAdmin )
13- const userViewPlg = useSelector ( accountCanViewPlg )
14+ const userViewGrafana = useSelector ( accountCanViewGrafana )
15+ const userViewAlerts = useSelector ( accountCanViewAlerts )
1416
1517 const permissions = useSelector ( selectUserPermissions )
1618 const userHasFra = userIsApproved && permissions . includes ( 'has_fra_access' )
@@ -43,17 +45,18 @@ const SiteMap = ({ user }) => {
4345 />
4446 ) }
4547
46- { userViewPlg && (
47- < >
48- < SiteMap . Link
49- text = "Grafana"
50- link = { `${ process . env . REACT_APP_BACKEND_HOST } /grafana/` }
51- />
52- < SiteMap . Link
53- text = "Alerts"
54- link = { `${ process . env . REACT_APP_BACKEND_HOST } /alerts/` }
55- />
56- </ >
48+ { userViewGrafana && (
49+ < SiteMap . Link
50+ text = "Grafana"
51+ link = { `${ process . env . REACT_APP_BACKEND_HOST } /grafana/` }
52+ />
53+ ) }
54+
55+ { userViewAlerts && (
56+ < SiteMap . Link
57+ text = "Alerts"
58+ link = { `${ process . env . REACT_APP_BACKEND_HOST } /alerts/` }
59+ />
5760 ) }
5861 </ div >
5962 )
Original file line number Diff line number Diff line change @@ -72,12 +72,16 @@ export const accountCanViewAdmin = (state) =>
7272 'System Owner' ,
7373 ] . includes ( selectPrimaryUserRole ( state ) ?. name )
7474
75- export const accountCanViewPlg = ( state ) =>
75+ export const accountCanViewGrafana = ( state ) =>
7676 accountStatusIsApproved ( state ) &&
7777 [ 'OFA System Admin' , 'Developer' , 'DIGIT Team' ] . includes (
7878 selectPrimaryUserRole ( state ) ?. name
7979 )
8080
81+ export const accountCanViewAlerts = ( state ) =>
82+ accountStatusIsApproved ( state ) &&
83+ [ 'OFA System Admin' , 'Developer' ] . includes ( selectPrimaryUserRole ( state ) ?. name )
84+
8185export const accountIsRegionalStaff = ( state ) =>
8286 accountStatusIsApproved ( state ) &&
8387 selectPrimaryUserRole ( state ) ?. name === 'OFA Regional Staff'
You can’t perform that action at this time.
0 commit comments