Skip to content

Commit

Permalink
Rebase and run format for line number rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
tirkarthi committed Jan 5, 2025
1 parent 6c37495 commit e2b6060
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 60 deletions.
13 changes: 2 additions & 11 deletions airflow/ui/src/components/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ export const SearchBar = ({
onChange,
placeHolder,
}: Props) => {
const handleSearchChange = useDebouncedCallback(
(val: string) => onChange(val),
debounceDelay,
);
const handleSearchChange = useDebouncedCallback((val: string) => onChange(val), debounceDelay);

const [value, setValue] = useState(defaultValue);

Expand Down Expand Up @@ -73,13 +70,7 @@ export const SearchBar = ({
/>
) : undefined}
{Boolean(hideAdvanced) ? undefined : (
<Button
fontWeight="normal"
height="1.75rem"
variant="ghost"
width={140}
{...buttonProps}
>
<Button fontWeight="normal" height="1.75rem" variant="ghost" width={140} {...buttonProps}>
Advanced Search
</Button>
)}
Expand Down
70 changes: 21 additions & 49 deletions airflow/ui/src/pages/Run/TaskInstances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
import {
Box,
Link,
createListCollection,
HStack,
type SelectValueChangeDetails,
} from "@chakra-ui/react";
import { Box, Link, createListCollection, HStack, type SelectValueChangeDetails } from "@chakra-ui/react";
import type { ColumnDef } from "@tanstack/react-table";
import { useCallback, useState } from "react";
import {
Link as RouterLink,
useParams,
useSearchParams,
} from "react-router-dom";
import { Link as RouterLink, useParams, useSearchParams } from "react-router-dom";

import { useTaskInstanceServiceGetTaskInstances } from "openapi/queries";
import type {
TaskInstanceResponse,
TaskInstanceState,
} from "openapi/requests/types.gen";
import type { TaskInstanceResponse, TaskInstanceState } from "openapi/requests/types.gen";
import { DataTable } from "src/components/DataTable";
import { useTableURLState } from "src/components/DataTable/useTableUrlState";
import { ErrorAlert } from "src/components/ErrorAlert";
import { SearchBar } from "src/components/SearchBar";
import Time from "src/components/Time";
import { Select, Status } from "src/components/ui";
import {
SearchParamsKeys,
type SearchParamsKeysType,
} from "src/constants/searchParams";
import { SearchParamsKeys, type SearchParamsKeysType } from "src/constants/searchParams";
import { capitalize, getDuration } from "src/utils";
import { getTaskInstanceLink } from "src/utils/links";

Expand Down Expand Up @@ -129,8 +113,7 @@ export const TaskInstances = () => {
const [sort] = sorting;
const orderBy = sort ? `${sort.desc ? "-" : ""}${sort.id}` : "-start_date";
const filteredState = searchParams.get(STATE_PARAM);
const { NAME_PATTERN: NAME_PATTERN_PARAM }: SearchParamsKeysType =
SearchParamsKeys;
const { NAME_PATTERN: NAME_PATTERN_PARAM }: SearchParamsKeysType = SearchParamsKeys;

const [taskDisplayNamePattern, setTaskDisplayNamePattern] = useState(
searchParams.get(NAME_PATTERN_PARAM) ?? undefined,
Expand Down Expand Up @@ -168,22 +151,19 @@ export const TaskInstances = () => {
setTaskDisplayNamePattern(value);
};

const { data, error, isFetching, isLoading } =
useTaskInstanceServiceGetTaskInstances(
{
dagId,
dagRunId: runId,
limit: pagination.pageSize,
offset: pagination.pageIndex * pagination.pageSize,
orderBy,
state: filteredState === null ? undefined : [filteredState],
taskDisplayNamePattern: Boolean(taskDisplayNamePattern)
? taskDisplayNamePattern
: undefined,
},
undefined,
{ enabled: !isNaN(pagination.pageSize) },
);
const { data, error, isFetching, isLoading } = useTaskInstanceServiceGetTaskInstances(
{
dagId,
dagRunId: runId,
limit: pagination.pageSize,
offset: pagination.pageIndex * pagination.pageSize,
orderBy,
state: filteredState === null ? undefined : [filteredState],
taskDisplayNamePattern: Boolean(taskDisplayNamePattern) ? taskDisplayNamePattern : undefined,
},
undefined,
{ enabled: !isNaN(pagination.pageSize) },
);

return (
<Box pt={4}>
Expand All @@ -194,19 +174,13 @@ export const TaskInstances = () => {
onValueChange={handleStateChange}
value={[filteredState ?? "all"]}
>
<Select.Trigger
clearable
colorPalette="blue"
isActive={Boolean(filteredState)}
>
<Select.Trigger clearable colorPalette="blue" isActive={Boolean(filteredState)}>
<Select.ValueText>
{() =>
filteredState === null ? (
"All States"
) : (
<Status state={filteredState as TaskInstanceState}>
{capitalize(filteredState)}
</Status>
<Status state={filteredState as TaskInstanceState}>{capitalize(filteredState)}</Status>
)
}
</Select.ValueText>
Expand All @@ -217,9 +191,7 @@ export const TaskInstances = () => {
{option.value === "all" ? (
option.label
) : (
<Status state={option.value as TaskInstanceState}>
{option.label}
</Status>
<Status state={option.value as TaskInstanceState}>{option.label}</Status>
)}
</Select.Item>
))}
Expand Down

0 comments on commit e2b6060

Please sign in to comment.