From 0a6ac964bff23051957ab8e2606d3bbb52405a2f Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Tue, 7 Nov 2023 10:06:26 -0500 Subject: [PATCH] DEVPROD-2234: Use correct project for querying task history (#2140) --- src/gql/generated/types.ts | 2 +- src/gql/queries/base-version-and-task.graphql | 2 +- .../previousCommits/PreviousCommits.test.tsx | 11 ++++++----- .../task/actionButtons/previousCommits/index.tsx | 13 +++++++++---- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index 2a74e58b89..fc3fad3a80 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -5304,6 +5304,7 @@ export type BaseVersionAndTaskQuery = { displayName: string; execution: number; id: string; + projectIdentifier?: string | null; baseTask?: { __typename?: "Task"; execution: number; @@ -5318,7 +5319,6 @@ export type BaseVersionAndTaskQuery = { __typename?: "Version"; id: string; order: number; - projectIdentifier: string; } | null; }; } | null; diff --git a/src/gql/queries/base-version-and-task.graphql b/src/gql/queries/base-version-and-task.graphql index 7f437015b5..3452491b5e 100644 --- a/src/gql/queries/base-version-and-task.graphql +++ b/src/gql/queries/base-version-and-task.graphql @@ -9,11 +9,11 @@ query BaseVersionAndTask($taskId: String!) { displayName execution id + projectIdentifier versionMetadata { baseVersion { id order - projectIdentifier } id isPatch diff --git a/src/pages/task/actionButtons/previousCommits/PreviousCommits.test.tsx b/src/pages/task/actionButtons/previousCommits/PreviousCommits.test.tsx index e8dbdfa1dd..59d63f5871 100644 --- a/src/pages/task/actionButtons/previousCommits/PreviousCommits.test.tsx +++ b/src/pages/task/actionButtons/previousCommits/PreviousCommits.test.tsx @@ -205,11 +205,11 @@ const getPatchTaskWithSuccessfulBaseTask: ApolloMock< execution: 0, displayName: "lint-agent", buildVariant: "lint", + projectIdentifier: "evergreen", versionMetadata: { baseVersion: { id: "baseVersion", order: 3676, - projectIdentifier: "evergreen", __typename: "Version", }, isPatch: true, @@ -245,11 +245,11 @@ const getPatchTaskWithRunningBaseTask: ApolloMock< execution: 0, displayName: "lint-agent", buildVariant: "lint", + projectIdentifier: "evergreen", versionMetadata: { baseVersion: { id: "baseVersion", order: 3676, - projectIdentifier: "evergreen", __typename: "Version", }, isPatch: true, @@ -285,11 +285,11 @@ const getPatchTaskWithFailingBaseTask: ApolloMock< execution: 0, displayName: "lint-agent", buildVariant: "lint", + projectIdentifier: "evergreen", versionMetadata: { baseVersion: { id: "baseVersion", order: 3676, - projectIdentifier: "evergreen", __typename: "Version", }, isPatch: true, @@ -325,6 +325,7 @@ const getPatchTaskWithNoBaseVersion: ApolloMock< execution: 0, displayName: "lint-agent", buildVariant: "lint", + projectIdentifier: "evergreen", versionMetadata: { baseVersion: null, id: "versionMetadataId", @@ -460,11 +461,11 @@ const getPatchTaskWithNoBaseTask: ApolloMock< execution: 0, displayName: "lint-agent", buildVariant: "lint", + projectIdentifier: "evergreen", versionMetadata: { baseVersion: { id: "baseVersion", order: 3676, - projectIdentifier: "evergreen", __typename: "Version", }, isPatch: true, @@ -496,11 +497,11 @@ const getMainlineTaskWithBaseVersion: ApolloMock< execution: 0, displayName: "lint-agent", buildVariant: "lint", + projectIdentifier: "evergreen", versionMetadata: { baseVersion: { id: "baseVersion", order: 3676, - projectIdentifier: "evergreen", __typename: "Version", }, isPatch: false, diff --git a/src/pages/task/actionButtons/previousCommits/index.tsx b/src/pages/task/actionButtons/previousCommits/index.tsx index 770add33a5..e1636af2e9 100644 --- a/src/pages/task/actionButtons/previousCommits/index.tsx +++ b/src/pages/task/actionButtons/previousCommits/index.tsx @@ -37,10 +37,15 @@ export const PreviousCommits: React.FC = ({ taskId }) => { variables: { taskId }, }); - const { baseTask, buildVariant, displayName, versionMetadata } = - taskData?.task ?? {}; - const { order: skipOrderNumber, projectIdentifier } = - versionMetadata?.baseVersion ?? {}; + const { + baseTask, + buildVariant, + displayName, + projectIdentifier, + versionMetadata, + } = taskData?.task ?? {}; + const { order: skipOrderNumber } = versionMetadata?.baseVersion ?? {}; + const bvOptionsBase = { tasks: [applyStrictRegex(displayName)], variants: [applyStrictRegex(buildVariant)],