Skip to content

Commit

Permalink
Added ability to display health api error message on the health dashb…
Browse files Browse the repository at this point in the history
…oard page.
  • Loading branch information
anilnatha committed Sep 19, 2024
1 parent 618d3c7 commit ad4c9e7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/routes/health-dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getHealthData } from "../../state/slices/healthSlice";
import { DocumentMeta } from "../../components/DocumentMeta/DocumentMeta";
import { useCallback, useEffect, useMemo, useState } from "react";
import { useAppDispatch, useAppSelector } from "../../state/hooks";
import { IconWarning } from "@nasa-jpl/react-stellar";
import { IconWarning, Error } from "@nasa-jpl/react-stellar";
import React from "react";
import { Link } from "react-router-dom";

Expand All @@ -30,6 +30,9 @@ const StatusCellRenderer = (props:CustomCellRendererProps) => {

function HealthDashboard() {

const [healthApiError, setHealthApiError] = useState(false);
const healthApiErrorMessage = "Application List Unavailable";

const dispatch = useAppDispatch();

const healthState = useAppSelector((state) => {
Expand Down Expand Up @@ -98,6 +101,7 @@ function HealthDashboard() {
// Do something to handle the successful fetching of data
} else if (healthState.status === "failed") {
// Do something to handle the error
setHealthApiError(true);
console.log(healthState.error);
}

Expand All @@ -112,6 +116,7 @@ function HealthDashboard() {
<DocumentMeta title="Health Dashboard" description="Health Dashboard" />
<div className="main-view">
<h1>Health Dashboard</h1>
{ healthApiError && <Error><IconWarning />{healthApiErrorMessage}</Error> }
<div className="ag-theme-stellar unity-aggrid-container">
<AgGridReact
rowData={healthState.items} // Row Data for Rows
Expand Down

0 comments on commit ad4c9e7

Please sign in to comment.