Skip to content

Commit 7cbc8bf

Browse files
github-actions[bot]vatsrahul1001
authored andcommitted
[v3-1-test] Fix plugin import error alignment issue (#57787) (#57790)
(cherry picked from commit ec5cfd7) Co-authored-by: Rahul Vats <[email protected]>
1 parent 6193c87 commit 7cbc8bf

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/PluginImportErrors.tsx

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,24 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { Box, Text, Button, useDisclosure, Skeleton } from "@chakra-ui/react";
19+
import { Box, Button, useDisclosure, Skeleton } from "@chakra-ui/react";
2020
import { useTranslation } from "react-i18next";
21-
import { FiChevronRight } from "react-icons/fi";
2221
import { LuPlug } from "react-icons/lu";
2322

2423
import { usePluginServiceImportErrors } from "openapi/queries";
2524
import { ErrorAlert, type ExpandedApiError } from "src/components/ErrorAlert";
2625
import { StateBadge } from "src/components/StateBadge";
26+
import { StatsCard } from "src/components/StatsCard";
2727

2828
import { PluginImportErrorsModal } from "./PluginImportErrorsModal";
2929

3030
export const PluginImportErrors = ({ iconOnly = false }: { readonly iconOnly?: boolean }) => {
3131
const { onClose, onOpen, open } = useDisclosure();
32-
const { t: translate } = useTranslation("admin");
32+
const { i18n, t: translate } = useTranslation("admin");
3333
const { data, error, isLoading } = usePluginServiceImportErrors();
3434

35+
const isRTL = i18n.dir() === "rtl";
36+
3537
const importErrorsCount = data?.total_entries ?? 0;
3638
const importErrors = data?.import_errors ?? [];
3739

@@ -48,7 +50,7 @@ export const PluginImportErrors = ({ iconOnly = false }: { readonly iconOnly?: b
4850
}
4951

5052
return (
51-
<Box alignItems="center" display="flex" maxH="10px">
53+
<Box alignItems="center" display="flex">
5254
<ErrorAlert error={error} />
5355
{iconOnly ? (
5456
<StateBadge
@@ -62,23 +64,15 @@ export const PluginImportErrors = ({ iconOnly = false }: { readonly iconOnly?: b
6264
{importErrorsCount}
6365
</StateBadge>
6466
) : (
65-
<Button
66-
alignItems="center"
67-
borderRadius="md"
68-
display="flex"
69-
gap={2}
67+
<StatsCard
68+
colorScheme="failed"
69+
count={importErrorsCount}
70+
icon={<LuPlug />}
71+
isLoading={isLoading}
72+
isRTL={isRTL}
73+
label={translate("plugins.importError", { count: importErrorsCount })}
7074
onClick={onOpen}
71-
variant="outline"
72-
>
73-
<StateBadge colorPalette="failed">
74-
<LuPlug />
75-
{importErrorsCount}
76-
</StateBadge>
77-
<Box alignItems="center" display="flex" gap={1}>
78-
<Text fontWeight="bold">{translate("plugins.importError", { count: importErrorsCount })}</Text>
79-
<FiChevronRight />
80-
</Box>
81-
</Button>
75+
/>
8276
)}
8377
<PluginImportErrorsModal importErrors={importErrors} onClose={onClose} open={open} />
8478
</Box>

0 commit comments

Comments
 (0)