Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Add depends on tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
sophstad committed Feb 12, 2024
1 parent e3b288b commit e399f93
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/components/TasksTable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Tooltip from "@leafygreen-ui/tooltip";
import { Table } from "antd";
import { ColumnProps } from "antd/es/table";
import { SortOrder as antSortOrder } from "antd/lib/table/interface";
import pluralize from "pluralize";
import { ConditionalWrapper } from "components/ConditionalWrapper";
import { StyledRouterLink } from "components/styles";
import {
Expand All @@ -18,7 +20,7 @@ import {
SortOrder,
TaskSortCategory,
} from "gql/generated/types";
import { TableOnChange } from "types/task";
import { TableOnChange, TaskStatus } from "types/task";
import { sortTasks } from "utils/statuses";
import { TaskLink } from "./TaskLink";

Expand All @@ -27,6 +29,7 @@ type TaskTableInfo = {
status: string;
};
buildVariantDisplayName?: string;
dependsOn?: Array<{ name: string }>;
displayName: string;
executionTasksFull?: TaskTableInfo[];
id: string;
Expand Down Expand Up @@ -172,9 +175,23 @@ const getColumnDefs = ({
multiple: 4,
},
className: "cy-task-table-col-STATUS",
render: (status: string, { execution, id }) =>
status && (
<TaskStatusBadge status={status} id={id} execution={execution} />
render: (status: string, { dependsOn, execution, id }) =>
dependsOn?.length && status === TaskStatus.Blocked ? (
<Tooltip
justify="middle"
trigger={
<span>
<TaskStatusBadge status={status} id={id} execution={execution} />
</span>
}
>
Depends on <>{pluralize("task", dependsOn.length)}</>:{" "}
{dependsOn.map(({ name }) => `“${name}”`).join(", ")}
</Tooltip>
) : (
status && (
<TaskStatusBadge status={status} id={id} execution={execution} />
)
),
...(statusSelectorProps && {
...getColumnTreeSelectFilterProps({
Expand Down
1 change: 1 addition & 0 deletions src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8869,6 +8869,7 @@ export type VersionTasksQuery = {
id: string;
status: string;
} | null;
dependsOn?: Array<{ __typename?: "Dependency"; name: string }> | null;
executionTasksFull?: Array<{
__typename?: "Task";
buildVariant: string;
Expand Down
3 changes: 3 additions & 0 deletions src/gql/queries/version-tasks.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ query VersionTasks(
blocked
buildVariant
buildVariantDisplayName
dependsOn {
name
}
displayName
execution
executionTasksFull {
Expand Down

0 comments on commit e399f93

Please sign in to comment.