generated from unity-sds/unity-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from unity-sds/features/create-health-dashboard
Create health dashboard and integrate dynamic navbar
- Loading branch information
Showing
21 changed files
with
1,135 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
18.16.0 | ||
lts/hydrogen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[ | ||
{ | ||
"service": "airflow", | ||
"landingPage":"https://unity.jpl.nasa.gov/project/venue/processing/ui", | ||
"healthChecks": [ | ||
{ | ||
"status": "HEALTHY", | ||
"date": "2024-04-09T18:01:08Z" | ||
} | ||
] | ||
}, | ||
{ | ||
"service": "jupyter", | ||
"landingPage":"https://unity.jpl.nasa.gov/project/venue/ads/jupyter", | ||
"healthChecks": [ | ||
{ | ||
"status": "HEALTHY", | ||
"date": "2024-04-09T18:01:08Z" | ||
} | ||
] | ||
}, | ||
{ | ||
"service": "other_service", | ||
"landingPage":"https://unity.jpl.nasa.gov/project/venue/other_service", | ||
"healthChecks": [ | ||
{ | ||
"status": "UNHEALTHY", | ||
"date": "2024-04-09T18:01:08Z" | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import Root from "./Root" | ||
|
||
import './css/app.css' | ||
|
||
function App() { | ||
return ( | ||
<Root /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,88 @@ | ||
import { | ||
Route, | ||
Routes, | ||
Route, | ||
Routes, | ||
} from "react-router-dom" | ||
|
||
import Home from "./routes/home" | ||
import Home from "./routes/home"; | ||
import HealthDashboard from "./routes/health-dashboard"; | ||
import JobMonitoring from "./routes/jobs/monitoring"; | ||
import NewJob from "./routes/jobs/new"; | ||
|
||
import Navbar from "./components/Navbar" | ||
import WebView from "./components/WebView"; | ||
|
||
import Config from "./Config"; | ||
|
||
import { getProcesses, getProcessRoute } from "./utils/processes"; | ||
import NotFound from "./routes/errors/not-found"; | ||
import { healthDataRequiresFetchOrUpdate } from "./state/selectors/healthSelectors"; | ||
import { useAppDispatch, useAppSelector } from "./state/hooks"; | ||
import { useEffect } from "react"; | ||
import { getHealthData } from "./state/slices/healthSlice"; | ||
|
||
function Root() { | ||
|
||
const processes = getProcesses(); | ||
|
||
return ( | ||
<div className="viewWrapper"> | ||
<Navbar /> | ||
<div className="view"> | ||
<Routes> | ||
<Route path="/applications/catalog" element={<WebView url={Config.ads.url} />} /> | ||
<Route path="/jobs/monitoring" element={<JobMonitoring />} /> | ||
<Route path="/jobs/monitoring/:jobid_param" element={<JobMonitoring />} /> | ||
<Route path="/jobs/new" element={<NewJob />} /> | ||
|
||
{ | ||
/* Add routes for job execution forms */ | ||
processes.map( (item) => { | ||
const path = "/jobs/new/" + item['id']; | ||
const route:JSX.Element | null = getProcessRoute(item['id']); | ||
return ( | ||
<Route path={path} element={ (route) ? route : <NotFound />} key={"route_" + item['id']}/> | ||
) | ||
}) | ||
} | ||
|
||
<Route path="/" element={<Home />} /> | ||
<Route path="*" element={<NotFound />} /> | ||
</Routes> | ||
</div> | ||
</div> | ||
) | ||
|
||
const dispatch = useAppDispatch(); | ||
const processes = getProcesses(); | ||
|
||
const healthState = useAppSelector((state) => { | ||
return state.health; | ||
}); | ||
|
||
useEffect(() => { | ||
|
||
//let isMounted = true; | ||
|
||
// Check if data manager status is 'idle', then fetch the investigations data from the API | ||
if (healthDataRequiresFetchOrUpdate(healthState)) { | ||
dispatch(getHealthData()); | ||
} | ||
|
||
if (healthState.status === "pending") { | ||
// Do something to inform user that investigation data is being fetched | ||
} else if (healthState.status === "succeeded") { | ||
// Do something to handle the successful fetching of data | ||
} else if (healthState.error != null || healthState.error != undefined) { | ||
// Do something to handle the error | ||
console.log(healthState.error); | ||
} | ||
|
||
// Cleanup function | ||
return () => { | ||
//isMounted = false; | ||
}; | ||
|
||
}, [healthState, dispatch]); | ||
|
||
return ( | ||
<div className="viewWrapper"> | ||
<Navbar /> | ||
<div className="view"> | ||
<Routes> | ||
{ | ||
healthState.items.map( (item, index) => { | ||
return <Route key={index} path={"/applications/" + item.service} element={<WebView url={item.landingPage} />} /> | ||
}) | ||
} | ||
{/*<Route path="/applications/catalog" element={<WebView url={Config.ads.url} />} />*/} | ||
<Route path="/health-dashboard" element={<HealthDashboard />} /> | ||
<Route path="/jobs/monitoring" element={<JobMonitoring />} /> | ||
<Route path="/jobs/monitoring/:jobid_param" element={<JobMonitoring />} /> | ||
<Route path="/jobs/new" element={<NewJob />} /> | ||
{ | ||
/* Add routes for job execution forms */ | ||
processes.map( (item) => { | ||
const path = "/jobs/new/" + item['id']; | ||
const route:JSX.Element | null = getProcessRoute(item['id']); | ||
return ( | ||
<Route path={path} element={ (route) ? route : <NotFound />} key={"route_" + item['id']}/> | ||
) | ||
}) | ||
} | ||
<Route path="/" element={<Home />} /> | ||
<Route path="*" element={<NotFound />} /> | ||
</Routes> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Root; |
Oops, something went wrong.