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

Commit

Permalink
DEVPROD-1122 Add stepback information to task metadata (#2206)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZackarySantana authored Dec 28, 2023
1 parent 054203d commit 723543d
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/analytics/task/useTaskAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ type Action =
}
| { name: "Click Trace Link" }
| { name: "Click Trace Metrics Link" }
| { name: "Click Last Passing Stepback Task Link" }
| { name: "Click Last Failing Stepback Task Link" }
| { name: "Click Previous Stepback Task Link" }
| { name: "Click Next Stepback Task Link" }
| { name: "Submit Previous Commit Selector"; type: CommitType };

export const useTaskAnalytics = () => {
Expand Down
16 changes: 16 additions & 0 deletions src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2418,6 +2418,14 @@ export type StatusCount = {
status: Scalars["String"]["output"];
};

export type StepbackInfo = {
__typename?: "StepbackInfo";
lastFailingStepbackTaskId?: Maybe<Scalars["String"]["output"]>;
lastPassingStepbackTaskId?: Maybe<Scalars["String"]["output"]>;
nextStepbackTaskId?: Maybe<Scalars["String"]["output"]>;
previousStepbackTaskId?: Maybe<Scalars["String"]["output"]>;
};

export type Subscriber = {
__typename?: "Subscriber";
emailSubscriber?: Maybe<Scalars["String"]["output"]>;
Expand Down Expand Up @@ -2526,6 +2534,7 @@ export type Task = {
spawnHostLink?: Maybe<Scalars["String"]["output"]>;
startTime?: Maybe<Scalars["Time"]["output"]>;
status: Scalars["String"]["output"];
stepbackInfo?: Maybe<StepbackInfo>;
/** @deprecated Use files instead */
taskFiles: TaskFiles;
taskGroup?: Maybe<Scalars["String"]["output"]>;
Expand Down Expand Up @@ -8562,6 +8571,13 @@ export type TaskQuery = {
};
pod?: { __typename?: "Pod"; id: string } | null;
project?: { __typename?: "Project"; id: string; identifier: string } | null;
stepbackInfo?: {
__typename?: "StepbackInfo";
lastFailingStepbackTaskId?: string | null;
lastPassingStepbackTaskId?: string | null;
nextStepbackTaskId?: string | null;
previousStepbackTaskId?: string | null;
} | null;
versionMetadata: {
__typename?: "Version";
author: string;
Expand Down
6 changes: 6 additions & 0 deletions src/gql/queries/task.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ query Task($taskId: String!, $execution: Int) {
resetWhenFinished
spawnHostLink
startTime
stepbackInfo {
lastFailingStepbackTaskId
lastPassingStepbackTaskId
nextStepbackTaskId
previousStepbackTaskId
}
timeTaken
totalTestCount
versionMetadata {
Expand Down
61 changes: 61 additions & 0 deletions src/pages/task/metadata/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const Metadata: React.FC<Props> = ({ error, loading, task, taskId }) => {
spawnHostLink,
startTime,
status,
stepbackInfo,
timeTaken,
versionMetadata,
} = task || {};
Expand Down Expand Up @@ -403,6 +404,66 @@ export const Metadata: React.FC<Props> = ({ error, loading, task, taskId }) => {
</StyledLink>
</MetadataItem>
)}
{stepbackInfo?.lastPassingStepbackTaskId && (
<>
<MetadataItem>
Last Passing Stepback Task:{" "}
<StyledRouterLink
to={getTaskRoute(stepbackInfo.lastPassingStepbackTaskId)}
onClick={() =>
taskAnalytics.sendEvent({
name: "Click Last Passing Stepback Task Link",
})
}
>
{stepbackInfo.lastPassingStepbackTaskId}
</StyledRouterLink>
</MetadataItem>
<MetadataItem>
Last Failing Stepback Task:{" "}
<StyledRouterLink
to={getTaskRoute(stepbackInfo.lastFailingStepbackTaskId)}
onClick={() =>
taskAnalytics.sendEvent({
name: "Click Last Failing Stepback Task Link",
})
}
>
{stepbackInfo.lastFailingStepbackTaskId}
</StyledRouterLink>
</MetadataItem>
</>
)}
{stepbackInfo?.previousStepbackTaskId && (
<MetadataItem>
Previous Stepback Task:{" "}
<StyledRouterLink
to={getTaskRoute(stepbackInfo.previousStepbackTaskId)}
onClick={() =>
taskAnalytics.sendEvent({
name: "Click Previous Stepback Task Link",
})
}
>
{stepbackInfo.previousStepbackTaskId}
</StyledRouterLink>
</MetadataItem>
)}
{stepbackInfo?.nextStepbackTaskId && (
<MetadataItem>
Next Stepback Task:{" "}
<StyledRouterLink
to={getTaskRoute(stepbackInfo.nextStepbackTaskId)}
onClick={() =>
taskAnalytics.sendEvent({
name: "Click Next Stepback Task Link",
})
}
>
{stepbackInfo.nextStepbackTaskId}
</StyledRouterLink>
</MetadataItem>
)}
</MetadataCard>
);
};
Expand Down

0 comments on commit 723543d

Please sign in to comment.