diff --git a/src/analytics/task/useTaskAnalytics.ts b/src/analytics/task/useTaskAnalytics.ts index dbb7057dd2..1d78d77f9b 100644 --- a/src/analytics/task/useTaskAnalytics.ts +++ b/src/analytics/task/useTaskAnalytics.ts @@ -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 = () => { diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index 3af7bd17b3..ae8b0f91b9 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -2418,6 +2418,14 @@ export type StatusCount = { status: Scalars["String"]["output"]; }; +export type StepbackInfo = { + __typename?: "StepbackInfo"; + lastFailingStepbackTaskId?: Maybe; + lastPassingStepbackTaskId?: Maybe; + nextStepbackTaskId?: Maybe; + previousStepbackTaskId?: Maybe; +}; + export type Subscriber = { __typename?: "Subscriber"; emailSubscriber?: Maybe; @@ -2526,6 +2534,7 @@ export type Task = { spawnHostLink?: Maybe; startTime?: Maybe; status: Scalars["String"]["output"]; + stepbackInfo?: Maybe; /** @deprecated Use files instead */ taskFiles: TaskFiles; taskGroup?: Maybe; @@ -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; diff --git a/src/gql/queries/task.graphql b/src/gql/queries/task.graphql index 742884fa45..b2338dc62d 100644 --- a/src/gql/queries/task.graphql +++ b/src/gql/queries/task.graphql @@ -107,6 +107,12 @@ query Task($taskId: String!, $execution: Int) { resetWhenFinished spawnHostLink startTime + stepbackInfo { + lastFailingStepbackTaskId + lastPassingStepbackTaskId + nextStepbackTaskId + previousStepbackTaskId + } timeTaken totalTestCount versionMetadata { diff --git a/src/pages/task/metadata/index.tsx b/src/pages/task/metadata/index.tsx index 0843f9dcb0..11e151533a 100644 --- a/src/pages/task/metadata/index.tsx +++ b/src/pages/task/metadata/index.tsx @@ -79,6 +79,7 @@ export const Metadata: React.FC = ({ error, loading, task, taskId }) => { spawnHostLink, startTime, status, + stepbackInfo, timeTaken, versionMetadata, } = task || {}; @@ -403,6 +404,66 @@ export const Metadata: React.FC = ({ error, loading, task, taskId }) => { )} + {stepbackInfo?.lastPassingStepbackTaskId && ( + <> + + Last Passing Stepback Task:{" "} + + taskAnalytics.sendEvent({ + name: "Click Last Passing Stepback Task Link", + }) + } + > + {stepbackInfo.lastPassingStepbackTaskId} + + + + Last Failing Stepback Task:{" "} + + taskAnalytics.sendEvent({ + name: "Click Last Failing Stepback Task Link", + }) + } + > + {stepbackInfo.lastFailingStepbackTaskId} + + + + )} + {stepbackInfo?.previousStepbackTaskId && ( + + Previous Stepback Task:{" "} + + taskAnalytics.sendEvent({ + name: "Click Previous Stepback Task Link", + }) + } + > + {stepbackInfo.previousStepbackTaskId} + + + )} + {stepbackInfo?.nextStepbackTaskId && ( + + Next Stepback Task:{" "} + + taskAnalytics.sendEvent({ + name: "Click Next Stepback Task Link", + }) + } + > + {stepbackInfo.nextStepbackTaskId} + + + )} ); };