Skip to content

Commit

Permalink
Add link to respective dagrun and task instance from recent runs. (ap…
Browse files Browse the repository at this point in the history
…ache#44903)

* Add link to the respective dag run and task instance from recent runs plot.

* Fix model name for pluralization.
  • Loading branch information
tirkarthi authored Dec 13, 2024
1 parent 224a4e3 commit db22778
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
26 changes: 15 additions & 11 deletions airflow/ui/src/pages/Dag/Tasks/TaskRecentRuns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
import { Box } from "@chakra-ui/react";
import { Flex } from "@chakra-ui/react";
import { Box, Flex } from "@chakra-ui/react";
import dayjs from "dayjs";
import duration from "dayjs/plugin/duration";
import { Link } from "react-router-dom";

import type { TaskInstanceResponse } from "openapi/requests/types.gen";
import TaskInstanceTooltip from "src/components/TaskInstanceTooltip";
Expand Down Expand Up @@ -59,15 +59,19 @@ export const TaskRecentRuns = ({
key={taskInstance.dag_run_id}
taskInstance={taskInstance}
>
<Box p={1}>
<Box
bg={stateColor[taskInstance.state]}
borderRadius="4px"
height={`${(taskInstance.duration / max) * BAR_HEIGHT}px`}
minHeight={1}
width="4px"
/>
</Box>
<Link
to={`/dags/${taskInstance.dag_id}/runs/${taskInstance.dag_run_id}/tasks/${taskInstance.task_id}?map_index=${taskInstance.map_index}`}
>
<Box p={1}>
<Box
bg={stateColor[taskInstance.state]}
borderRadius="4px"
height={`${(taskInstance.duration / max) * BAR_HEIGHT}px`}
minHeight={1}
width="4px"
/>
</Box>
</Link>
</TaskInstanceTooltip>
),
)}
Expand Down
21 changes: 12 additions & 9 deletions airflow/ui/src/pages/DagsList/RecentRuns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { Flex, Box, Text } from "@chakra-ui/react";
import dayjs from "dayjs";
import duration from "dayjs/plugin/duration";
import { Link } from "react-router-dom";

import type { DAGWithLatestDagRunsResponse } from "openapi/requests/types.gen";
import Time from "src/components/Time";
Expand Down Expand Up @@ -73,15 +74,17 @@ export const RecentRuns = ({
}}
showArrow
>
<Box p={1}>
<Box
bg={stateColor[run.state]}
borderRadius="4px"
height={`${(run.duration / max) * BAR_HEIGHT}px`}
minHeight={1}
width="4px"
/>
</Box>
<Link to={`/dags/${run.dag_id}/runs/${run.dag_run_id}/`}>
<Box p={1}>
<Box
bg={stateColor[run.state]}
borderRadius="4px"
height={`${(run.duration / max) * BAR_HEIGHT}px`}
minHeight={1}
width="4px"
/>
</Box>
</Link>
</Tooltip>
))}
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion airflow/ui/src/pages/Variables/Variables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const Variables = () => {
initialState={tableURLState}
isFetching={isFetching}
isLoading={isLoading}
modelName="Variables"
modelName="Variable"
onStateChange={setTableURLState}
total={data ? data.total_entries : 0}
/>
Expand Down

0 comments on commit db22778

Please sign in to comment.