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


##########
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:
   maybe `category: Literal["info", "warning", "error"]` no default value and 
the user need to always specify it, so there is no surprises. (field is 
required)
   



##########
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:
   maybe `category: Literal["info", "warning", "error"]` no default value and 
the user needs to always specify it, so there is no surprises. (field is 
required)
   



-- 
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