steveahnahn commented on code in PR #55604:
URL: https://github.com/apache/airflow/pull/55604#discussion_r2353411067
##########
airflow-core/src/airflow/ui/src/components/LimitedItemsList.tsx:
##########
@@ -16,67 +16,178 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { Box, Text, HStack, StackSeparator } from "@chakra-ui/react";
+import { Box, Text, HStack, useDisclosure, Heading, Stack } from
"@chakra-ui/react";
import React, { type ReactNode } from "react";
import { useTranslation } from "react-i18next";
-import { Tooltip } from "./ui";
+import { Tooltip, Dialog, Button } from "./ui";
type ListProps = {
readonly icon?: ReactNode;
readonly interactive?: boolean;
readonly items: Array<ReactNode | string>;
readonly maxItems?: number;
+ readonly modalTitle?: string;
readonly separator?: string;
+ readonly showModal?: boolean;
};
export const LimitedItemsList = ({
icon,
interactive = false,
items,
maxItems,
+ modalTitle = "All Items",
separator = ", ",
+ showModal = false,
}: ListProps) => {
const { t: translate } = useTranslation("components");
+ const { onClose, onOpen, open } = useDisclosure();
const shouldTruncate = maxItems !== undefined && items.length > maxItems;
const displayItems = shouldTruncate ? items.slice(0, maxItems) : items;
const remainingItems = shouldTruncate ? items.slice(maxItems) : [];
const remainingItemsList = interactive ? (
- <HStack separator={<StackSeparator />}>{remainingItems}</HStack>
+ <Box maxH="200px" overflowY="auto" p={2}>
+ <Text fontSize="sm" fontWeight="bold" mb={2}>
+ {translate("limitedList.allItems", { count: items.length })}
+ </Text>
+ <Stack gap={1}>
+ {items.map((item, index) => (
+ // eslint-disable-next-line react/no-array-index-key
+ <Box fontSize="sm" key={index}>
+ {item}
+ </Box>
+ ))}
+ </Stack>
+ <Text color="gray.500" fontSize="xs" mt={2}>
+ {translate("limitedList.clickToOpenFull", { count:
remainingItems.length })}
+ </Text>
+ </Box>
) : (
- `More items: ${remainingItems.map((item) => (typeof item === "string" ?
item : "item")).join(", ")}`
+ <Box maxH="200px" overflowY="auto" p={2}>
+ <Text fontSize="sm" fontWeight="bold" mb={2}>
+ {translate("limitedList.allItems", { count: items.length })}
+ </Text>
+ <Stack gap={1}>
+ {items.map((item, index) => (
+ // eslint-disable-next-line react/no-array-index-key
+ <Text fontSize="sm" key={index}>
+ {typeof item === "string" ? item : "item"}
Review Comment:
mistake, fixed in
[8c99d8c](https://github.com/apache/airflow/pull/55604/commits/8c99d8cf65b8a6f6c2fbc7135aad2ae226eb015a)
--
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]