pierrejeambrun commented on code in PR #55082:
URL: https://github.com/apache/airflow/pull/55082#discussion_r2316038822
##########
airflow-core/src/airflow/ui/src/layouts/Details/PanelButtons.tsx:
##########
@@ -292,6 +320,64 @@ export const PanelButtons = ({
</Select.Content>
</Select.Positioner>
</Select.Root>
+ <Select.Root
+ // @ts-expect-error The expected option type is
incorrect
+ collection={dagRunTypeOptions}
+ data-testid="run-type-filter"
Review Comment:
I think there's a confusion between single value select and multi value
select. The selector does not allow multiple values, so I we shouldn't have an
`array` for `runTypeFilter`.
##########
airflow-core/src/airflow/ui/src/layouts/Details/PanelButtons.tsx:
##########
@@ -292,6 +320,64 @@ export const PanelButtons = ({
</Select.Content>
</Select.Positioner>
</Select.Root>
+ <Select.Root
+ // @ts-expect-error The expected option type is
incorrect
+ collection={dagRunTypeOptions}
+ data-testid="run-type-filter"
+ onValueChange={handleRunTypeChange}
+ size="sm"
+ value={[runTypeFilter?.[0] ?? "all"]}
+ >
+
<Select.Label>{translate("common:dagRun.runType")}</Select.Label>
+ <Select.Control>
+ <Select.Trigger>
+ <Select.ValueText>
+ {(runTypeFilter?.[0] ?? "all") === "all"
+ ? translate("dags:filters.allRunTypes")
+ : runTypeFilter?.[0] !== undefined && (
+ <Flex gap={1}>
+ <RunTypeIcon
runType={runTypeFilter[0]} />
+ {translate(
+ dagRunTypeOptions.items.find(
+ (item) => item.value ===
runTypeFilter[0],
+ )?.label ?? "",
+ )}
+ </Flex>
+ )}
+ </Select.ValueText>
+ </Select.Trigger>
+ <Select.IndicatorGroup>
+ <Select.Indicator />
+ </Select.IndicatorGroup>
+ </Select.Control>
+ <Select.Positioner>
+ <Select.Content>
+ {dagRunTypeOptions.items.map((option) => (
+ <Select.Item item={option} key={option.value}>
+ {option.value === "all" ? (
+ translate(option.label)
+ ) : (
+ <Flex gap={1}>
+ <RunTypeIcon runType={option.value as
DagRunType} />
+ {translate(option.label)}
+ </Flex>
+ )}
+ </Select.Item>
+ ))}
+ </Select.Content>
+ </Select.Positioner>
+ </Select.Root>
+ <VStack alignItems="flex-start">
+ <Text fontSize="xs" mb={1}>
+ {translate("common:dagRun.triggeringUser")}
+ </Text>
+ <Input
+ onChange={handleTriggeringUserChange}
+
placeholder={translate("common:filters.triggeringUserPlaceholder")}
+ size="sm"
+ value={triggeringUserFilter ?? ""}
+ />
Review Comment:
I think you can replace this with a 'searchbox' which will give you the
`debounce` function out of the box. Here on each key stroke we make multiple
requests, that's not great
##########
airflow-core/src/airflow/ui/src/layouts/Details/PanelButtons.tsx:
##########
@@ -292,6 +320,64 @@ export const PanelButtons = ({
</Select.Content>
</Select.Positioner>
</Select.Root>
+ <Select.Root
+ // @ts-expect-error The expected option type is
incorrect
+ collection={dagRunTypeOptions}
+ data-testid="run-type-filter"
Review Comment:
You can take a look at `PausedFilter` which is really similar, and don't
need such type ignores or `[0]` access
##########
airflow-core/src/airflow/ui/src/layouts/Details/PanelButtons.tsx:
##########
@@ -122,6 +134,22 @@ export const PanelButtons = ({
}
};
+ const handleRunTypeChange = (event: SelectValueChangeDetails<{ label:
string; value: Array<string> }>) => {
+ const [val] = event.value;
+
+ if (val === undefined || val === "all") {
+ setRunTypeFilter(null);
+ } else {
+ setRunTypeFilter([val as DagRunType]);
Review Comment:
`handleRunTypeChange` type is wrong I think.
--
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]