bbovenzi commented on code in PR #24403:
URL: https://github.com/apache/airflow/pull/24403#discussion_r895786767
##########
airflow/www/static/js/grid/details/content/taskInstance/Logs/index.jsx:
##########
@@ -86,55 +94,95 @@ const Logs = ({
execution_date: executionDate,
}).toString();
+ const { parsedLogs, logGroups = [] } = useMemo(() => parseLogs(
+ data,
+ timezone,
+ logLevelFilter,
+ logGroupFilter,
+ ),
+ [data, logGroupFilter, logLevelFilter, timezone]);
+
+ useEffect(() => {
+ // Reset filters and selected attempt when changing to
+ // a task that do not have those filters anymore.
+ if (!internalIndexes.includes(selectedAttempt)) {
+ setSelectedAttempt(internalIndexes[0]);
+ }
+ if (logGroupFilter && !logGroups.includes(logGroupFilter)) {
+ setLogGroupFilter('');
+ }
+ }, [data, internalIndexes, logGroupFilter, logGroups, selectedAttempt]);
+
return (
<>
{tryNumber > 0 && (
<>
<Text as="span"> (by attempts)</Text>
- <Box>
- <Flex my={1} justifyContent="space-between">
- <Flex flexWrap="wrap">
- {internalIndexes.map((index) => (
- <Button
- key={index}
- variant="ghost"
- colorScheme="blue"
- onClick={() => setSelectedAttempt(index)}
- data-testid={`log-attempt-select-button-${index}`}
- >
- {index}
- </Button>
- ))}
- </Flex>
- <Flex>
- <Checkbox
- onChange={() => setWrap((previousState) => !previousState)}
- px={4}
- >
- <Text as="strong">Wrap</Text>
- </Checkbox>
- <Checkbox
- onChange={() => setShouldRequestFullContent((previousState) =>
!previousState)}
- px={4}
- data-testid="full-content-checkbox"
- >
- <Text as="strong">Full Logs</Text>
- </Checkbox>
- <LogLink
- index={selectedAttempt}
- dagId={dagId}
- taskId={taskId}
- executionDate={executionDate}
- isInternal
- />
- <LinkButton
- href={`${logUrl}&${params}`}
+ <Flex my={1} justifyContent="space-between">
+ <Flex flexWrap="wrap">
+ {internalIndexes.map((index) => (
+ <Button
+ key={index}
+ variant="ghost"
+ colorScheme="blue"
+ onClick={() => setSelectedAttempt(index)}
+ data-testid={`log-attempt-select-button-${index}`}
>
- See More
- </LinkButton>
- </Flex>
+ {index}
+ </Button>
+ ))}
</Flex>
- </Box>
+ <Flex alignItems="center">
+ <Select
Review Comment:
I think we'll want to use multi-select here. Although, I'm happy to do that
in a subsequent PR to keep scope creep in check.
--
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]