Skip to content

Commit

Permalink
pr comments, slight difference in routes
Browse files Browse the repository at this point in the history
  • Loading branch information
gitdallas committed Dec 15, 2023
1 parent 9768d00 commit 85721e1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 115 deletions.
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
REACT_APP_ENV=development
OPEN_PATH=/client
OPEN_PATH=/

REACT_APP_AUTH_TOKEN=csrfspoof

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# dependencies
node_modules/
**/node_modules
.yarn-integrity

# coverage
Expand Down
4 changes: 3 additions & 1 deletion src/app/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { Route, Routes } from 'react-router';
import NotFound from '../pages/notFound/NotFound';
import { Navigate, Redirect } from 'react-router-dom';

const Sources = React.lazy(() => import('../pages/sources/SourcesListView'));
const Scans = React.lazy(() => import('../pages/scans/ScansListView'));
Expand Down Expand Up @@ -28,7 +29,7 @@ const routes: AppRouteConfig[] = [
id: 'sources',
component: <Sources />,
label: 'Sources',
path: '/',
path: '/sources',
title: 'Sources'
},
{
Expand Down Expand Up @@ -58,6 +59,7 @@ const AppRoutes = (): React.ReactElement => (
{flattenedRoutes.map(route => (
<Route path={route.path} element={route.component} key={route.id} />
))}
<Route path="/" element={<Navigate to="/sources" replace />} />
<Route path="*" element={<NotFound />} />
</Routes>
</React.Suspense>
Expand Down
14 changes: 7 additions & 7 deletions src/components/sessionContext/SessionProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ const SessionProvider: React.FC<{ children: React.ReactNode }> = ({ children })
useQuery({
queryKey: [WHO_AM_I_QUERY],
refetchOnWindowFocus: !helpers.DEV_MODE,
// queryFn: () => {
// return axios.get(process.env.REACT_APP_USER_SERVICE_CURRENT || '').then(res => {
// if (res.data.username) {
// setSessionData(prev => ({ ...prev, authorized: true, username: res.data.username }));
// }
// });
// }
queryFn: () => {
return axios.get(process.env.REACT_APP_USER_SERVICE_CURRENT || '').then(res => {
if (res.data.username) {
setSessionData(prev => ({ ...prev, authorized: true, username: res.data.username }));
}
});
}
});

return <SessionContext.Provider value={sessionData}>{children}</SessionContext.Provider>;
Expand Down
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (process.env.NODE_ENV !== 'production') {
const root = ReactDOM.createRoot(document.getElementById('root') as Element);
const queryClient = new QueryClient();

//just to get token manually until we have login screen
//TODO: just to get token manually until we have login screen
axios.post('https://0.0.0.0:9443/api/v1/token/', {
username: 'admin',
password: 'pleasechangethispassword'
Expand All @@ -33,9 +33,9 @@ axios.post('https://0.0.0.0:9443/api/v1/token/', {
root.render(
<React.StrictMode>
<QueryClientProvider client={queryClient} >
<SessionProvider>
{/* <SessionProvider> TODO: possibly add this back in when we do login/auth stuff */}
<App />
</SessionProvider>
{/* </SessionProvider> */}
<ReactQueryDevtools />
</QueryClientProvider>
</React.StrictMode>
Expand Down
103 changes: 1 addition & 102 deletions src/pages/sources/SourcesListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
EmptyState,
EmptyStateIcon,
Form,
FormContextProvider,
FormGroup,
Icon,
List,
Expand Down Expand Up @@ -412,7 +411,6 @@ const SourcesListView: React.FunctionComponent = () => {
<Th {...getThProps({ columnKey: 'connection' })} />
<Th {...getThProps({ columnKey: 'type' })} />
<Th {...getThProps({ columnKey: 'credentials' })} />
{/* <Th {...getThProps({ columnKey: 'unreachableSystems' })} /> */}
<Th {...getThProps({ columnKey: 'scan' })} />
<Th {...getThProps({ columnKey: 'actions' })} />
</TableHeaderContentWithBatteries>
Expand Down Expand Up @@ -443,11 +441,6 @@ const SourcesListView: React.FunctionComponent = () => {
<Td {...getTdProps({ columnKey: 'credentials' })}><Button variant={ButtonVariant.link} onClick={() => {
setCredentialsSelected(source.credentials)
}}>{source.credentials.length}</Button></Td>
{/* <Td {...getTdProps({ columnKey: 'unreachableSystems' })}>
{helpers.devModeNormalizeCount(
source.connection?.source_systems_unreachable ?? 0
)}
</Td> */}
<Td isActionCell {...getTdProps({ columnKey: 'scan' })}>
<Button isDisabled={source.connection.status === "pending"} variant={ButtonVariant.link} onClick={() => onScanSource(source)}>
Scan
Expand Down Expand Up @@ -547,14 +540,6 @@ const SourcesListView: React.FunctionComponent = () => {
onClose={() => setAddSourceModal(undefined)}
onSubmit={onAddSource}
/>
// <Modal
// variant={ModalVariant.medium}
// onClose={() => setAddSourceModal(undefined)}
// isOpen={!!addSourceModal}
// title={`Add sorce: ${addSourceModal}`}
// >
// {addSourceModal}
// </Modal>
)}

{scanSelected && (
Expand Down Expand Up @@ -585,90 +570,4 @@ const SourcesListView: React.FunctionComponent = () => {
);
};

export default SourcesListView;



// const sourcesData = {
// "count": 2,
// "next": null,
// "previous": null,
// "results": [
// {
// "id": 1,
// "name": "Peripherals",
// "source_type": "openshift",
// "port": 443,
// "hosts": [
// "4444"
// ],
// "options": {
// "ssl_protocol": "SSLv23",
// "ssl_cert_verify": true
// },
// "credentials": [
// {
// "id": 1,
// "name": "Peripherals"
// }
// ],
// "connection": {
// "id": 1,
// "start_time": "2023-11-15T18:18:31.562241",
// "end_time": "2023-11-15T18:18:31.636013",
// "systems_count": 1,
// "systems_scanned": 0,
// "systems_failed": 0,
// "systems_unreachable": 1,
// "system_fingerprint_count": 0,
// "status_details": {
// "job_status_message": "The following tasks failed: 1",
// "task_1_status_message": "Unable to connect to OpenShift host."
// },
// "status": "failed",
// "source_systems_count": 1,
// "source_systems_scanned": 0,
// "source_systems_failed": 0,
// "source_systems_unreachable": 1
// }
// },
// {
// "id": 2,
// "name": "vcsource",
// "source_type": "vcenter",
// "port": 443,
// "hosts": [
// "vcenter.toledo.satellite.lab.eng.rdu2.redhat.com"
// ],
// "options": {
// "ssl_protocol": "SSLv23",
// "ssl_cert_verify": false
// },
// "credentials": [
// {
// "id": 2,
// "name": "vcenter pass"
// }
// ],
// "connection": {
// "id": 3,
// "report_id": 1,
// "start_time": "2023-11-15T19:23:44.062270",
// "end_time": "2023-11-15T19:23:48.851240",
// "systems_count": 160,
// "systems_scanned": 160,
// "systems_failed": 0,
// "systems_unreachable": 0,
// "system_fingerprint_count": 160,
// "status_details": {
// "job_status_message": "Job is complete."
// },
// "status": "completed",
// "source_systems_count": 160,
// "source_systems_scanned": 160,
// "source_systems_failed": 0,
// "source_systems_unreachable": 0
// }
// }
// ]
// };
export default SourcesListView;

0 comments on commit 85721e1

Please sign in to comment.