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

DEVPROD-948: Allow setting Parsley filters for repos #2135

Merged
merged 6 commits into from
Nov 8, 2023

Conversation

sophstad
Copy link
Contributor

@sophstad sophstad commented Nov 1, 2023

DEVPROD-948

Description

  • Allow users to save Parsley filters for repos
  • For attached projects, show repo level filters in a disabled view
  • I didn't add a "Move filters to repo" button like we have for variables; due to the usage rate of filters, this would be high effort with low impact. It's easy enough to copy the values over manually.
  • Fun update: because the Project resolver applies the includeRepo flag, Parsley already handles applying repo-level filters without any further updates 🎉 you can try it out as part of reviewing this PR! I personally don't think there's any need to distinguish a project vs repo-level filter on the Parsley UI. nvm 😢 small backend update required: DEVPROD-948: Return repo level filters with project evergreen#7200

Screenshots

Repo view:
image

Project view:
image

Copy link

cypress bot commented Nov 1, 2023

Passing run #13729 ↗︎

0 601 7 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Codegen
Project: Spruce Commit: 70ff39abaf
Status: Passed Duration: 18:30 💡
Started: Nov 7, 2023 10:34 PM Ended: Nov 7, 2023 10:52 PM

Review all test suite changes for PR #2135 ↗︎

@sophstad sophstad requested a review from a team November 2, 2023 14:37
@sophstad sophstad marked this pull request as ready for review November 2, 2023 14:37
@@ -2,44 +2,15 @@ import { GetFormSchema } from "components/SpruceForm";
import { CardFieldTemplate } from "components/SpruceForm/FieldTemplates";
import widgets from "components/SpruceForm/Widgets";
import { ProjectHealthView } from "gql/generated/types";
import { ProjectType } from "../utils";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I be able to see the repo filters on Parsley in the project filters modal? I'm testing using localhost, but I don't see them... :o

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I opened an Evergreen PR to address this: evergreen-ci/evergreen#7200

@@ -2,44 +2,15 @@ import { GetFormSchema } from "components/SpruceForm";
import { CardFieldTemplate } from "components/SpruceForm/FieldTemplates";
import widgets from "components/SpruceForm/Widgets";
import { ProjectHealthView } from "gql/generated/types";
import { ProjectType } from "../utils";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the repo and project filter use the same filter expression? Should they count as separate filters or should they be deduplicated? (For the project filters, it errors if you try to define the same filter expression more than once)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good callout, added repo values to the same validation

Copy link
Contributor

@minnakt minnakt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job, i see the filters in Parsley now! 🤩

Comment on lines +22 to +23
...(projectType !== ProjectType.Repo &&
"projectHealthView" in projectRef && {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to check the ProjectType?

Suggested change
...(projectType !== ProjectType.Repo &&
"projectHealthView" in projectRef && {
...("projectHealthView" in projectRef && {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly necessary, but this is the pattern we've used on other pages for non-repo settings and I feel like it makes it clear that that's the intended purpose.

Comment on lines 41 to 43
...("view" in formState && {
projectHealthView: formState.view.projectHealthView,
}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to keep the destructuring on L31 and then do:

Suggested change
...("view" in formState && {
projectHealthView: formState.view.projectHealthView,
}),
...(view && {
projectHealthView: view.projectHealthView,
}),

@@ -1,13 +1,16 @@
import { ProjectHealthView, ProjectSettingsInput } from "gql/generated/types";
import { data } from "../testData";
import { ProjectType } from "../utils";
import { formToGql, gqlToForm } from "./transformers";
import { ViewsFormState } from "./types";

const { projectBase } = data;

describe("project data", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think another test using the repo data showing that the project health view gets correctly omitted would be nice!

@sophstad sophstad merged commit 9853281 into evergreen-ci:main Nov 8, 2023
5 checks passed
@sophstad sophstad deleted the DEVPROD-948 branch November 8, 2023 14:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants