Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const CHART_ROW_HEIGHT = 20;
const MIN_BAR_WIDTH = 10;

export const Gantt = ({ limit }: Props) => {
const { dagId = "", groupId: selectedGroupId, runId, taskId: selectedTaskId } = useParams();
const { dagId = "", groupId: selectedGroupId, runId = "", taskId: selectedTaskId } = useParams();
const { openGroupIds } = useOpenGroups();
const { t: translate } = useTranslation("common");
const { selectedTimezone } = useTimezone();
Expand All @@ -101,15 +101,15 @@ export const Gantt = ({ limit }: Props) => {
// Get grid summaries for groups (which have min/max times)
const { data: gridTiSummaries, isLoading: summariesLoading } = useGridTiSummaries({
dagId,
runId: runId ?? "",
runId,
state: selectedRun?.state,
});

// Get individual task instances for tasks (which have start/end times)
const { data: taskInstancesData, isLoading: tiLoading } = useTaskInstanceServiceGetTaskInstances(
{
dagId,
dagRunId: runId ?? "~",
dagRunId: runId,
},
undefined,
{
Expand All @@ -124,7 +124,7 @@ export const Gantt = ({ limit }: Props) => {
const isLoading = runsLoading || structureLoading || summariesLoading || tiLoading;

const data = useMemo(() => {
if (isLoading || runId === undefined) {
if (isLoading || runId === "") {
return [];
}

Expand Down Expand Up @@ -222,7 +222,7 @@ export const Gantt = ({ limit }: Props) => {
],
);

if (runId === undefined) {
if (runId === "") {
return undefined;
}

Expand Down
14 changes: 12 additions & 2 deletions airflow-core/src/airflow/ui/src/layouts/Details/Gantt/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import type { NavigateFunction, Location } from "react-router-dom";
import type { GridRunsResponse, TaskInstanceState } from "openapi/requests";
import { getDuration } from "src/utils";
import { formatDate } from "src/utils/datetimeUtils";
import { buildTaskInstanceUrl } from "src/utils/links";

export type GanttDataItem = {
isGroup: boolean;
Expand All @@ -38,7 +39,7 @@ type HandleBarClickOptions = {
data: Array<GanttDataItem>;
location: Location;
navigate: NavigateFunction;
runId: string | undefined;
runId: string;
};

type ChartOptionsParams = {
Expand All @@ -61,9 +62,18 @@ export const createHandleBarClick =
if (clickedData) {
const { isGroup, isMapped, taskId } = clickedData;

const taskUrl = buildTaskInstanceUrl({
currentPathname: location.pathname,
dagId,
isGroup,
isMapped: Boolean(isMapped),
runId,
taskId,
});

navigate(
{
pathname: `/dags/${dagId}/runs/${runId}/tasks/${isGroup ? "group/" : ""}${taskId}${isMapped ? "/mapped" : ""}`,
pathname: taskUrl,
search: location.search,
},
{ replace: true },
Expand Down