This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
DEVPROD-1976: Migrate execution tasks table to LeafyGreen table #2302
Merged
minnakt
merged 9 commits into
evergreen-ci:main
from
minnakt:DEVPROD-1976_execution-tasks
Mar 20, 2024
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8324fe5
DEVPROD-1976: Migrate execution tasks table
minnakt ad6bab1
Update snapshots
minnakt 132dc75
Fix tests
minnakt 111651f
Merge branch 'main' into DEVPROD-1976_execution-tasks
minnakt 53c1a7a
add multisort
minnakt 3d130eb
codegen
minnakt 51545bc
Merge branch 'main' into DEVPROD-1976_execution-tasks
minnakt 36adab4
Merge branch 'main' into DEVPROD-1976_execution-tasks
minnakt e6f1790
sad codegen
minnakt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import { LGColumnDef } from "@leafygreen-ui/table"; | ||
import Tooltip from "@leafygreen-ui/tooltip"; | ||
import pluralize from "pluralize"; | ||
import { ConditionalWrapper } from "components/ConditionalWrapper"; | ||
import { StyledRouterLink } from "components/styles"; | ||
import TaskStatusBadge from "components/TaskStatusBadge"; | ||
import { TreeDataEntry } from "components/TreeSelect"; | ||
import { getVariantHistoryRoute } from "constants/routes"; | ||
import { mergeTaskVariant } from "constants/task"; | ||
import { zIndex } from "constants/tokens"; | ||
import { TaskSortCategory } from "gql/generated/types"; | ||
import { TaskStatus } from "types/task"; | ||
import { TaskLink } from "./TaskLink"; | ||
import { TaskTableInfo } from "./types"; | ||
|
||
export const getColumnsTemplate = ({ | ||
baseStatusOptions = [], | ||
isPatch = false, | ||
onClickTaskLink = () => {}, | ||
showTaskExecutionLabel = false, | ||
statusOptions = [], | ||
}: { | ||
baseStatusOptions?: TreeDataEntry[]; | ||
isPatch?: boolean; | ||
onClickTaskLink?: (taskId: string) => void; | ||
showTaskExecutionLabel?: boolean; | ||
statusOptions?: TreeDataEntry[]; | ||
}): LGColumnDef<TaskTableInfo>[] => [ | ||
{ | ||
header: "Name", | ||
accessorKey: "displayName", | ||
id: TaskSortCategory.Name, | ||
cell: ({ | ||
getValue, | ||
row: { | ||
original: { execution, id }, | ||
}, | ||
}): JSX.Element => ( | ||
<TaskLink | ||
execution={execution} | ||
onClick={onClickTaskLink} | ||
showTaskExecutionLabel={showTaskExecutionLabel} | ||
taskId={id} | ||
taskName={getValue() as string} | ||
/> | ||
), | ||
meta: { | ||
search: { | ||
"data-cy": "task-name-filter-popover", | ||
placeholder: "Task name regex", | ||
}, | ||
}, | ||
enableSorting: true, | ||
size: 300, | ||
}, | ||
{ | ||
accessorKey: "status", | ||
id: TaskSortCategory.Status, | ||
header: "Task Status", | ||
cell: ({ | ||
getValue, | ||
row: { | ||
original: { dependsOn, execution, id }, | ||
}, | ||
}) => { | ||
const status = getValue() as string; | ||
|
||
return dependsOn?.length && getValue() === TaskStatus.Blocked ? ( | ||
<Tooltip | ||
data-cy="depends-on-tooltip" | ||
justify="middle" | ||
popoverZIndex={zIndex.tooltip} | ||
trigger={ | ||
<span> | ||
<TaskStatusBadge status={status} id={id} execution={execution} /> | ||
</span> | ||
} | ||
> | ||
Depends on {pluralize("task", dependsOn.length)}:{" "} | ||
{dependsOn.map(({ name }) => `“${name}”`).join(", ")} | ||
</Tooltip> | ||
) : ( | ||
getValue() && ( | ||
<TaskStatusBadge status={status} id={id} execution={execution} /> | ||
) | ||
); | ||
}, | ||
meta: { | ||
treeSelect: { | ||
"data-cy": "status-filter-popover", | ||
options: statusOptions, | ||
}, | ||
}, | ||
Comment on lines
+88
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, the current table doesn't allow filtering so this may be superfluous |
||
enableSorting: true, | ||
size: 80, | ||
}, | ||
{ | ||
id: TaskSortCategory.BaseStatus, | ||
accessorKey: "baseTask.status", | ||
header: `${isPatch ? "Base" : "Previous"} Status`, | ||
cell: ({ | ||
getValue, | ||
row: { | ||
original: { baseTask }, | ||
}, | ||
}) => | ||
getValue() && ( | ||
<TaskStatusBadge | ||
status={getValue() as string} | ||
id={baseTask?.id} | ||
execution={baseTask?.execution} | ||
/> | ||
), | ||
meta: { | ||
treeSelect: { | ||
"data-cy": "base-status-filter-popover", | ||
options: baseStatusOptions, | ||
}, | ||
}, | ||
Comment on lines
+114
to
+119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
enableSorting: true, | ||
size: 80, | ||
}, | ||
{ | ||
accessorKey: "buildVariantDisplayName", | ||
id: TaskSortCategory.Variant, | ||
header: "Variant", | ||
cell: ({ | ||
getValue, | ||
row: { | ||
original: { buildVariant, projectIdentifier }, | ||
}, | ||
}) => ( | ||
<ConditionalWrapper | ||
condition={buildVariant !== mergeTaskVariant} | ||
wrapper={(children) => ( | ||
<StyledRouterLink | ||
to={getVariantHistoryRoute(projectIdentifier, buildVariant)} | ||
> | ||
{children} | ||
</StyledRouterLink> | ||
)} | ||
> | ||
{getValue() as string} | ||
</ConditionalWrapper> | ||
), | ||
meta: { | ||
search: { | ||
"data-cy": "variant-filter-popover", | ||
placeholder: "Variant name regex", | ||
}, | ||
}, | ||
Comment on lines
+146
to
+151
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
enableSorting: true, | ||
size: 250, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be removed since task name isn't a searchable column for the execution tasks table? Or will it be used later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this column definition will be reused for the upcoming tables, and they'll be shown in those tables! (initially i wrote these changes in one big PR which got split up now into 3 PRs, so that's why they are here 😅)