aritra24 commented on code in PR #48450:
URL: https://github.com/apache/airflow/pull/48450#discussion_r2022831815


##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Dashboard.tsx:
##########
@@ -16,23 +16,55 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { Box, Heading } from "@chakra-ui/react";
+import { Box, Heading, VStack } from "@chakra-ui/react";
+
+import type { UIAlert } from "openapi/requests/types.gen";
+import ReactMarkdown from "src/components/ReactMarkdown";
+import { Accordion, Alert } from "src/components/ui";
+import { useConfig } from "src/queries/useConfig";
 
 import { Health } from "./Health";
 import { HistoricalMetrics } from "./HistoricalMetrics";
 import { Stats } from "./Stats";
 
-export const Dashboard = () => (
-  <Box>
-    <Heading mb={4}>Welcome</Heading>
+export const Dashboard = () => {
+  const alerts = useConfig("dashboard_alert") as Array<UIAlert>;
+
+  return (
     <Box>
-      <Health />
-    </Box>
-    <Box mt={5}>
-      <Stats />
-    </Box>
-    <Box mt={5}>
-      <HistoricalMetrics />
+      <VStack alignItems="start">
+        {alerts.length > 0 ? (
+          <Accordion.Root collapsible defaultValue={["ui_alerts"]}>
+            <Accordion.Item key="ui_alerts" value="ui_alerts">
+              {alerts.map((alert: UIAlert, index) =>
+                index === 0 ? (
+                  <Accordion.ItemTrigger key={alert.text}>
+                    <Alert status={alert.category ?? "info"}>

Review Comment:
   It still can be undefined, looks like adding the default still leaves 
category as an optional field. I am not sure why. 
   ```
   /**
    * Optional alert to be shown at the top of the page.
    */
   export type UIAlert = {
     text: string;
     category?: "info" | "warning" | "error";
   };
   
   export type category = "info" | "warning" | "error";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to