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

Commit

Permalink
Merge branch 'main' of https://github.com/evergreen-ci/spruce into EV…
Browse files Browse the repository at this point in the history
  • Loading branch information
sophstad committed Sep 21, 2023
2 parents b2babcc + 7df69bb commit 7a8a2d7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7981,7 +7981,11 @@ export type SpruceConfigQuery = {
port: number;
}>;
} | null;
jira?: { __typename?: "JiraConfig"; host?: string | null } | null;
jira?: {
__typename?: "JiraConfig";
email?: string | null;
host?: string | null;
} | null;
keys: Array<{ __typename?: "SSHKey"; location: string; name: string }>;
providers?: {
__typename?: "CloudProviderConfig";
Expand Down
1 change: 1 addition & 0 deletions src/gql/queries/spruce-config.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ query SpruceConfig {
}
}
jira {
email
host
}
keys {
Expand Down
6 changes: 5 additions & 1 deletion src/pages/projectSettings/tabs/PluginsTab/PluginsTab.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useMemo } from "react";
import { ValidateProps } from "components/SpruceForm";
import { ProjectSettingsTabRoutes } from "constants/routes";
import { useSpruceConfig } from "hooks";
import { BaseTab } from "../BaseTab";
import { ProjectType } from "../utils";
import { getFormSchema } from "./getFormSchema";
Expand All @@ -14,13 +15,16 @@ export const PluginsTab: React.FC<TabProps> = ({
repoData,
}) => {
const initialFormState = projectData || repoData;
const spruceConfig = useSpruceConfig();
const jiraEmail = spruceConfig?.jira?.email;

const formSchema = useMemo(
() =>
getFormSchema(
jiraEmail,
projectType === ProjectType.AttachedProject ? repoData : null
),
[projectType, repoData]
[jiraEmail, projectType, repoData]
);

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { InlineCode } from "@leafygreen-ui/typography";
import { GetFormSchema } from "components/SpruceForm";
import { CardFieldTemplate } from "components/SpruceForm/FieldTemplates";
import widgets from "components/SpruceForm/Widgets";
Expand Down Expand Up @@ -30,6 +31,7 @@ const requesters = [
];

export const getFormSchema = (
jiraEmail?: string,
repoData?: PluginsFormState
): ReturnType<GetFormSchema> => ({
fields: {},
Expand Down Expand Up @@ -228,16 +230,29 @@ export const getFormSchema = (
},
ticketSearchProjects: {
"ui:description":
"Specify an existing JIRA project to search for tickets related to a failing task",
"Specify an existing JIRA project to search for tickets related to a failing task.",
"ui:addButtonText": "Add Search Project",
"ui:orderable": false,
items: {
"ui:label": false,
},
},
ticketCreateProject: {
"ui:description":
"Specify an existing JIRA project to create tickets in when the File Ticket button is clicked on a failing task.",
"ui:description": (
<>
Specify an existing JIRA project to create tickets in when the File
Ticket button is clicked on a failing task.
{jiraEmail && (
<>
{" "}
This project must include <InlineCode>
{jiraEmail}
</InlineCode>{" "}
as a user with create permissions.
</>
)}
</>
),
},
fileTicketWebhook: {
"ui:description":
Expand Down

0 comments on commit 7a8a2d7

Please sign in to comment.