Skip to content

Commit 0f5be32

Browse files
authored
Merge pull request #561 from cisagov/543-refactor-of-saved-search-accordion
543 Refactor of Saved Search Accordion
2 parents 75c1c25 + acc8b75 commit 0f5be32

13 files changed

+470
-366
lines changed

frontend/src/App.tsx

Lines changed: 178 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { RSCLogin } from 'components/ReadySetCyber/RSCLogin';
4242
import { RSCAuthLoginCreate } from 'components/ReadySetCyber/RSCAuthLoginCreate';
4343
import { RiskWithSearch } from 'pages/Risk/Risk';
4444
import { StaticsContextProvider } from 'context/StaticsContextProvider';
45+
import { SavedSearchContextProvider } from 'context/SavedSearchContextProvider';
4546

4647
API.configure({
4748
endpoints: [
@@ -94,140 +95,183 @@ const App: React.FC = () => (
9495
<AuthContextProvider>
9596
<Authenticator.Provider>
9697
<StaticsContextProvider>
97-
<SearchProvider>
98-
<LayoutWithSearch>
99-
<LinkTracker />
100-
<Switch>
101-
<RouteGuard
102-
exact
103-
path="/"
104-
render={() => <Redirect to="/inventory" />}
105-
unauth={AuthLogin}
106-
component={RiskWithSearch}
107-
/>
108-
<Route
109-
exact
110-
path="/login-gov-callback"
111-
component={LoginGovCallback}
112-
/>
113-
<Route
114-
exact
115-
path="/okta-callback"
116-
component={OktaCallback}
117-
/>
118-
<Route
119-
exact
120-
path="/create-account"
121-
component={AuthCreateAccount}
122-
/>
123-
<Route exact path="/terms" component={TermsOfUse} />
124-
<RouteGuard
125-
exact
126-
path="/inventory"
127-
component={SearchPage}
128-
permissions={['globalView', 'regionalAdmin', 'standard']}
129-
/>
130-
<RouteGuard
131-
path="/inventory/domain/:domainId"
132-
component={Domain}
133-
permissions={['globalView', 'regionalAdmin', 'standard']}
134-
/>
135-
<RouteGuard path="/inventory/domains" component={Domains} />
136-
<RouteGuard
137-
path="/inventory/vulnerabilities"
138-
exact
139-
component={Vulnerabilities}
140-
permissions={['globalView', 'regionalAdmin', 'standard']}
141-
/>
142-
<RouteGuard
143-
path="/inventory/vulnerabilities/grouped"
144-
component={(props) => (
145-
<Vulnerabilities {...props} groupBy="title" />
146-
)}
147-
permissions={['globalView', 'regionalAdmin', 'standard']}
148-
/>
149-
<RouteGuard
150-
path="/inventory/vulnerability/:vulnerabilityId"
151-
component={Vulnerability}
152-
permissions={['globalView', 'regionalAdmin', 'standard']}
153-
/>
154-
<RouteGuard
155-
path="/feeds"
156-
component={Feeds}
157-
permissions={['globalView']}
158-
/>
159-
<RouteGuard
160-
path="/reports"
161-
component={Reports}
162-
permissions={['globalView', 'regionalAdmin', 'standard']}
163-
/>
164-
<RouteGuard path="/admin-tools" component={AdminTools} />
165-
<RouteGuard
166-
path="/organizations/:organizationId"
167-
component={Organization}
168-
permissions={['globalView', 'regionalAdmin']}
169-
/>
170-
<RouteGuard
171-
path="/organizations"
172-
component={Organizations}
173-
permissions={['globalView', 'regionalAdmin', 'standard']}
174-
/>
175-
<RouteGuard
176-
path="/users"
177-
component={Users}
178-
permissions={['globalView', 'regionalAdmin']}
179-
/>
180-
<RouteGuard
181-
path="/settings"
182-
component={Settings}
183-
permissions={['globalView', 'regionalAdmin', 'standard']}
184-
/>
185-
<RouteGuard
186-
path="/region-admin-dashboard"
187-
component={RegionUsers}
188-
permissions={['regionalAdmin', 'globalView']}
189-
/>
190-
<RouteGuard
191-
exact
192-
path="/readysetcyber"
193-
render={() => <Redirect to="/readysetcyber/dashboard" />}
194-
unauth={RSCLogin}
195-
component={RSCDashboard}
196-
/>
197-
<RouteGuard
198-
exact
199-
path="/readysetcyber/create-account"
200-
render={() => <Redirect to="/readysetcyber/dashboard" />}
201-
unauth={RSCAuthLoginCreate}
202-
component={RSCDashboard}
203-
/>
204-
<RouteGuard
205-
exact
206-
path="/readysetcyber/dashboard"
207-
component={RSCDashboard}
208-
render={() => <Redirect to="/readysetcyber/dashboard" />}
209-
permissions={[
210-
'globalView',
211-
'readySetCyber',
212-
'regionalAdmin',
213-
'standard'
214-
]}
215-
unauth={RSCLogin}
216-
/>
217-
<RouteGuard
218-
path="/readysetcyber/result/:id"
219-
component={RSCDetail}
220-
permissions={[
221-
'globalView',
222-
'readySetCyber',
223-
'regionalAdmin',
224-
'standard'
225-
]}
226-
unauth={RSCLogin}
227-
/>
228-
</Switch>
229-
</LayoutWithSearch>
230-
</SearchProvider>
98+
<SavedSearchContextProvider>
99+
<SearchProvider>
100+
<LayoutWithSearch>
101+
<LinkTracker />
102+
<Switch>
103+
<RouteGuard
104+
exact
105+
path="/"
106+
render={() => <Redirect to="/inventory" />}
107+
unauth={AuthLogin}
108+
component={RiskWithSearch}
109+
/>
110+
<Route
111+
exact
112+
path="/login-gov-callback"
113+
component={LoginGovCallback}
114+
/>
115+
<Route
116+
exact
117+
path="/okta-callback"
118+
component={OktaCallback}
119+
/>
120+
<Route
121+
exact
122+
path="/create-account"
123+
component={AuthCreateAccount}
124+
/>
125+
<Route exact path="/terms" component={TermsOfUse} />
126+
<RouteGuard
127+
exact
128+
path="/inventory"
129+
component={SearchPage}
130+
permissions={[
131+
'globalView',
132+
'regionalAdmin',
133+
'standard'
134+
]}
135+
/>
136+
<RouteGuard
137+
path="/inventory/domain/:domainId"
138+
component={Domain}
139+
permissions={[
140+
'globalView',
141+
'regionalAdmin',
142+
'standard'
143+
]}
144+
/>
145+
<RouteGuard
146+
path="/inventory/domains"
147+
component={Domains}
148+
/>
149+
<RouteGuard
150+
path="/inventory/vulnerabilities"
151+
exact
152+
component={Vulnerabilities}
153+
permissions={[
154+
'globalView',
155+
'regionalAdmin',
156+
'standard'
157+
]}
158+
/>
159+
<RouteGuard
160+
path="/inventory/vulnerabilities/grouped"
161+
component={(props) => (
162+
<Vulnerabilities {...props} groupBy="title" />
163+
)}
164+
permissions={[
165+
'globalView',
166+
'regionalAdmin',
167+
'standard'
168+
]}
169+
/>
170+
<RouteGuard
171+
path="/inventory/vulnerability/:vulnerabilityId"
172+
component={Vulnerability}
173+
permissions={[
174+
'globalView',
175+
'regionalAdmin',
176+
'standard'
177+
]}
178+
/>
179+
<RouteGuard
180+
path="/feeds"
181+
component={Feeds}
182+
permissions={['globalView']}
183+
/>
184+
<RouteGuard
185+
path="/reports"
186+
component={Reports}
187+
permissions={[
188+
'globalView',
189+
'regionalAdmin',
190+
'standard'
191+
]}
192+
/>
193+
<RouteGuard path="/admin-tools" component={AdminTools} />
194+
<RouteGuard
195+
path="/organizations/:organizationId"
196+
component={Organization}
197+
permissions={['globalView', 'regionalAdmin']}
198+
/>
199+
<RouteGuard
200+
path="/organizations"
201+
component={Organizations}
202+
permissions={[
203+
'globalView',
204+
'regionalAdmin',
205+
'standard'
206+
]}
207+
/>
208+
<RouteGuard
209+
path="/users"
210+
component={Users}
211+
permissions={['globalView', 'regionalAdmin']}
212+
/>
213+
<RouteGuard
214+
path="/settings"
215+
component={Settings}
216+
permissions={[
217+
'globalView',
218+
'regionalAdmin',
219+
'standard'
220+
]}
221+
/>
222+
<RouteGuard
223+
path="/region-admin-dashboard"
224+
component={RegionUsers}
225+
permissions={['regionalAdmin', 'globalView']}
226+
/>
227+
<RouteGuard
228+
exact
229+
path="/readysetcyber"
230+
render={() => (
231+
<Redirect to="/readysetcyber/dashboard" />
232+
)}
233+
unauth={RSCLogin}
234+
component={RSCDashboard}
235+
/>
236+
<RouteGuard
237+
exact
238+
path="/readysetcyber/create-account"
239+
render={() => (
240+
<Redirect to="/readysetcyber/dashboard" />
241+
)}
242+
unauth={RSCAuthLoginCreate}
243+
component={RSCDashboard}
244+
/>
245+
<RouteGuard
246+
exact
247+
path="/readysetcyber/dashboard"
248+
component={RSCDashboard}
249+
render={() => (
250+
<Redirect to="/readysetcyber/dashboard" />
251+
)}
252+
permissions={[
253+
'globalView',
254+
'readySetCyber',
255+
'regionalAdmin',
256+
'standard'
257+
]}
258+
unauth={RSCLogin}
259+
/>
260+
<RouteGuard
261+
path="/readysetcyber/result/:id"
262+
component={RSCDetail}
263+
permissions={[
264+
'globalView',
265+
'readySetCyber',
266+
'regionalAdmin',
267+
'standard'
268+
]}
269+
unauth={RSCLogin}
270+
/>
271+
</Switch>
272+
</LayoutWithSearch>
273+
</SearchProvider>
274+
</SavedSearchContextProvider>
231275
</StaticsContextProvider>
232276
</Authenticator.Provider>
233277
</AuthContextProvider>

0 commit comments

Comments
 (0)