aritra24 commented on code in PR #48450:
URL: https://github.com/apache/airflow/pull/48450#discussion_r2022872887
##########
airflow-core/src/airflow/api_fastapi/common/types.py:
##########
@@ -96,3 +96,10 @@ class MenuItem(Enum):
PROVIDERS = "Providers"
VARIABLES = "Variables"
XCOMS = "XComs"
+
+
+class UIAlert(BaseModel):
Review Comment:
Ack
##########
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"}>
+ <ReactMarkdown>{alert.text}</ReactMarkdown>
+ </Alert>
+ </Accordion.ItemTrigger>
+ ) : (
+ <Accordion.ItemContent key={alert.text} paddingRight="8">
+ <Alert status={alert.category ?? "info"}>
Review Comment:
Ack
--
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]