From 9611b0ce535ab0982375c2545ebe9c92816b62e9 Mon Sep 17 00:00:00 2001 From: Jan Vorcak Date: Thu, 26 Oct 2023 21:05:54 +0200 Subject: [PATCH] Migrates remaining Alert components --- .../pages/connect/CreateConnector.tsx | 88 +++++++++++-------- .../src/components/pages/connect/helper.tsx | 22 +++-- 2 files changed, 64 insertions(+), 46 deletions(-) diff --git a/frontend/src/components/pages/connect/CreateConnector.tsx b/frontend/src/components/pages/connect/CreateConnector.tsx index 6dfd05581..b2075d2ce 100644 --- a/frontend/src/components/pages/connect/CreateConnector.tsx +++ b/frontend/src/components/pages/connect/CreateConnector.tsx @@ -19,14 +19,14 @@ import { api } from '../../../state/backendApi'; import { uiState } from '../../../state/uiState'; import { appGlobal } from '../../../state/appGlobal'; import { ClusterConnectors, ConnectorValidationResult } from '../../../state/restInterfaces'; -import { Alert, Select, Skeleton, Table } from 'antd'; +import { Select, Skeleton, Table } from 'antd'; import { HiddenRadioList } from '../../misc/HiddenRadioList'; import { ConnectorBoxCard, ConnectorPlugin, getConnectorFriendlyName } from './ConnectorBoxCard'; import { ConfigPage } from './dynamic-ui/components'; import KowlEditor from '../../misc/KowlEditor'; import PageContent from '../../misc/PageContent'; import { ConnectClusterStore, ConnectorValidationError } from '../../../state/connect/state'; -import { Flex, Text, Tabs, Link, SearchField, Box, Heading, Modal, ModalOverlay, ModalContent, ModalHeader, ModalBody, Spinner, useToast, useDisclosure } from '@redpanda-data/ui'; +import { Flex, Text, Tabs, Link, SearchField, Box, Heading, Modal, ModalOverlay, ModalContent, ModalHeader, ModalBody, Spinner, useToast, useDisclosure, Alert, AlertDescription, AlertIcon } from '@redpanda-data/ui'; import { findConnectorMetadata } from './helper'; import { containsIgnoreCase, delay, TimeSince } from '../../../utils/utils'; const { Option } = Select; @@ -539,41 +539,50 @@ function Review({ {validationFailure ? ( - Validation attempt failed -

{String(validationFailure)}

- - } - /> + status="error" + variant="left-accent" + my={4} + > + + + + Validation attempt failed + {String(validationFailure)} + + +
) : null} {creationFailure ? ( - Creation attempt failed -

{String(creationFailure)}

- - } - /> + status="error" + variant="left-accent" + my={4} + > + + + + Creation attempt failed + {String(creationFailure)} + + +
) : null} {genericFailure ? ( - An error occurred -

{String(genericFailure)}

- - } - /> + status="error" + variant="left-accent" + my={4} + > + + + + An error occurred + {String(genericFailure)} + + +
) : null} Connector Properties @@ -599,12 +608,13 @@ function getDataSource(validationResult: ConnectorValidationResult) { function ValidationDisplay({ validationResult }: { validationResult: ConnectorValidationResult }) { return ( -

Submitted configuration is invalid

- + status="warning" + variant="left-accent" + my={4} + > + + + Submitted configuration is invalid record.name} /> - - } - /> - ); + + + + ) } export default CreateConnector; diff --git a/frontend/src/components/pages/connect/helper.tsx b/frontend/src/components/pages/connect/helper.tsx index 1d13ec02a..fb9b94821 100644 --- a/frontend/src/components/pages/connect/helper.tsx +++ b/frontend/src/components/pages/connect/helper.tsx @@ -10,7 +10,6 @@ */ -import { Alert } from 'antd'; import { observer, useLocalObservable } from 'mobx-react'; import React, { CSSProperties, useRef, useState } from 'react'; import { api } from '../../../state/backendApi'; @@ -45,7 +44,7 @@ import { CheckCircleTwoTone, ExclamationCircleTwoTone, HourglassTwoTone, PauseCi import Section from '../../misc/Section'; import PageContent from '../../misc/PageContent'; import { isEmbedded } from '../../../config'; -import { AlertDialog, AlertDialogBody, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, Box, Button, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalOverlay, Popover, useToast, VStack, Text, Empty } from '@redpanda-data/ui'; +import { AlertDialog, AlertDialogBody, AlertDialogContent, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, Box, Button, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, ModalOverlay, Popover, useToast, VStack, Text, Empty, AlertDescription, AlertIcon, Alert } from '@redpanda-data/ui'; import { Statistic } from '../../misc/Statistic'; interface ConnectorMetadata { @@ -594,11 +593,20 @@ export const ConfirmModal = observer((props: ConfirmModalProps) => { Confirm {content} - {err && } + {err && + + + + + {err.title} + {err.content} + + + + }