From cd7a950361c3c42f6ccf9157bd34a09ccf23b81d Mon Sep 17 00:00:00 2001 From: minnakt Date: Mon, 9 Oct 2023 16:42:07 -0400 Subject: [PATCH 1/3] EVG-20692: Indicate if a version is ignored --- cypress/integration/version/banners.ts | 27 ++++++++++++++++--- src/constants/externalResources.ts | 2 ++ src/gql/generated/types.ts | 2 ++ src/gql/queries/mainline-commits.graphql | 1 + src/gql/queries/version.graphql | 1 + src/pages/Version.tsx | 4 ++- .../InactiveCommits.stories.tsx | 9 ++++++- .../InactiveCommits/InactiveCommits.test.tsx | 8 +++++- src/pages/commits/InactiveCommits/index.tsx | 13 +++++++++ src/pages/commits/ProjectHealth.stories.tsx | 1 + .../version/Banners/IgnoredBanner/index.tsx | 22 +++++++++++++++ src/pages/version/Banners/index.tsx | 3 ++- 12 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 src/pages/version/Banners/IgnoredBanner/index.tsx diff --git a/cypress/integration/version/banners.ts b/cypress/integration/version/banners.ts index f152aee3ea..7e70a84d56 100644 --- a/cypress/integration/version/banners.ts +++ b/cypress/integration/version/banners.ts @@ -2,11 +2,11 @@ describe("banners", () => { const versionWithBanners = "/version/logkeeper_e864cf934194c161aa044e4599c8c81cee7b6237/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC"; - beforeEach(() => { - cy.visit(versionWithBanners); - }); - describe("errors", () => { + beforeEach(() => { + cy.visit(versionWithBanners); + }); + it("should display the number of configuration errors", () => { cy.dataCy("configuration-errors-banner").should("be.visible"); cy.contains("4 errors in configuration file").should("be.visible"); @@ -19,6 +19,10 @@ describe("banners", () => { }); describe("warnings", () => { + beforeEach(() => { + cy.visit(versionWithBanners); + }); + it("should display the number of configuration warnings", () => { cy.dataCy("configuration-warnings-banner").should("be.visible"); cy.contains("3 warnings in configuration file").should("be.visible"); @@ -29,4 +33,19 @@ describe("banners", () => { cy.get("ol").find("li").should("have.length", 3); }); }); + + describe("ignored", () => { + it("should display a banner", () => { + cy.visit("/version/spruce_e695f654c8b4b959d3e12e71696c3e318bcd4c33"); + cy.dataCy("ignored-banner").should("be.visible"); + }); + + it("should indicate if a version is ignored in the inactive commits tooltip", () => { + cy.visit("/commits/spruce"); + cy.dataCy("ignored-version-icon").should("not.exist"); + cy.dataCy("inactive-commits-button").click(); + cy.dataCy("inactive-commits-tooltip").should("be.visible"); + cy.dataCy("ignored-version-icon").should("be.visible"); + }); + }); }); diff --git a/src/constants/externalResources.ts b/src/constants/externalResources.ts index 768bcca167..39f6c1507b 100644 --- a/src/constants/externalResources.ts +++ b/src/constants/externalResources.ts @@ -26,6 +26,8 @@ export const githubChecksAliasesDocumentationUrl = `${projectDistroSettingsDocum export const githubMergeQueueDocumentationUrl = `${wikiBaseUrl}/Project-Configuration/Merge-Queue`; +export const ignoredFilesDocumentationUrl = `${wikiBaseUrl}/Project-Configuration/Project-Configuration-Files#ignoring-changes-to-certain-files`; + export const cliDocumentationUrl = `${wikiBaseUrl}/CLI`; export const windowsPasswordRulesURL = diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index 538313c0c0..bd327e9cbe 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -6182,6 +6182,7 @@ export type MainlineCommitsQuery = { author: string; createTime: Date; id: string; + ignored: boolean; message: string; order: number; revision: string; @@ -8739,6 +8740,7 @@ export type VersionQuery = { errors: Array; finishTime?: Date | null; id: string; + ignored: boolean; isPatch: boolean; message: string; order: number; diff --git a/src/gql/queries/mainline-commits.graphql b/src/gql/queries/mainline-commits.graphql index 37ab99e212..1c7c7609fd 100644 --- a/src/gql/queries/mainline-commits.graphql +++ b/src/gql/queries/mainline-commits.graphql @@ -18,6 +18,7 @@ query MainlineCommits( author createTime id + ignored message order revision diff --git a/src/gql/queries/version.graphql b/src/gql/queries/version.graphql index 6098ede1ae..9876fb62fc 100644 --- a/src/gql/queries/version.graphql +++ b/src/gql/queries/version.graphql @@ -19,6 +19,7 @@ query Version($id: String!) { tag } id + ignored isPatch manifest { branch diff --git a/src/pages/Version.tsx b/src/pages/Version.tsx index bf09017533..838eefeee7 100644 --- a/src/pages/Version.tsx +++ b/src/pages/Version.tsx @@ -28,7 +28,7 @@ import { PageDoesNotExist } from "pages/404"; import { isPatchUnconfigured } from "utils/patch"; import { shortenGithash, githubPRLinkify } from "utils/string"; import { jiraLinkify } from "utils/string/jiraLinkify"; -import { WarningBanner, ErrorBanner } from "./version/Banners"; +import { WarningBanner, ErrorBanner, IgnoredBanner } from "./version/Banners"; import VersionPageBreadcrumbs from "./version/Breadcrumbs"; import BuildVariantCard from "./version/BuildVariantCard"; import { ActionButtons, Metadata, VersionTabs } from "./version/index"; @@ -133,6 +133,7 @@ export const VersionPage: React.FC = () => { const { version } = versionData || {}; const { errors, + ignored, isPatch, message, order, @@ -165,6 +166,7 @@ export const VersionPage: React.FC = () => { {errors && errors.length > 0 && } {warnings && warnings.length > 0 && } + {ignored && } {version && ( = { }, }; -const versions = [ +const versions: CommitRolledUpVersions = [ { id: "123", createTime: new Date("2021-06-16T23:38:13Z"), @@ -20,6 +21,7 @@ const versions = [ order: 39365, author: "Mohamed Khelif", revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112", + ignored: false, upstreamProject: { triggerID: "123", triggerType: "task", @@ -38,6 +40,7 @@ const versions = [ order: 39366, author: "Arjun Patel", revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112", + ignored: false, }, { id: "123", @@ -46,6 +49,7 @@ const versions = [ order: 39365, author: "Mohamed Khelif", revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112", + ignored: false, }, { id: "123", @@ -54,6 +58,7 @@ const versions = [ order: 39366, author: "Arjun Patel", revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112", + ignored: false, }, { id: "123", @@ -62,6 +67,7 @@ const versions = [ order: 39365, author: "Elena Chen", revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112", + ignored: true, }, { id: "123", @@ -70,5 +76,6 @@ const versions = [ order: 39366, author: "Sophie Stadler", revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f112", + ignored: false, }, ]; diff --git a/src/pages/commits/InactiveCommits/InactiveCommits.test.tsx b/src/pages/commits/InactiveCommits/InactiveCommits.test.tsx index 716ffbb6ba..35ca678f30 100644 --- a/src/pages/commits/InactiveCommits/InactiveCommits.test.tsx +++ b/src/pages/commits/InactiveCommits/InactiveCommits.test.tsx @@ -107,7 +107,7 @@ describe("inactiveCommitButton", () => { }); const time = new Date("2021-06-16T23:38:13Z"); -const versions = [ +const versions: CommitRolledUpVersions = [ { id: "1", createTime: time, @@ -115,6 +115,7 @@ const versions = [ order: 39365, author: "Mohamed Khelif", revision: "4137c33fa4a0d5c747a1115f0853b5f70e46f112", + ignored: false, }, { id: "2", @@ -123,6 +124,7 @@ const versions = [ order: 39366, author: "Arjun Patel", revision: "4237c33fa4a0d5c747a1115f0853b5f70e46f113", + ignored: false, }, { id: "3", @@ -131,6 +133,7 @@ const versions = [ order: 39365, author: "Mohamed Khelif", revision: "4337c33fa4a0d5c747a1115f0853b5f70e46f114", + ignored: false, }, { id: "4", @@ -139,6 +142,7 @@ const versions = [ order: 39366, author: "Arjun Patel", revision: "4437c33fa4a0d5c747a1115f0853b5f70e46f115", + ignored: false, }, { id: "5", @@ -147,6 +151,7 @@ const versions = [ order: 39365, author: "Elena Chen", revision: "4537c33fa4a0d5c747a1115f0853b5f70e46f116", + ignored: false, }, { id: "6", @@ -155,5 +160,6 @@ const versions = [ order: 39366, author: "Sophie Stadler", revision: "4637c33fa4a0d5c747a1115f0853b5f70e46f117", + ignored: false, }, ]; diff --git a/src/pages/commits/InactiveCommits/index.tsx b/src/pages/commits/InactiveCommits/index.tsx index 7bd219bd23..906159ecc2 100644 --- a/src/pages/commits/InactiveCommits/index.tsx +++ b/src/pages/commits/InactiveCommits/index.tsx @@ -5,6 +5,7 @@ import Tooltip from "@leafygreen-ui/tooltip"; import { Disclaimer } from "@leafygreen-ui/typography"; import { useProjectHealthAnalytics } from "analytics/projectHealth/useProjectHealthAnalytics"; import { DisplayModal } from "components/DisplayModal"; +import Icon from "components/Icon"; import { StyledRouterLink } from "components/styles"; import { getVersionRoute, getTaskRoute } from "constants/routes"; import { size, zIndex, fontSize } from "constants/tokens"; @@ -167,6 +168,13 @@ const CommitCopy: React.FC = ({ isTooltip, v }) => { )} + {v.ignored && ( + + )} {v.author} -{" "} {jiraLinkify(message, jiraHost, () => { sendEvent({ @@ -181,6 +189,11 @@ const CommitCopy: React.FC = ({ isTooltip, v }) => { ); }; +const StyledIcon = styled(Icon)` + margin-right: ${size.xxs}; + vertical-align: text-bottom; +`; + const InactiveCommitContainer = styled.div` display: flex; justify-content: center; diff --git a/src/pages/commits/ProjectHealth.stories.tsx b/src/pages/commits/ProjectHealth.stories.tsx index 98b8d2d5fa..a9c8e96531 100644 --- a/src/pages/commits/ProjectHealth.stories.tsx +++ b/src/pages/commits/ProjectHealth.stories.tsx @@ -235,6 +235,7 @@ const versions: Commits = [ order: 927, message: "v2.11.1", revision: "a77bd39ccf515b63327dc2355a8444955043c66a", + ignored: false, }, ], }, diff --git a/src/pages/version/Banners/IgnoredBanner/index.tsx b/src/pages/version/Banners/IgnoredBanner/index.tsx new file mode 100644 index 0000000000..1215b61a47 --- /dev/null +++ b/src/pages/version/Banners/IgnoredBanner/index.tsx @@ -0,0 +1,22 @@ +import Banner, { Variant } from "@leafygreen-ui/banner"; +import { StyledLink } from "components/styles"; +import { ignoredFilesDocumentationUrl } from "constants/externalResources"; +import { BannerContainer } from "../styles"; + +const IgnoredBanner: React.FC = () => ( + + + This revision will not be automatically scheduled, because only{" "} + + ignored files + {" "} + are changed. It may still be scheduled manually, or on failure stepback. + + +); + +export default IgnoredBanner; diff --git a/src/pages/version/Banners/index.tsx b/src/pages/version/Banners/index.tsx index 83899bd75e..2329a7a836 100644 --- a/src/pages/version/Banners/index.tsx +++ b/src/pages/version/Banners/index.tsx @@ -1,4 +1,5 @@ import ErrorBanner from "./ErrorBanner"; +import IgnoredBanner from "./IgnoredBanner"; import WarningBanner from "./WarningBanner"; -export { WarningBanner, ErrorBanner }; +export { WarningBanner, ErrorBanner, IgnoredBanner }; From c2d165d751344fda971007fc19a090c831e18970 Mon Sep 17 00:00:00 2001 From: minnakt Date: Mon, 9 Oct 2023 20:29:38 -0400 Subject: [PATCH 2/3] Fix copy-paste error --- src/pages/version/Banners/IgnoredBanner/index.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/version/Banners/IgnoredBanner/index.tsx b/src/pages/version/Banners/IgnoredBanner/index.tsx index 1215b61a47..291732da56 100644 --- a/src/pages/version/Banners/IgnoredBanner/index.tsx +++ b/src/pages/version/Banners/IgnoredBanner/index.tsx @@ -7,11 +7,7 @@ const IgnoredBanner: React.FC = () => ( This revision will not be automatically scheduled, because only{" "} - + ignored files {" "} are changed. It may still be scheduled manually, or on failure stepback. From 6dfb482f03133c527b8276c496e27b34af4286c5 Mon Sep 17 00:00:00 2001 From: minnakt Date: Tue, 10 Oct 2023 12:35:50 -0400 Subject: [PATCH 3/3] Add unit test --- cypress/integration/version/banners.ts | 4 +-- src/components/Icon/icons/index.tsx | 25 +++++++++++++++++++ .../InactiveCommits/InactiveCommits.test.tsx | 13 +++++++++- src/pages/commits/InactiveCommits/index.tsx | 8 +----- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/cypress/integration/version/banners.ts b/cypress/integration/version/banners.ts index 7e70a84d56..c7c209d5ee 100644 --- a/cypress/integration/version/banners.ts +++ b/cypress/integration/version/banners.ts @@ -42,10 +42,10 @@ describe("banners", () => { it("should indicate if a version is ignored in the inactive commits tooltip", () => { cy.visit("/commits/spruce"); - cy.dataCy("ignored-version-icon").should("not.exist"); + cy.dataCy("ignored-icon").should("not.exist"); cy.dataCy("inactive-commits-button").click(); cy.dataCy("inactive-commits-tooltip").should("be.visible"); - cy.dataCy("ignored-version-icon").should("be.visible"); + cy.dataCy("ignored-icon").should("be.visible"); }); }); }); diff --git a/src/components/Icon/icons/index.tsx b/src/components/Icon/icons/index.tsx index 24fb86eeb3..cfeded92e1 100644 --- a/src/components/Icon/icons/index.tsx +++ b/src/components/Icon/icons/index.tsx @@ -6,6 +6,7 @@ const { green } = palette; interface LeafygreenIconProps extends React.SVGProps { size?: number; role?: "presentation" | "img"; + ["data-cy"]?: string; } export const EvergreenLogo: React.ComponentType = ({ @@ -241,3 +242,27 @@ export const Loading: React.ComponentType = ({ ); + +export const Ignored: React.ComponentType = ({ + className, + "data-cy": dataCy, + fill, + size = 16, +}) => ( + + + +); diff --git a/src/pages/commits/InactiveCommits/InactiveCommits.test.tsx b/src/pages/commits/InactiveCommits/InactiveCommits.test.tsx index 35ca678f30..6cdf5855eb 100644 --- a/src/pages/commits/InactiveCommits/InactiveCommits.test.tsx +++ b/src/pages/commits/InactiveCommits/InactiveCommits.test.tsx @@ -104,6 +104,17 @@ describe("inactiveCommitButton", () => { "6Unmatching" ); }); + + it("should show ignored icon for ignored versions", async () => { + const user = userEvent.setup(); + render(); + expect(screen.queryByDataCy("inactive-commits-tooltip")).toBeNull(); + await user.click(screen.queryByDataCy("inactive-commits-button")); + await waitFor(() => { + expect(screen.queryByDataCy("inactive-commits-tooltip")).toBeVisible(); + }); + expect(screen.getByDataCy("ignored-icon")).toBeVisible(); + }); }); const time = new Date("2021-06-16T23:38:13Z"); @@ -115,7 +126,7 @@ const versions: CommitRolledUpVersions = [ order: 39365, author: "Mohamed Khelif", revision: "4137c33fa4a0d5c747a1115f0853b5f70e46f112", - ignored: false, + ignored: true, }, { id: "2", diff --git a/src/pages/commits/InactiveCommits/index.tsx b/src/pages/commits/InactiveCommits/index.tsx index 906159ecc2..1e03188ad6 100644 --- a/src/pages/commits/InactiveCommits/index.tsx +++ b/src/pages/commits/InactiveCommits/index.tsx @@ -168,13 +168,7 @@ const CommitCopy: React.FC = ({ isTooltip, v }) => { )} - {v.ignored && ( - - )} + {v.ignored && } {v.author} -{" "} {jiraLinkify(message, jiraHost, () => { sendEvent({