From f10d2b9549b7ff1c2f51eeddd6d71716e14d144e Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Tue, 19 Sep 2023 17:18:37 -0400 Subject: [PATCH 01/17] EVG-19815: Remove GET_ prefix from GraphQL queries (#2046) --- src/analytics/patch/usePatchAnalytics.ts | 13 +- src/analytics/task/useAnnotationAnalytics.ts | 6 +- src/analytics/task/useTaskAnalytics.ts | 13 +- src/analytics/version/useVersionAnalytics.ts | 4 +- .../Banners/GithubUsernameBanner.tsx | 4 +- src/components/Banners/ProjectBanner.tsx | 4 +- .../Banners/SlackNotificationBanner.tsx | 5 +- src/components/CodeChanges/index.tsx | 4 +- src/components/Content/Layout.tsx | 4 +- src/components/Header/Navbar.tsx | 4 +- src/components/Header/UserDropdown.tsx | 4 +- .../hooks/useTestResults.test.tsx | 8 +- .../HistoryTable/hooks/useTestResults.ts | 4 +- src/components/Notifications/index.tsx | 4 +- .../ScheduleTasks/testData.ts | 6 +- .../ProjectSelect/ProjectSelect.test.tsx | 8 +- src/components/ProjectSelect/index.tsx | 6 +- src/components/ProjectSelect/testData.ts | 6 +- .../Redirects/ProjectSettingsRedirect.tsx | 4 +- src/components/ScheduleTasksModal/index.tsx | 4 +- src/components/Spawn/MountVolumeSelect.tsx | 4 +- .../Spawn/editHostModal/useLoadFormData.ts | 14 +- .../spawnHostModal/useLoadFormSchemaData.ts | 21 +- .../Spawn/spawnVolumeModal/useLoadFormData.ts | 6 +- .../VersionRestartModal.tsx | 4 +- src/gql/generated/types.ts | 1249 +++++++++-------- src/gql/mocks/getUser.ts | 4 +- ...-agent-logs.graphql => agent-logs.graphql} | 0 ...{get-all-logs.graphql => all-logs.graphql} | 0 ....graphql => annotation-event-data.graphql} | 0 ....graphql => base-version-and-task.graphql} | 0 ...graphql => build-baron-configured.graphql} | 0 ...uild-baron.graphql => build-baron.graphql} | 0 ...ts.graphql => build-variant-stats.graphql} | 0 ...l => build-variants-for-task-name.graphql} | 0 ...l => build-variants-with-children.graphql} | 0 ...t-config.graphql => client-config.graphql} | 0 ...e-changes.graphql => code-changes.graphql} | 0 ...mit-queue.graphql => commit-queue.graphql} | 0 ...ickets.graphql => created-tickets.graphql} | 0 ...play-task.graphql => display-task.graphql} | 0 .../{get-distros.graphql => distros.graphql} | 0 ...ithub-orgs.graphql => github-orgs.graphql} | 0 ...aphql => github-project-conflicts.graphql} | 0 ...as-version.graphql => has-version.graphql} | 0 ...ost-events.graphql => host-events.graphql} | 0 .../{get-host.graphql => host.graphql} | 0 src/gql/queries/index.ts | 284 ++-- ...e-types.graphql => instance-types.graphql} | 0 ...ed.graphql => is-patch-configured.graphql} | 0 ...hql => jira-custom-created-issues.graphql} | 0 ...ira-issues.graphql => jira-issues.graphql} | 0 ....graphql => jira-suspected-issues.graphql} | 0 ...t.graphql => last-mainline-commit.graphql} | 0 ...aphql => logkeeper-build-metadata.graphql} | 0 ...l => mainline-commits-for-history.graphql} | 0 ...mmits.graphql => mainline-commits.graphql} | 0 ...{get-my-hosts.graphql => my-hosts.graphql} | 0 ...-my-volumes.graphql => my-volumes.graphql} | 0 ...-other-user.graphql => other-user.graphql} | 0 ...figure.graphql => patch-configure.graphql} | 0 ...es.graphql => patch-task-statuses.graphql} | 0 .../{get-patch.graphql => patch.graphql} | 0 ...-pod-events.graphql => pod-events.graphql} | 0 .../queries/{get-pod.graphql => pod.graphql} | 0 ...-banner.graphql => project-banner.graphql} | 0 ...ogs.graphql => project-event-logs.graphql} | 0 ...tings.graphql => project-settings.graphql} | 0 ...{get-projects.graphql => projects.graphql} | 0 ...ublic-keys.graphql => public-keys.graphql} | 0 ...t-logs.graphql => repo-event-logs.graphql} | 0 ...settings.graphql => repo-settings.graphql} | 0 ...ystem-logs.graphql => system-logs.graphql} | 0 ...ns.graphql => task-all-executions.graphql} | 0 ...t-logs.graphql => task-event-logs.graphql} | 0 ...-task-files.graphql => task-files.graphql} | 0 ...et-task-logs.graphql => task-logs.graphql} | 0 ...l => task-names-for-build-variant.graphql} | 0 ...statuses.graphql => task-statuses.graphql} | 0 ...ample.graphql => task-test-sample.graphql} | 0 ...-task-tests.graphql => task-tests.graphql} | 0 .../{get-task.graphql => task.graphql} | 0 ...sks.graphql => undispatched-tasks.graphql} | 0 ...ser-config.graphql => user-config.graphql} | 0 ...settings.graphql => user-settings.graphql} | 0 .../{get-user.graphql => user.graphql} | 0 ...graphql => version-task-durations.graphql} | 0 ...on-tasks.graphql => version-tasks.graphql} | 0 .../{get-version.graphql => version.graphql} | 0 ...ects.graphql => viewable-projects.graphql} | 0 src/hooks/tests/useBreadcrumbRoot.test.tsx | 6 +- ...useDisableSpawnExpirationCheckbox.test.tsx | 6 +- ...useGetUserPatchesPageTitleAndLink.test.tsx | 8 +- .../useDisableSpawnExpirationCheckbox.ts | 6 +- .../useGetUserPatchesPageTitleAndLink.ts | 4 +- src/hooks/useTaskStatuses.ts | 4 +- src/hooks/useUserSettings.ts | 4 +- src/hooks/useUserTimeZone.ts | 4 +- src/pages/CommitQueue.tsx | 4 +- src/pages/JobLogs.tsx | 4 +- src/pages/Login.tsx | 4 +- src/pages/MyPatches.tsx | 4 +- src/pages/ProjectPatches.tsx | 4 +- src/pages/Task.tsx | 4 +- src/pages/UserPatches.tsx | 4 +- src/pages/Version.tsx | 12 +- .../WaterfallTaskStatusIcon.test.tsx | 4 +- .../WaterfallTaskStatusIcon/index.tsx | 4 +- .../WaterfallTaskStatusIcon/testData.ts | 4 +- src/pages/commits/index.tsx | 4 +- .../configurePatchCore/testData.ts | 4 +- src/pages/configurePatch/index.tsx | 4 +- src/pages/container/EventsTable/index.tsx | 4 +- src/pages/container/index.tsx | 21 +- .../DistroSelect/DistroSelect.test.tsx | 4 +- .../distroSettings/DistroSelect/index.tsx | 4 +- .../tabs/EventLogTab/EventLogTab.test.tsx | 8 +- src/pages/host/index.tsx | 6 +- .../preferencesTabs/ProfileTab.tsx | 4 +- .../preferencesTabs/PublicKeysTab.tsx | 6 +- .../cliTab/AuthenticationCard.tsx | 4 +- .../preferencesTabs/cliTab/DownloadCard.tsx | 4 +- .../preferencesTabs/cliTab/VerifyCard.tsx | 4 +- .../publicKeysTab/EditModal.tsx | 8 +- .../projectSettings/CopyProjectModal.test.tsx | 6 +- .../CreateProjectModal.test.tsx | 4 +- .../projectSettings/CreateProjectModal.tsx | 4 +- src/pages/projectSettings/index.tsx | 6 +- .../tabs/EventLogTab/EventLogTab.test.tsx | 4 +- .../EventLogTab/useProjectSettingsEvents.ts | 6 +- .../Fields/RepoConfigField.test.tsx | 4 +- .../GeneralTab/Fields/RepoConfigField.tsx | 4 +- .../GithubCommitQueueTab.tsx | 4 +- src/pages/spawn/SpawnHost.tsx | 4 +- src/pages/spawn/SpawnVolume.tsx | 4 +- .../spawn/spawnHost/SpawnHostActionButton.tsx | 6 +- .../spawn/spawnHost/SpawnHostButton.test.tsx | 8 +- src/pages/spawn/spawnHost/SpawnHostButton.tsx | 4 +- .../spawnHostButton/SpawnHostModal.tsx | 4 +- .../spawnVolume/SpawnVolumeModal.test.tsx | 12 +- .../spawnVolumeTableActions/UnmountButton.tsx | 4 +- .../previousCommits/PreviousCommits.test.tsx | 29 +- .../actionButtons/previousCommits/index.tsx | 13 +- .../executionDropdown/ExecutionSelector.tsx | 4 +- src/pages/task/taskTabs/FileTable/index.tsx | 4 +- src/pages/task/taskTabs/TestsTable.tsx | 4 +- .../BuildBaron.test.tsx | 6 +- .../buildBaronAndAnnotations/BuildBaron.tsx | 4 +- .../BuildBaronContent.tsx | 9 +- .../Issues/Issues.tsx | 4 +- .../Issues/SuspectedIssues.tsx | 4 +- .../useBuildBaronVariables.ts | 4 +- src/pages/task/taskTabs/logs/LogTypes.tsx | 20 +- .../taskHistory/BuildVariantSelector.tsx | 4 +- .../ColumnHeaders/ColumnHeaders.test.tsx | 4 +- src/pages/taskHistory/ColumnHeaders/index.tsx | 4 +- .../TaskHistoryRow/TaskHistoryRow.test.tsx | 8 +- src/pages/taskHistory/index.tsx | 4 +- .../variantHistory/ColumnHeaders.test.tsx | 4 +- src/pages/variantHistory/ColumnHeaders.tsx | 4 +- src/pages/variantHistory/TaskSelector.tsx | 4 +- .../variantHistory/VariantHistoryRow.test.tsx | 8 +- src/pages/variantHistory/index.tsx | 4 +- src/pages/version/BuildVariantCard/index.tsx | 4 +- .../version/BuildVariantCard/testData.ts | 4 +- src/pages/version/EnqueueModal.tsx | 4 +- src/pages/version/TaskDuration.tsx | 4 +- src/pages/version/Tasks.tsx | 4 +- .../DownstreamProjectAccordion.tsx | 4 +- 169 files changed, 1059 insertions(+), 1090 deletions(-) rename src/gql/queries/{get-agent-logs.graphql => agent-logs.graphql} (100%) rename src/gql/queries/{get-all-logs.graphql => all-logs.graphql} (100%) rename src/gql/queries/{get-annotation-event-data.graphql => annotation-event-data.graphql} (100%) rename src/gql/queries/{get-base-version-and-task.graphql => base-version-and-task.graphql} (100%) rename src/gql/queries/{get-build-baron-configured.graphql => build-baron-configured.graphql} (100%) rename src/gql/queries/{get-build-baron.graphql => build-baron.graphql} (100%) rename src/gql/queries/{get-build-variant-stats.graphql => build-variant-stats.graphql} (100%) rename src/gql/queries/{get-build-variants-for-task-name.graphql => build-variants-for-task-name.graphql} (100%) rename src/gql/queries/{get-build-variants-with-children.graphql => build-variants-with-children.graphql} (100%) rename src/gql/queries/{get-client-config.graphql => client-config.graphql} (100%) rename src/gql/queries/{get-code-changes.graphql => code-changes.graphql} (100%) rename src/gql/queries/{get-commit-queue.graphql => commit-queue.graphql} (100%) rename src/gql/queries/{get-created-tickets.graphql => created-tickets.graphql} (100%) rename src/gql/queries/{get-display-task.graphql => display-task.graphql} (100%) rename src/gql/queries/{get-distros.graphql => distros.graphql} (100%) rename src/gql/queries/{get-github-orgs.graphql => github-orgs.graphql} (100%) rename src/gql/queries/{get-github-project-conflicts.graphql => github-project-conflicts.graphql} (100%) rename src/gql/queries/{get-has-version.graphql => has-version.graphql} (100%) rename src/gql/queries/{get-host-events.graphql => host-events.graphql} (100%) rename src/gql/queries/{get-host.graphql => host.graphql} (100%) rename src/gql/queries/{get-instance-types.graphql => instance-types.graphql} (100%) rename src/gql/queries/{get-is-patch-configured.graphql => is-patch-configured.graphql} (100%) rename src/gql/queries/{get-jira-custom-created-issues.graphql => jira-custom-created-issues.graphql} (100%) rename src/gql/queries/{get-jira-issues.graphql => jira-issues.graphql} (100%) rename src/gql/queries/{get-jira-suspected-issues.graphql => jira-suspected-issues.graphql} (100%) rename src/gql/queries/{get-last-mainline-commit.graphql => last-mainline-commit.graphql} (100%) rename src/gql/queries/{get-logkeeper-build-metadata.graphql => logkeeper-build-metadata.graphql} (100%) rename src/gql/queries/{get-mainline-commits-for-history.graphql => mainline-commits-for-history.graphql} (100%) rename src/gql/queries/{get-mainline-commits.graphql => mainline-commits.graphql} (100%) rename src/gql/queries/{get-my-hosts.graphql => my-hosts.graphql} (100%) rename src/gql/queries/{get-my-volumes.graphql => my-volumes.graphql} (100%) rename src/gql/queries/{get-other-user.graphql => other-user.graphql} (100%) rename src/gql/queries/{get-patch-configure.graphql => patch-configure.graphql} (100%) rename src/gql/queries/{get-patch-task-statuses.graphql => patch-task-statuses.graphql} (100%) rename src/gql/queries/{get-patch.graphql => patch.graphql} (100%) rename src/gql/queries/{get-pod-events.graphql => pod-events.graphql} (100%) rename src/gql/queries/{get-pod.graphql => pod.graphql} (100%) rename src/gql/queries/{get-project-banner.graphql => project-banner.graphql} (100%) rename src/gql/queries/{get-project-event-logs.graphql => project-event-logs.graphql} (100%) rename src/gql/queries/{get-project-settings.graphql => project-settings.graphql} (100%) rename src/gql/queries/{get-projects.graphql => projects.graphql} (100%) rename src/gql/queries/{get-public-keys.graphql => public-keys.graphql} (100%) rename src/gql/queries/{get-repo-event-logs.graphql => repo-event-logs.graphql} (100%) rename src/gql/queries/{get-repo-settings.graphql => repo-settings.graphql} (100%) rename src/gql/queries/{get-system-logs.graphql => system-logs.graphql} (100%) rename src/gql/queries/{get-task-all-executions.graphql => task-all-executions.graphql} (100%) rename src/gql/queries/{get-task-event-logs.graphql => task-event-logs.graphql} (100%) rename src/gql/queries/{get-task-files.graphql => task-files.graphql} (100%) rename src/gql/queries/{get-task-logs.graphql => task-logs.graphql} (100%) rename src/gql/queries/{get-task-names-for-build-variant.graphql => task-names-for-build-variant.graphql} (100%) rename src/gql/queries/{get-task-statuses.graphql => task-statuses.graphql} (100%) rename src/gql/queries/{get-task-test-sample.graphql => task-test-sample.graphql} (100%) rename src/gql/queries/{get-task-tests.graphql => task-tests.graphql} (100%) rename src/gql/queries/{get-task.graphql => task.graphql} (100%) rename src/gql/queries/{get-undispatched-tasks.graphql => undispatched-tasks.graphql} (100%) rename src/gql/queries/{get-user-config.graphql => user-config.graphql} (100%) rename src/gql/queries/{get-user-settings.graphql => user-settings.graphql} (100%) rename src/gql/queries/{get-user.graphql => user.graphql} (100%) rename src/gql/queries/{get-version-task-durations.graphql => version-task-durations.graphql} (100%) rename src/gql/queries/{get-version-tasks.graphql => version-tasks.graphql} (100%) rename src/gql/queries/{get-version.graphql => version.graphql} (100%) rename src/gql/queries/{get-viewable-projects.graphql => viewable-projects.graphql} (100%) diff --git a/src/analytics/patch/usePatchAnalytics.ts b/src/analytics/patch/usePatchAnalytics.ts index 42d21d3396..2a62c3e4ad 100644 --- a/src/analytics/patch/usePatchAnalytics.ts +++ b/src/analytics/patch/usePatchAnalytics.ts @@ -6,7 +6,7 @@ import { PatchQueryVariables, TaskSortCategory, } from "gql/generated/types"; -import { GET_PATCH } from "gql/queries"; +import { PATCH } from "gql/queries"; type Action = | { name: "Filter Tasks"; filterBy: string } @@ -49,13 +49,10 @@ type Action = | { name: "Open Schedule Tasks Modal" }; export const usePatchAnalytics = (id: string) => { - const { data: eventData } = useQuery( - GET_PATCH, - { - variables: { id }, - fetchPolicy: "cache-first", - } - ); + const { data: eventData } = useQuery(PATCH, { + variables: { id }, + fetchPolicy: "cache-first", + }); const { status } = eventData?.patch || {}; return useAnalyticsRoot("Patch", { diff --git a/src/analytics/task/useAnnotationAnalytics.ts b/src/analytics/task/useAnnotationAnalytics.ts index cbea73b95c..fce458b23c 100644 --- a/src/analytics/task/useAnnotationAnalytics.ts +++ b/src/analytics/task/useAnnotationAnalytics.ts @@ -8,7 +8,7 @@ import { AnnotationEventDataQuery, AnnotationEventDataQueryVariables, } from "gql/generated/types"; -import { GET_ANNOTATION_EVENT_DATA, GET_BUILD_BARON } from "gql/queries"; +import { ANNOTATION_EVENT_DATA, BUILD_BARON } from "gql/queries"; import { RequiredQueryParams } from "types/task"; import { queryString } from "utils"; @@ -36,13 +36,13 @@ export const useAnnotationAnalytics = () => { const { data: eventData } = useQuery< AnnotationEventDataQuery, AnnotationEventDataQueryVariables - >(GET_ANNOTATION_EVENT_DATA, { + >(ANNOTATION_EVENT_DATA, { variables: { taskId: id, execution }, fetchPolicy: "cache-first", }); const { data: bbData } = useQuery( - GET_BUILD_BARON, + BUILD_BARON, { variables: { taskId: id, execution }, fetchPolicy: "cache-first", diff --git a/src/analytics/task/useTaskAnalytics.ts b/src/analytics/task/useTaskAnalytics.ts index 7b8469b411..0fd4867cdb 100644 --- a/src/analytics/task/useTaskAnalytics.ts +++ b/src/analytics/task/useTaskAnalytics.ts @@ -8,7 +8,7 @@ import { TaskSortCategory, TestSortCategory, } from "gql/generated/types"; -import { GET_TASK } from "gql/queries"; +import { TASK } from "gql/queries"; import { CommitType } from "pages/task/actionButtons/previousCommits/types"; import { RequiredQueryParams, LogTypes } from "types/task"; import { queryString } from "utils"; @@ -71,13 +71,10 @@ export const useTaskAnalytics = () => { const parsed = parseQueryString(location.search); const execution = Number(parsed[RequiredQueryParams.Execution]); - const { data: eventData } = useQuery( - GET_TASK, - { - variables: { taskId: id, execution }, - fetchPolicy: "cache-first", - } - ); + const { data: eventData } = useQuery(TASK, { + variables: { taskId: id, execution }, + fetchPolicy: "cache-first", + }); const { failedTestCount, diff --git a/src/analytics/version/useVersionAnalytics.ts b/src/analytics/version/useVersionAnalytics.ts index 904286cecc..712ae92a7e 100644 --- a/src/analytics/version/useVersionAnalytics.ts +++ b/src/analytics/version/useVersionAnalytics.ts @@ -6,7 +6,7 @@ import { VersionQueryVariables, TaskSortCategory, } from "gql/generated/types"; -import { GET_VERSION } from "gql/queries"; +import { VERSION } from "gql/queries"; type Action = | { name: "Filter Tasks"; filterBy: string } @@ -52,7 +52,7 @@ type Action = export const useVersionAnalytics = (id: string) => { const { data: eventData } = useQuery( - GET_VERSION, + VERSION, { variables: { id }, fetchPolicy: "cache-first", diff --git a/src/components/Banners/GithubUsernameBanner.tsx b/src/components/Banners/GithubUsernameBanner.tsx index c8c34a2c92..5fe6d1e2ee 100644 --- a/src/components/Banners/GithubUsernameBanner.tsx +++ b/src/components/Banners/GithubUsernameBanner.tsx @@ -8,7 +8,7 @@ import { routes, } from "constants/routes"; import { UserSettingsQuery } from "gql/generated/types"; -import { GET_USER_SETTINGS } from "gql/queries"; +import { USER_SETTINGS } from "gql/queries"; export const GithubUsernameBanner = () => { const { pathname } = useLocation(); @@ -17,7 +17,7 @@ export const GithubUsernameBanner = () => { // USER SETTINGS QUERY const { data: userSettingsData } = useQuery( - GET_USER_SETTINGS, + USER_SETTINGS, { skip: !isPatchesPage } ); const { userSettings } = userSettingsData || {}; diff --git a/src/components/Banners/ProjectBanner.tsx b/src/components/Banners/ProjectBanner.tsx index 33243c869d..c589e76e8b 100644 --- a/src/components/Banners/ProjectBanner.tsx +++ b/src/components/Banners/ProjectBanner.tsx @@ -3,7 +3,7 @@ import { ProjectBannerQuery, ProjectBannerQueryVariables, } from "gql/generated/types"; -import { GET_PROJECT_BANNER } from "gql/queries"; +import { PROJECT_BANNER } from "gql/queries"; import { PortalBanner } from "./PortalBanner"; interface ProjectBannerProps { @@ -15,7 +15,7 @@ export const ProjectBanner: React.FC = ({ const { data: projectBannerData } = useQuery< ProjectBannerQuery, ProjectBannerQueryVariables - >(GET_PROJECT_BANNER, { + >(PROJECT_BANNER, { variables: { identifier: projectIdentifier }, skip: !projectIdentifier, }); diff --git a/src/components/Banners/SlackNotificationBanner.tsx b/src/components/Banners/SlackNotificationBanner.tsx index 7fe99a1cef..9d841bcbf8 100644 --- a/src/components/Banners/SlackNotificationBanner.tsx +++ b/src/components/Banners/SlackNotificationBanner.tsx @@ -15,7 +15,7 @@ import { UserSettingsQuery, } from "gql/generated/types"; import { UPDATE_USER_SETTINGS } from "gql/mutations"; -import { GET_USER_SETTINGS } from "gql/queries"; +import { USER_SETTINGS } from "gql/queries"; const { blue } = palette; @@ -41,8 +41,7 @@ export const SlackNotificationBanner = () => { }); // USER SETTINGS QUERY - const { data: userSettingsData } = - useQuery(GET_USER_SETTINGS); + const { data: userSettingsData } = useQuery(USER_SETTINGS); const { userSettings } = userSettingsData || {}; const { notifications, slackUsername: defaultSlackUsername } = userSettings || {}; diff --git a/src/components/CodeChanges/index.tsx b/src/components/CodeChanges/index.tsx index 61fecbbaa1..a826febd32 100644 --- a/src/components/CodeChanges/index.tsx +++ b/src/components/CodeChanges/index.tsx @@ -17,7 +17,7 @@ import { CodeChangesQueryVariables, FileDiffsFragment, } from "gql/generated/types"; -import { GET_CODE_CHANGES } from "gql/queries"; +import { CODE_CHANGES } from "gql/queries"; import { commits } from "utils"; import { formatZeroIndexForDisplay } from "utils/numbers"; @@ -30,7 +30,7 @@ export const CodeChanges: React.FC = ({ patchId }) => { const { data, error, loading } = useQuery< CodeChangesQuery, CodeChangesQueryVariables - >(GET_CODE_CHANGES, { + >(CODE_CHANGES, { variables: { id: patchId }, }); const { moduleCodeChanges } = data?.patch ?? {}; diff --git a/src/components/Content/Layout.tsx b/src/components/Content/Layout.tsx index 3a0154f35b..d05af83fa5 100644 --- a/src/components/Content/Layout.tsx +++ b/src/components/Content/Layout.tsx @@ -15,7 +15,7 @@ import { size } from "constants/tokens"; import { newSpruceUser } from "constants/welcomeModalProps"; import { useAuthStateContext } from "context/auth"; import { UserQuery, UserQueryVariables } from "gql/generated/types"; -import { GET_USER } from "gql/queries"; +import { USER } from "gql/queries"; import { useUserSettings } from "hooks"; import { useAnnouncementToast } from "hooks/useAnnouncementToast"; import { isProduction } from "utils/environmentVariables"; @@ -33,7 +33,7 @@ export const Layout: React.FC = () => { // this top-level query is required for authentication to work // afterware is used at apollo link level to authenticate or deauthenticate user based on response to query // therefore this could be any query as long as it is top-level - const { data } = useQuery(GET_USER); + const { data } = useQuery(USER); localStorage.setItem("userId", data?.user?.userId ?? ""); const { userSettings } = useUserSettings(); const { useSpruceOptions } = userSettings ?? {}; diff --git a/src/components/Header/Navbar.tsx b/src/components/Header/Navbar.tsx index 73b16a9235..730ac0a9f9 100644 --- a/src/components/Header/Navbar.tsx +++ b/src/components/Header/Navbar.tsx @@ -13,7 +13,7 @@ import { getCommitsRoute, getUserPatchesRoute, routes } from "constants/routes"; import { size } from "constants/tokens"; import { useAuthStateContext } from "context/auth"; import { UserQuery, SpruceConfigQuery } from "gql/generated/types"; -import { GET_USER, SPRUCE_CONFIG } from "gql/queries"; +import { USER, SPRUCE_CONFIG } from "gql/queries"; import { useLegacyUIURL } from "hooks"; import { AuxiliaryDropdown } from "./AuxiliaryDropdown"; import { UserDropdown } from "./UserDropdown"; @@ -25,7 +25,7 @@ export const Navbar: React.FC = () => { const legacyURL = useLegacyUIURL(); const { sendEvent } = useNavbarAnalytics(); - const { data: userData } = useQuery(GET_USER); + const { data: userData } = useQuery(USER); const { user } = userData || {}; const { userId } = user || {}; diff --git a/src/components/Header/UserDropdown.tsx b/src/components/Header/UserDropdown.tsx index aac144d773..235ae98717 100644 --- a/src/components/Header/UserDropdown.tsx +++ b/src/components/Header/UserDropdown.tsx @@ -4,11 +4,11 @@ import { adminSettingsURL } from "constants/externalResources"; import { PreferencesTabRoutes, getPreferencesRoute } from "constants/routes"; import { useAuthDispatchContext } from "context/auth"; import { UserQuery } from "gql/generated/types"; -import { GET_USER } from "gql/queries"; +import { USER } from "gql/queries"; import { MenuItemType, NavDropdown } from "./NavDropdown"; export const UserDropdown = () => { - const { data } = useQuery(GET_USER); + const { data } = useQuery(USER); const { user } = data || {}; const { displayName, permissions } = user || {}; diff --git a/src/components/HistoryTable/hooks/useTestResults.test.tsx b/src/components/HistoryTable/hooks/useTestResults.test.tsx index bd7da8c9d5..3c34658313 100644 --- a/src/components/HistoryTable/hooks/useTestResults.test.tsx +++ b/src/components/HistoryTable/hooks/useTestResults.test.tsx @@ -2,7 +2,7 @@ import { TaskTestSampleQuery, TaskTestSampleQueryVariables, } from "gql/generated/types"; -import { GET_TASK_TEST_SAMPLE } from "gql/queries"; +import { TASK_TEST_SAMPLE } from "gql/queries"; import { act, renderHook, waitFor } from "test_utils"; import { ApolloMock } from "types/gql"; import { TestStatus } from "types/history"; @@ -241,7 +241,7 @@ const noFilterData: ApolloMock< TaskTestSampleQueryVariables > = { request: { - query: GET_TASK_TEST_SAMPLE, + query: TASK_TEST_SAMPLE, variables: { tasks: [ "evergreen_lint_lint_model_distro_d4cf298cf0b2536fb3bff875775b93a9ceafb75c_21_09_02_14_20_04", @@ -273,7 +273,7 @@ const withMatchingFilter: ApolloMock< TaskTestSampleQueryVariables > = { request: { - query: GET_TASK_TEST_SAMPLE, + query: TASK_TEST_SAMPLE, variables: { tasks: [ "evergreen_lint_lint_model_distro_d4cf298cf0b2536fb3bff875775b93a9ceafb75c_21_09_02_14_20_04", @@ -307,7 +307,7 @@ const withNonMatchingFilter: ApolloMock< TaskTestSampleQueryVariables > = { request: { - query: GET_TASK_TEST_SAMPLE, + query: TASK_TEST_SAMPLE, variables: { tasks: [ "evergreen_lint_lint_model_distro_d4cf298cf0b2536fb3bff875775b93a9ceafb75c_21_09_02_14_20_04", diff --git a/src/components/HistoryTable/hooks/useTestResults.ts b/src/components/HistoryTable/hooks/useTestResults.ts index a1005cb739..ae152d7e0c 100644 --- a/src/components/HistoryTable/hooks/useTestResults.ts +++ b/src/components/HistoryTable/hooks/useTestResults.ts @@ -5,7 +5,7 @@ import { TaskTestSampleQueryVariables, TaskTestResultSample, } from "gql/generated/types"; -import { GET_TASK_TEST_SAMPLE } from "gql/queries"; +import { TASK_TEST_SAMPLE } from "gql/queries"; import { array } from "utils"; import { useHistoryTable } from "../HistoryTableContext"; import { rowType } from "../types"; @@ -35,7 +35,7 @@ const useTestResults = (rowIndex: number) => { const { loading } = useQuery< TaskTestSampleQuery, TaskTestSampleQueryVariables - >(GET_TASK_TEST_SAMPLE, { + >(TASK_TEST_SAMPLE, { variables: { tasks: taskIds, filters: historyTableFilters, diff --git a/src/components/Notifications/index.tsx b/src/components/Notifications/index.tsx index b76232f12c..91c1e08e6f 100644 --- a/src/components/Notifications/index.tsx +++ b/src/components/Notifications/index.tsx @@ -18,7 +18,7 @@ import { UserQuery, } from "gql/generated/types"; import { SAVE_SUBSCRIPTION } from "gql/mutations"; -import { GET_USER } from "gql/queries"; +import { USER } from "gql/queries"; import { useUserSettings } from "hooks/useUserSettings"; import { SubscriptionMethodOption } from "types/subscription"; import { Trigger } from "types/triggers"; @@ -65,7 +65,7 @@ export const NotificationModal: React.FC = ({ // Fetch user Slack and email information. const { userSettings } = useUserSettings(); const { slackUsername } = userSettings || {}; - const { data: userData } = useQuery(GET_USER); + const { data: userData } = useQuery(USER); const { user } = userData || {}; const { emailAddress } = user || {}; diff --git a/src/components/PatchActionButtons/ScheduleTasks/testData.ts b/src/components/PatchActionButtons/ScheduleTasks/testData.ts index 8eaae7cea2..0e7436a82b 100644 --- a/src/components/PatchActionButtons/ScheduleTasks/testData.ts +++ b/src/components/PatchActionButtons/ScheduleTasks/testData.ts @@ -2,7 +2,7 @@ import { UndispatchedTasksQuery, UndispatchedTasksQueryVariables, } from "gql/generated/types"; -import { GET_UNSCHEDULED_TASKS } from "gql/queries"; +import { UNSCHEDULED_TASKS } from "gql/queries"; import { ApolloMock } from "types/gql"; const mocks: ApolloMock< @@ -11,7 +11,7 @@ const mocks: ApolloMock< >[] = [ { request: { - query: GET_UNSCHEDULED_TASKS, + query: UNSCHEDULED_TASKS, variables: { versionId: "version" }, }, result: { @@ -142,7 +142,7 @@ const mocks: ApolloMock< }, { request: { - query: GET_UNSCHEDULED_TASKS, + query: UNSCHEDULED_TASKS, variables: { versionId: "emptyVersion" }, }, result: { diff --git a/src/components/ProjectSelect/ProjectSelect.test.tsx b/src/components/ProjectSelect/ProjectSelect.test.tsx index bd83b7424e..0a85d7388b 100644 --- a/src/components/ProjectSelect/ProjectSelect.test.tsx +++ b/src/components/ProjectSelect/ProjectSelect.test.tsx @@ -7,7 +7,7 @@ import { ViewableProjectRefsQuery, ViewableProjectRefsQueryVariables, } from "gql/generated/types"; -import { GET_PROJECTS, GET_VIEWABLE_PROJECTS } from "gql/queries"; +import { PROJECTS, VIEWABLE_PROJECTS } from "gql/queries"; import { renderWithRouterMatch, screen, userEvent, waitFor } from "test_utils"; import { ApolloMock } from "types/gql"; @@ -257,7 +257,7 @@ describe("projectSelect", () => { const getProjectsMock: [ApolloMock] = [ { request: { - query: GET_PROJECTS, + query: PROJECTS, }, result: { data: { @@ -357,7 +357,7 @@ const getViewableProjectsMock: [ ] = [ { request: { - query: GET_VIEWABLE_PROJECTS, + query: VIEWABLE_PROJECTS, }, result: { data: { @@ -438,7 +438,7 @@ const noDisabledProjectsMock: [ ] = [ { request: { - query: GET_VIEWABLE_PROJECTS, + query: VIEWABLE_PROJECTS, }, result: { data: { diff --git a/src/components/ProjectSelect/index.tsx b/src/components/ProjectSelect/index.tsx index a223b557c5..b9c7b72ad1 100644 --- a/src/components/ProjectSelect/index.tsx +++ b/src/components/ProjectSelect/index.tsx @@ -8,7 +8,7 @@ import { ViewableProjectRefsQuery, ViewableProjectRefsQueryVariables, } from "gql/generated/types"; -import { GET_PROJECTS, GET_VIEWABLE_PROJECTS } from "gql/queries"; +import { PROJECTS, VIEWABLE_PROJECTS } from "gql/queries"; import { Unpacked } from "types/utils"; import { ProjectOptionGroup } from "./ProjectOptionGroup"; @@ -32,13 +32,13 @@ export const ProjectSelect: React.FC = ({ const { data: projectsData, loading: projectsLoading } = useQuery< ProjectsQuery, ProjectsQueryVariables - >(GET_PROJECTS, { + >(PROJECTS, { skip: isProjectSettingsPage, }); const { data: viewableProjectsData, loading: viewableProjectsLoading } = useQuery( - GET_VIEWABLE_PROJECTS, + VIEWABLE_PROJECTS, { skip: !isProjectSettingsPage, } diff --git a/src/components/ProjectSelect/testData.ts b/src/components/ProjectSelect/testData.ts index bea7f28c90..e688c531df 100644 --- a/src/components/ProjectSelect/testData.ts +++ b/src/components/ProjectSelect/testData.ts @@ -9,7 +9,7 @@ import { RemoveFavoriteProjectMutationVariables, } from "gql/generated/types"; import { ADD_FAVORITE_PROJECT, REMOVE_FAVORITE_PROJECT } from "gql/mutations"; -import { GET_PROJECTS, GET_VIEWABLE_PROJECTS } from "gql/queries"; +import { PROJECTS, VIEWABLE_PROJECTS } from "gql/queries"; import { ApolloMock } from "types/gql"; const addFavoriteMock: ApolloMock< @@ -59,7 +59,7 @@ const removeFavoriteMock: ApolloMock< const getProjectsMock: ApolloMock = { request: { - query: GET_PROJECTS, + query: PROJECTS, }, result: { data: { @@ -158,7 +158,7 @@ const viewableProjectsMock: ApolloMock< ViewableProjectRefsQueryVariables > = { request: { - query: GET_VIEWABLE_PROJECTS, + query: VIEWABLE_PROJECTS, }, result: { data: { diff --git a/src/components/Redirects/ProjectSettingsRedirect.tsx b/src/components/Redirects/ProjectSettingsRedirect.tsx index 46b3b7527e..838207fa85 100644 --- a/src/components/Redirects/ProjectSettingsRedirect.tsx +++ b/src/components/Redirects/ProjectSettingsRedirect.tsx @@ -8,13 +8,13 @@ import { ViewableProjectRefsQuery, ViewableProjectRefsQueryVariables, } from "gql/generated/types"; -import { GET_VIEWABLE_PROJECTS } from "gql/queries"; +import { VIEWABLE_PROJECTS } from "gql/queries"; export const ProjectSettingsRedirect: React.FC = () => { const { data } = useQuery< ViewableProjectRefsQuery, ViewableProjectRefsQueryVariables - >(GET_VIEWABLE_PROJECTS); + >(VIEWABLE_PROJECTS); if (data) { const { viewableProjectRefs } = data; diff --git a/src/components/ScheduleTasksModal/index.tsx b/src/components/ScheduleTasksModal/index.tsx index e6fef38e63..fe56b889b6 100644 --- a/src/components/ScheduleTasksModal/index.tsx +++ b/src/components/ScheduleTasksModal/index.tsx @@ -15,7 +15,7 @@ import { ScheduleTasksMutationVariables, } from "gql/generated/types"; import { SCHEDULE_TASKS } from "gql/mutations"; -import { GET_UNSCHEDULED_TASKS } from "gql/queries"; +import { UNSCHEDULED_TASKS } from "gql/queries"; import { initialState, reducer } from "./reducer"; interface ScheduleTasksModalProps { @@ -56,7 +56,7 @@ export const ScheduleTasksModal: React.FC = ({ loadTaskData, { called: calledTaskData, data: taskData, loading: loadingTaskData }, ] = useLazyQuery( - GET_UNSCHEDULED_TASKS, + UNSCHEDULED_TASKS, { variables: { versionId }, } diff --git a/src/components/Spawn/MountVolumeSelect.tsx b/src/components/Spawn/MountVolumeSelect.tsx index 25f31df90b..cea519833c 100644 --- a/src/components/Spawn/MountVolumeSelect.tsx +++ b/src/components/Spawn/MountVolumeSelect.tsx @@ -6,7 +6,7 @@ import { InputLabel } from "components/styles"; import { DEFAULT_POLL_INTERVAL } from "constants/index"; import { useToastContext } from "context/toast"; import { MyHostsQuery, MyHostsQueryVariables } from "gql/generated/types"; -import { GET_MY_HOSTS } from "gql/queries"; +import { MY_HOSTS } from "gql/queries"; import { usePolling } from "hooks"; import { HostStatus } from "types/host"; @@ -35,7 +35,7 @@ export const MountVolumeSelect = ({ const { data, refetch, startPolling, stopPolling } = useQuery< MyHostsQuery, MyHostsQueryVariables - >(GET_MY_HOSTS, { + >(MY_HOSTS, { pollInterval: DEFAULT_POLL_INTERVAL, onError: (e) => { dispatchToast.error(`There was an error loading hosts: ${e.message}`); diff --git a/src/components/Spawn/editHostModal/useLoadFormData.ts b/src/components/Spawn/editHostModal/useLoadFormData.ts index f7b4a97d84..e64cc18b8e 100644 --- a/src/components/Spawn/editHostModal/useLoadFormData.ts +++ b/src/components/Spawn/editHostModal/useLoadFormData.ts @@ -7,33 +7,29 @@ import { MyVolumesQuery, MyVolumesQueryVariables, } from "gql/generated/types"; -import { - GET_INSTANCE_TYPES, - GET_MY_PUBLIC_KEYS, - GET_MY_VOLUMES, -} from "gql/queries"; +import { INSTANCE_TYPES, MY_PUBLIC_KEYS, MY_VOLUMES } from "gql/queries"; import { useDisableSpawnExpirationCheckbox, useSpruceConfig } from "hooks"; import { MyHost } from "types/spawn"; import { getNoExpirationCheckboxTooltipCopy } from "../utils"; export const useLoadFormData = (host: MyHost) => { - // QUERY get_instance_types + // QUERY instance_types const { data: instanceTypesData } = useQuery< InstanceTypesQuery, InstanceTypesQueryVariables - >(GET_INSTANCE_TYPES); + >(INSTANCE_TYPES); // QUERY volumes const { data: volumesData } = useQuery< MyVolumesQuery, MyVolumesQueryVariables - >(GET_MY_VOLUMES); + >(MY_VOLUMES); // QUERY public keys const { data: publicKeysData } = useQuery< MyPublicKeysQuery, MyPublicKeysQueryVariables - >(GET_MY_PUBLIC_KEYS); + >(MY_PUBLIC_KEYS); const spruceConfig = useSpruceConfig(); diff --git a/src/components/Spawn/spawnHostModal/useLoadFormSchemaData.ts b/src/components/Spawn/spawnHostModal/useLoadFormSchemaData.ts index 8913e6dfa5..bed6f3bbc4 100644 --- a/src/components/Spawn/spawnHostModal/useLoadFormSchemaData.ts +++ b/src/components/Spawn/spawnHostModal/useLoadFormSchemaData.ts @@ -11,11 +11,11 @@ import { MyHostsQueryVariables, } from "gql/generated/types"; import { - GET_DISTROS, - GET_AWS_REGIONS, - GET_USER_SETTINGS, - GET_MY_PUBLIC_KEYS, - GET_MY_VOLUMES, + AWS_REGIONS, + DISTROS, + MY_PUBLIC_KEYS, + MY_VOLUMES, + USER_SETTINGS, } from "gql/queries"; import { useDisableSpawnExpirationCheckbox, useSpruceConfig } from "hooks"; import { getNoExpirationCheckboxTooltipCopy } from "../utils"; @@ -27,12 +27,12 @@ export const useLoadFormSchemaData = (p?: Props) => { const { data: awsData, loading: awsLoading } = useQuery< AwsRegionsQuery, AwsRegionsQueryVariables - >(GET_AWS_REGIONS); + >(AWS_REGIONS); const { data: distrosData, loading: distrosLoading } = useQuery< DistrosQuery, DistrosQueryVariables - >(GET_DISTROS, { + >(DISTROS, { variables: { onlySpawnable: true, }, @@ -41,18 +41,17 @@ export const useLoadFormSchemaData = (p?: Props) => { const { data: publicKeysData, loading: publicKeyLoading } = useQuery< MyPublicKeysQuery, MyPublicKeysQueryVariables - >(GET_MY_PUBLIC_KEYS); + >(MY_PUBLIC_KEYS); const spruceConfig = useSpruceConfig(); - const { data: userSettingsData } = - useQuery(GET_USER_SETTINGS); + const { data: userSettingsData } = useQuery(USER_SETTINGS); const { region: userAwsRegion } = userSettingsData?.userSettings ?? {}; const { data: volumesData, loading: volumesLoading } = useQuery< MyVolumesQuery, MyHostsQueryVariables - >(GET_MY_VOLUMES); + >(MY_VOLUMES); const disableExpirationCheckbox = useDisableSpawnExpirationCheckbox( false, diff --git a/src/components/Spawn/spawnVolumeModal/useLoadFormData.ts b/src/components/Spawn/spawnVolumeModal/useLoadFormData.ts index 5e10aec630..caae06cbf6 100644 --- a/src/components/Spawn/spawnVolumeModal/useLoadFormData.ts +++ b/src/components/Spawn/spawnVolumeModal/useLoadFormData.ts @@ -6,7 +6,7 @@ import { MyHostsQuery, MyHostsQueryVariables, } from "gql/generated/types"; -import { GET_SUBNET_AVAILABILITY_ZONES, GET_MY_HOSTS } from "gql/queries"; +import { SUBNET_AVAILABILITY_ZONES, MY_HOSTS } from "gql/queries"; import { useDisableSpawnExpirationCheckbox, useSpruceConfig } from "hooks"; import { getNoExpirationCheckboxTooltipCopy } from "../utils"; @@ -17,7 +17,7 @@ export const useLoadFormData = () => { const { data: hostsData, loading: hostsLoading } = useQuery< MyHostsQuery, MyHostsQueryVariables - >(GET_MY_HOSTS); + >(MY_HOSTS); const hosts = hostsData?.myHosts ?? []; // QUERY availability zones @@ -25,7 +25,7 @@ export const useLoadFormData = () => { useQuery< SubnetAvailabilityZonesQuery, SubnetAvailabilityZonesQueryVariables - >(GET_SUBNET_AVAILABILITY_ZONES); + >(SUBNET_AVAILABILITY_ZONES); const availabilityZones = availabilityZoneData?.subnetAvailabilityZones ?? []; const disableExpirationCheckbox = useDisableSpawnExpirationCheckbox(true); diff --git a/src/components/VersionRestartModal/VersionRestartModal.tsx b/src/components/VersionRestartModal/VersionRestartModal.tsx index 94c4eba0b3..211bfd42d6 100644 --- a/src/components/VersionRestartModal/VersionRestartModal.tsx +++ b/src/components/VersionRestartModal/VersionRestartModal.tsx @@ -16,7 +16,7 @@ import { RestartVersionsMutationVariables, } from "gql/generated/types"; import { RESTART_VERSIONS } from "gql/mutations"; -import { GET_BUILD_VARIANTS_WITH_CHILDREN } from "gql/queries"; +import { BUILD_VARIANTS_WITH_CHILDREN } from "gql/queries"; import { useVersionTaskStatusSelect } from "hooks"; import { versionSelectedTasks, @@ -60,7 +60,7 @@ const VersionRestartModal: React.FC = ({ const { data, loading } = useQuery< BuildVariantsWithChildrenQuery, BuildVariantsWithChildrenQueryVariables - >(GET_BUILD_VARIANTS_WITH_CHILDREN, { + >(BUILD_VARIANTS_WITH_CHILDREN, { variables: { id: versionId }, skip: !visible, }); diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index 9b7b567525..f5bbd7f1b5 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -839,6 +839,7 @@ export type IssueLinkInput = { export type JiraConfig = { __typename?: "JiraConfig"; + email?: Maybe; host?: Maybe; }; @@ -5158,172 +5159,6 @@ export type UpdateUserSettingsMutation = { updateUserSettings: boolean; }; -export type AwsRegionsQueryVariables = Exact<{ [key: string]: never }>; - -export type AwsRegionsQuery = { - __typename?: "Query"; - awsRegions?: Array | null; -}; - -export type DistroEventsQueryVariables = Exact<{ - distroId: Scalars["String"]["input"]; - limit?: InputMaybe; - before?: InputMaybe; -}>; - -export type DistroEventsQuery = { - __typename?: "Query"; - distroEvents: { - __typename?: "DistroEventsPayload"; - count: number; - eventLogEntries: Array<{ - __typename?: "DistroEvent"; - after?: any | null; - before?: any | null; - data?: any | null; - timestamp: Date; - user: string; - }>; - }; -}; - -export type DistroTaskQueueQueryVariables = Exact<{ - distroId: Scalars["String"]["input"]; -}>; - -export type DistroTaskQueueQuery = { - __typename?: "Query"; - distroTaskQueue: Array<{ - __typename?: "TaskQueueItem"; - activatedBy: string; - buildVariant: string; - displayName: string; - expectedDuration: number; - id: string; - priority: number; - project: string; - requester: TaskQueueItemType; - version: string; - }>; -}; - -export type DistroQueryVariables = Exact<{ - distroId: Scalars["String"]["input"]; -}>; - -export type DistroQuery = { - __typename?: "Query"; - distro?: { - __typename?: "Distro"; - aliases: Array; - arch: Arch; - authorizedKeysFile: string; - cloneMethod: CloneMethod; - containerPool: string; - disabled: boolean; - disableShallowClone: boolean; - isCluster: boolean; - isVirtualWorkStation: boolean; - name: string; - note: string; - provider: Provider; - providerSettingsList: Array; - setup: string; - setupAsSudo: boolean; - sshKey: string; - sshOptions: Array; - user: string; - userSpawnAllowed: boolean; - validProjects: Array; - workDir: string; - bootstrapSettings: { - __typename?: "BootstrapSettings"; - clientDir: string; - communication: CommunicationMethod; - jasperBinaryDir: string; - jasperCredentialsPath: string; - method: BootstrapMethod; - rootDir: string; - serviceUser: string; - shellPath: string; - env: Array<{ __typename?: "EnvVar"; key: string; value: string }>; - preconditionScripts: Array<{ - __typename?: "PreconditionScript"; - path: string; - script: string; - }>; - resourceLimits: { - __typename?: "ResourceLimits"; - lockedMemoryKb: number; - numFiles: number; - numProcesses: number; - numTasks: number; - virtualMemoryKb: number; - }; - }; - dispatcherSettings: { - __typename?: "DispatcherSettings"; - version: DispatcherVersion; - }; - expansions: Array<{ __typename?: "Expansion"; key: string; value: string }>; - finderSettings: { __typename?: "FinderSettings"; version: FinderVersion }; - homeVolumeSettings: { - __typename?: "HomeVolumeSettings"; - formatCommand: string; - }; - hostAllocatorSettings: { - __typename?: "HostAllocatorSettings"; - acceptableHostIdleTime: number; - feedbackRule: FeedbackRule; - futureHostFraction: number; - hostsOverallocatedRule: OverallocatedRule; - maximumHosts: number; - minimumHosts: number; - roundingRule: RoundingRule; - version: HostAllocatorVersion; - }; - iceCreamSettings: { - __typename?: "IceCreamSettings"; - configPath: string; - schedulerHost: string; - }; - plannerSettings: { - __typename?: "PlannerSettings"; - commitQueueFactor: number; - expectedRuntimeFactor: number; - generateTaskFactor: number; - groupVersions: boolean; - mainlineTimeInQueueFactor: number; - patchFactor: number; - patchTimeInQueueFactor: number; - targetTime: number; - version: PlannerVersion; - }; - } | null; -}; - -export type FailedTaskStatusIconTooltipQueryVariables = Exact<{ - taskId: Scalars["String"]["input"]; -}>; - -export type FailedTaskStatusIconTooltipQuery = { - __typename?: "Query"; - task?: { - __typename?: "Task"; - execution: number; - id: string; - tests: { - __typename?: "TaskTestResult"; - filteredTestCount: number; - testResults: Array<{ - __typename?: "TestResult"; - id: string; - testFile: string; - }>; - }; - } | null; -}; - export type AgentLogsQueryVariables = Exact<{ id: Scalars["String"]["input"]; execution?: InputMaybe; @@ -5439,6 +5274,13 @@ export type AnnotationEventDataQuery = { } | null; }; +export type AwsRegionsQueryVariables = Exact<{ [key: string]: never }>; + +export type AwsRegionsQuery = { + __typename?: "Query"; + awsRegions?: Array | null; +}; + export type BaseVersionAndTaskQueryVariables = Exact<{ taskId: Scalars["String"]["input"]; }>; @@ -5717,67 +5559,226 @@ export type DisplayTaskQuery = { } | null; }; -export type DistrosQueryVariables = Exact<{ - onlySpawnable: Scalars["Boolean"]["input"]; +export type DistroEventsQueryVariables = Exact<{ + distroId: Scalars["String"]["input"]; + limit?: InputMaybe; + before?: InputMaybe; }>; -export type DistrosQuery = { - __typename?: "Query"; - distros: Array<{ - __typename?: "Distro"; - isVirtualWorkStation: boolean; - name: string; - } | null>; -}; - -export type GithubOrgsQueryVariables = Exact<{ [key: string]: never }>; - -export type GithubOrgsQuery = { +export type DistroEventsQuery = { __typename?: "Query"; - spruceConfig?: { - __typename?: "SpruceConfig"; - githubOrgs: Array; - } | null; + distroEvents: { + __typename?: "DistroEventsPayload"; + count: number; + eventLogEntries: Array<{ + __typename?: "DistroEvent"; + after?: any | null; + before?: any | null; + data?: any | null; + timestamp: Date; + user: string; + }>; + }; }; -export type GithubProjectConflictsQueryVariables = Exact<{ - projectId: Scalars["String"]["input"]; +export type DistroTaskQueueQueryVariables = Exact<{ + distroId: Scalars["String"]["input"]; }>; -export type GithubProjectConflictsQuery = { +export type DistroTaskQueueQuery = { __typename?: "Query"; - githubProjectConflicts: { - __typename?: "GithubProjectConflicts"; - commitCheckIdentifiers?: Array | null; - commitQueueIdentifiers?: Array | null; - prTestingIdentifiers?: Array | null; - }; + distroTaskQueue: Array<{ + __typename?: "TaskQueueItem"; + activatedBy: string; + buildVariant: string; + displayName: string; + expectedDuration: number; + id: string; + priority: number; + project: string; + requester: TaskQueueItemType; + version: string; + }>; }; -export type HasVersionQueryVariables = Exact<{ - id: Scalars["String"]["input"]; -}>; - -export type HasVersionQuery = { __typename?: "Query"; hasVersion: boolean }; - -export type HostEventsQueryVariables = Exact<{ - id: Scalars["String"]["input"]; - tag: Scalars["String"]["input"]; - limit?: InputMaybe; - page?: InputMaybe; +export type DistroQueryVariables = Exact<{ + distroId: Scalars["String"]["input"]; }>; -export type HostEventsQuery = { +export type DistroQuery = { __typename?: "Query"; - hostEvents: { - __typename?: "HostEvents"; - count: number; - eventLogEntries: Array<{ - __typename?: "HostEventLogEntry"; - eventType?: string | null; - id: string; - processedAt: Date; - resourceId: string; + distro?: { + __typename?: "Distro"; + aliases: Array; + arch: Arch; + authorizedKeysFile: string; + cloneMethod: CloneMethod; + containerPool: string; + disabled: boolean; + disableShallowClone: boolean; + isCluster: boolean; + isVirtualWorkStation: boolean; + name: string; + note: string; + provider: Provider; + providerSettingsList: Array; + setup: string; + setupAsSudo: boolean; + sshKey: string; + sshOptions: Array; + user: string; + userSpawnAllowed: boolean; + validProjects: Array; + workDir: string; + bootstrapSettings: { + __typename?: "BootstrapSettings"; + clientDir: string; + communication: CommunicationMethod; + jasperBinaryDir: string; + jasperCredentialsPath: string; + method: BootstrapMethod; + rootDir: string; + serviceUser: string; + shellPath: string; + env: Array<{ __typename?: "EnvVar"; key: string; value: string }>; + preconditionScripts: Array<{ + __typename?: "PreconditionScript"; + path: string; + script: string; + }>; + resourceLimits: { + __typename?: "ResourceLimits"; + lockedMemoryKb: number; + numFiles: number; + numProcesses: number; + numTasks: number; + virtualMemoryKb: number; + }; + }; + dispatcherSettings: { + __typename?: "DispatcherSettings"; + version: DispatcherVersion; + }; + expansions: Array<{ __typename?: "Expansion"; key: string; value: string }>; + finderSettings: { __typename?: "FinderSettings"; version: FinderVersion }; + homeVolumeSettings: { + __typename?: "HomeVolumeSettings"; + formatCommand: string; + }; + hostAllocatorSettings: { + __typename?: "HostAllocatorSettings"; + acceptableHostIdleTime: number; + feedbackRule: FeedbackRule; + futureHostFraction: number; + hostsOverallocatedRule: OverallocatedRule; + maximumHosts: number; + minimumHosts: number; + roundingRule: RoundingRule; + version: HostAllocatorVersion; + }; + iceCreamSettings: { + __typename?: "IceCreamSettings"; + configPath: string; + schedulerHost: string; + }; + plannerSettings: { + __typename?: "PlannerSettings"; + commitQueueFactor: number; + expectedRuntimeFactor: number; + generateTaskFactor: number; + groupVersions: boolean; + mainlineTimeInQueueFactor: number; + patchFactor: number; + patchTimeInQueueFactor: number; + targetTime: number; + version: PlannerVersion; + }; + } | null; +}; + +export type DistrosQueryVariables = Exact<{ + onlySpawnable: Scalars["Boolean"]["input"]; +}>; + +export type DistrosQuery = { + __typename?: "Query"; + distros: Array<{ + __typename?: "Distro"; + isVirtualWorkStation: boolean; + name: string; + } | null>; +}; + +export type FailedTaskStatusIconTooltipQueryVariables = Exact<{ + taskId: Scalars["String"]["input"]; +}>; + +export type FailedTaskStatusIconTooltipQuery = { + __typename?: "Query"; + task?: { + __typename?: "Task"; + execution: number; + id: string; + tests: { + __typename?: "TaskTestResult"; + filteredTestCount: number; + testResults: Array<{ + __typename?: "TestResult"; + id: string; + testFile: string; + }>; + }; + } | null; +}; + +export type GithubOrgsQueryVariables = Exact<{ [key: string]: never }>; + +export type GithubOrgsQuery = { + __typename?: "Query"; + spruceConfig?: { + __typename?: "SpruceConfig"; + githubOrgs: Array; + } | null; +}; + +export type GithubProjectConflictsQueryVariables = Exact<{ + projectId: Scalars["String"]["input"]; +}>; + +export type GithubProjectConflictsQuery = { + __typename?: "Query"; + githubProjectConflicts: { + __typename?: "GithubProjectConflicts"; + commitCheckIdentifiers?: Array | null; + commitQueueIdentifiers?: Array | null; + prTestingIdentifiers?: Array | null; + }; +}; + +export type HasVersionQueryVariables = Exact<{ + id: Scalars["String"]["input"]; +}>; + +export type HasVersionQuery = { __typename?: "Query"; hasVersion: boolean }; + +export type HostEventsQueryVariables = Exact<{ + id: Scalars["String"]["input"]; + tag: Scalars["String"]["input"]; + limit?: InputMaybe; + page?: InputMaybe; +}>; + +export type HostEventsQuery = { + __typename?: "Query"; + hostEvents: { + __typename?: "HostEvents"; + count: number; + eventLogEntries: Array<{ + __typename?: "HostEventLogEntry"; + eventType?: string | null; + id: string; + processedAt: Date; + resourceId: string; resourceType: string; timestamp?: Date | null; data: { @@ -5835,6 +5836,51 @@ export type HostQuery = { } | null; }; +export type HostsQueryVariables = Exact<{ + hostId?: InputMaybe; + distroId?: InputMaybe; + currentTaskId?: InputMaybe; + statuses?: InputMaybe>; + startedBy?: InputMaybe; + sortBy?: InputMaybe; + sortDir?: InputMaybe; + page?: InputMaybe; + limit?: InputMaybe; +}>; + +export type HostsQuery = { + __typename?: "Query"; + hosts: { + __typename?: "HostsResponse"; + filteredHostsCount?: number | null; + totalHostsCount: number; + hosts: Array<{ + __typename?: "Host"; + distroId?: string | null; + elapsed?: Date | null; + hostUrl: string; + id: string; + noExpiration: boolean; + provider: string; + startedBy: string; + status: string; + tag: string; + totalIdleTime?: number | null; + uptime?: Date | null; + distro?: { + __typename?: "DistroInfo"; + bootstrapMethod?: string | null; + id?: string | null; + } | null; + runningTask?: { + __typename?: "TaskInfo"; + id?: string | null; + name?: string | null; + } | null; + }>; + }; +}; + export type InstanceTypesQueryVariables = Exact<{ [key: string]: never }>; export type InstanceTypesQuery = { @@ -6924,52 +6970,118 @@ export type ProjectEventLogsQuery = { }; }; -export type ProjectSettingsQueryVariables = Exact<{ +export type ProjectHealthViewQueryVariables = Exact<{ identifier: Scalars["String"]["input"]; }>; -export type ProjectSettingsQuery = { +export type ProjectHealthViewQuery = { __typename?: "Query"; projectSettings: { __typename?: "ProjectSettings"; - githubWebhooksEnabled: boolean; - aliases?: Array<{ - __typename?: "ProjectAlias"; - alias: string; - description?: string | null; - gitTag: string; - id: string; - remotePath: string; - task: string; - taskTags: Array; - variant: string; - variantTags: Array; - parameters: Array<{ - __typename?: "Parameter"; - key: string; - value: string; - }>; - }> | null; projectRef?: { __typename?: "Project"; id: string; - identifier: string; - repoRefId: string; - admins?: Array | null; - restricted?: boolean | null; - batchTime: number; - branch: string; - deactivatePrevious?: boolean | null; - disabledStatsCache?: boolean | null; - dispatchingDisabled?: boolean | null; - displayName: string; - enabled?: boolean | null; - owner: string; - patchingDisabled?: boolean | null; - remotePath: string; - repo: string; - repotrackerDisabled?: boolean | null; - spawnHostScriptPath: string; + projectHealthView: ProjectHealthView; + } | null; + }; +}; + +export type ProjectPatchesQueryVariables = Exact<{ + projectIdentifier: Scalars["String"]["input"]; + patchesInput: PatchesInput; +}>; + +export type ProjectPatchesQuery = { + __typename?: "Query"; + project: { + __typename?: "Project"; + displayName: string; + id: string; + patches: { + __typename?: "Patches"; + filteredPatchCount: number; + patches: Array<{ + __typename?: "Patch"; + activated: boolean; + alias?: string | null; + author: string; + authorDisplayName: string; + canEnqueueToCommitQueue: boolean; + commitQueuePosition?: number | null; + createTime?: Date | null; + description: string; + id: string; + projectIdentifier: string; + status: string; + projectMetadata?: { + __typename?: "Project"; + owner: string; + repo: string; + } | null; + versionFull?: { + __typename?: "Version"; + id: string; + status: string; + taskStatusStats?: { + __typename?: "TaskStats"; + counts?: Array<{ + __typename?: "StatusCount"; + count: number; + status: string; + }> | null; + } | null; + } | null; + }>; + }; + }; +}; + +export type ProjectSettingsQueryVariables = Exact<{ + identifier: Scalars["String"]["input"]; +}>; + +export type ProjectSettingsQuery = { + __typename?: "Query"; + projectSettings: { + __typename?: "ProjectSettings"; + githubWebhooksEnabled: boolean; + aliases?: Array<{ + __typename?: "ProjectAlias"; + alias: string; + description?: string | null; + gitTag: string; + id: string; + remotePath: string; + task: string; + taskTags: Array; + variant: string; + variantTags: Array; + parameters: Array<{ + __typename?: "Parameter"; + key: string; + value: string; + }>; + }> | null; + projectRef?: { + __typename?: "Project"; + id: string; + identifier: string; + repoRefId: string; + admins?: Array | null; + restricted?: boolean | null; + batchTime: number; + branch: string; + deactivatePrevious?: boolean | null; + disabledStatsCache?: boolean | null; + dispatchingDisabled?: boolean | null; + displayName: string; + enabled?: boolean | null; + owner: string; + patchingDisabled?: boolean | null; + remotePath: string; + repo: string; + repotrackerDisabled?: boolean | null; + spawnHostScriptPath: string; stepbackDisabled?: boolean | null; versionControlEnabled?: boolean | null; notifyOnBuildFailure?: boolean | null; @@ -7815,6 +7927,97 @@ export type RepoSettingsQuery = { }; }; +export type SpawnExpirationInfoQueryVariables = Exact<{ [key: string]: never }>; + +export type SpawnExpirationInfoQuery = { + __typename?: "Query"; + myHosts: Array<{ __typename?: "Host"; id: string; noExpiration: boolean }>; + myVolumes: Array<{ + __typename?: "Volume"; + id: string; + noExpiration: boolean; + }>; +}; + +export type SpawnTaskQueryVariables = Exact<{ + taskId: Scalars["String"]["input"]; +}>; + +export type SpawnTaskQuery = { + __typename?: "Query"; + task?: { + __typename?: "Task"; + canSync: boolean; + buildVariant: string; + buildVariantDisplayName?: string | null; + displayName: string; + execution: number; + id: string; + revision?: string | null; + status: string; + project?: { + __typename?: "Project"; + id: string; + spawnHostScriptPath: string; + } | null; + } | null; +}; + +export type SpruceConfigQueryVariables = Exact<{ [key: string]: never }>; + +export type SpruceConfigQuery = { + __typename?: "Query"; + spruceConfig?: { + __typename?: "SpruceConfig"; + banner?: string | null; + bannerTheme?: string | null; + containerPools?: { + __typename?: "ContainerPoolsConfig"; + pools: Array<{ + __typename?: "ContainerPool"; + distro: string; + id: string; + maxContainers: number; + port: number; + }>; + } | null; + jira?: { __typename?: "JiraConfig"; host?: string | null } | null; + keys: Array<{ __typename?: "SSHKey"; location: string; name: string }>; + providers?: { + __typename?: "CloudProviderConfig"; + aws?: { + __typename?: "AWSConfig"; + maxVolumeSizePerUser?: number | null; + pod?: { + __typename?: "AWSPodConfig"; + ecs?: { + __typename?: "ECSConfig"; + maxCPU: number; + maxMemoryMb: number; + } | null; + } | null; + } | null; + } | null; + slack?: { __typename?: "SlackConfig"; name?: string | null } | null; + spawnHost: { + __typename?: "SpawnHostConfig"; + spawnHostsPerUser: number; + unexpirableHostsPerUser: number; + unexpirableVolumesPerUser: number; + }; + ui?: { __typename?: "UIConfig"; defaultProject: string } | null; + } | null; +}; + +export type SubnetAvailabilityZonesQueryVariables = Exact<{ + [key: string]: never; +}>; + +export type SubnetAvailabilityZonesQuery = { + __typename?: "Query"; + subnetAvailabilityZones: Array; +}; + export type SystemLogsQueryVariables = Exact<{ id: Scalars["String"]["input"]; execution?: InputMaybe; @@ -7948,6 +8151,18 @@ export type TaskNamesForBuildVariantQuery = { taskNamesForBuildVariant?: Array | null; }; +export type TaskQueueDistrosQueryVariables = Exact<{ [key: string]: never }>; + +export type TaskQueueDistrosQuery = { + __typename?: "Query"; + taskQueueDistros: Array<{ + __typename?: "TaskQueueDistro"; + hostCount: number; + id: string; + taskCount: number; + }>; +}; + export type TaskStatusesQueryVariables = Exact<{ id: Scalars["String"]["input"]; }>; @@ -8237,49 +8452,174 @@ export type UserConfigQuery = { } | null; }; -export type UserSettingsQueryVariables = Exact<{ [key: string]: never }>; +export type UserDistroSettingsPermissionsQueryVariables = Exact<{ + distroId: Scalars["String"]["input"]; +}>; -export type UserSettingsQuery = { +export type UserDistroSettingsPermissionsQuery = { __typename?: "Query"; - userSettings?: { - __typename?: "UserSettings"; - dateFormat?: string | null; - region?: string | null; - slackMemberId?: string | null; - slackUsername?: string | null; - timezone?: string | null; - githubUser?: { - __typename?: "GithubUser"; - lastKnownAs?: string | null; - } | null; - notifications?: { - __typename?: "Notifications"; - buildBreak?: string | null; - commitQueue?: string | null; - patchFinish?: string | null; - patchFirstFailure?: string | null; - spawnHostExpiration?: string | null; - spawnHostOutcome?: string | null; - } | null; - useSpruceOptions?: { - __typename?: "UseSpruceOptions"; - hasUsedMainlineCommitsBefore?: boolean | null; - hasUsedSpruceBefore?: boolean | null; - spruceV1?: boolean | null; - } | null; - } | null; + user: { + __typename?: "User"; + userId: string; + permissions: { + __typename?: "Permissions"; + canCreateDistro: boolean; + distroPermissions: { __typename?: "DistroPermissions"; admin: boolean }; + }; + }; }; -export type UserQueryVariables = Exact<{ [key: string]: never }>; +export type UserPatchesQueryVariables = Exact<{ + userId: Scalars["String"]["input"]; + patchesInput: PatchesInput; +}>; -export type UserQuery = { +export type UserPatchesQuery = { __typename?: "Query"; user: { __typename?: "User"; - displayName: string; - emailAddress: string; userId: string; - permissions: { __typename?: "Permissions"; canEditAdminSettings: boolean }; + patches: { + __typename?: "Patches"; + filteredPatchCount: number; + patches: Array<{ + __typename?: "Patch"; + activated: boolean; + alias?: string | null; + author: string; + authorDisplayName: string; + canEnqueueToCommitQueue: boolean; + commitQueuePosition?: number | null; + createTime?: Date | null; + description: string; + id: string; + projectIdentifier: string; + status: string; + projectMetadata?: { + __typename?: "Project"; + owner: string; + repo: string; + } | null; + versionFull?: { + __typename?: "Version"; + id: string; + status: string; + taskStatusStats?: { + __typename?: "TaskStats"; + counts?: Array<{ + __typename?: "StatusCount"; + count: number; + status: string; + }> | null; + } | null; + } | null; + }>; + }; + }; +}; + +export type UserProjectSettingsPermissionsQueryVariables = Exact<{ + [key: string]: never; +}>; + +export type UserProjectSettingsPermissionsQuery = { + __typename?: "Query"; + user: { + __typename?: "User"; + userId: string; + permissions: { __typename?: "Permissions"; canCreateProject: boolean }; + }; +}; + +export type UserSettingsQueryVariables = Exact<{ [key: string]: never }>; + +export type UserSettingsQuery = { + __typename?: "Query"; + userSettings?: { + __typename?: "UserSettings"; + dateFormat?: string | null; + region?: string | null; + slackMemberId?: string | null; + slackUsername?: string | null; + timezone?: string | null; + githubUser?: { + __typename?: "GithubUser"; + lastKnownAs?: string | null; + } | null; + notifications?: { + __typename?: "Notifications"; + buildBreak?: string | null; + commitQueue?: string | null; + patchFinish?: string | null; + patchFirstFailure?: string | null; + spawnHostExpiration?: string | null; + spawnHostOutcome?: string | null; + } | null; + useSpruceOptions?: { + __typename?: "UseSpruceOptions"; + hasUsedMainlineCommitsBefore?: boolean | null; + hasUsedSpruceBefore?: boolean | null; + spruceV1?: boolean | null; + } | null; + } | null; +}; + +export type UserSubscriptionsQueryVariables = Exact<{ [key: string]: never }>; + +export type UserSubscriptionsQuery = { + __typename?: "Query"; + user: { + __typename?: "User"; + userId: string; + subscriptions?: Array<{ + __typename?: "GeneralSubscription"; + id: string; + ownerType: string; + resourceType: string; + trigger: string; + triggerData?: { [key: string]: any } | null; + regexSelectors: Array<{ + __typename?: "Selector"; + data: string; + type: string; + }>; + selectors: Array<{ __typename?: "Selector"; data: string; type: string }>; + subscriber?: { + __typename?: "SubscriberWrapper"; + type: string; + subscriber: { + __typename?: "Subscriber"; + emailSubscriber?: string | null; + jiraCommentSubscriber?: string | null; + slackSubscriber?: string | null; + }; + } | null; + }> | null; + }; + userSettings?: { + __typename?: "UserSettings"; + notifications?: { + __typename?: "Notifications"; + buildBreakId?: string | null; + commitQueueId?: string | null; + patchFinishId?: string | null; + patchFirstFailureId?: string | null; + spawnHostExpirationId?: string | null; + spawnHostOutcomeId?: string | null; + } | null; + } | null; +}; + +export type UserQueryVariables = Exact<{ [key: string]: never }>; + +export type UserQuery = { + __typename?: "Query"; + user: { + __typename?: "User"; + displayName: string; + emailAddress: string; + userId: string; + permissions: { __typename?: "Permissions"; canEditAdminSettings: boolean }; }; }; @@ -8494,342 +8834,3 @@ export type ViewableProjectRefsQuery = { repo?: { __typename?: "RepoRef"; id: string } | null; } | null>; }; - -export type HostsQueryVariables = Exact<{ - hostId?: InputMaybe; - distroId?: InputMaybe; - currentTaskId?: InputMaybe; - statuses?: InputMaybe>; - startedBy?: InputMaybe; - sortBy?: InputMaybe; - sortDir?: InputMaybe; - page?: InputMaybe; - limit?: InputMaybe; -}>; - -export type HostsQuery = { - __typename?: "Query"; - hosts: { - __typename?: "HostsResponse"; - filteredHostsCount?: number | null; - totalHostsCount: number; - hosts: Array<{ - __typename?: "Host"; - distroId?: string | null; - elapsed?: Date | null; - hostUrl: string; - id: string; - noExpiration: boolean; - provider: string; - startedBy: string; - status: string; - tag: string; - totalIdleTime?: number | null; - uptime?: Date | null; - distro?: { - __typename?: "DistroInfo"; - bootstrapMethod?: string | null; - id?: string | null; - } | null; - runningTask?: { - __typename?: "TaskInfo"; - id?: string | null; - name?: string | null; - } | null; - }>; - }; -}; - -export type ProjectHealthViewQueryVariables = Exact<{ - identifier: Scalars["String"]["input"]; -}>; - -export type ProjectHealthViewQuery = { - __typename?: "Query"; - projectSettings: { - __typename?: "ProjectSettings"; - projectRef?: { - __typename?: "Project"; - id: string; - projectHealthView: ProjectHealthView; - } | null; - }; -}; - -export type ProjectPatchesQueryVariables = Exact<{ - projectIdentifier: Scalars["String"]["input"]; - patchesInput: PatchesInput; -}>; - -export type ProjectPatchesQuery = { - __typename?: "Query"; - project: { - __typename?: "Project"; - displayName: string; - id: string; - patches: { - __typename?: "Patches"; - filteredPatchCount: number; - patches: Array<{ - __typename?: "Patch"; - activated: boolean; - alias?: string | null; - author: string; - authorDisplayName: string; - canEnqueueToCommitQueue: boolean; - commitQueuePosition?: number | null; - createTime?: Date | null; - description: string; - id: string; - projectIdentifier: string; - status: string; - projectMetadata?: { - __typename?: "Project"; - owner: string; - repo: string; - } | null; - versionFull?: { - __typename?: "Version"; - id: string; - status: string; - taskStatusStats?: { - __typename?: "TaskStats"; - counts?: Array<{ - __typename?: "StatusCount"; - count: number; - status: string; - }> | null; - } | null; - } | null; - }>; - }; - }; -}; - -export type SpawnExpirationInfoQueryVariables = Exact<{ [key: string]: never }>; - -export type SpawnExpirationInfoQuery = { - __typename?: "Query"; - myHosts: Array<{ __typename?: "Host"; id: string; noExpiration: boolean }>; - myVolumes: Array<{ - __typename?: "Volume"; - id: string; - noExpiration: boolean; - }>; -}; - -export type SpawnTaskQueryVariables = Exact<{ - taskId: Scalars["String"]["input"]; -}>; - -export type SpawnTaskQuery = { - __typename?: "Query"; - task?: { - __typename?: "Task"; - canSync: boolean; - buildVariant: string; - buildVariantDisplayName?: string | null; - displayName: string; - execution: number; - id: string; - revision?: string | null; - status: string; - project?: { - __typename?: "Project"; - id: string; - spawnHostScriptPath: string; - } | null; - } | null; -}; - -export type SpruceConfigQueryVariables = Exact<{ [key: string]: never }>; - -export type SpruceConfigQuery = { - __typename?: "Query"; - spruceConfig?: { - __typename?: "SpruceConfig"; - banner?: string | null; - bannerTheme?: string | null; - containerPools?: { - __typename?: "ContainerPoolsConfig"; - pools: Array<{ - __typename?: "ContainerPool"; - distro: string; - id: string; - maxContainers: number; - port: number; - }>; - } | null; - jira?: { __typename?: "JiraConfig"; host?: string | null } | null; - keys: Array<{ __typename?: "SSHKey"; location: string; name: string }>; - providers?: { - __typename?: "CloudProviderConfig"; - aws?: { - __typename?: "AWSConfig"; - maxVolumeSizePerUser?: number | null; - pod?: { - __typename?: "AWSPodConfig"; - ecs?: { - __typename?: "ECSConfig"; - maxCPU: number; - maxMemoryMb: number; - } | null; - } | null; - } | null; - } | null; - slack?: { __typename?: "SlackConfig"; name?: string | null } | null; - spawnHost: { - __typename?: "SpawnHostConfig"; - spawnHostsPerUser: number; - unexpirableHostsPerUser: number; - unexpirableVolumesPerUser: number; - }; - ui?: { __typename?: "UIConfig"; defaultProject: string } | null; - } | null; -}; - -export type SubnetAvailabilityZonesQueryVariables = Exact<{ - [key: string]: never; -}>; - -export type SubnetAvailabilityZonesQuery = { - __typename?: "Query"; - subnetAvailabilityZones: Array; -}; - -export type TaskQueueDistrosQueryVariables = Exact<{ [key: string]: never }>; - -export type TaskQueueDistrosQuery = { - __typename?: "Query"; - taskQueueDistros: Array<{ - __typename?: "TaskQueueDistro"; - hostCount: number; - id: string; - taskCount: number; - }>; -}; - -export type UserDistroSettingsPermissionsQueryVariables = Exact<{ - distroId: Scalars["String"]["input"]; -}>; - -export type UserDistroSettingsPermissionsQuery = { - __typename?: "Query"; - user: { - __typename?: "User"; - userId: string; - permissions: { - __typename?: "Permissions"; - canCreateDistro: boolean; - distroPermissions: { __typename?: "DistroPermissions"; admin: boolean }; - }; - }; -}; - -export type UserPatchesQueryVariables = Exact<{ - userId: Scalars["String"]["input"]; - patchesInput: PatchesInput; -}>; - -export type UserPatchesQuery = { - __typename?: "Query"; - user: { - __typename?: "User"; - userId: string; - patches: { - __typename?: "Patches"; - filteredPatchCount: number; - patches: Array<{ - __typename?: "Patch"; - activated: boolean; - alias?: string | null; - author: string; - authorDisplayName: string; - canEnqueueToCommitQueue: boolean; - commitQueuePosition?: number | null; - createTime?: Date | null; - description: string; - id: string; - projectIdentifier: string; - status: string; - projectMetadata?: { - __typename?: "Project"; - owner: string; - repo: string; - } | null; - versionFull?: { - __typename?: "Version"; - id: string; - status: string; - taskStatusStats?: { - __typename?: "TaskStats"; - counts?: Array<{ - __typename?: "StatusCount"; - count: number; - status: string; - }> | null; - } | null; - } | null; - }>; - }; - }; -}; - -export type UserProjectSettingsPermissionsQueryVariables = Exact<{ - [key: string]: never; -}>; - -export type UserProjectSettingsPermissionsQuery = { - __typename?: "Query"; - user: { - __typename?: "User"; - userId: string; - permissions: { __typename?: "Permissions"; canCreateProject: boolean }; - }; -}; - -export type UserSubscriptionsQueryVariables = Exact<{ [key: string]: never }>; - -export type UserSubscriptionsQuery = { - __typename?: "Query"; - user: { - __typename?: "User"; - userId: string; - subscriptions?: Array<{ - __typename?: "GeneralSubscription"; - id: string; - ownerType: string; - resourceType: string; - trigger: string; - triggerData?: { [key: string]: any } | null; - regexSelectors: Array<{ - __typename?: "Selector"; - data: string; - type: string; - }>; - selectors: Array<{ __typename?: "Selector"; data: string; type: string }>; - subscriber?: { - __typename?: "SubscriberWrapper"; - type: string; - subscriber: { - __typename?: "Subscriber"; - emailSubscriber?: string | null; - jiraCommentSubscriber?: string | null; - slackSubscriber?: string | null; - }; - } | null; - }> | null; - }; - userSettings?: { - __typename?: "UserSettings"; - notifications?: { - __typename?: "Notifications"; - buildBreakId?: string | null; - commitQueueId?: string | null; - patchFinishId?: string | null; - patchFirstFailureId?: string | null; - spawnHostExpirationId?: string | null; - spawnHostOutcomeId?: string | null; - } | null; - } | null; -}; diff --git a/src/gql/mocks/getUser.ts b/src/gql/mocks/getUser.ts index 9f4d3042e2..bdcd1c12ee 100644 --- a/src/gql/mocks/getUser.ts +++ b/src/gql/mocks/getUser.ts @@ -1,10 +1,10 @@ import { UserQuery, UserQueryVariables } from "gql/generated/types"; -import { GET_USER } from "gql/queries"; +import { USER } from "gql/queries"; import { ApolloMock } from "types/gql"; export const getUserMock: ApolloMock = { request: { - query: GET_USER, + query: USER, variables: {}, }, result: { diff --git a/src/gql/queries/get-agent-logs.graphql b/src/gql/queries/agent-logs.graphql similarity index 100% rename from src/gql/queries/get-agent-logs.graphql rename to src/gql/queries/agent-logs.graphql diff --git a/src/gql/queries/get-all-logs.graphql b/src/gql/queries/all-logs.graphql similarity index 100% rename from src/gql/queries/get-all-logs.graphql rename to src/gql/queries/all-logs.graphql diff --git a/src/gql/queries/get-annotation-event-data.graphql b/src/gql/queries/annotation-event-data.graphql similarity index 100% rename from src/gql/queries/get-annotation-event-data.graphql rename to src/gql/queries/annotation-event-data.graphql diff --git a/src/gql/queries/get-base-version-and-task.graphql b/src/gql/queries/base-version-and-task.graphql similarity index 100% rename from src/gql/queries/get-base-version-and-task.graphql rename to src/gql/queries/base-version-and-task.graphql diff --git a/src/gql/queries/get-build-baron-configured.graphql b/src/gql/queries/build-baron-configured.graphql similarity index 100% rename from src/gql/queries/get-build-baron-configured.graphql rename to src/gql/queries/build-baron-configured.graphql diff --git a/src/gql/queries/get-build-baron.graphql b/src/gql/queries/build-baron.graphql similarity index 100% rename from src/gql/queries/get-build-baron.graphql rename to src/gql/queries/build-baron.graphql diff --git a/src/gql/queries/get-build-variant-stats.graphql b/src/gql/queries/build-variant-stats.graphql similarity index 100% rename from src/gql/queries/get-build-variant-stats.graphql rename to src/gql/queries/build-variant-stats.graphql diff --git a/src/gql/queries/get-build-variants-for-task-name.graphql b/src/gql/queries/build-variants-for-task-name.graphql similarity index 100% rename from src/gql/queries/get-build-variants-for-task-name.graphql rename to src/gql/queries/build-variants-for-task-name.graphql diff --git a/src/gql/queries/get-build-variants-with-children.graphql b/src/gql/queries/build-variants-with-children.graphql similarity index 100% rename from src/gql/queries/get-build-variants-with-children.graphql rename to src/gql/queries/build-variants-with-children.graphql diff --git a/src/gql/queries/get-client-config.graphql b/src/gql/queries/client-config.graphql similarity index 100% rename from src/gql/queries/get-client-config.graphql rename to src/gql/queries/client-config.graphql diff --git a/src/gql/queries/get-code-changes.graphql b/src/gql/queries/code-changes.graphql similarity index 100% rename from src/gql/queries/get-code-changes.graphql rename to src/gql/queries/code-changes.graphql diff --git a/src/gql/queries/get-commit-queue.graphql b/src/gql/queries/commit-queue.graphql similarity index 100% rename from src/gql/queries/get-commit-queue.graphql rename to src/gql/queries/commit-queue.graphql diff --git a/src/gql/queries/get-created-tickets.graphql b/src/gql/queries/created-tickets.graphql similarity index 100% rename from src/gql/queries/get-created-tickets.graphql rename to src/gql/queries/created-tickets.graphql diff --git a/src/gql/queries/get-display-task.graphql b/src/gql/queries/display-task.graphql similarity index 100% rename from src/gql/queries/get-display-task.graphql rename to src/gql/queries/display-task.graphql diff --git a/src/gql/queries/get-distros.graphql b/src/gql/queries/distros.graphql similarity index 100% rename from src/gql/queries/get-distros.graphql rename to src/gql/queries/distros.graphql diff --git a/src/gql/queries/get-github-orgs.graphql b/src/gql/queries/github-orgs.graphql similarity index 100% rename from src/gql/queries/get-github-orgs.graphql rename to src/gql/queries/github-orgs.graphql diff --git a/src/gql/queries/get-github-project-conflicts.graphql b/src/gql/queries/github-project-conflicts.graphql similarity index 100% rename from src/gql/queries/get-github-project-conflicts.graphql rename to src/gql/queries/github-project-conflicts.graphql diff --git a/src/gql/queries/get-has-version.graphql b/src/gql/queries/has-version.graphql similarity index 100% rename from src/gql/queries/get-has-version.graphql rename to src/gql/queries/has-version.graphql diff --git a/src/gql/queries/get-host-events.graphql b/src/gql/queries/host-events.graphql similarity index 100% rename from src/gql/queries/get-host-events.graphql rename to src/gql/queries/host-events.graphql diff --git a/src/gql/queries/get-host.graphql b/src/gql/queries/host.graphql similarity index 100% rename from src/gql/queries/get-host.graphql rename to src/gql/queries/host.graphql diff --git a/src/gql/queries/index.ts b/src/gql/queries/index.ts index dff6ac2ef2..f796b6013b 100644 --- a/src/gql/queries/index.ts +++ b/src/gql/queries/index.ts @@ -1,161 +1,161 @@ -import GET_AWS_REGIONS from "./aws-regions.graphql"; +import AGENT_LOGS from "./agent-logs.graphql"; +import ALL_LOGS from "./all-logs.graphql"; +import ANNOTATION_EVENT_DATA from "./annotation-event-data.graphql"; +import AWS_REGIONS from "./aws-regions.graphql"; +import BASE_VERSION_AND_TASK from "./base-version-and-task.graphql"; +import BUILD_BARON_CONFIGURED from "./build-baron-configured.graphql"; +import BUILD_BARON from "./build-baron.graphql"; +import BUILD_VARIANTS_STATS from "./build-variant-stats.graphql"; +import BUILD_VARIANTS_FOR_TASK_NAME from "./build-variants-for-task-name.graphql"; +import BUILD_VARIANTS_WITH_CHILDREN from "./build-variants-with-children.graphql"; +import CLIENT_CONFIG from "./client-config.graphql"; +import CODE_CHANGES from "./code-changes.graphql"; +import COMMIT_QUEUE from "./commit-queue.graphql"; +import CREATED_TICKETS from "./created-tickets.graphql"; +import DISPLAY_TASK from "./display-task.graphql"; import DISTRO_EVENTS from "./distro-events.graphql"; import DISTRO_TASK_QUEUE from "./distro-task-queue.graphql"; import DISTRO from "./distro.graphql"; -import GET_FAILED_TASK_STATUS_ICON_TOOLTIP from "./failed-task-status-icon-tooltip.graphql"; -import GET_AGENT_LOGS from "./get-agent-logs.graphql"; -import GET_ALL_LOGS from "./get-all-logs.graphql"; -import GET_ANNOTATION_EVENT_DATA from "./get-annotation-event-data.graphql"; -import GET_BASE_VERSION_AND_TASK from "./get-base-version-and-task.graphql"; -import GET_BUILD_BARON_CONFIGURED from "./get-build-baron-configured.graphql"; -import GET_BUILD_BARON from "./get-build-baron.graphql"; -import GET_BUILD_VARIANTS_STATS from "./get-build-variant-stats.graphql"; -import GET_BUILD_VARIANTS_FOR_TASK_NAME from "./get-build-variants-for-task-name.graphql"; -import GET_BUILD_VARIANTS_WITH_CHILDREN from "./get-build-variants-with-children.graphql"; -import GET_CLIENT_CONFIG from "./get-client-config.graphql"; -import GET_CODE_CHANGES from "./get-code-changes.graphql"; -import GET_COMMIT_QUEUE from "./get-commit-queue.graphql"; -import GET_CREATED_TICKETS from "./get-created-tickets.graphql"; -import GET_DISPLAY_TASK from "./get-display-task.graphql"; -import GET_DISTROS from "./get-distros.graphql"; -import GET_GITHUB_ORGS from "./get-github-orgs.graphql"; -import GET_GITHUB_PROJECT_CONFLICTS from "./get-github-project-conflicts.graphql"; -import GET_HAS_VERSION from "./get-has-version.graphql"; -import GET_HOST_EVENTS from "./get-host-events.graphql"; -import GET_HOST from "./get-host.graphql"; -import GET_INSTANCE_TYPES from "./get-instance-types.graphql"; -import GET_IS_PATCH_CONFIGURED from "./get-is-patch-configured.graphql"; -import GET_JIRA_CUSTOM_CREATED_ISSUES from "./get-jira-custom-created-issues.graphql"; -import GET_JIRA_ISSUES from "./get-jira-issues.graphql"; -import GET_JIRA_SUSPECTED_ISSUES from "./get-jira-suspected-issues.graphql"; -import GET_LAST_MAINLINE_COMMIT from "./get-last-mainline-commit.graphql"; -import GET_LOGKEEPER_BUILD_METADATA from "./get-logkeeper-build-metadata.graphql"; -import GET_MAINLINE_COMMITS_FOR_HISTORY from "./get-mainline-commits-for-history.graphql"; -import GET_MAINLINE_COMMITS from "./get-mainline-commits.graphql"; -import GET_MY_HOSTS from "./get-my-hosts.graphql"; -import GET_MY_VOLUMES from "./get-my-volumes.graphql"; -import GET_OTHER_USER from "./get-other-user.graphql"; -import GET_PATCH_CONFIGURE from "./get-patch-configure.graphql"; -import GET_PATCH_TASK_STATUSES from "./get-patch-task-statuses.graphql"; -import GET_PATCH from "./get-patch.graphql"; -import GET_POD_EVENTS from "./get-pod-events.graphql"; -import GET_POD from "./get-pod.graphql"; -import GET_PROJECT_BANNER from "./get-project-banner.graphql"; -import GET_PROJECT_EVENT_LOGS from "./get-project-event-logs.graphql"; -import GET_PROJECT_SETTINGS from "./get-project-settings.graphql"; -import GET_PROJECTS from "./get-projects.graphql"; -import GET_MY_PUBLIC_KEYS from "./get-public-keys.graphql"; -import GET_REPO_EVENT_LOGS from "./get-repo-event-logs.graphql"; -import GET_REPO_SETTINGS from "./get-repo-settings.graphql"; -import GET_SYSTEM_LOGS from "./get-system-logs.graphql"; -import GET_TASK_ALL_EXECUTIONS from "./get-task-all-executions.graphql"; -import GET_TASK_EVENT_LOGS from "./get-task-event-logs.graphql"; -import GET_TASK_FILES from "./get-task-files.graphql"; -import GET_TASK_LOGS from "./get-task-logs.graphql"; -import GET_TASK_NAMES_FOR_BUILD_VARIANT from "./get-task-names-for-build-variant.graphql"; -import GET_TASK_STATUSES from "./get-task-statuses.graphql"; -import GET_TASK_TEST_SAMPLE from "./get-task-test-sample.graphql"; -import GET_TASK_TESTS from "./get-task-tests.graphql"; -import GET_TASK from "./get-task.graphql"; -import GET_UNSCHEDULED_TASKS from "./get-undispatched-tasks.graphql"; -import GET_USER_CONFIG from "./get-user-config.graphql"; -import GET_USER_SETTINGS from "./get-user-settings.graphql"; -import GET_USER from "./get-user.graphql"; -import GET_VERSION_TASK_DURATIONS from "./get-version-task-durations.graphql"; -import GET_VERSION_TASKS from "./get-version-tasks.graphql"; -import GET_VERSION from "./get-version.graphql"; -import GET_VIEWABLE_PROJECTS from "./get-viewable-projects.graphql"; +import DISTROS from "./distros.graphql"; +import FAILED_TASK_STATUS_ICON_TOOLTIP from "./failed-task-status-icon-tooltip.graphql"; +import GITHUB_ORGS from "./github-orgs.graphql"; +import GITHUB_PROJECT_CONFLICTS from "./github-project-conflicts.graphql"; +import HAS_VERSION from "./has-version.graphql"; +import HOST_EVENTS from "./host-events.graphql"; +import HOST from "./host.graphql"; import HOSTS from "./hosts.graphql"; +import INSTANCE_TYPES from "./instance-types.graphql"; +import IS_PATCH_CONFIGURED from "./is-patch-configured.graphql"; +import JIRA_CUSTOM_CREATED_ISSUES from "./jira-custom-created-issues.graphql"; +import JIRA_ISSUES from "./jira-issues.graphql"; +import JIRA_SUSPECTED_ISSUES from "./jira-suspected-issues.graphql"; +import LAST_MAINLINE_COMMIT from "./last-mainline-commit.graphql"; +import LOGKEEPER_BUILD_METADATA from "./logkeeper-build-metadata.graphql"; +import MAINLINE_COMMITS_FOR_HISTORY from "./mainline-commits-for-history.graphql"; +import MAINLINE_COMMITS from "./mainline-commits.graphql"; +import MY_HOSTS from "./my-hosts.graphql"; +import MY_VOLUMES from "./my-volumes.graphql"; +import OTHER_USER from "./other-user.graphql"; +import PATCH_CONFIGURE from "./patch-configure.graphql"; +import PATCH_TASK_STATUSES from "./patch-task-statuses.graphql"; +import PATCH from "./patch.graphql"; +import POD_EVENTS from "./pod-events.graphql"; +import POD from "./pod.graphql"; +import PROJECT_BANNER from "./project-banner.graphql"; +import PROJECT_EVENT_LOGS from "./project-event-logs.graphql"; import PROJECT_HEALTH_VIEW from "./project-health-view.graphql"; -import GET_PROJECT_PATCHES from "./project-patches.graphql"; -import GET_SPAWN_EXPIRATION_INFO from "./spawn-expiration.graphql"; -import GET_SPAWN_TASK from "./spawn-task.graphql"; +import PROJECT_PATCHES from "./project-patches.graphql"; +import PROJECT_SETTINGS from "./project-settings.graphql"; +import PROJECTS from "./projects.graphql"; +import MY_PUBLIC_KEYS from "./public-keys.graphql"; +import REPO_EVENT_LOGS from "./repo-event-logs.graphql"; +import REPO_SETTINGS from "./repo-settings.graphql"; +import SPAWN_EXPIRATION_INFO from "./spawn-expiration.graphql"; +import SPAWN_TASK from "./spawn-task.graphql"; import SPRUCE_CONFIG from "./spruce-config.graphql"; -import GET_SUBNET_AVAILABILITY_ZONES from "./subnet-availability-zones.graphql"; +import SUBNET_AVAILABILITY_ZONES from "./subnet-availability-zones.graphql"; +import SYSTEM_LOGS from "./system-logs.graphql"; +import TASK_ALL_EXECUTIONS from "./task-all-executions.graphql"; +import TASK_EVENT_LOGS from "./task-event-logs.graphql"; +import TASK_FILES from "./task-files.graphql"; +import TASK_LOGS from "./task-logs.graphql"; +import TASK_NAMES_FOR_BUILD_VARIANT from "./task-names-for-build-variant.graphql"; import TASK_QUEUE_DISTROS from "./task-queue-distros.graphql"; +import TASK_STATUSES from "./task-statuses.graphql"; +import TASK_TEST_SAMPLE from "./task-test-sample.graphql"; +import TASK_TESTS from "./task-tests.graphql"; +import TASK from "./task.graphql"; +import UNSCHEDULED_TASKS from "./undispatched-tasks.graphql"; +import USER_CONFIG from "./user-config.graphql"; import USER_DISTRO_SETTINGS_PERMISSIONS from "./user-distro-settings-permissions.graphql"; -import GET_USER_PATCHES from "./user-patches.graphql"; +import USER_PATCHES from "./user-patches.graphql"; import USER_PROJECT_SETTINGS_PERMISSIONS from "./user-project-settings-permissions.graphql"; +import USER_SETTINGS from "./user-settings.graphql"; import USER_SUBSCRIPTIONS from "./user-subscriptions.graphql"; +import USER from "./user.graphql"; +import VERSION_TASK_DURATIONS from "./version-task-durations.graphql"; +import VERSION_TASKS from "./version-tasks.graphql"; +import VERSION from "./version.graphql"; +import VIEWABLE_PROJECTS from "./viewable-projects.graphql"; export { - DISTRO, + AGENT_LOGS, + ALL_LOGS, + ANNOTATION_EVENT_DATA, + AWS_REGIONS, + BASE_VERSION_AND_TASK, + BUILD_BARON_CONFIGURED, + BUILD_BARON, + BUILD_VARIANTS_FOR_TASK_NAME, + BUILD_VARIANTS_STATS, + BUILD_VARIANTS_WITH_CHILDREN, + CLIENT_CONFIG, + CODE_CHANGES, + COMMIT_QUEUE, + CREATED_TICKETS, + DISPLAY_TASK, DISTRO_EVENTS, DISTRO_TASK_QUEUE, - GET_AGENT_LOGS, - GET_ALL_LOGS, - GET_ANNOTATION_EVENT_DATA, - GET_AWS_REGIONS, - GET_BASE_VERSION_AND_TASK, - GET_BUILD_BARON_CONFIGURED, - GET_BUILD_BARON, - GET_BUILD_VARIANTS_FOR_TASK_NAME, - GET_BUILD_VARIANTS_STATS, - GET_BUILD_VARIANTS_WITH_CHILDREN, - GET_CLIENT_CONFIG, - GET_CODE_CHANGES, - GET_COMMIT_QUEUE, - GET_CREATED_TICKETS, - GET_DISPLAY_TASK, - GET_DISTROS, - GET_FAILED_TASK_STATUS_ICON_TOOLTIP, - GET_GITHUB_ORGS, - GET_GITHUB_PROJECT_CONFLICTS, - GET_HAS_VERSION, - GET_HOST_EVENTS, - GET_HOST, - GET_INSTANCE_TYPES, - GET_IS_PATCH_CONFIGURED, - GET_JIRA_CUSTOM_CREATED_ISSUES, - GET_JIRA_ISSUES, - GET_JIRA_SUSPECTED_ISSUES, - GET_LAST_MAINLINE_COMMIT, - GET_LOGKEEPER_BUILD_METADATA, - GET_MAINLINE_COMMITS_FOR_HISTORY, - GET_MAINLINE_COMMITS, - GET_MY_HOSTS, - GET_MY_PUBLIC_KEYS, - GET_MY_VOLUMES, - GET_OTHER_USER, - GET_PATCH_CONFIGURE, - GET_PATCH_TASK_STATUSES, - GET_PATCH, - GET_POD_EVENTS, - GET_POD, - GET_PROJECT_BANNER, - GET_PROJECT_EVENT_LOGS, - GET_PROJECT_PATCHES, - GET_PROJECT_SETTINGS, - GET_PROJECTS, - GET_REPO_EVENT_LOGS, - GET_REPO_SETTINGS, - GET_SPAWN_EXPIRATION_INFO, - GET_SPAWN_TASK, - SPRUCE_CONFIG, - GET_SUBNET_AVAILABILITY_ZONES, - GET_SYSTEM_LOGS, - GET_TASK_ALL_EXECUTIONS, - GET_TASK_EVENT_LOGS, - GET_TASK_FILES, - GET_TASK_LOGS, - GET_TASK_NAMES_FOR_BUILD_VARIANT, - GET_TASK_STATUSES, - GET_TASK_TEST_SAMPLE, - GET_TASK_TESTS, - GET_TASK, - GET_UNSCHEDULED_TASKS, - GET_USER_CONFIG, - GET_USER_PATCHES, - USER_DISTRO_SETTINGS_PERMISSIONS, - USER_PROJECT_SETTINGS_PERMISSIONS, - GET_USER_SETTINGS, - GET_USER, - GET_VERSION_TASK_DURATIONS, - GET_VERSION_TASKS, - GET_VERSION, - GET_VIEWABLE_PROJECTS, + DISTRO, + DISTROS, + FAILED_TASK_STATUS_ICON_TOOLTIP, + GITHUB_ORGS, + GITHUB_PROJECT_CONFLICTS, + HAS_VERSION, + HOST_EVENTS, + HOST, HOSTS, + INSTANCE_TYPES, + IS_PATCH_CONFIGURED, + JIRA_CUSTOM_CREATED_ISSUES, + JIRA_ISSUES, + JIRA_SUSPECTED_ISSUES, + LAST_MAINLINE_COMMIT, + LOGKEEPER_BUILD_METADATA, + MAINLINE_COMMITS_FOR_HISTORY, + MAINLINE_COMMITS, + MY_HOSTS, + MY_PUBLIC_KEYS, + MY_VOLUMES, + OTHER_USER, + PATCH_CONFIGURE, + PATCH_TASK_STATUSES, + PATCH, + POD_EVENTS, + POD, + PROJECT_BANNER, + PROJECT_EVENT_LOGS, PROJECT_HEALTH_VIEW, + PROJECT_PATCHES, + PROJECT_SETTINGS, + PROJECTS, + REPO_EVENT_LOGS, + REPO_SETTINGS, + SPAWN_EXPIRATION_INFO, + SPAWN_TASK, + SPRUCE_CONFIG, + SUBNET_AVAILABILITY_ZONES, + SYSTEM_LOGS, + TASK_ALL_EXECUTIONS, + TASK_EVENT_LOGS, + TASK_FILES, + TASK_LOGS, + TASK_NAMES_FOR_BUILD_VARIANT, TASK_QUEUE_DISTROS, + TASK_STATUSES, + TASK_TEST_SAMPLE, + TASK_TESTS, + TASK, + UNSCHEDULED_TASKS, + USER_CONFIG, + USER_PATCHES, + USER_DISTRO_SETTINGS_PERMISSIONS, + USER_PROJECT_SETTINGS_PERMISSIONS, + USER_SETTINGS, USER_SUBSCRIPTIONS, + USER, + VERSION_TASK_DURATIONS, + VERSION_TASKS, + VERSION, + VIEWABLE_PROJECTS, }; diff --git a/src/gql/queries/get-instance-types.graphql b/src/gql/queries/instance-types.graphql similarity index 100% rename from src/gql/queries/get-instance-types.graphql rename to src/gql/queries/instance-types.graphql diff --git a/src/gql/queries/get-is-patch-configured.graphql b/src/gql/queries/is-patch-configured.graphql similarity index 100% rename from src/gql/queries/get-is-patch-configured.graphql rename to src/gql/queries/is-patch-configured.graphql diff --git a/src/gql/queries/get-jira-custom-created-issues.graphql b/src/gql/queries/jira-custom-created-issues.graphql similarity index 100% rename from src/gql/queries/get-jira-custom-created-issues.graphql rename to src/gql/queries/jira-custom-created-issues.graphql diff --git a/src/gql/queries/get-jira-issues.graphql b/src/gql/queries/jira-issues.graphql similarity index 100% rename from src/gql/queries/get-jira-issues.graphql rename to src/gql/queries/jira-issues.graphql diff --git a/src/gql/queries/get-jira-suspected-issues.graphql b/src/gql/queries/jira-suspected-issues.graphql similarity index 100% rename from src/gql/queries/get-jira-suspected-issues.graphql rename to src/gql/queries/jira-suspected-issues.graphql diff --git a/src/gql/queries/get-last-mainline-commit.graphql b/src/gql/queries/last-mainline-commit.graphql similarity index 100% rename from src/gql/queries/get-last-mainline-commit.graphql rename to src/gql/queries/last-mainline-commit.graphql diff --git a/src/gql/queries/get-logkeeper-build-metadata.graphql b/src/gql/queries/logkeeper-build-metadata.graphql similarity index 100% rename from src/gql/queries/get-logkeeper-build-metadata.graphql rename to src/gql/queries/logkeeper-build-metadata.graphql diff --git a/src/gql/queries/get-mainline-commits-for-history.graphql b/src/gql/queries/mainline-commits-for-history.graphql similarity index 100% rename from src/gql/queries/get-mainline-commits-for-history.graphql rename to src/gql/queries/mainline-commits-for-history.graphql diff --git a/src/gql/queries/get-mainline-commits.graphql b/src/gql/queries/mainline-commits.graphql similarity index 100% rename from src/gql/queries/get-mainline-commits.graphql rename to src/gql/queries/mainline-commits.graphql diff --git a/src/gql/queries/get-my-hosts.graphql b/src/gql/queries/my-hosts.graphql similarity index 100% rename from src/gql/queries/get-my-hosts.graphql rename to src/gql/queries/my-hosts.graphql diff --git a/src/gql/queries/get-my-volumes.graphql b/src/gql/queries/my-volumes.graphql similarity index 100% rename from src/gql/queries/get-my-volumes.graphql rename to src/gql/queries/my-volumes.graphql diff --git a/src/gql/queries/get-other-user.graphql b/src/gql/queries/other-user.graphql similarity index 100% rename from src/gql/queries/get-other-user.graphql rename to src/gql/queries/other-user.graphql diff --git a/src/gql/queries/get-patch-configure.graphql b/src/gql/queries/patch-configure.graphql similarity index 100% rename from src/gql/queries/get-patch-configure.graphql rename to src/gql/queries/patch-configure.graphql diff --git a/src/gql/queries/get-patch-task-statuses.graphql b/src/gql/queries/patch-task-statuses.graphql similarity index 100% rename from src/gql/queries/get-patch-task-statuses.graphql rename to src/gql/queries/patch-task-statuses.graphql diff --git a/src/gql/queries/get-patch.graphql b/src/gql/queries/patch.graphql similarity index 100% rename from src/gql/queries/get-patch.graphql rename to src/gql/queries/patch.graphql diff --git a/src/gql/queries/get-pod-events.graphql b/src/gql/queries/pod-events.graphql similarity index 100% rename from src/gql/queries/get-pod-events.graphql rename to src/gql/queries/pod-events.graphql diff --git a/src/gql/queries/get-pod.graphql b/src/gql/queries/pod.graphql similarity index 100% rename from src/gql/queries/get-pod.graphql rename to src/gql/queries/pod.graphql diff --git a/src/gql/queries/get-project-banner.graphql b/src/gql/queries/project-banner.graphql similarity index 100% rename from src/gql/queries/get-project-banner.graphql rename to src/gql/queries/project-banner.graphql diff --git a/src/gql/queries/get-project-event-logs.graphql b/src/gql/queries/project-event-logs.graphql similarity index 100% rename from src/gql/queries/get-project-event-logs.graphql rename to src/gql/queries/project-event-logs.graphql diff --git a/src/gql/queries/get-project-settings.graphql b/src/gql/queries/project-settings.graphql similarity index 100% rename from src/gql/queries/get-project-settings.graphql rename to src/gql/queries/project-settings.graphql diff --git a/src/gql/queries/get-projects.graphql b/src/gql/queries/projects.graphql similarity index 100% rename from src/gql/queries/get-projects.graphql rename to src/gql/queries/projects.graphql diff --git a/src/gql/queries/get-public-keys.graphql b/src/gql/queries/public-keys.graphql similarity index 100% rename from src/gql/queries/get-public-keys.graphql rename to src/gql/queries/public-keys.graphql diff --git a/src/gql/queries/get-repo-event-logs.graphql b/src/gql/queries/repo-event-logs.graphql similarity index 100% rename from src/gql/queries/get-repo-event-logs.graphql rename to src/gql/queries/repo-event-logs.graphql diff --git a/src/gql/queries/get-repo-settings.graphql b/src/gql/queries/repo-settings.graphql similarity index 100% rename from src/gql/queries/get-repo-settings.graphql rename to src/gql/queries/repo-settings.graphql diff --git a/src/gql/queries/get-system-logs.graphql b/src/gql/queries/system-logs.graphql similarity index 100% rename from src/gql/queries/get-system-logs.graphql rename to src/gql/queries/system-logs.graphql diff --git a/src/gql/queries/get-task-all-executions.graphql b/src/gql/queries/task-all-executions.graphql similarity index 100% rename from src/gql/queries/get-task-all-executions.graphql rename to src/gql/queries/task-all-executions.graphql diff --git a/src/gql/queries/get-task-event-logs.graphql b/src/gql/queries/task-event-logs.graphql similarity index 100% rename from src/gql/queries/get-task-event-logs.graphql rename to src/gql/queries/task-event-logs.graphql diff --git a/src/gql/queries/get-task-files.graphql b/src/gql/queries/task-files.graphql similarity index 100% rename from src/gql/queries/get-task-files.graphql rename to src/gql/queries/task-files.graphql diff --git a/src/gql/queries/get-task-logs.graphql b/src/gql/queries/task-logs.graphql similarity index 100% rename from src/gql/queries/get-task-logs.graphql rename to src/gql/queries/task-logs.graphql diff --git a/src/gql/queries/get-task-names-for-build-variant.graphql b/src/gql/queries/task-names-for-build-variant.graphql similarity index 100% rename from src/gql/queries/get-task-names-for-build-variant.graphql rename to src/gql/queries/task-names-for-build-variant.graphql diff --git a/src/gql/queries/get-task-statuses.graphql b/src/gql/queries/task-statuses.graphql similarity index 100% rename from src/gql/queries/get-task-statuses.graphql rename to src/gql/queries/task-statuses.graphql diff --git a/src/gql/queries/get-task-test-sample.graphql b/src/gql/queries/task-test-sample.graphql similarity index 100% rename from src/gql/queries/get-task-test-sample.graphql rename to src/gql/queries/task-test-sample.graphql diff --git a/src/gql/queries/get-task-tests.graphql b/src/gql/queries/task-tests.graphql similarity index 100% rename from src/gql/queries/get-task-tests.graphql rename to src/gql/queries/task-tests.graphql diff --git a/src/gql/queries/get-task.graphql b/src/gql/queries/task.graphql similarity index 100% rename from src/gql/queries/get-task.graphql rename to src/gql/queries/task.graphql diff --git a/src/gql/queries/get-undispatched-tasks.graphql b/src/gql/queries/undispatched-tasks.graphql similarity index 100% rename from src/gql/queries/get-undispatched-tasks.graphql rename to src/gql/queries/undispatched-tasks.graphql diff --git a/src/gql/queries/get-user-config.graphql b/src/gql/queries/user-config.graphql similarity index 100% rename from src/gql/queries/get-user-config.graphql rename to src/gql/queries/user-config.graphql diff --git a/src/gql/queries/get-user-settings.graphql b/src/gql/queries/user-settings.graphql similarity index 100% rename from src/gql/queries/get-user-settings.graphql rename to src/gql/queries/user-settings.graphql diff --git a/src/gql/queries/get-user.graphql b/src/gql/queries/user.graphql similarity index 100% rename from src/gql/queries/get-user.graphql rename to src/gql/queries/user.graphql diff --git a/src/gql/queries/get-version-task-durations.graphql b/src/gql/queries/version-task-durations.graphql similarity index 100% rename from src/gql/queries/get-version-task-durations.graphql rename to src/gql/queries/version-task-durations.graphql diff --git a/src/gql/queries/get-version-tasks.graphql b/src/gql/queries/version-tasks.graphql similarity index 100% rename from src/gql/queries/get-version-tasks.graphql rename to src/gql/queries/version-tasks.graphql diff --git a/src/gql/queries/get-version.graphql b/src/gql/queries/version.graphql similarity index 100% rename from src/gql/queries/get-version.graphql rename to src/gql/queries/version.graphql diff --git a/src/gql/queries/get-viewable-projects.graphql b/src/gql/queries/viewable-projects.graphql similarity index 100% rename from src/gql/queries/get-viewable-projects.graphql rename to src/gql/queries/viewable-projects.graphql diff --git a/src/hooks/tests/useBreadcrumbRoot.test.tsx b/src/hooks/tests/useBreadcrumbRoot.test.tsx index 60e61f84d2..8989331728 100644 --- a/src/hooks/tests/useBreadcrumbRoot.test.tsx +++ b/src/hooks/tests/useBreadcrumbRoot.test.tsx @@ -2,7 +2,7 @@ import { InMemoryCache } from "@apollo/client"; import { MockedProvider } from "@apollo/client/testing"; import { OtherUserQuery, OtherUserQueryVariables } from "gql/generated/types"; import { getUserMock } from "gql/mocks/getUser"; -import { GET_OTHER_USER } from "gql/queries"; +import { OTHER_USER } from "gql/queries"; import { useBreadcrumbRoot } from "hooks"; import { renderHook, waitFor } from "test_utils"; import { ApolloMock } from "types/gql"; @@ -63,7 +63,7 @@ describe("useBreadcrumbRoot", () => { const sameUserMock: ApolloMock = { request: { - query: GET_OTHER_USER, + query: OTHER_USER, variables: { userId: "admin", }, @@ -82,7 +82,7 @@ const sameUserMock: ApolloMock = { const otherUserMock: ApolloMock = { request: { - query: GET_OTHER_USER, + query: OTHER_USER, variables: { userId: "john.doe", }, diff --git a/src/hooks/tests/useDisableSpawnExpirationCheckbox.test.tsx b/src/hooks/tests/useDisableSpawnExpirationCheckbox.test.tsx index 1cd04fbee0..4e82ff7c01 100644 --- a/src/hooks/tests/useDisableSpawnExpirationCheckbox.test.tsx +++ b/src/hooks/tests/useDisableSpawnExpirationCheckbox.test.tsx @@ -6,7 +6,7 @@ import { MyVolumesQueryVariables, } from "gql/generated/types"; import { getSpruceConfigMock } from "gql/mocks/getSpruceConfig"; -import { GET_MY_VOLUMES, GET_MY_HOSTS } from "gql/queries"; +import { MY_VOLUMES, MY_HOSTS } from "gql/queries"; import { renderHook } from "test_utils"; import { ApolloMock } from "types/gql"; import { useDisableSpawnExpirationCheckbox } from ".."; @@ -116,7 +116,7 @@ const myVolumesBase: Omit< }; const myVolumesQueryMock: ApolloMock = { - request: { query: GET_MY_VOLUMES, variables: {} }, + request: { query: MY_VOLUMES, variables: {} }, result: { data: { myVolumes: [ @@ -239,7 +239,7 @@ const myHostBase: Omit = { }; const myHostsMock: ApolloMock = { request: { - query: GET_MY_HOSTS, + query: MY_HOSTS, variables: {}, }, result: { diff --git a/src/hooks/tests/useGetUserPatchesPageTitleAndLink.test.tsx b/src/hooks/tests/useGetUserPatchesPageTitleAndLink.test.tsx index 50a42a2448..48a1eed46b 100644 --- a/src/hooks/tests/useGetUserPatchesPageTitleAndLink.test.tsx +++ b/src/hooks/tests/useGetUserPatchesPageTitleAndLink.test.tsx @@ -1,6 +1,6 @@ import { MockedProvider } from "@apollo/client/testing"; import { OtherUserQuery, OtherUserQueryVariables } from "gql/generated/types"; -import { GET_OTHER_USER } from "gql/queries"; +import { OTHER_USER } from "gql/queries"; import { useGetUserPatchesPageTitleAndLink } from "hooks"; import { renderHook, waitFor } from "test_utils"; import { ApolloMock } from "types/gql"; @@ -8,7 +8,7 @@ import { ApolloMock } from "types/gql"; const mocks: ApolloMock[] = [ { request: { - query: GET_OTHER_USER, + query: OTHER_USER, variables: { userId: "admin", }, @@ -26,7 +26,7 @@ const mocks: ApolloMock[] = [ }, { request: { - query: GET_OTHER_USER, + query: OTHER_USER, variables: { userId: "justin.mathew", }, @@ -44,7 +44,7 @@ const mocks: ApolloMock[] = [ }, { request: { - query: GET_OTHER_USER, + query: OTHER_USER, variables: { userId: "justin.mathews", }, diff --git a/src/hooks/useDisableSpawnExpirationCheckbox.ts b/src/hooks/useDisableSpawnExpirationCheckbox.ts index 3e8c30c19f..c735cbde58 100644 --- a/src/hooks/useDisableSpawnExpirationCheckbox.ts +++ b/src/hooks/useDisableSpawnExpirationCheckbox.ts @@ -5,7 +5,7 @@ import { MyVolumesQuery, MyVolumesQueryVariables, } from "gql/generated/types"; -import { GET_MY_HOSTS, GET_MY_VOLUMES } from "gql/queries"; +import { MY_HOSTS, MY_VOLUMES } from "gql/queries"; import { useSpruceConfig } from "./useSpruceConfig"; type ListItem = @@ -21,12 +21,12 @@ export const useDisableSpawnExpirationCheckbox = ( targetItem?: { noExpiration?: boolean } // Target item represents a host or volume being edited. ) => { const { data: MyHostsData } = useQuery( - GET_MY_HOSTS + MY_HOSTS ); const { data: MyVolumesData } = useQuery< MyVolumesQuery, MyVolumesQueryVariables - >(GET_MY_VOLUMES); + >(MY_VOLUMES); const spruceConfig = useSpruceConfig(); const currentUnexpirableCount = ( diff --git a/src/hooks/useGetUserPatchesPageTitleAndLink.ts b/src/hooks/useGetUserPatchesPageTitleAndLink.ts index 0c6f945431..1a118f931d 100644 --- a/src/hooks/useGetUserPatchesPageTitleAndLink.ts +++ b/src/hooks/useGetUserPatchesPageTitleAndLink.ts @@ -1,14 +1,14 @@ import { useQuery } from "@apollo/client"; import { getUserPatchesRoute } from "constants/routes"; import { OtherUserQuery, OtherUserQueryVariables } from "gql/generated/types"; -import { GET_OTHER_USER } from "gql/queries"; +import { OTHER_USER } from "gql/queries"; export const useGetUserPatchesPageTitleAndLink = ( userId: string, skip: boolean = false ) => { const { data } = useQuery( - GET_OTHER_USER, + OTHER_USER, { variables: { userId }, skip } ); diff --git a/src/hooks/useTaskStatuses.ts b/src/hooks/useTaskStatuses.ts index 9171a781d6..2a6adb8c7e 100644 --- a/src/hooks/useTaskStatuses.ts +++ b/src/hooks/useTaskStatuses.ts @@ -7,7 +7,7 @@ import { TaskStatusesQuery, TaskStatusesQueryVariables, } from "gql/generated/types"; -import { GET_TASK_STATUSES } from "gql/queries"; +import { TASK_STATUSES } from "gql/queries"; import { usePolling } from "hooks"; import { getCurrentStatuses } from "utils/statuses"; @@ -26,7 +26,7 @@ export const useTaskStatuses = ({ const { data, refetch, startPolling, stopPolling } = useQuery< TaskStatusesQuery, TaskStatusesQueryVariables - >(GET_TASK_STATUSES, { + >(TASK_STATUSES, { variables: { id: versionId }, pollInterval: DEFAULT_POLL_INTERVAL, }); diff --git a/src/hooks/useUserSettings.ts b/src/hooks/useUserSettings.ts index 131d26d4f9..f031b9ba6b 100644 --- a/src/hooks/useUserSettings.ts +++ b/src/hooks/useUserSettings.ts @@ -3,7 +3,7 @@ import { UserSettingsQuery, UserSettingsQueryVariables, } from "gql/generated/types"; -import { GET_USER_SETTINGS } from "gql/queries"; +import { USER_SETTINGS } from "gql/queries"; type UseUserSettingsOptions = { onError?: (error: Error) => void; @@ -13,7 +13,7 @@ export const useUserSettings = (options?: UseUserSettingsOptions) => { const { data, loading } = useQuery< UserSettingsQuery, UserSettingsQueryVariables - >(GET_USER_SETTINGS, { + >(USER_SETTINGS, { onError(err) { options?.onError?.(err); }, diff --git a/src/hooks/useUserTimeZone.ts b/src/hooks/useUserTimeZone.ts index eef4b0b643..3e1a9fa462 100644 --- a/src/hooks/useUserTimeZone.ts +++ b/src/hooks/useUserTimeZone.ts @@ -1,9 +1,9 @@ import { useQuery } from "@apollo/client"; import { UserSettingsQuery } from "gql/generated/types"; -import { GET_USER_SETTINGS } from "gql/queries"; +import { USER_SETTINGS } from "gql/queries"; // get the timezone for the user export const useUserTimeZone = () => { - const { data } = useQuery(GET_USER_SETTINGS); + const { data } = useQuery(USER_SETTINGS); return data?.userSettings?.timezone; }; diff --git a/src/pages/CommitQueue.tsx b/src/pages/CommitQueue.tsx index 2c5ea43299..3ce444741b 100644 --- a/src/pages/CommitQueue.tsx +++ b/src/pages/CommitQueue.tsx @@ -14,7 +14,7 @@ import { CommitQueueQuery, CommitQueueQueryVariables, } from "gql/generated/types"; -import { GET_COMMIT_QUEUE } from "gql/queries"; +import { COMMIT_QUEUE } from "gql/queries"; import { formatZeroIndexForDisplay } from "utils/numbers"; import { CommitQueueCard } from "./commitqueue/CommitQueueCard"; @@ -26,7 +26,7 @@ export const CommitQueue: React.FC = () => { const { data, loading } = useQuery< CommitQueueQuery, CommitQueueQueryVariables - >(GET_COMMIT_QUEUE, { + >(COMMIT_QUEUE, { variables: { projectIdentifier }, fetchPolicy: "cache-and-network", onError: (err) => { diff --git a/src/pages/JobLogs.tsx b/src/pages/JobLogs.tsx index 209854756e..af51146958 100644 --- a/src/pages/JobLogs.tsx +++ b/src/pages/JobLogs.tsx @@ -13,7 +13,7 @@ import { LogkeeperBuildMetadataQuery, LogkeeperBuildMetadataQueryVariables, } from "gql/generated/types"; -import { GET_LOGKEEPER_BUILD_METADATA } from "gql/queries"; +import { LOGKEEPER_BUILD_METADATA } from "gql/queries"; import { usePageTitle } from "hooks"; import { JobLogsTable } from "./jobLogs/JobLogsTable"; @@ -27,7 +27,7 @@ export const JobLogs = () => { const { data } = useQuery< LogkeeperBuildMetadataQuery, LogkeeperBuildMetadataQueryVariables - >(GET_LOGKEEPER_BUILD_METADATA, { + >(LOGKEEPER_BUILD_METADATA, { variables: { buildId }, onError: (err) => { dispatchToast.error( diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx index efd7450a01..02d28e7d93 100644 --- a/src/pages/Login.tsx +++ b/src/pages/Login.tsx @@ -4,7 +4,7 @@ import styled from "@emotion/styled"; import { Navigate, useLocation } from "react-router-dom"; import { useAuthDispatchContext, useAuthStateContext } from "context/auth"; import { UserQuery, UserQueryVariables } from "gql/generated/types"; -import { GET_USER } from "gql/queries"; +import { USER } from "gql/queries"; type LocationState = { referrer?: string; @@ -26,7 +26,7 @@ export const Login: React.FC = () => { // this top-level query is required for authentication to work // afterware is used at apollo link level to authenticate or deauthenticate user based on response to query // therefore this could be any query as long as it is top-level - useQuery(GET_USER); + useQuery(USER); const loginHandler = (): void => { devLogin({ username, password }); diff --git a/src/pages/MyPatches.tsx b/src/pages/MyPatches.tsx index 743de1dee2..c63ce26f83 100644 --- a/src/pages/MyPatches.tsx +++ b/src/pages/MyPatches.tsx @@ -2,10 +2,10 @@ import { useQuery } from "@apollo/client"; import { Navigate } from "react-router-dom"; import { getUserPatchesRoute } from "constants/routes"; import { UserQuery } from "gql/generated/types"; -import { GET_USER } from "gql/queries"; +import { USER } from "gql/queries"; export const MyPatches: React.FC = () => { - const { data } = useQuery(GET_USER); + const { data } = useQuery(USER); if (data) { return ; } diff --git a/src/pages/ProjectPatches.tsx b/src/pages/ProjectPatches.tsx index 50304469dd..875f81094c 100644 --- a/src/pages/ProjectPatches.tsx +++ b/src/pages/ProjectPatches.tsx @@ -13,7 +13,7 @@ import { ProjectPatchesQuery, ProjectPatchesQueryVariables, } from "gql/generated/types"; -import { GET_PROJECT_PATCHES } from "gql/queries"; +import { PROJECT_PATCHES } from "gql/queries"; import { usePolling } from "hooks"; import { useQueryParam } from "hooks/useQueryParam"; import { PatchPageQueryParams } from "types/patch"; @@ -34,7 +34,7 @@ export const ProjectPatches = () => { const { data, loading, refetch, startPolling, stopPolling } = useQuery< ProjectPatchesQuery, ProjectPatchesQueryVariables - >(GET_PROJECT_PATCHES, { + >(PROJECT_PATCHES, { variables: { projectIdentifier, patchesInput: { diff --git a/src/pages/Task.tsx b/src/pages/Task.tsx index 8ca773218a..028c2af03c 100644 --- a/src/pages/Task.tsx +++ b/src/pages/Task.tsx @@ -15,7 +15,7 @@ import TaskStatusBadge from "components/TaskStatusBadge"; import { DEFAULT_POLL_INTERVAL } from "constants/index"; import { useToastContext } from "context/toast"; import { TaskQuery, TaskQueryVariables } from "gql/generated/types"; -import { GET_TASK } from "gql/queries"; +import { TASK } from "gql/queries"; import { usePolling } from "hooks"; import { useUpdateURLQueryParams } from "hooks/useUpdateURLQueryParams"; import { PageDoesNotExist } from "pages/404"; @@ -42,7 +42,7 @@ export const Task = () => { const { data, error, loading, refetch, startPolling, stopPolling } = useQuery< TaskQuery, TaskQueryVariables - >(GET_TASK, { + >(TASK, { variables: { taskId: id, execution: selectedExecution }, pollInterval: DEFAULT_POLL_INTERVAL, fetchPolicy: "network-only", diff --git a/src/pages/UserPatches.tsx b/src/pages/UserPatches.tsx index 7cd5d0b75c..0700affeb1 100644 --- a/src/pages/UserPatches.tsx +++ b/src/pages/UserPatches.tsx @@ -10,7 +10,7 @@ import { UserPatchesQuery, UserPatchesQueryVariables, } from "gql/generated/types"; -import { GET_USER_PATCHES } from "gql/queries"; +import { USER_PATCHES } from "gql/queries"; import { usePolling, useGetUserPatchesPageTitleAndLink } from "hooks"; import { useQueryParam } from "hooks/useQueryParam"; import { PatchPageQueryParams } from "types/patch"; @@ -31,7 +31,7 @@ export const UserPatches = () => { const { data, loading, refetch, startPolling, stopPolling } = useQuery< UserPatchesQuery, UserPatchesQueryVariables - >(GET_USER_PATCHES, { + >(USER_PATCHES, { variables: { userId, patchesInput: { diff --git a/src/pages/Version.tsx b/src/pages/Version.tsx index ea3b781c33..bf09017533 100644 --- a/src/pages/Version.tsx +++ b/src/pages/Version.tsx @@ -22,11 +22,7 @@ import { HasVersionQuery, HasVersionQueryVariables, } from "gql/generated/types"; -import { - GET_VERSION, - GET_IS_PATCH_CONFIGURED, - GET_HAS_VERSION, -} from "gql/queries"; +import { VERSION, IS_PATCH_CONFIGURED, HAS_VERSION } from "gql/queries"; import { useSpruceConfig } from "hooks"; import { PageDoesNotExist } from "pages/404"; import { isPatchUnconfigured } from "utils/patch"; @@ -49,7 +45,7 @@ export const VersionPage: React.FC = () => { const [getVersion, { data: versionData, error: versionError }] = useLazyQuery< VersionQuery, VersionQueryVariables - >(GET_VERSION, { + >(VERSION, { variables: { id }, fetchPolicy: "cache-and-network", onError: (error) => { @@ -63,7 +59,7 @@ export const VersionPage: React.FC = () => { const [getPatch, { data: patchData, error: patchError }] = useLazyQuery< IsPatchConfiguredQuery, IsPatchConfiguredQueryVariables - >(GET_IS_PATCH_CONFIGURED, { + >(IS_PATCH_CONFIGURED, { variables: { id }, onError: (error) => { dispatchToast.error( @@ -76,7 +72,7 @@ export const VersionPage: React.FC = () => { const { error: hasVersionError } = useQuery< HasVersionQuery, HasVersionQueryVariables - >(GET_HAS_VERSION, { + >(HAS_VERSION, { variables: { id }, onCompleted: ({ hasVersion }) => { if (hasVersion) { diff --git a/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/WaterfallTaskStatusIcon.test.tsx b/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/WaterfallTaskStatusIcon.test.tsx index ddeb0d5c2f..19d05b87ae 100644 --- a/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/WaterfallTaskStatusIcon.test.tsx +++ b/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/WaterfallTaskStatusIcon.test.tsx @@ -3,7 +3,7 @@ import { FailedTaskStatusIconTooltipQuery, FailedTaskStatusIconTooltipQueryVariables, } from "gql/generated/types"; -import { GET_FAILED_TASK_STATUS_ICON_TOOLTIP } from "gql/queries"; +import { FAILED_TASK_STATUS_ICON_TOOLTIP } from "gql/queries"; import { injectGlobalHighlightStyle, removeGlobalHighlightStyle, @@ -106,7 +106,7 @@ const getTooltipQueryMock: ApolloMock< FailedTaskStatusIconTooltipQueryVariables > = { request: { - query: GET_FAILED_TASK_STATUS_ICON_TOOLTIP, + query: FAILED_TASK_STATUS_ICON_TOOLTIP, variables: { taskId: "task" }, }, result: { diff --git a/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/index.tsx b/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/index.tsx index 7313aa2e1e..cbb8967f3b 100644 --- a/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/index.tsx +++ b/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/index.tsx @@ -13,7 +13,7 @@ import { FailedTaskStatusIconTooltipQuery, FailedTaskStatusIconTooltipQueryVariables, } from "gql/generated/types"; -import { GET_FAILED_TASK_STATUS_ICON_TOOLTIP } from "gql/queries"; +import { FAILED_TASK_STATUS_ICON_TOOLTIP } from "gql/queries"; import { injectGlobalHighlightStyle, removeGlobalHighlightStyle, @@ -47,7 +47,7 @@ export const WaterfallTaskStatusIcon: React.FC< const [loadData, { data, loading }] = useLazyQuery< FailedTaskStatusIconTooltipQuery, FailedTaskStatusIconTooltipQueryVariables - >(GET_FAILED_TASK_STATUS_ICON_TOOLTIP, { variables: { taskId } }); + >(FAILED_TASK_STATUS_ICON_TOOLTIP, { variables: { taskId } }); const { filteredTestCount, testResults } = data?.task?.tests ?? {}; const failedTestDifference = filteredTestCount - (testResults ?? []).length; diff --git a/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/testData.ts b/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/testData.ts index 56607f4042..8a3f0eeff1 100644 --- a/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/testData.ts +++ b/src/pages/commits/ActiveCommits/BuildVariantCard/WaterfallTaskStatusIcon/testData.ts @@ -2,7 +2,7 @@ import { FailedTaskStatusIconTooltipQuery, FailedTaskStatusIconTooltipQueryVariables, } from "gql/generated/types"; -import { GET_FAILED_TASK_STATUS_ICON_TOOLTIP } from "gql/queries"; +import { FAILED_TASK_STATUS_ICON_TOOLTIP } from "gql/queries"; import { ApolloMock } from "types/gql"; const getTooltipQueryMock: ApolloMock< @@ -10,7 +10,7 @@ const getTooltipQueryMock: ApolloMock< FailedTaskStatusIconTooltipQueryVariables > = { request: { - query: GET_FAILED_TASK_STATUS_ICON_TOOLTIP, + query: FAILED_TASK_STATUS_ICON_TOOLTIP, variables: { taskId: "task-id" }, }, result: { diff --git a/src/pages/commits/index.tsx b/src/pages/commits/index.tsx index 0577aa68f5..058891d163 100644 --- a/src/pages/commits/index.tsx +++ b/src/pages/commits/index.tsx @@ -29,7 +29,7 @@ import { MainlineCommitsQueryVariables, ProjectHealthView, } from "gql/generated/types"; -import { GET_MAINLINE_COMMITS, SPRUCE_CONFIG } from "gql/queries"; +import { MAINLINE_COMMITS, SPRUCE_CONFIG } from "gql/queries"; import { usePageTitle, usePolling, @@ -129,7 +129,7 @@ const Commits = () => { const { data, error, loading, refetch, startPolling, stopPolling } = useQuery< MainlineCommitsQuery, MainlineCommitsQueryVariables - >(GET_MAINLINE_COMMITS, { + >(MAINLINE_COMMITS, { skip: !projectIdentifier || isResizing, fetchPolicy: "cache-and-network", variables, diff --git a/src/pages/configurePatch/configurePatchCore/testData.ts b/src/pages/configurePatch/configurePatchCore/testData.ts index 568187521d..e3a5e704bd 100644 --- a/src/pages/configurePatch/configurePatchCore/testData.ts +++ b/src/pages/configurePatch/configurePatchCore/testData.ts @@ -3,7 +3,7 @@ import { CodeChangesQueryVariables, ConfigurePatchQuery, } from "gql/generated/types"; -import { GET_CODE_CHANGES } from "gql/queries"; +import { CODE_CHANGES } from "gql/queries"; import { ApolloMock } from "types/gql"; export const patchQuery: ConfigurePatchQuery = { @@ -61,7 +61,7 @@ export const mocks: ApolloMock[] = [ { request: { - query: GET_CODE_CHANGES, + query: CODE_CHANGES, variables: { id: "version" }, }, result: { diff --git a/src/pages/configurePatch/index.tsx b/src/pages/configurePatch/index.tsx index bbe98f1247..13e4b22fd4 100644 --- a/src/pages/configurePatch/index.tsx +++ b/src/pages/configurePatch/index.tsx @@ -10,7 +10,7 @@ import { ConfigurePatchQuery, ConfigurePatchQueryVariables, } from "gql/generated/types"; -import { GET_PATCH_CONFIGURE } from "gql/queries"; +import { PATCH_CONFIGURE } from "gql/queries"; import { usePageTitle } from "hooks"; import { PageDoesNotExist } from "pages/404"; import { validateObjectId } from "utils/validators"; @@ -22,7 +22,7 @@ const ConfigurePatch: React.FC = () => { const { data, error, loading } = useQuery< ConfigurePatchQuery, ConfigurePatchQueryVariables - >(GET_PATCH_CONFIGURE, { + >(PATCH_CONFIGURE, { variables: { id }, onError(err) { dispatchToast.error(err.message); diff --git a/src/pages/container/EventsTable/index.tsx b/src/pages/container/EventsTable/index.tsx index 1a1de2f747..8499832d16 100644 --- a/src/pages/container/EventsTable/index.tsx +++ b/src/pages/container/EventsTable/index.tsx @@ -19,7 +19,7 @@ import { SiderCard, TableControlInnerRow } from "components/styles"; import { size } from "constants/tokens"; import { useToastContext } from "context/toast"; import { PodEventsQuery, PodEventsQueryVariables } from "gql/generated/types"; -import { GET_POD_EVENTS } from "gql/queries"; +import { POD_EVENTS } from "gql/queries"; import { useDateFormat } from "hooks"; import { url } from "utils"; import { getEventCopy } from "./util"; @@ -37,7 +37,7 @@ const EventsTable: React.FC<{}> = () => { const { data: podEventsData } = useQuery< PodEventsQuery, PodEventsQueryVariables - >(GET_POD_EVENTS, { + >(POD_EVENTS, { variables: { id, page, limit }, onError: (err) => { dispatchToast.error( diff --git a/src/pages/container/index.tsx b/src/pages/container/index.tsx index 7bc3e8e040..bc664a399d 100644 --- a/src/pages/container/index.tsx +++ b/src/pages/container/index.tsx @@ -10,7 +10,7 @@ import { } from "components/styles"; import { useToastContext } from "context/toast"; import { PodQuery, PodQueryVariables } from "gql/generated/types"; -import { GET_POD } from "gql/queries"; +import { POD } from "gql/queries"; import { PodStatus } from "types/pod"; import EventsTable from "./EventsTable"; import Metadata from "./Metadata"; @@ -18,17 +18,14 @@ import Metadata from "./Metadata"; const Container = () => { const dispatchToast = useToastContext(); const { id } = useParams<{ id: string }>(); - const { data, error, loading } = useQuery( - GET_POD, - { - variables: { podId: id }, - onError: (err) => { - dispatchToast.error( - `There was an error loading the host: ${err.message}` - ); - }, - } - ); + const { data, error, loading } = useQuery(POD, { + variables: { podId: id }, + onError: (err) => { + dispatchToast.error( + `There was an error loading the host: ${err.message}` + ); + }, + }); const { pod } = data || {}; const { id: podId, status } = pod || {}; return ( diff --git a/src/pages/distroSettings/DistroSelect/DistroSelect.test.tsx b/src/pages/distroSettings/DistroSelect/DistroSelect.test.tsx index 2591c8c8a8..38c956106c 100644 --- a/src/pages/distroSettings/DistroSelect/DistroSelect.test.tsx +++ b/src/pages/distroSettings/DistroSelect/DistroSelect.test.tsx @@ -1,6 +1,6 @@ import { MockedProvider } from "@apollo/client/testing"; import { DistrosQuery, DistrosQueryVariables } from "gql/generated/types"; -import { GET_DISTROS } from "gql/queries"; +import { DISTROS } from "gql/queries"; import { renderWithRouterMatch as render, screen, @@ -68,7 +68,7 @@ describe("distro select", () => { const distrosMock: ApolloMock = { request: { - query: GET_DISTROS, + query: DISTROS, variables: { onlySpawnable: false }, }, result: { diff --git a/src/pages/distroSettings/DistroSelect/index.tsx b/src/pages/distroSettings/DistroSelect/index.tsx index 69e20a1fb6..ea6618ee7a 100644 --- a/src/pages/distroSettings/DistroSelect/index.tsx +++ b/src/pages/distroSettings/DistroSelect/index.tsx @@ -3,7 +3,7 @@ import { useNavigate } from "react-router-dom"; import SearchableDropdown from "components/SearchableDropdown"; import { getDistroSettingsRoute } from "constants/routes"; import { DistrosQuery, DistrosQueryVariables } from "gql/generated/types"; -import { GET_DISTROS } from "gql/queries"; +import { DISTROS } from "gql/queries"; interface DistroSelectProps { selectedDistro: string; @@ -17,7 +17,7 @@ export const DistroSelect: React.FC = ({ const { data: distrosData, loading } = useQuery< DistrosQuery, DistrosQueryVariables - >(GET_DISTROS, { + >(DISTROS, { variables: { onlySpawnable: false, }, diff --git a/src/pages/distroSettings/tabs/EventLogTab/EventLogTab.test.tsx b/src/pages/distroSettings/tabs/EventLogTab/EventLogTab.test.tsx index e372ba55ba..55388016db 100644 --- a/src/pages/distroSettings/tabs/EventLogTab/EventLogTab.test.tsx +++ b/src/pages/distroSettings/tabs/EventLogTab/EventLogTab.test.tsx @@ -158,7 +158,7 @@ const distroEvents: DistroEventsQuery = { patch_time_in_queue_factor: 0, patch_zipper_factor: 0, stepback_task_factor: 0, - target_time: 0, + tartime: 0, version: "tunable", }, provider: "ec2-ondemand", @@ -260,7 +260,7 @@ const distroEvents: DistroEventsQuery = { patch_time_in_queue_factor: 0, patch_zipper_factor: 0, stepback_task_factor: 0, - target_time: 0, + tartime: 0, version: "tunable", }, provider: "ec2-ondemand", @@ -362,7 +362,7 @@ const distroEvents: DistroEventsQuery = { patch_time_in_queue_factor: 0, patch_zipper_factor: 0, stepback_task_factor: 0, - target_time: 0, + tartime: 0, version: "tunable", }, provider: "ec2-ondemand", @@ -471,7 +471,7 @@ const distroEvents: DistroEventsQuery = { patch_time_in_queue_factor: 0, patch_zipper_factor: 0, stepback_task_factor: 0, - target_time: 0, + tartime: 0, version: "tunable", }, provider: "ec2-ondemand", diff --git a/src/pages/host/index.tsx b/src/pages/host/index.tsx index 26b27ef346..12b88f7c25 100644 --- a/src/pages/host/index.tsx +++ b/src/pages/host/index.tsx @@ -23,7 +23,7 @@ import { HostEventsQuery, HostEventsQueryVariables, } from "gql/generated/types"; -import { GET_HOST, GET_HOST_EVENTS } from "gql/queries/index"; +import { HOST, HOST_EVENTS } from "gql/queries/index"; import { HostTable } from "pages/host/HostTable"; import { Metadata } from "pages/host/Metadata"; import { HostStatus } from "types/host"; @@ -39,7 +39,7 @@ const Host: React.FC = () => { data: hostData, error, loading: hostMetaDataLoading, - } = useQuery(GET_HOST, { + } = useQuery(HOST, { variables: { id }, onError: (err) => { dispatchToast.error( @@ -63,7 +63,7 @@ const Host: React.FC = () => { const { data: hostEventData, loading: hostEventLoading } = useQuery< HostEventsQuery, HostEventsQueryVariables - >(GET_HOST_EVENTS, { + >(HOST_EVENTS, { variables: { id, tag, page, limit }, }); diff --git a/src/pages/preferences/preferencesTabs/ProfileTab.tsx b/src/pages/preferences/preferencesTabs/ProfileTab.tsx index c42d37b9d9..26313f1164 100644 --- a/src/pages/preferences/preferencesTabs/ProfileTab.tsx +++ b/src/pages/preferences/preferencesTabs/ProfileTab.tsx @@ -14,7 +14,7 @@ import { AwsRegionsQuery, } from "gql/generated/types"; import { UPDATE_USER_SETTINGS } from "gql/mutations"; -import { GET_AWS_REGIONS } from "gql/queries"; +import { AWS_REGIONS } from "gql/queries"; import { useUserSettings } from "hooks"; import { omitTypename } from "utils/string"; @@ -27,7 +27,7 @@ export const ProfileTab: React.FC = () => { const lastKnownAs = githubUser?.lastKnownAs || ""; const { data: awsRegionData, loading: awsRegionLoading } = - useQuery(GET_AWS_REGIONS); + useQuery(AWS_REGIONS); const awsRegions = awsRegionData?.awsRegions || []; const [updateUserSettings, { loading: updateLoading }] = useMutation< diff --git a/src/pages/preferences/preferencesTabs/PublicKeysTab.tsx b/src/pages/preferences/preferencesTabs/PublicKeysTab.tsx index 1e4485e670..cb1b11ee0f 100644 --- a/src/pages/preferences/preferencesTabs/PublicKeysTab.tsx +++ b/src/pages/preferences/preferencesTabs/PublicKeysTab.tsx @@ -17,7 +17,7 @@ import { RemovePublicKeyMutationVariables, } from "gql/generated/types"; import { REMOVE_PUBLIC_KEY } from "gql/mutations"; -import { GET_MY_PUBLIC_KEYS } from "gql/queries"; +import { MY_PUBLIC_KEYS } from "gql/queries"; import { EditModal, EditModalPropsState, @@ -35,7 +35,7 @@ export const PublicKeysTab: React.FC = () => { const { data: myKeysData, loading: loadingMyPublicKeys } = useQuery< MyPublicKeysQuery, MyPublicKeysQueryVariables - >(GET_MY_PUBLIC_KEYS, { + >(MY_PUBLIC_KEYS, { onError(error) { dispatchToast.error( `There was an error fetching your public keys: ${error.message}` @@ -54,7 +54,7 @@ export const PublicKeysTab: React.FC = () => { }, update(cache, { data }) { cache.writeQuery({ - query: GET_MY_PUBLIC_KEYS, + query: MY_PUBLIC_KEYS, data: { myPublicKeys: [...data.removePublicKey] }, }); }, diff --git a/src/pages/preferences/preferencesTabs/cliTab/AuthenticationCard.tsx b/src/pages/preferences/preferencesTabs/cliTab/AuthenticationCard.tsx index fa6d6d5120..30a783f660 100644 --- a/src/pages/preferences/preferencesTabs/cliTab/AuthenticationCard.tsx +++ b/src/pages/preferences/preferencesTabs/cliTab/AuthenticationCard.tsx @@ -9,7 +9,7 @@ import { usePreferencesAnalytics } from "analytics"; import { SettingsCard } from "components/SettingsCard"; import { size } from "constants/tokens"; import { UserConfigQuery, UserConfigQueryVariables } from "gql/generated/types"; -import { GET_USER_CONFIG } from "gql/queries"; +import { USER_CONFIG } from "gql/queries"; import { request } from "utils"; const { post } = request; @@ -18,7 +18,7 @@ export const AuthenticationCard = () => { const { data, loading, refetch } = useQuery< UserConfigQuery, UserConfigQueryVariables - >(GET_USER_CONFIG); + >(USER_CONFIG); const { sendEvent } = usePreferencesAnalytics(); if (loading) { return ; diff --git a/src/pages/preferences/preferencesTabs/cliTab/DownloadCard.tsx b/src/pages/preferences/preferencesTabs/cliTab/DownloadCard.tsx index 6d105eff96..74c225e52e 100644 --- a/src/pages/preferences/preferencesTabs/cliTab/DownloadCard.tsx +++ b/src/pages/preferences/preferencesTabs/cliTab/DownloadCard.tsx @@ -21,14 +21,14 @@ import { ClientConfigQueryVariables, ClientBinary, } from "gql/generated/types"; -import { GET_CLIENT_CONFIG } from "gql/queries"; +import { CLIENT_CONFIG } from "gql/queries"; import { CardType } from "types/leafygreen"; export const DownloadCard = () => { const { data, loading } = useQuery< ClientConfigQuery, ClientConfigQueryVariables - >(GET_CLIENT_CONFIG); + >(CLIENT_CONFIG); if (loading) { return ; diff --git a/src/pages/preferences/preferencesTabs/cliTab/VerifyCard.tsx b/src/pages/preferences/preferencesTabs/cliTab/VerifyCard.tsx index d4a0084446..3704dc2e02 100644 --- a/src/pages/preferences/preferencesTabs/cliTab/VerifyCard.tsx +++ b/src/pages/preferences/preferencesTabs/cliTab/VerifyCard.tsx @@ -7,11 +7,11 @@ import { ClientConfigQuery, ClientConfigQueryVariables, } from "gql/generated/types"; -import { GET_CLIENT_CONFIG } from "gql/queries"; +import { CLIENT_CONFIG } from "gql/queries"; export const VerifyCard = () => { const { data } = useQuery( - GET_CLIENT_CONFIG + CLIENT_CONFIG ); const latestRevision = get(data, "clientConfig.latestRevision", ""); diff --git a/src/pages/preferences/preferencesTabs/publicKeysTab/EditModal.tsx b/src/pages/preferences/preferencesTabs/publicKeysTab/EditModal.tsx index 1a0e4e452b..29e3357f13 100644 --- a/src/pages/preferences/preferencesTabs/publicKeysTab/EditModal.tsx +++ b/src/pages/preferences/preferencesTabs/publicKeysTab/EditModal.tsx @@ -17,7 +17,7 @@ import { CreatePublicKeyMutationVariables, } from "gql/generated/types"; import { CREATE_PUBLIC_KEY, UPDATE_PUBLIC_KEY } from "gql/mutations"; -import { GET_MY_PUBLIC_KEYS } from "gql/queries"; +import { MY_PUBLIC_KEYS } from "gql/queries"; import { validators, string } from "utils"; const { validateSSHPublicKey } = validators; @@ -40,7 +40,7 @@ export const EditModal: React.FC = ({ const { data: myKeysData } = useQuery< MyPublicKeysQuery, MyPublicKeysQueryVariables - >(GET_MY_PUBLIC_KEYS, { fetchPolicy: "cache-only" }); + >(MY_PUBLIC_KEYS, { fetchPolicy: "cache-only" }); const { sendEvent } = usePreferencesAnalytics(); const dispatchToast = useToastContext(); const [errors, setErrors] = useState([]); @@ -56,7 +56,7 @@ export const EditModal: React.FC = ({ onCompleted() {}, update(cache, { data }) { cache.writeQuery({ - query: GET_MY_PUBLIC_KEYS, + query: MY_PUBLIC_KEYS, data: { myPublicKeys: [...data.updatePublicKey] }, }); }, @@ -73,7 +73,7 @@ export const EditModal: React.FC = ({ onCompleted() {}, update(cache, { data }) { cache.writeQuery({ - query: GET_MY_PUBLIC_KEYS, + query: MY_PUBLIC_KEYS, data: { myPublicKeys: [...data.createPublicKey] }, }); }, diff --git a/src/pages/projectSettings/CopyProjectModal.test.tsx b/src/pages/projectSettings/CopyProjectModal.test.tsx index 6078c2025d..e90c3212cb 100644 --- a/src/pages/projectSettings/CopyProjectModal.test.tsx +++ b/src/pages/projectSettings/CopyProjectModal.test.tsx @@ -12,7 +12,7 @@ import { MergeQueue, } from "gql/generated/types"; import { COPY_PROJECT } from "gql/mutations"; -import { GET_PROJECT_SETTINGS, GET_REPO_SETTINGS } from "gql/queries"; +import { PROJECT_SETTINGS, REPO_SETTINGS } from "gql/queries"; import { renderWithRouterMatch as render, screen, @@ -263,7 +263,7 @@ const projectSettingsMock: ApolloMock< ProjectSettingsQueryVariables > = { request: { - query: GET_PROJECT_SETTINGS, + query: PROJECT_SETTINGS, variables: { identifier: newProjectIdentifier, }, @@ -385,7 +385,7 @@ const repoSettingsMock: ApolloMock< RepoSettingsQueryVariables > = { request: { - query: GET_REPO_SETTINGS, + query: REPO_SETTINGS, variables: { repoId: newProjectIdentifier, }, diff --git a/src/pages/projectSettings/CreateProjectModal.test.tsx b/src/pages/projectSettings/CreateProjectModal.test.tsx index cf6c2a78b1..507ba8c913 100644 --- a/src/pages/projectSettings/CreateProjectModal.test.tsx +++ b/src/pages/projectSettings/CreateProjectModal.test.tsx @@ -8,7 +8,7 @@ import { GithubOrgsQueryVariables, } from "gql/generated/types"; import { CREATE_PROJECT } from "gql/mutations"; -import { GET_GITHUB_ORGS } from "gql/queries"; +import { GITHUB_ORGS } from "gql/queries"; import { renderWithRouterMatch as render, screen, @@ -313,7 +313,7 @@ const createProjectMock: ApolloMock< const getGithubOrgsMock: ApolloMock = { request: { - query: GET_GITHUB_ORGS, + query: GITHUB_ORGS, }, result: { data: { diff --git a/src/pages/projectSettings/CreateProjectModal.tsx b/src/pages/projectSettings/CreateProjectModal.tsx index 3fda26f787..0afa75b10c 100644 --- a/src/pages/projectSettings/CreateProjectModal.tsx +++ b/src/pages/projectSettings/CreateProjectModal.tsx @@ -13,7 +13,7 @@ import { GithubOrgsQuery, } from "gql/generated/types"; import { CREATE_PROJECT } from "gql/mutations"; -import { GET_GITHUB_ORGS } from "gql/queries"; +import { GITHUB_ORGS } from "gql/queries"; import { projectId, projectName, requestS3Creds } from "./sharedFormSchema"; interface Props { @@ -42,7 +42,7 @@ export const CreateProjectModal: React.FC = ({ }); const [hasError, setHasError] = useState(true); - const { data: gitOrgs } = useQuery(GET_GITHUB_ORGS, { + const { data: gitOrgs } = useQuery(GITHUB_ORGS, { skip: !open, }); const { spruceConfig: { githubOrgs = [] } = {} } = gitOrgs ?? {}; diff --git a/src/pages/projectSettings/index.tsx b/src/pages/projectSettings/index.tsx index c2343e0f31..1d6121bd21 100644 --- a/src/pages/projectSettings/index.tsx +++ b/src/pages/projectSettings/index.tsx @@ -22,7 +22,7 @@ import { RepoSettingsQuery, RepoSettingsQueryVariables, } from "gql/generated/types"; -import { GET_PROJECT_SETTINGS, GET_REPO_SETTINGS } from "gql/queries"; +import { PROJECT_SETTINGS, REPO_SETTINGS } from "gql/queries"; import { usePageTitle } from "hooks"; import { validators } from "utils"; import { ProjectSettingsProvider } from "./Context"; @@ -46,7 +46,7 @@ const ProjectSettings: React.FC = () => { const { data: projectData, loading: projectLoading } = useQuery< ProjectSettingsQuery, ProjectSettingsQueryVariables - >(GET_PROJECT_SETTINGS, { + >(PROJECT_SETTINGS, { skip: isRepo, variables: { identifier }, onError: (e) => { @@ -72,7 +72,7 @@ const ProjectSettings: React.FC = () => { const { data: repoData } = useQuery< RepoSettingsQuery, RepoSettingsQueryVariables - >(GET_REPO_SETTINGS, { + >(REPO_SETTINGS, { skip: projectLoading || projectType === ProjectType.Project, variables: { repoId }, onError: (e) => { diff --git a/src/pages/projectSettings/tabs/EventLogTab/EventLogTab.test.tsx b/src/pages/projectSettings/tabs/EventLogTab/EventLogTab.test.tsx index 34352c3ec2..c2dc49bcf4 100644 --- a/src/pages/projectSettings/tabs/EventLogTab/EventLogTab.test.tsx +++ b/src/pages/projectSettings/tabs/EventLogTab/EventLogTab.test.tsx @@ -6,7 +6,7 @@ import { ProjectHealthView, MergeQueue, } from "gql/generated/types"; -import { GET_PROJECT_EVENT_LOGS } from "gql/queries"; +import { PROJECT_EVENT_LOGS } from "gql/queries"; import { renderWithRouterMatch as render, screen, waitFor } from "test_utils"; import { ApolloMock } from "types/gql"; import { ProjectType } from "../utils"; @@ -59,7 +59,7 @@ const mock = ( limit: number = 15 ): ApolloMock => ({ request: { - query: GET_PROJECT_EVENT_LOGS, + query: PROJECT_EVENT_LOGS, variables: { identifier: "spruce", limit, diff --git a/src/pages/projectSettings/tabs/EventLogTab/useProjectSettingsEvents.ts b/src/pages/projectSettings/tabs/EventLogTab/useProjectSettingsEvents.ts index 5b66d32019..14bf5c7de1 100644 --- a/src/pages/projectSettings/tabs/EventLogTab/useProjectSettingsEvents.ts +++ b/src/pages/projectSettings/tabs/EventLogTab/useProjectSettingsEvents.ts @@ -8,7 +8,7 @@ import { RepoEventLogsQuery, RepoEventLogsQueryVariables, } from "gql/generated/types"; -import { GET_PROJECT_EVENT_LOGS, GET_REPO_EVENT_LOGS } from "gql/queries"; +import { PROJECT_EVENT_LOGS, REPO_EVENT_LOGS } from "gql/queries"; export const useProjectSettingsEvents = ( identifier: string, @@ -24,7 +24,7 @@ export const useProjectSettingsEvents = ( fetchMore: projectFetchMore, previousData: projectPreviousData, } = useQuery( - GET_PROJECT_EVENT_LOGS, + PROJECT_EVENT_LOGS, { variables: { identifier, limit }, errorPolicy: "all", @@ -42,7 +42,7 @@ export const useProjectSettingsEvents = ( fetchMore: repoFetchMore, previousData: repoPreviousData, } = useQuery( - GET_REPO_EVENT_LOGS, + REPO_EVENT_LOGS, { variables: { id: identifier, limit }, errorPolicy: "all", diff --git a/src/pages/projectSettings/tabs/GeneralTab/Fields/RepoConfigField.test.tsx b/src/pages/projectSettings/tabs/GeneralTab/Fields/RepoConfigField.test.tsx index 4eb5ed2507..04cd54f41d 100644 --- a/src/pages/projectSettings/tabs/GeneralTab/Fields/RepoConfigField.test.tsx +++ b/src/pages/projectSettings/tabs/GeneralTab/Fields/RepoConfigField.test.tsx @@ -16,7 +16,7 @@ import { ATTACH_PROJECT_TO_NEW_REPO, DETACH_PROJECT_FROM_REPO, } from "gql/mutations"; -import { GET_GITHUB_ORGS } from "gql/queries"; +import { GITHUB_ORGS } from "gql/queries"; import { renderWithRouterMatch as render, screen, @@ -380,7 +380,7 @@ const detachProjectFromRepoMock: ApolloMock< const getGithubOrgsMock: ApolloMock = { request: { - query: GET_GITHUB_ORGS, + query: GITHUB_ORGS, }, result: { data: { diff --git a/src/pages/projectSettings/tabs/GeneralTab/Fields/RepoConfigField.tsx b/src/pages/projectSettings/tabs/GeneralTab/Fields/RepoConfigField.tsx index e19b891080..692e068581 100644 --- a/src/pages/projectSettings/tabs/GeneralTab/Fields/RepoConfigField.tsx +++ b/src/pages/projectSettings/tabs/GeneralTab/Fields/RepoConfigField.tsx @@ -7,7 +7,7 @@ import { Field } from "@rjsf/core"; import { SpruceForm } from "components/SpruceForm"; import { size, zIndex } from "constants/tokens"; import { GithubOrgsQuery } from "gql/generated/types"; -import { GET_GITHUB_ORGS } from "gql/queries"; +import { GITHUB_ORGS } from "gql/queries"; import { ProjectType } from "../../utils"; import { AttachDetachModal } from "./AttachDetachModal"; import { MoveRepoModal } from "./MoveRepoModal"; @@ -36,7 +36,7 @@ export const RepoConfigField: Field = ({ const ownerOrRepoHasChanges = formData.owner !== initialOwner || formData.repo !== initialRepo; - const { data } = useQuery(GET_GITHUB_ORGS); + const { data } = useQuery(GITHUB_ORGS); const { spruceConfig: { githubOrgs = [] } = {} } = data ?? {}; return ( diff --git a/src/pages/projectSettings/tabs/GithubCommitQueueTab/GithubCommitQueueTab.tsx b/src/pages/projectSettings/tabs/GithubCommitQueueTab/GithubCommitQueueTab.tsx index a03c123a73..95880f41ee 100644 --- a/src/pages/projectSettings/tabs/GithubCommitQueueTab/GithubCommitQueueTab.tsx +++ b/src/pages/projectSettings/tabs/GithubCommitQueueTab/GithubCommitQueueTab.tsx @@ -7,7 +7,7 @@ import { GithubProjectConflictsQuery, GithubProjectConflictsQueryVariables, } from "gql/generated/types"; -import { GET_GITHUB_PROJECT_CONFLICTS } from "gql/queries"; +import { GITHUB_PROJECT_CONFLICTS } from "gql/queries"; import { useProjectSettingsContext } from "pages/projectSettings/Context"; import { BaseTab } from "../BaseTab"; import { ProjectType } from "../utils"; @@ -45,7 +45,7 @@ export const GithubCommitQueueTab: React.FC = ({ const { data } = useQuery< GithubProjectConflictsQuery, GithubProjectConflictsQueryVariables - >(GET_GITHUB_PROJECT_CONFLICTS, { + >(GITHUB_PROJECT_CONFLICTS, { skip: projectType === ProjectType.Repo, variables: { projectId }, }); diff --git a/src/pages/spawn/SpawnHost.tsx b/src/pages/spawn/SpawnHost.tsx index 1df97411f3..72eb8784f2 100644 --- a/src/pages/spawn/SpawnHost.tsx +++ b/src/pages/spawn/SpawnHost.tsx @@ -6,7 +6,7 @@ import { TitleContainer, Title, BadgeWrapper } from "components/Spawn"; import { DEFAULT_POLL_INTERVAL } from "constants/index"; import { useToastContext } from "context/toast"; import { MyHostsQuery, MyHostsQueryVariables } from "gql/generated/types"; -import { GET_MY_HOSTS } from "gql/queries"; +import { MY_HOSTS } from "gql/queries"; import { usePolling, usePageTitle } from "hooks"; import { SpawnHostButton, SpawnHostTable } from "pages/spawn/spawnHost/index"; import { HostStatus } from "types/host"; @@ -17,7 +17,7 @@ export const SpawnHost = () => { const { data, loading, refetch, startPolling, stopPolling } = useQuery< MyHostsQuery, MyHostsQueryVariables - >(GET_MY_HOSTS, { + >(MY_HOSTS, { pollInterval: DEFAULT_POLL_INTERVAL, onError: (e) => { dispatchToast.error( diff --git a/src/pages/spawn/SpawnVolume.tsx b/src/pages/spawn/SpawnVolume.tsx index 41321ea91a..63313ef45d 100644 --- a/src/pages/spawn/SpawnVolume.tsx +++ b/src/pages/spawn/SpawnVolume.tsx @@ -6,7 +6,7 @@ import { Title, BadgeWrapper, TitleContainer } from "components/Spawn"; import { DEFAULT_POLL_INTERVAL } from "constants/index"; import { useToastContext } from "context/toast"; import { MyVolumesQuery, MyVolumesQueryVariables } from "gql/generated/types"; -import { GET_MY_VOLUMES } from "gql/queries"; +import { MY_VOLUMES } from "gql/queries"; import { usePolling, usePageTitle, useSpruceConfig } from "hooks"; import { SpawnVolumeTable } from "pages/spawn/spawnVolume/SpawnVolumeTable"; import { SpawnVolumeButton } from "./spawnVolume/SpawnVolumeButton"; @@ -22,7 +22,7 @@ export const SpawnVolume = () => { refetch, startPolling, stopPolling, - } = useQuery(GET_MY_VOLUMES, { + } = useQuery(MY_VOLUMES, { pollInterval: DEFAULT_POLL_INTERVAL, onError: (e) => { dispatchToast.error( diff --git a/src/pages/spawn/spawnHost/SpawnHostActionButton.tsx b/src/pages/spawn/spawnHost/SpawnHostActionButton.tsx index 5097c18d04..91a462d8fd 100644 --- a/src/pages/spawn/spawnHost/SpawnHostActionButton.tsx +++ b/src/pages/spawn/spawnHost/SpawnHostActionButton.tsx @@ -14,7 +14,7 @@ import { MyHostsQueryVariables, } from "gql/generated/types"; import { UPDATE_SPAWN_HOST_STATUS } from "gql/mutations"; -import { GET_MY_HOSTS } from "gql/queries"; +import { MY_HOSTS } from "gql/queries"; import { usePolling } from "hooks"; import { HostStatus } from "types/host"; import { MyHost } from "types/spawn"; @@ -27,13 +27,13 @@ export const SpawnHostActionButton: React.FC<{ host: MyHost }> = ({ host }) => { const canTerminate = host.status !== HostStatus.Terminated; // When the UPDATE_SPAWN_HOST_STATUS mutation occurs the host state is not immediately updated, It gets updated a few seconds later. - // Since the GET_MY_HOSTS query on this components parent polls at a slower rate, this component triggers a poll at a faster interval for that + // Since the MY_HOSTS query on this components parent polls at a slower rate, this component triggers a poll at a faster interval for that // query when it returns an updated host status the polling is halted. This allows the query to poll slowly and not utilize unnecessary bandwith // except when an action is performed and we need to fetch updated data. const [getMyHosts, { refetch, startPolling, stopPolling }] = useLazyQuery< MyHostsQuery, MyHostsQueryVariables - >(GET_MY_HOSTS, { + >(MY_HOSTS, { pollInterval: 3000, onError: (e) => { dispatchToast.error( diff --git a/src/pages/spawn/spawnHost/SpawnHostButton.test.tsx b/src/pages/spawn/spawnHost/SpawnHostButton.test.tsx index b4f3adbc1f..6d4613c034 100644 --- a/src/pages/spawn/spawnHost/SpawnHostButton.test.tsx +++ b/src/pages/spawn/spawnHost/SpawnHostButton.test.tsx @@ -2,7 +2,7 @@ import { MockedProvider } from "@apollo/client/testing"; import { RenderFakeToastContext } from "context/toast/__mocks__"; import { MyHostsQuery, MyHostsQueryVariables } from "gql/generated/types"; import { getSpruceConfigMock } from "gql/mocks/getSpruceConfig"; -import { GET_MY_HOSTS } from "gql/queries"; +import { MY_HOSTS } from "gql/queries"; import { renderWithRouterMatch as render, screen, waitFor } from "test_utils"; import { ApolloMock } from "types/gql"; import { HostStatus } from "types/host"; @@ -142,7 +142,7 @@ const terminatedHost: MyHost = { const sixHostsMock: ApolloMock = { request: { - query: GET_MY_HOSTS, + query: MY_HOSTS, variables: {}, }, result: { @@ -161,7 +161,7 @@ const sixHostsMock: ApolloMock = { const twoHostsMock: ApolloMock = { request: { - query: GET_MY_HOSTS, + query: MY_HOSTS, variables: {}, }, result: { @@ -176,7 +176,7 @@ const fiveHostsWithTerminatedMock: ApolloMock< MyHostsQueryVariables > = { request: { - query: GET_MY_HOSTS, + query: MY_HOSTS, variables: {}, }, result: { diff --git a/src/pages/spawn/spawnHost/SpawnHostButton.tsx b/src/pages/spawn/spawnHost/SpawnHostButton.tsx index a4d6091a92..f3ac1b3335 100644 --- a/src/pages/spawn/spawnHost/SpawnHostButton.tsx +++ b/src/pages/spawn/spawnHost/SpawnHostButton.tsx @@ -6,7 +6,7 @@ import { useSpawnAnalytics } from "analytics"; import { PlusButton } from "components/Buttons"; import { size, zIndex } from "constants/tokens"; import { MyHostsQuery, MyHostsQueryVariables } from "gql/generated/types"; -import { GET_MY_HOSTS } from "gql/queries"; +import { MY_HOSTS } from "gql/queries"; import { useSpruceConfig } from "hooks"; import { useQueryParam } from "hooks/useQueryParam"; import { HostStatus } from "types/host"; @@ -15,7 +15,7 @@ import { SpawnHostModal } from "./spawnHostButton/SpawnHostModal"; export const SpawnHostButton: React.FC = () => { const { data: myHostsData } = useQuery( - GET_MY_HOSTS + MY_HOSTS ); const [spawnHostParam, setSpawnHostParam] = useQueryParam< boolean | undefined diff --git a/src/pages/spawn/spawnHost/spawnHostButton/SpawnHostModal.tsx b/src/pages/spawn/spawnHost/spawnHostButton/SpawnHostModal.tsx index e8dff158e0..48685aa245 100644 --- a/src/pages/spawn/spawnHost/spawnHostButton/SpawnHostModal.tsx +++ b/src/pages/spawn/spawnHost/spawnHostButton/SpawnHostModal.tsx @@ -20,7 +20,7 @@ import { SpawnTaskQueryVariables, } from "gql/generated/types"; import { SPAWN_HOST } from "gql/mutations"; -import { GET_SPAWN_TASK } from "gql/queries"; +import { SPAWN_TASK } from "gql/queries"; import { omit } from "utils/object"; import { getString, parseQueryString } from "utils/queryString"; @@ -44,7 +44,7 @@ export const SpawnHostModal: React.FC = ({ const { data: spawnTaskData } = useQuery< SpawnTaskQuery, SpawnTaskQueryVariables - >(GET_SPAWN_TASK, { + >(SPAWN_TASK, { skip: !(taskIdQueryParam && distroIdQueryParam), variables: { taskId: taskIdQueryParam }, }); diff --git a/src/pages/spawn/spawnVolume/SpawnVolumeModal.test.tsx b/src/pages/spawn/spawnVolume/SpawnVolumeModal.test.tsx index 553cd5e93e..dd4b686c30 100644 --- a/src/pages/spawn/spawnVolume/SpawnVolumeModal.test.tsx +++ b/src/pages/spawn/spawnVolume/SpawnVolumeModal.test.tsx @@ -13,11 +13,7 @@ import { import { getSpruceConfigMock } from "gql/mocks/getSpruceConfig"; import { getUserMock } from "gql/mocks/getUser"; import { SPAWN_VOLUME } from "gql/mutations"; -import { - GET_MY_HOSTS, - GET_SUBNET_AVAILABILITY_ZONES, - GET_MY_VOLUMES, -} from "gql/queries"; +import { MY_HOSTS, SUBNET_AVAILABILITY_ZONES, MY_VOLUMES } from "gql/queries"; import { userEvent, renderWithRouterMatch as render, @@ -165,7 +161,7 @@ describe("spawnVolumeModal", () => { const myHostsMock: ApolloMock = { request: { - query: GET_MY_HOSTS, + query: MY_HOSTS, variables: {}, }, result: { @@ -352,7 +348,7 @@ const myHostsMock: ApolloMock = { const myVolumesQueryMock: ApolloMock = { - request: { query: GET_MY_VOLUMES, variables: {} }, + request: { query: MY_VOLUMES, variables: {} }, result: { data: { myVolumes: [ @@ -410,7 +406,7 @@ const subnetZonesMock: ApolloMock< SubnetAvailabilityZonesQueryVariables > = { request: { - query: GET_SUBNET_AVAILABILITY_ZONES, + query: SUBNET_AVAILABILITY_ZONES, variables: {}, }, result: { diff --git a/src/pages/spawn/spawnVolume/spawnVolumeTableActions/UnmountButton.tsx b/src/pages/spawn/spawnVolume/spawnVolumeTableActions/UnmountButton.tsx index 6e04f538bb..16ec579c67 100644 --- a/src/pages/spawn/spawnVolume/spawnVolumeTableActions/UnmountButton.tsx +++ b/src/pages/spawn/spawnVolume/spawnVolumeTableActions/UnmountButton.tsx @@ -12,7 +12,7 @@ import { DetachVolumeFromHostMutationVariables, } from "gql/generated/types"; import { DETACH_VOLUME } from "gql/mutations"; -import { GET_MY_HOSTS } from "gql/queries"; +import { MY_HOSTS } from "gql/queries"; import { TableVolume } from "types/spawn"; interface Props { @@ -24,7 +24,7 @@ export const UnmountButton: React.FC = ({ volume }) => { const spawnAnalytics = useSpawnAnalytics(); const { data: myHostsData } = useQuery( - GET_MY_HOSTS + MY_HOSTS ); const myHosts = myHostsData?.myHosts ?? []; diff --git a/src/pages/task/actionButtons/previousCommits/PreviousCommits.test.tsx b/src/pages/task/actionButtons/previousCommits/PreviousCommits.test.tsx index 6c85442d46..b4a0601d08 100644 --- a/src/pages/task/actionButtons/previousCommits/PreviousCommits.test.tsx +++ b/src/pages/task/actionButtons/previousCommits/PreviousCommits.test.tsx @@ -6,10 +6,7 @@ import { LastMainlineCommitQuery, LastMainlineCommitQueryVariables, } from "gql/generated/types"; -import { - GET_BASE_VERSION_AND_TASK, - GET_LAST_MAINLINE_COMMIT, -} from "gql/queries"; +import { BASE_VERSION_AND_TASK, LAST_MAINLINE_COMMIT } from "gql/queries"; import { renderWithRouterMatch, screen, userEvent, waitFor } from "test_utils"; import { ApolloMock } from "types/gql"; import { PreviousCommits } from "."; @@ -19,8 +16,8 @@ const select = { name: "Previous commits for this task" }; describe("previous commits", () => { // Patch and mainline commit behavior only have a significant difference when it comes to determining - // the base or previous task. Patch gets the base task directly from GET_BASE_VERSION_AND_TASK, while - // mainline commits needs to run another query GET_LAST_MAINLINE_COMMIT to get previous task. + // the base or previous task. Patch gets the base task directly from BASE_VERSION_AND_TASK, while + // mainline commits needs to run another query LAST_MAINLINE_COMMIT to get previous task. describe("patch specific", () => { it("the GO button is disabled when there is no base task", async () => { const { Component } = RenderFakeToastContext( @@ -244,7 +241,7 @@ const getPatchTaskWithSuccessfulBaseTask: ApolloMock< BaseVersionAndTaskQueryVariables > = { request: { - query: GET_BASE_VERSION_AND_TASK, + query: BASE_VERSION_AND_TASK, variables: { taskId: "t1", }, @@ -284,7 +281,7 @@ const getPatchTaskWithRunningBaseTask: ApolloMock< BaseVersionAndTaskQueryVariables > = { request: { - query: GET_BASE_VERSION_AND_TASK, + query: BASE_VERSION_AND_TASK, variables: { taskId: "t3", }, @@ -324,7 +321,7 @@ const getPatchTaskWithFailingBaseTask: ApolloMock< BaseVersionAndTaskQueryVariables > = { request: { - query: GET_BASE_VERSION_AND_TASK, + query: BASE_VERSION_AND_TASK, variables: { taskId: "t1", }, @@ -364,7 +361,7 @@ const getPatchTaskWithNoBaseVersion: ApolloMock< BaseVersionAndTaskQueryVariables > = { request: { - query: GET_BASE_VERSION_AND_TASK, + query: BASE_VERSION_AND_TASK, variables: { taskId: "t3", }, @@ -394,7 +391,7 @@ const getLastPassingVersion: ApolloMock< LastMainlineCommitQueryVariables > = { request: { - query: GET_LAST_MAINLINE_COMMIT, + query: LAST_MAINLINE_COMMIT, variables: { projectIdentifier: "evergreen", skipOrderNumber: 3676, @@ -441,7 +438,7 @@ const getLastExecutedVersion: ApolloMock< LastMainlineCommitQueryVariables > = { request: { - query: GET_LAST_MAINLINE_COMMIT, + query: LAST_MAINLINE_COMMIT, variables: { projectIdentifier: "evergreen", skipOrderNumber: 3676, @@ -499,7 +496,7 @@ const getPatchTaskWithNoBaseTask: ApolloMock< BaseVersionAndTaskQueryVariables > = { request: { - query: GET_BASE_VERSION_AND_TASK, + query: BASE_VERSION_AND_TASK, variables: { taskId: "t1", }, @@ -535,7 +532,7 @@ const getMainlineTaskWithBaseVersion: ApolloMock< BaseVersionAndTaskQueryVariables > = { request: { - query: GET_BASE_VERSION_AND_TASK, + query: BASE_VERSION_AND_TASK, variables: { taskId: "t4", }, @@ -570,7 +567,7 @@ const getNullParentTask: ApolloMock< LastMainlineCommitQueryVariables > = { request: { - query: GET_LAST_MAINLINE_COMMIT, + query: LAST_MAINLINE_COMMIT, variables: { projectIdentifier: "evergreen", skipOrderNumber: 3676, @@ -589,7 +586,7 @@ const getParentTaskWithError: ApolloMock< LastMainlineCommitQueryVariables > = { request: { - query: GET_LAST_MAINLINE_COMMIT, + query: LAST_MAINLINE_COMMIT, variables: { projectIdentifier: "evergreen", skipOrderNumber: 3676, diff --git a/src/pages/task/actionButtons/previousCommits/index.tsx b/src/pages/task/actionButtons/previousCommits/index.tsx index 68bb9abe8e..66f5bbc50d 100644 --- a/src/pages/task/actionButtons/previousCommits/index.tsx +++ b/src/pages/task/actionButtons/previousCommits/index.tsx @@ -16,10 +16,7 @@ import { LastMainlineCommitQuery, LastMainlineCommitQueryVariables, } from "gql/generated/types"; -import { - GET_BASE_VERSION_AND_TASK, - GET_LAST_MAINLINE_COMMIT, -} from "gql/queries"; +import { BASE_VERSION_AND_TASK, LAST_MAINLINE_COMMIT } from "gql/queries"; import { useLGButtonRouterLink } from "hooks/useLGButtonRouterLink"; import { TaskStatus } from "types/task"; import { string } from "utils"; @@ -51,7 +48,7 @@ export const PreviousCommits: React.FC = ({ taskId }) => { const { data: taskData } = useQuery< BaseVersionAndTaskQuery, BaseVersionAndTaskQueryVariables - >(GET_BASE_VERSION_AND_TASK, { + >(BASE_VERSION_AND_TASK, { variables: { taskId }, }); @@ -60,7 +57,7 @@ export const PreviousCommits: React.FC = ({ taskId }) => { const [fetchParentTask, { loading: parentLoading }] = useLazyQuery< LastMainlineCommitQuery, LastMainlineCommitQueryVariables - >(GET_LAST_MAINLINE_COMMIT, { + >(LAST_MAINLINE_COMMIT, { onCompleted: (data) => { dispatch({ type: "setParentTask", @@ -72,7 +69,7 @@ export const PreviousCommits: React.FC = ({ taskId }) => { const [fetchLastPassing, { loading: passingLoading }] = useLazyQuery< LastMainlineCommitQuery, LastMainlineCommitQueryVariables - >(GET_LAST_MAINLINE_COMMIT, { + >(LAST_MAINLINE_COMMIT, { onCompleted: (data) => { dispatch({ type: "setLastPassingTask", @@ -87,7 +84,7 @@ export const PreviousCommits: React.FC = ({ taskId }) => { const [fetchLastExecuted, { loading: executedLoading }] = useLazyQuery< LastMainlineCommitQuery, LastMainlineCommitQueryVariables - >(GET_LAST_MAINLINE_COMMIT, { + >(LAST_MAINLINE_COMMIT, { onCompleted: (data) => { dispatch({ type: "setLastExecutedTask", diff --git a/src/pages/task/executionDropdown/ExecutionSelector.tsx b/src/pages/task/executionDropdown/ExecutionSelector.tsx index 07fcf3a223..441e1f80f1 100644 --- a/src/pages/task/executionDropdown/ExecutionSelector.tsx +++ b/src/pages/task/executionDropdown/ExecutionSelector.tsx @@ -8,7 +8,7 @@ import { TaskAllExecutionsQuery, TaskAllExecutionsQueryVariables, } from "gql/generated/types"; -import { GET_TASK_ALL_EXECUTIONS } from "gql/queries"; +import { TASK_ALL_EXECUTIONS } from "gql/queries"; import { useDateFormat } from "hooks"; import { formatZeroIndexForDisplay } from "utils/numbers"; @@ -28,7 +28,7 @@ export const ExecutionSelect: React.FC = ({ const allExecutionsResult = useQuery< TaskAllExecutionsQuery, TaskAllExecutionsQueryVariables - >(GET_TASK_ALL_EXECUTIONS, { + >(TASK_ALL_EXECUTIONS, { variables: { taskId: id }, }); const allExecutions = allExecutionsResult?.data?.taskAllExecutions; diff --git a/src/pages/task/taskTabs/FileTable/index.tsx b/src/pages/task/taskTabs/FileTable/index.tsx index e40da4b54c..b3ad4b4e57 100644 --- a/src/pages/task/taskTabs/FileTable/index.tsx +++ b/src/pages/task/taskTabs/FileTable/index.tsx @@ -7,7 +7,7 @@ import { Body } from "@leafygreen-ui/typography"; import { size } from "constants/tokens"; import { useToastContext } from "context/toast"; import { TaskFilesQuery, TaskFilesQueryVariables } from "gql/generated/types"; -import { GET_TASK_FILES } from "gql/queries"; +import { TASK_FILES } from "gql/queries"; import GroupedFileTable from "./GroupedFileTable"; import { filterGroupedFiles } from "./utils"; @@ -19,7 +19,7 @@ const FileTable: React.FC = ({ execution, taskId }) => { const [search, setSearch] = useState(""); const dispatchToast = useToastContext(); const { data, loading } = useQuery( - GET_TASK_FILES, + TASK_FILES, { variables: { taskId, diff --git a/src/pages/task/taskTabs/TestsTable.tsx b/src/pages/task/taskTabs/TestsTable.tsx index 462fc0a013..aee2dfa7a6 100644 --- a/src/pages/task/taskTabs/TestsTable.tsx +++ b/src/pages/task/taskTabs/TestsTable.tsx @@ -16,7 +16,7 @@ import { TestResult, TaskQuery, } from "gql/generated/types"; -import { GET_TASK_TESTS } from "gql/queries"; +import { TASK_TESTS } from "gql/queries"; import { useUpdateURLQueryParams, usePolling, @@ -106,7 +106,7 @@ export const TestsTable: React.FC = ({ task }) => { const { data, loading, refetch, startPolling, stopPolling } = useQuery< TaskTestsQuery, TaskTestsQueryVariables - >(GET_TASK_TESTS, { + >(TASK_TESTS, { variables: queryVariables, skip: queryVariables.execution === null, pollInterval: DEFAULT_POLL_INTERVAL, diff --git a/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaron.test.tsx b/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaron.test.tsx index 0a7ea98d53..4f7c2e9b6d 100644 --- a/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaron.test.tsx +++ b/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaron.test.tsx @@ -12,7 +12,7 @@ import { import { getSpruceConfigMock } from "gql/mocks/getSpruceConfig"; import { getUserMock } from "gql/mocks/getUser"; import { FILE_JIRA_TICKET } from "gql/mutations"; -import { GET_BUILD_BARON, GET_CREATED_TICKETS } from "gql/queries"; +import { BUILD_BARON, CREATED_TICKETS } from "gql/queries"; import { renderWithRouterMatch as render, screen, userEvent } from "test_utils"; import { ApolloMock } from "types/gql"; import BuildBaronContent from "./BuildBaronContent"; @@ -194,7 +194,7 @@ const buildBaronQuery: BuildBaronQuery = { const getBuildBaronMock: ApolloMock = { request: { - query: GET_BUILD_BARON, + query: BUILD_BARON, variables: { taskId, execution, @@ -227,7 +227,7 @@ const getJiraTicketsMock: ApolloMock< CreatedTicketsQueryVariables > = { request: { - query: GET_CREATED_TICKETS, + query: CREATED_TICKETS, variables: { taskId, }, diff --git a/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaron.tsx b/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaron.tsx index 1dedac3705..5c3246e43a 100644 --- a/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaron.tsx +++ b/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaron.tsx @@ -5,7 +5,7 @@ import { BuildBaronQuery, BuildBaronQueryVariables, } from "gql/generated/types"; -import { GET_BUILD_BARON } from "gql/queries"; +import { BUILD_BARON } from "gql/queries"; import BuildBaronContent from "./BuildBaronContent"; interface Props { @@ -22,7 +22,7 @@ const BuildBaron: React.FC = ({ userCanModify, }) => { const { data, loading } = useQuery( - GET_BUILD_BARON, + BUILD_BARON, { variables: { taskId, execution }, } diff --git a/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaronContent.tsx b/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaronContent.tsx index 5fa0058afb..cdd4bfdede 100644 --- a/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaronContent.tsx +++ b/src/pages/task/taskTabs/buildBaronAndAnnotations/BuildBaronContent.tsx @@ -11,10 +11,7 @@ import { CreatedTicketsQuery, CreatedTicketsQueryVariables, } from "gql/generated/types"; -import { - GET_CREATED_TICKETS, - GET_JIRA_CUSTOM_CREATED_ISSUES, -} from "gql/queries"; +import { CREATED_TICKETS, JIRA_CUSTOM_CREATED_ISSUES } from "gql/queries"; import AnnotationNote from "./AnnotationNote"; import { BBCreatedTickets, CustomCreatedTickets } from "./CreatedTicketsTable"; import { Issues, SuspectedIssues } from "./Issues"; @@ -43,7 +40,7 @@ const BuildBaronContent: React.FC = ({ const { data: customCreatedTickets } = useQuery< CustomCreatedIssuesQuery, CustomCreatedIssuesQueryVariables - >(GET_JIRA_CUSTOM_CREATED_ISSUES, { + >(JIRA_CUSTOM_CREATED_ISSUES, { variables: { taskId, execution }, onError: (err) => { dispatchToast.error( @@ -55,7 +52,7 @@ const BuildBaronContent: React.FC = ({ const { data: bbCreatedTickets } = useQuery< CreatedTicketsQuery, CreatedTicketsQueryVariables - >(GET_CREATED_TICKETS, { + >(CREATED_TICKETS, { variables: { taskId }, onError(error) { dispatchToast.error( diff --git a/src/pages/task/taskTabs/buildBaronAndAnnotations/Issues/Issues.tsx b/src/pages/task/taskTabs/buildBaronAndAnnotations/Issues/Issues.tsx index 36dc05f1e5..ed6ba12f1d 100644 --- a/src/pages/task/taskTabs/buildBaronAndAnnotations/Issues/Issues.tsx +++ b/src/pages/task/taskTabs/buildBaronAndAnnotations/Issues/Issues.tsx @@ -5,7 +5,7 @@ import { IssuesQueryVariables, Annotation, } from "gql/generated/types"; -import { GET_JIRA_ISSUES } from "gql/queries"; +import { JIRA_ISSUES } from "gql/queries"; import AnnotationTickets from "./AnnotationTickets"; interface IssuesProps { @@ -28,7 +28,7 @@ const Issues: React.FC = ({ const dispatchToast = useToastContext(); // Query Jira ticket data const { data, loading } = useQuery( - GET_JIRA_ISSUES, + JIRA_ISSUES, { variables: { taskId, execution }, onError: (err) => { diff --git a/src/pages/task/taskTabs/buildBaronAndAnnotations/Issues/SuspectedIssues.tsx b/src/pages/task/taskTabs/buildBaronAndAnnotations/Issues/SuspectedIssues.tsx index 629da5a94d..c65c5b95d1 100644 --- a/src/pages/task/taskTabs/buildBaronAndAnnotations/Issues/SuspectedIssues.tsx +++ b/src/pages/task/taskTabs/buildBaronAndAnnotations/Issues/SuspectedIssues.tsx @@ -5,7 +5,7 @@ import { SuspectedIssuesQueryVariables, Annotation, } from "gql/generated/types"; -import { GET_JIRA_SUSPECTED_ISSUES } from "gql/queries"; +import { JIRA_SUSPECTED_ISSUES } from "gql/queries"; import AnnotationTickets from "./AnnotationTickets"; interface SuspectedIssuesProps { @@ -30,7 +30,7 @@ const SuspectedIssues: React.FC = ({ const { data, loading } = useQuery< SuspectedIssuesQuery, SuspectedIssuesQueryVariables - >(GET_JIRA_SUSPECTED_ISSUES, { + >(JIRA_SUSPECTED_ISSUES, { variables: { taskId, execution }, onError: (err) => { dispatchToast.error( diff --git a/src/pages/task/taskTabs/buildBaronAndAnnotations/useBuildBaronVariables.ts b/src/pages/task/taskTabs/buildBaronAndAnnotations/useBuildBaronVariables.ts index 4179f4244a..7d956f7fdf 100644 --- a/src/pages/task/taskTabs/buildBaronAndAnnotations/useBuildBaronVariables.ts +++ b/src/pages/task/taskTabs/buildBaronAndAnnotations/useBuildBaronVariables.ts @@ -3,7 +3,7 @@ import { BuildBaronConfiguredQuery, BuildBaronConfiguredQueryVariables, } from "gql/generated/types"; -import { GET_BUILD_BARON_CONFIGURED } from "gql/queries"; +import { BUILD_BARON_CONFIGURED } from "gql/queries"; import { statuses } from "utils"; const { isFailedTaskStatus } = statuses; @@ -22,7 +22,7 @@ const useBuildBaronVariables = ({ task }: UseBuildBaronVariablesType) => { const { data: buildBaronData } = useQuery< BuildBaronConfiguredQuery, BuildBaronConfiguredQueryVariables - >(GET_BUILD_BARON_CONFIGURED, { + >(BUILD_BARON_CONFIGURED, { variables: { taskId: id, execution, diff --git a/src/pages/task/taskTabs/logs/LogTypes.tsx b/src/pages/task/taskTabs/logs/LogTypes.tsx index 2475762991..4d1e7c40a0 100644 --- a/src/pages/task/taskTabs/logs/LogTypes.tsx +++ b/src/pages/task/taskTabs/logs/LogTypes.tsx @@ -21,11 +21,11 @@ import { LogMessageFragment, } from "gql/generated/types"; import { - GET_AGENT_LOGS, - GET_TASK_EVENT_LOGS, - GET_SYSTEM_LOGS, - GET_TASK_LOGS, - GET_ALL_LOGS, + AGENT_LOGS, + TASK_EVENT_LOGS, + SYSTEM_LOGS, + TASK_LOGS, + ALL_LOGS, } from "gql/queries"; import { usePolling } from "hooks"; import { RequiredQueryParams } from "types/task"; @@ -56,7 +56,7 @@ export const AllLog: React.FC = (props) => { const { data, error, loading, refetch, startPolling, stopPolling } = useQuery< AllLogsQuery, AllLogsQueryVariables - >(GET_ALL_LOGS, { + >(ALL_LOGS, { variables: { id, execution: selectedExecution }, pollInterval: DEFAULT_POLL_INTERVAL, }); @@ -83,7 +83,7 @@ export const EventLog: React.FC = (props) => { const { data, error, loading, refetch, startPolling, stopPolling } = useQuery< TaskEventLogsQuery, TaskEventLogsQueryVariables - >(GET_TASK_EVENT_LOGS, { + >(TASK_EVENT_LOGS, { variables: { id, execution: selectedExecution }, pollInterval: DEFAULT_POLL_INTERVAL, }); @@ -113,7 +113,7 @@ export const SystemLog: React.FC = (props) => { const { data, error, loading, refetch, startPolling, stopPolling } = useQuery< SystemLogsQuery, SystemLogsQueryVariables - >(GET_SYSTEM_LOGS, { + >(SYSTEM_LOGS, { variables: { id, execution: selectedExecution }, pollInterval: DEFAULT_POLL_INTERVAL, }); @@ -139,7 +139,7 @@ export const AgentLog: React.FC = (props) => { const { data, error, loading, refetch, startPolling, stopPolling } = useQuery< AgentLogsQuery, AgentLogsQueryVariables - >(GET_AGENT_LOGS, { + >(AGENT_LOGS, { variables: { id, execution: selectedExecution }, pollInterval: DEFAULT_POLL_INTERVAL, }); @@ -165,7 +165,7 @@ export const TaskLog: React.FC = (props) => { const { data, error, loading, refetch, startPolling, stopPolling } = useQuery< TaskLogsQuery, TaskLogsQueryVariables - >(GET_TASK_LOGS, { + >(TASK_LOGS, { variables: { id, execution: selectedExecution }, pollInterval: DEFAULT_POLL_INTERVAL, }); diff --git a/src/pages/taskHistory/BuildVariantSelector.tsx b/src/pages/taskHistory/BuildVariantSelector.tsx index e82d74ab49..2f30fda17c 100644 --- a/src/pages/taskHistory/BuildVariantSelector.tsx +++ b/src/pages/taskHistory/BuildVariantSelector.tsx @@ -6,7 +6,7 @@ import { BuildVariantsForTaskNameQuery, BuildVariantsForTaskNameQueryVariables, } from "gql/generated/types"; -import { GET_BUILD_VARIANTS_FOR_TASK_NAME } from "gql/queries"; +import { BUILD_VARIANTS_FOR_TASK_NAME } from "gql/queries"; import { useQueryParam } from "hooks/useQueryParam"; import { HistoryQueryParams } from "types/history"; @@ -28,7 +28,7 @@ const BuildVariantSelector: React.FC = ({ const { data, loading } = useQuery< BuildVariantsForTaskNameQuery, BuildVariantsForTaskNameQueryVariables - >(GET_BUILD_VARIANTS_FOR_TASK_NAME, { + >(BUILD_VARIANTS_FOR_TASK_NAME, { variables: { projectIdentifier, taskName, diff --git a/src/pages/taskHistory/ColumnHeaders/ColumnHeaders.test.tsx b/src/pages/taskHistory/ColumnHeaders/ColumnHeaders.test.tsx index 507f0827dd..07a6e8716b 100644 --- a/src/pages/taskHistory/ColumnHeaders/ColumnHeaders.test.tsx +++ b/src/pages/taskHistory/ColumnHeaders/ColumnHeaders.test.tsx @@ -5,7 +5,7 @@ import { BuildVariantsForTaskNameQuery, BuildVariantsForTaskNameQueryVariables, } from "gql/generated/types"; -import { GET_BUILD_VARIANTS_FOR_TASK_NAME } from "gql/queries"; +import { BUILD_VARIANTS_FOR_TASK_NAME } from "gql/queries"; import { renderWithRouterMatch as render, screen, @@ -200,7 +200,7 @@ const mock = ( BuildVariantsForTaskNameQueryVariables > => ({ request: { - query: GET_BUILD_VARIANTS_FOR_TASK_NAME, + query: BUILD_VARIANTS_FOR_TASK_NAME, variables: { projectIdentifier: "evergreen", taskName: "some_task", diff --git a/src/pages/taskHistory/ColumnHeaders/index.tsx b/src/pages/taskHistory/ColumnHeaders/index.tsx index fbb72441d3..e346e415dc 100644 --- a/src/pages/taskHistory/ColumnHeaders/index.tsx +++ b/src/pages/taskHistory/ColumnHeaders/index.tsx @@ -9,7 +9,7 @@ import { BuildVariantsForTaskNameQuery, BuildVariantsForTaskNameQueryVariables, } from "gql/generated/types"; -import { GET_BUILD_VARIANTS_FOR_TASK_NAME } from "gql/queries"; +import { BUILD_VARIANTS_FOR_TASK_NAME } from "gql/queries"; import { array, string } from "utils"; import { reportError } from "utils/errorReporting"; @@ -35,7 +35,7 @@ const ColumnHeaders: React.FC = ({ const { data: columnData, loading } = useQuery< BuildVariantsForTaskNameQuery, BuildVariantsForTaskNameQueryVariables - >(GET_BUILD_VARIANTS_FOR_TASK_NAME, { + >(BUILD_VARIANTS_FOR_TASK_NAME, { variables: { projectIdentifier, taskName, diff --git a/src/pages/taskHistory/TaskHistoryRow/TaskHistoryRow.test.tsx b/src/pages/taskHistory/TaskHistoryRow/TaskHistoryRow.test.tsx index 3d1f3b73dd..7b53aabcd6 100644 --- a/src/pages/taskHistory/TaskHistoryRow/TaskHistoryRow.test.tsx +++ b/src/pages/taskHistory/TaskHistoryRow/TaskHistoryRow.test.tsx @@ -7,7 +7,7 @@ import { TaskTestSampleQuery, TaskTestSampleQueryVariables, } from "gql/generated/types"; -import { GET_TASK_TEST_SAMPLE } from "gql/queries"; +import { TASK_TEST_SAMPLE } from "gql/queries"; import { renderWithRouterMatch as render, screen, @@ -335,7 +335,7 @@ const noFilterData: ApolloMock< TaskTestSampleQueryVariables > = { request: { - query: GET_TASK_TEST_SAMPLE, + query: TASK_TEST_SAMPLE, variables: { tasks: [ "some_id_1", @@ -369,7 +369,7 @@ const withMatchingFilter: ApolloMock< TaskTestSampleQueryVariables > = { request: { - query: GET_TASK_TEST_SAMPLE, + query: TASK_TEST_SAMPLE, variables: { tasks: [ "some_id_1", @@ -405,7 +405,7 @@ const withNonMatchingFilter: ApolloMock< TaskTestSampleQueryVariables > = { request: { - query: GET_TASK_TEST_SAMPLE, + query: TASK_TEST_SAMPLE, variables: { tasks: [ "some_id_1", diff --git a/src/pages/taskHistory/index.tsx b/src/pages/taskHistory/index.tsx index 37a87f2272..897856330b 100644 --- a/src/pages/taskHistory/index.tsx +++ b/src/pages/taskHistory/index.tsx @@ -23,7 +23,7 @@ import { MainlineCommitsForHistoryQuery, MainlineCommitsForHistoryQueryVariables, } from "gql/generated/types"; -import { GET_MAINLINE_COMMITS_FOR_HISTORY } from "gql/queries"; +import { MAINLINE_COMMITS_FOR_HISTORY } from "gql/queries"; import { usePageTitle } from "hooks"; import { string } from "utils"; import { leaveBreadcrumb } from "utils/errorReporting"; @@ -54,7 +54,7 @@ const TaskHistoryContents: React.FC = () => { const { data, loading, refetch } = useQuery< MainlineCommitsForHistoryQuery, MainlineCommitsForHistoryQueryVariables - >(GET_MAINLINE_COMMITS_FOR_HISTORY, { + >(MAINLINE_COMMITS_FOR_HISTORY, { variables: { mainlineCommitsOptions: { projectIdentifier, diff --git a/src/pages/variantHistory/ColumnHeaders.test.tsx b/src/pages/variantHistory/ColumnHeaders.test.tsx index fae5f539a5..74906ce58c 100644 --- a/src/pages/variantHistory/ColumnHeaders.test.tsx +++ b/src/pages/variantHistory/ColumnHeaders.test.tsx @@ -5,7 +5,7 @@ import { TaskNamesForBuildVariantQuery, TaskNamesForBuildVariantQueryVariables, } from "gql/generated/types"; -import { GET_TASK_NAMES_FOR_BUILD_VARIANT } from "gql/queries"; +import { TASK_NAMES_FOR_BUILD_VARIANT } from "gql/queries"; import { renderWithRouterMatch as render, screen, @@ -150,7 +150,7 @@ const mock = ( TaskNamesForBuildVariantQueryVariables > => ({ request: { - query: GET_TASK_NAMES_FOR_BUILD_VARIANT, + query: TASK_NAMES_FOR_BUILD_VARIANT, variables: { projectIdentifier: "evergreen", buildVariant: "some_variant", diff --git a/src/pages/variantHistory/ColumnHeaders.tsx b/src/pages/variantHistory/ColumnHeaders.tsx index 34b8e3bfa2..aaeba13247 100644 --- a/src/pages/variantHistory/ColumnHeaders.tsx +++ b/src/pages/variantHistory/ColumnHeaders.tsx @@ -9,7 +9,7 @@ import { TaskNamesForBuildVariantQuery, TaskNamesForBuildVariantQueryVariables, } from "gql/generated/types"; -import { GET_TASK_NAMES_FOR_BUILD_VARIANT } from "gql/queries"; +import { TASK_NAMES_FOR_BUILD_VARIANT } from "gql/queries"; import { array, string } from "utils"; import { reportError } from "utils/errorReporting"; @@ -35,7 +35,7 @@ const ColumnHeaders: React.FC = ({ const { data: columnData, loading } = useQuery< TaskNamesForBuildVariantQuery, TaskNamesForBuildVariantQueryVariables - >(GET_TASK_NAMES_FOR_BUILD_VARIANT, { + >(TASK_NAMES_FOR_BUILD_VARIANT, { variables: { projectIdentifier, buildVariant: variantName, diff --git a/src/pages/variantHistory/TaskSelector.tsx b/src/pages/variantHistory/TaskSelector.tsx index dd4867bf3e..9a898c6ddc 100644 --- a/src/pages/variantHistory/TaskSelector.tsx +++ b/src/pages/variantHistory/TaskSelector.tsx @@ -6,7 +6,7 @@ import { TaskNamesForBuildVariantQuery, TaskNamesForBuildVariantQueryVariables, } from "gql/generated/types"; -import { GET_TASK_NAMES_FOR_BUILD_VARIANT } from "gql/queries"; +import { TASK_NAMES_FOR_BUILD_VARIANT } from "gql/queries"; import { useQueryParam } from "hooks/useQueryParam"; import { HistoryQueryParams } from "types/history"; @@ -29,7 +29,7 @@ const TaskSelector: React.FC = ({ const { data, loading } = useQuery< TaskNamesForBuildVariantQuery, TaskNamesForBuildVariantQueryVariables - >(GET_TASK_NAMES_FOR_BUILD_VARIANT, { + >(TASK_NAMES_FOR_BUILD_VARIANT, { variables: { projectIdentifier, buildVariant, diff --git a/src/pages/variantHistory/VariantHistoryRow.test.tsx b/src/pages/variantHistory/VariantHistoryRow.test.tsx index 07817420ca..e322910525 100644 --- a/src/pages/variantHistory/VariantHistoryRow.test.tsx +++ b/src/pages/variantHistory/VariantHistoryRow.test.tsx @@ -7,7 +7,7 @@ import { TaskTestSampleQuery, TaskTestSampleQueryVariables, } from "gql/generated/types"; -import { GET_TASK_TEST_SAMPLE } from "gql/queries"; +import { TASK_TEST_SAMPLE } from "gql/queries"; import { renderWithRouterMatch as render, screen, @@ -302,7 +302,7 @@ const noFilterData: ApolloMock< TaskTestSampleQueryVariables > = { request: { - query: GET_TASK_TEST_SAMPLE, + query: TASK_TEST_SAMPLE, variables: { tasks: [ "some_id_1", @@ -336,7 +336,7 @@ const withMatchingFilter: ApolloMock< TaskTestSampleQueryVariables > = { request: { - query: GET_TASK_TEST_SAMPLE, + query: TASK_TEST_SAMPLE, variables: { tasks: [ "some_id_1", @@ -372,7 +372,7 @@ const withNonMatchingFilter: ApolloMock< TaskTestSampleQueryVariables > = { request: { - query: GET_TASK_TEST_SAMPLE, + query: TASK_TEST_SAMPLE, variables: { tasks: [ "some_id_1", diff --git a/src/pages/variantHistory/index.tsx b/src/pages/variantHistory/index.tsx index 6d25e51fc2..fde2af78ca 100644 --- a/src/pages/variantHistory/index.tsx +++ b/src/pages/variantHistory/index.tsx @@ -23,7 +23,7 @@ import { MainlineCommitsForHistoryQuery, MainlineCommitsForHistoryQueryVariables, } from "gql/generated/types"; -import { GET_MAINLINE_COMMITS_FOR_HISTORY } from "gql/queries"; +import { MAINLINE_COMMITS_FOR_HISTORY } from "gql/queries"; import { usePageTitle } from "hooks"; import { string } from "utils"; import { leaveBreadcrumb } from "utils/errorReporting"; @@ -52,7 +52,7 @@ const VariantHistoryContents: React.FC = () => { const { data, loading, refetch } = useQuery< MainlineCommitsForHistoryQuery, MainlineCommitsForHistoryQueryVariables - >(GET_MAINLINE_COMMITS_FOR_HISTORY, { + >(MAINLINE_COMMITS_FOR_HISTORY, { variables: { mainlineCommitsOptions: { projectIdentifier, diff --git a/src/pages/version/BuildVariantCard/index.tsx b/src/pages/version/BuildVariantCard/index.tsx index 33bcfdaccd..f12a0c37bf 100644 --- a/src/pages/version/BuildVariantCard/index.tsx +++ b/src/pages/version/BuildVariantCard/index.tsx @@ -9,7 +9,7 @@ import { BuildVariantStatsQuery, BuildVariantStatsQueryVariables, } from "gql/generated/types"; -import { GET_BUILD_VARIANTS_STATS } from "gql/queries"; +import { BUILD_VARIANTS_STATS } from "gql/queries"; import { usePolling } from "hooks"; import VariantTaskGroup from "./VariantTaskGroup"; @@ -19,7 +19,7 @@ const BuildVariantCard: React.FC = () => { const { data, error, loading, refetch, startPolling, stopPolling } = useQuery< BuildVariantStatsQuery, BuildVariantStatsQueryVariables - >(GET_BUILD_VARIANTS_STATS, { + >(BUILD_VARIANTS_STATS, { fetchPolicy: "cache-and-network", variables: { id }, pollInterval: DEFAULT_POLL_INTERVAL, diff --git a/src/pages/version/BuildVariantCard/testData.ts b/src/pages/version/BuildVariantCard/testData.ts index 4c7da89fb4..d73ce95a2a 100644 --- a/src/pages/version/BuildVariantCard/testData.ts +++ b/src/pages/version/BuildVariantCard/testData.ts @@ -2,7 +2,7 @@ import { BuildVariantStatsQuery, BuildVariantStatsQueryVariables, } from "gql/generated/types"; -import { GET_BUILD_VARIANTS_STATS } from "gql/queries"; +import { BUILD_VARIANTS_STATS } from "gql/queries"; import { ApolloMock } from "types/gql"; const mocks: ApolloMock< @@ -11,7 +11,7 @@ const mocks: ApolloMock< >[] = [ { request: { - query: GET_BUILD_VARIANTS_STATS, + query: BUILD_VARIANTS_STATS, variables: { id: "version" }, }, result: { diff --git a/src/pages/version/EnqueueModal.tsx b/src/pages/version/EnqueueModal.tsx index 61614613d7..88e65ac825 100644 --- a/src/pages/version/EnqueueModal.tsx +++ b/src/pages/version/EnqueueModal.tsx @@ -14,7 +14,7 @@ import { CodeChangesQueryVariables, } from "gql/generated/types"; import { ENQUEUE_PATCH } from "gql/mutations"; -import { GET_CODE_CHANGES } from "gql/queries"; +import { CODE_CHANGES } from "gql/queries"; import { commits } from "utils"; const { shouldPreserveCommits } = commits; @@ -42,7 +42,7 @@ export const EnqueuePatchModal: React.FC = ({ const { data, previousData } = useQuery< CodeChangesQuery, CodeChangesQueryVariables - >(GET_CODE_CHANGES, { + >(CODE_CHANGES, { variables: { id: patchId }, skip: !visible, }); diff --git a/src/pages/version/TaskDuration.tsx b/src/pages/version/TaskDuration.tsx index 175baebc01..271081323d 100644 --- a/src/pages/version/TaskDuration.tsx +++ b/src/pages/version/TaskDuration.tsx @@ -11,7 +11,7 @@ import { VersionTaskDurationsQuery, VersionTaskDurationsQueryVariables, } from "gql/generated/types"; -import { GET_VERSION_TASK_DURATIONS } from "gql/queries"; +import { VERSION_TASK_DURATIONS } from "gql/queries"; import { usePolling } from "hooks"; import { useUpdateURLQueryParams } from "hooks/useUpdateURLQueryParams"; import { PatchTasksQueryParams } from "types/task"; @@ -58,7 +58,7 @@ const TaskDuration: React.FC = ({ taskCount }) => { const { data, loading, refetch, startPolling, stopPolling } = useQuery< VersionTaskDurationsQuery, VersionTaskDurationsQueryVariables - >(GET_VERSION_TASK_DURATIONS, { + >(VERSION_TASK_DURATIONS, { variables: queryVariables, skip: !hasQueryVariables, pollInterval: DEFAULT_POLL_INTERVAL, diff --git a/src/pages/version/Tasks.tsx b/src/pages/version/Tasks.tsx index 6dfdf93948..c392b53719 100644 --- a/src/pages/version/Tasks.tsx +++ b/src/pages/version/Tasks.tsx @@ -10,7 +10,7 @@ import { VersionTasksQuery, VersionTasksQueryVariables, } from "gql/generated/types"; -import { GET_VERSION_TASKS } from "gql/queries"; +import { VERSION_TASKS } from "gql/queries"; import { usePolling } from "hooks"; import { useUpdateURLQueryParams } from "hooks/useUpdateURLQueryParams"; import { PatchTasksQueryParams } from "types/task"; @@ -60,7 +60,7 @@ export const Tasks: React.FC = ({ taskCount }) => { const { data, loading, refetch, startPolling, stopPolling } = useQuery< VersionTasksQuery, VersionTasksQueryVariables - >(GET_VERSION_TASKS, { + >(VERSION_TASKS, { variables: queryVariables, pollInterval: DEFAULT_POLL_INTERVAL, skip: !hasQueryVariables, diff --git a/src/pages/version/downstreamTasks/DownstreamProjectAccordion.tsx b/src/pages/version/downstreamTasks/DownstreamProjectAccordion.tsx index 8fe6a42116..a2b68f1f8b 100644 --- a/src/pages/version/downstreamTasks/DownstreamProjectAccordion.tsx +++ b/src/pages/version/downstreamTasks/DownstreamProjectAccordion.tsx @@ -23,7 +23,7 @@ import { VersionTasksQuery, VersionTasksQueryVariables, } from "gql/generated/types"; -import { GET_VERSION_TASKS } from "gql/queries"; +import { VERSION_TASKS } from "gql/queries"; import { usePolling, useTaskStatuses } from "hooks"; import { PatchStatus } from "types/patch"; import { queryString, string } from "utils"; @@ -139,7 +139,7 @@ export const DownstreamProjectAccordion: React.FC< const { data, refetch, startPolling, stopPolling } = useQuery< VersionTasksQuery, VersionTasksQueryVariables - >(GET_VERSION_TASKS, { + >(VERSION_TASKS, { variables, fetchPolicy: "cache-and-network", onError: (err) => { From bf22fccd7513ec342eaa57183886a71db590c9d7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 10:01:41 -0400 Subject: [PATCH 02/17] CHORE(NPM) - bump @apollo/client from 3.6.9 to 3.8.4 (#2048) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 59 ++++++++++++++++++++++++---------------------------- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 3d285d7670..2475a1965a 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "extends": "react-app" }, "dependencies": { - "@apollo/client": "3.6.9", + "@apollo/client": "3.8.4", "@bugsnag/js": "7.20.2", "@bugsnag/plugin-react": "7.18.0", "@emotion/css": "11.11.2", diff --git a/yarn.lock b/yarn.lock index 121b555f42..f864cff117 100644 --- a/yarn.lock +++ b/yarn.lock @@ -55,19 +55,20 @@ lodash "^4.17.21" resize-observer-polyfill "^1.5.0" -"@apollo/client@3.6.9": - version "3.6.9" - resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.6.9.tgz#ad0ee2e3a3c92dbed4acd6917b6158a492739d94" - integrity sha512-Y1yu8qa2YeaCUBVuw08x8NHenFi0sw2I3KCu7Kw9mDSu86HmmtHJkCAifKVrN2iPgDTW/BbP3EpSV8/EQCcxZA== +"@apollo/client@3.8.4": + version "3.8.4" + resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.8.4.tgz#b6d67251422ee8bb05e240ffa65fe8fbd336cd66" + integrity sha512-QFXE4ylSHUa6LgYoOGsPysJCm4YJOOM1NwHyF6msZdZXIerqUVpLvxQOdQEXgS0RWvYiBMC1wGOWKzJKSWBdAg== dependencies: "@graphql-typed-document-node/core" "^3.1.1" - "@wry/context" "^0.6.0" - "@wry/equality" "^0.5.0" - "@wry/trie" "^0.3.0" + "@wry/context" "^0.7.3" + "@wry/equality" "^0.5.6" + "@wry/trie" "^0.4.3" graphql-tag "^2.12.6" hoist-non-react-statics "^3.3.2" - optimism "^0.16.1" + optimism "^0.17.5" prop-types "^15.7.2" + response-iterator "^0.2.6" symbol-observable "^4.0.0" ts-invariant "^0.10.3" tslib "^2.3.0" @@ -6576,31 +6577,24 @@ fast-url-parser "^1.1.3" tslib "^2.3.1" -"@wry/context@^0.6.0": - version "0.6.1" - resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.6.1.tgz#c3c29c0ad622adb00f6a53303c4f965ee06ebeb2" - integrity sha512-LOmVnY1iTU2D8tv4Xf6MVMZZ+juIJ87Kt/plMijjN20NMAXGmH4u8bS1t0uT74cZ5gwpocYueV58YwyI8y+GKw== - dependencies: - tslib "^2.3.0" - -"@wry/context@^0.7.0": +"@wry/context@^0.7.0", "@wry/context@^0.7.3": version "0.7.3" resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.7.3.tgz#240f6dfd4db5ef54f81f6597f6714e58d4f476a1" integrity sha512-Nl8WTesHp89RF803Se9X3IiHjdmLBrIvPMaJkl+rKVJAYyPsz1TEUbu89943HpvujtSJgDUx9W4vZw3K1Mr3sA== dependencies: tslib "^2.3.0" -"@wry/equality@^0.5.0": +"@wry/equality@^0.5.6": version "0.5.6" resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.5.6.tgz#cd4a533c72c3752993ab8cbf682d3d20e3cb601e" integrity sha512-D46sfMTngaYlrH+OspKf8mIJETntFnf6Hsjb0V41jAXJ7Bx2kB8Rv8RCUujuVWYttFtHkUNp7g+FwxNQAr6mXA== dependencies: tslib "^2.3.0" -"@wry/trie@^0.3.0": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@wry/trie/-/trie-0.3.2.tgz#a06f235dc184bd26396ba456711f69f8c35097e6" - integrity sha512-yRTyhWSls2OY/pYLfwff867r8ekooZ4UI+/gxot5Wj8EFwSf2rG+n+Mo/6LoLQm1TKA4GRj2+LCpbfS937dClQ== +"@wry/trie@^0.4.3": + version "0.4.3" + resolved "https://registry.yarnpkg.com/@wry/trie/-/trie-0.4.3.tgz#077d52c22365871bf3ffcbab8e95cb8bc5689af4" + integrity sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w== dependencies: tslib "^2.3.0" @@ -12709,13 +12703,14 @@ open@^8.0.4, open@^8.4.0: is-docker "^2.1.1" is-wsl "^2.2.0" -optimism@^0.16.1: - version "0.16.2" - resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.16.2.tgz#519b0c78b3b30954baed0defe5143de7776bf081" - integrity sha512-zWNbgWj+3vLEjZNIh/okkY2EUfX+vB9TJopzIZwT1xxaMqC5hRLLraePod4c5n4He08xuXNH+zhKFFCu390wiQ== +optimism@^0.17.5: + version "0.17.5" + resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.17.5.tgz#a4c78b3ad12c58623abedbebb4f2f2c19b8e8816" + integrity sha512-TEcp8ZwK1RczmvMnvktxHSF2tKgMWjJ71xEFGX5ApLh67VsMSTy1ZUlipJw8W+KaqgOmQ+4pqwkeivY89j+4Vw== dependencies: "@wry/context" "^0.7.0" - "@wry/trie" "^0.3.0" + "@wry/trie" "^0.4.3" + tslib "^2.3.0" optionator@^0.9.1: version "0.9.3" @@ -14233,6 +14228,11 @@ resolve@^2.0.0-next.3: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +response-iterator@^0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/response-iterator/-/response-iterator-0.2.6.tgz#249005fb14d2e4eeb478a3f735a28fd8b4c9f3da" + integrity sha512-pVzEEzrsg23Sh053rmDUvLSkGXluZio0qu8VT6ukrYuvtjVfCbDZH9d6PGXb8HZfzdNZt8feXv/jvUzlhRgLnw== + restore-cursor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" @@ -15293,12 +15293,7 @@ tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.4.1, tslib@^2.5.0, tslib@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.1.tgz#fd8c9a0ff42590b25703c0acb3de3d3f4ede0410" - integrity sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig== - -"tslib@^2.4.1 || ^1.9.3": +tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.4.1, "tslib@^2.4.1 || ^1.9.3", tslib@^2.5.0, tslib@^2.6.1: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== From f6d83ac42b582d3680ffb3c865f70455bd70e3e4 Mon Sep 17 00:00:00 2001 From: Mohamed Khelif Date: Wed, 20 Sep 2023 14:11:21 -0400 Subject: [PATCH 03/17] EVG-20802 Migrate Task.TaskFiles usage to task.files (#2051) --- src/gql/generated/types.ts | 4 ++-- src/gql/mocks/taskData.ts | 2 +- src/gql/queries/task-files.graphql | 4 ++-- src/gql/queries/task.graphql | 6 +++--- src/pages/task/TaskTabs.tsx | 4 ++-- src/pages/task/taskTabs/FileTable/index.tsx | 4 ++-- src/pages/task/taskTabs/FileTable/types.ts | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index f5bbd7f1b5..5bc464d832 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -8102,7 +8102,7 @@ export type TaskFilesQuery = { __typename?: "Task"; execution: number; id: string; - taskFiles: { + files: { __typename?: "TaskFiles"; fileCount: number; groupedFiles: Array<{ @@ -8391,6 +8391,7 @@ export type TaskQuery = { id: string; status: string; }> | null; + files: { __typename?: "TaskFiles"; fileCount: number }; logs: { __typename?: "TaskLogLinks"; agentLogLink?: string | null; @@ -8401,7 +8402,6 @@ export type TaskQuery = { }; pod?: { __typename?: "Pod"; id: string } | null; project?: { __typename?: "Project"; id: string; identifier: string } | null; - taskFiles: { __typename?: "TaskFiles"; fileCount: number }; versionMetadata: { __typename?: "Version"; author: string; diff --git a/src/gql/mocks/taskData.ts b/src/gql/mocks/taskData.ts index 6c6945d992..85d9a2e13f 100644 --- a/src/gql/mocks/taskData.ts +++ b/src/gql/mocks/taskData.ts @@ -79,7 +79,7 @@ export const taskQuery: TaskQuery = { spawnHostLink: "https://evergreen.mongodb.com/spawn?distro_id=ubuntu1604-small&task_id=spruce_ubuntu1604_e2e_test_patch_e0ece5ad52ad01630bdf29f55b9382a26d6256b3_5f4889313627e0544660c800_20_08_28_04_33_55", status: "pending", - taskFiles: { __typename: "TaskFiles", fileCount: 38 }, + files: { __typename: "TaskFiles", fileCount: 38 }, totalTestCount: 0, versionMetadata: { __typename: "Version", diff --git a/src/gql/queries/task-files.graphql b/src/gql/queries/task-files.graphql index 2ce204002f..39f1dbf0b8 100644 --- a/src/gql/queries/task-files.graphql +++ b/src/gql/queries/task-files.graphql @@ -1,8 +1,7 @@ query TaskFiles($taskId: String!, $execution: Int) { task(taskId: $taskId, execution: $execution) { execution - id - taskFiles { + files { fileCount groupedFiles { files { @@ -12,5 +11,6 @@ query TaskFiles($taskId: String!, $execution: Int) { taskName } } + id } } diff --git a/src/gql/queries/task.graphql b/src/gql/queries/task.graphql index e56c555288..e8931efb59 100644 --- a/src/gql/queries/task.graphql +++ b/src/gql/queries/task.graphql @@ -74,6 +74,9 @@ query Task($taskId: String!, $execution: Int) { } expectedDuration failedTestCount + files { + fileCount + } finishTime generatedBy generatedByName @@ -103,9 +106,6 @@ query Task($taskId: String!, $execution: Int) { resetWhenFinished spawnHostLink startTime - taskFiles { - fileCount - } timeTaken totalTestCount versionMetadata { diff --git a/src/pages/task/TaskTabs.tsx b/src/pages/task/TaskTabs.tsx index e0cc5071bb..aecf854f73 100644 --- a/src/pages/task/TaskTabs.tsx +++ b/src/pages/task/TaskTabs.tsx @@ -35,15 +35,15 @@ export const TaskTabs: React.FC = ({ isDisplayTask, task }) => { execution, executionTasksFull, failedTestCount, + files, id, isPerfPluginEnabled, logs: logLinks, status, - taskFiles, totalTestCount, versionMetadata, } = task ?? {}; - const { fileCount } = taskFiles ?? {}; + const { fileCount } = files ?? {}; const { showBuildBaron } = useBuildBaronVariables({ task: { diff --git a/src/pages/task/taskTabs/FileTable/index.tsx b/src/pages/task/taskTabs/FileTable/index.tsx index b3ad4b4e57..91adfc2d95 100644 --- a/src/pages/task/taskTabs/FileTable/index.tsx +++ b/src/pages/task/taskTabs/FileTable/index.tsx @@ -30,9 +30,9 @@ const FileTable: React.FC = ({ execution, taskId }) => { }, } ); - const { taskFiles } = data?.task ?? {}; + const { files } = data?.task ?? {}; - const { groupedFiles = [] } = taskFiles ?? {}; + const { groupedFiles = [] } = files ?? {}; const filteredGroupedFiles = filterGroupedFiles(groupedFiles, search); // We only want to show the file group name if there are multiple file groups. diff --git a/src/pages/task/taskTabs/FileTable/types.ts b/src/pages/task/taskTabs/FileTable/types.ts index becb7bf7bb..8ce4b5d6ae 100644 --- a/src/pages/task/taskTabs/FileTable/types.ts +++ b/src/pages/task/taskTabs/FileTable/types.ts @@ -2,5 +2,5 @@ import { TaskFilesQuery } from "gql/generated/types"; import { Unpacked } from "types/utils"; export type GroupedFiles = Unpacked< - TaskFilesQuery["task"]["taskFiles"]["groupedFiles"] + TaskFilesQuery["task"]["files"]["groupedFiles"] >; From 56394425915aa4a49ea6751bf02b4cd08c80debe Mon Sep 17 00:00:00 2001 From: julianedwards Date: Wed, 20 Sep 2023 14:49:07 -0400 Subject: [PATCH 04/17] v3.0.140 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2475a1965a..2be176ea48 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spruce", - "version": "3.0.139", + "version": "3.0.140", "private": true, "scripts": { "bootstrap-logkeeper": "./scripts/bootstrap-logkeeper.sh", From 7df69bb2f1a0c6e6d6ab9d19a6e5b69ce496aca3 Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Thu, 21 Sep 2023 09:29:55 -0400 Subject: [PATCH 05/17] EVG-19784: Add JIRA user info (#2052) --- src/gql/generated/types.ts | 6 +++++- src/gql/queries/spruce-config.graphql | 1 + .../tabs/PluginsTab/PluginsTab.tsx | 6 +++++- .../{getFormSchema.ts => getFormSchema.tsx} | 21 ++++++++++++++++--- 4 files changed, 29 insertions(+), 5 deletions(-) rename src/pages/projectSettings/tabs/PluginsTab/{getFormSchema.ts => getFormSchema.tsx} (93%) diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index 5bc464d832..d312e9e046 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -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"; diff --git a/src/gql/queries/spruce-config.graphql b/src/gql/queries/spruce-config.graphql index 1b770adeba..a5f57b7529 100644 --- a/src/gql/queries/spruce-config.graphql +++ b/src/gql/queries/spruce-config.graphql @@ -11,6 +11,7 @@ query SpruceConfig { } } jira { + email host } keys { diff --git a/src/pages/projectSettings/tabs/PluginsTab/PluginsTab.tsx b/src/pages/projectSettings/tabs/PluginsTab/PluginsTab.tsx index 020db66836..a24b86c1bb 100644 --- a/src/pages/projectSettings/tabs/PluginsTab/PluginsTab.tsx +++ b/src/pages/projectSettings/tabs/PluginsTab/PluginsTab.tsx @@ -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"; @@ -14,13 +15,16 @@ export const PluginsTab: React.FC = ({ 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 ( diff --git a/src/pages/projectSettings/tabs/PluginsTab/getFormSchema.ts b/src/pages/projectSettings/tabs/PluginsTab/getFormSchema.tsx similarity index 93% rename from src/pages/projectSettings/tabs/PluginsTab/getFormSchema.ts rename to src/pages/projectSettings/tabs/PluginsTab/getFormSchema.tsx index 7f4f9e2b5e..80a3915422 100644 --- a/src/pages/projectSettings/tabs/PluginsTab/getFormSchema.ts +++ b/src/pages/projectSettings/tabs/PluginsTab/getFormSchema.tsx @@ -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"; @@ -30,6 +31,7 @@ const requesters = [ ]; export const getFormSchema = ( + jiraEmail?: string, repoData?: PluginsFormState ): ReturnType => ({ fields: {}, @@ -228,7 +230,7 @@ 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: { @@ -236,8 +238,21 @@ export const getFormSchema = ( }, }, 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 + {jiraEmail} + {" "} + as a user with create permissions. + + )} + + ), }, fileTicketWebhook: { "ui:description": From 19413f990ffbb5a835d6cb2e38c4edf3e5d769b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Sep 2023 17:08:40 -0400 Subject: [PATCH 06/17] CHORE(NPM) - bump graphql from 16.6.0 to 16.8.1 (#2057) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 2be176ea48..14d48ae4f1 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "date-fns-tz": "2.0.0", "deep-object-diff": "1.1.9", "env-cmd": "10.1.0", - "graphql": "16.6.0", + "graphql": "16.8.1", "html-react-parser": "4.2.1", "js-cookie": "3.0.5", "linkify-html": "4.1.1", diff --git a/yarn.lock b/yarn.lock index f864cff117..deb67c4a1e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10216,10 +10216,10 @@ graphql-ws@^5.14.0: resolved "https://registry.yarnpkg.com/graphql-ws/-/graphql-ws-5.14.0.tgz#766f249f3974fc2c48fae0d1fb20c2c4c79cd591" integrity sha512-itrUTQZP/TgswR4GSSYuwWUzrE/w5GhbwM2GX3ic2U7aw33jgEsayfIlvaj7/GcIvZgNMzsPTrE5hqPuFUiE5g== -graphql@16.6.0: - version "16.6.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.6.0.tgz#c2dcffa4649db149f6282af726c8c83f1c7c5fdb" - integrity sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw== +graphql@16.8.1: + version "16.8.1" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.1.tgz#1930a965bef1170603702acdb68aedd3f3cf6f07" + integrity sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw== gunzip-maybe@^1.4.2: version "1.4.2" From fe23889903ef79d397ca80c620acbf0dbf7464a6 Mon Sep 17 00:00:00 2001 From: julianedwards Date: Fri, 22 Sep 2023 12:20:01 -0400 Subject: [PATCH 07/17] v3.0.141 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 14d48ae4f1..f9ce21e5bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spruce", - "version": "3.0.140", + "version": "3.0.141", "private": true, "scripts": { "bootstrap-logkeeper": "./scripts/bootstrap-logkeeper.sh", From 5df7a1358a49dcb3a7e4c8807830bca44f600a40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 15:00:06 -0400 Subject: [PATCH 08/17] CHORE(NPM) - bump @leafygreen-ui/loading-indicator from 2.0.5 to 2.0.6 (#2060) --- package.json | 2 +- yarn.lock | 35 ++++++++--------------------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index f9ce21e5bd..3415bce7e7 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "@leafygreen-ui/inline-definition": "6.0.0", "@leafygreen-ui/interaction-ring": "7.0.2", "@leafygreen-ui/leafygreen-provider": "3.1.0", - "@leafygreen-ui/loading-indicator": "2.0.5", + "@leafygreen-ui/loading-indicator": "2.0.6", "@leafygreen-ui/menu": "20.0.1", "@leafygreen-ui/modal": "16.0.1", "@leafygreen-ui/number-input": "1.0.4", diff --git a/yarn.lock b/yarn.lock index deb67c4a1e..9d419fac50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3707,16 +3707,16 @@ lodash "^4.17.21" prop-types "^15.7.2" -"@leafygreen-ui/loading-indicator@2.0.5": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@leafygreen-ui/loading-indicator/-/loading-indicator-2.0.5.tgz#a961ac1da31346aab14a15c3f1efa84226af2ad4" - integrity sha512-46qAwxxApQUPCLDwtWdrqZiicn6Zdp/kuRatxq3c5Xgxackt/Z0obJmIhUC4hD4Ir3r87SbAE49Ucy8fgJ/5BQ== +"@leafygreen-ui/loading-indicator@2.0.6": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@leafygreen-ui/loading-indicator/-/loading-indicator-2.0.6.tgz#95bc845e460c0e53ffbc8e1ae4bad081036aac22" + integrity sha512-UonmjKPSeQNCpPGR4hfrf6GYUY1bKBV30HTdegzNHBQMMXNUY+sxKQn8vJrvWTFQPVN032u9csiWTCrkMqUoew== dependencies: "@leafygreen-ui/emotion" "^4.0.7" - "@leafygreen-ui/lib" "^11.0.0" + "@leafygreen-ui/lib" "^12.0.0" "@leafygreen-ui/palette" "^4.0.7" "@leafygreen-ui/tokens" "^2.1.4" - "@leafygreen-ui/typography" "^17.0.0" + "@leafygreen-ui/typography" "^17.0.1" react-lottie-player "^1.5.4" "@leafygreen-ui/menu@20.0.1": @@ -4151,14 +4151,7 @@ dependencies: "@leafygreen-ui/palette" "^3.4.5" -"@leafygreen-ui/tokens@^2.0.0", "@leafygreen-ui/tokens@^2.0.1", "@leafygreen-ui/tokens@^2.0.2", "@leafygreen-ui/tokens@^2.0.3", "@leafygreen-ui/tokens@^2.1.0", "@leafygreen-ui/tokens@^2.1.1", "@leafygreen-ui/tokens@^2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@leafygreen-ui/tokens/-/tokens-2.1.4.tgz#0581bd7de718962305de134865182944e038f863" - integrity sha512-cP3FYPswaG99+gt/b9ISUQc2920C1qeFTKiguKZUftIPS8PBMkCHAGNbBpJJYU3VO46ISs2BHtOiztBf5spKQA== - dependencies: - "@leafygreen-ui/palette" "^4.0.7" - -"@leafygreen-ui/tokens@^2.2.0": +"@leafygreen-ui/tokens@^2.0.0", "@leafygreen-ui/tokens@^2.0.1", "@leafygreen-ui/tokens@^2.0.2", "@leafygreen-ui/tokens@^2.0.3", "@leafygreen-ui/tokens@^2.1.0", "@leafygreen-ui/tokens@^2.1.1", "@leafygreen-ui/tokens@^2.1.4", "@leafygreen-ui/tokens@^2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@leafygreen-ui/tokens/-/tokens-2.2.0.tgz#8cae3fc84bd54e9d579ab6bd2a43fad3f9050fd9" integrity sha512-hmRT1Sz6J9tv84ty1YPs1zmFewOCt/TghfbR0So5UtA5S2q4sVqjPZEpSvLmlxmtXIyl77fjU+uZYHpW2EID6w== @@ -4213,7 +4206,7 @@ lodash "^4.17.21" polished "^4.2.2" -"@leafygreen-ui/typography@17.0.1": +"@leafygreen-ui/typography@17.0.1", "@leafygreen-ui/typography@^17.0.0", "@leafygreen-ui/typography@^17.0.1": version "17.0.1" resolved "https://registry.yarnpkg.com/@leafygreen-ui/typography/-/typography-17.0.1.tgz#11c52b4441e4f30f58f4bfe3a69cf8365fdc6a5e" integrity sha512-hsj92VPWODCSzajFDfM5kBTD5wXAQVt7ERnUX8DfdUal8h3XsWJYvluA3QdehvDv2xS2pQeBmcCS1vWFlB+rTA== @@ -4249,18 +4242,6 @@ "@leafygreen-ui/polymorphic" "^1.3.5" "@leafygreen-ui/tokens" "^2.1.4" -"@leafygreen-ui/typography@^17.0.0": - version "17.0.0" - resolved "https://registry.yarnpkg.com/@leafygreen-ui/typography/-/typography-17.0.0.tgz#2f4c098a5e0aa853d796434880884ecf605d8432" - integrity sha512-ECGA/IgueeRvh5en9iTdc0xmzS8sklktNHp0YBdN+Q/XKzRkY6W2ewAESfmyQibb9G8AS2rXrEJ1pOF+rfC6EA== - dependencies: - "@leafygreen-ui/emotion" "^4.0.7" - "@leafygreen-ui/icon" "^11.22.2" - "@leafygreen-ui/lib" "^11.0.0" - "@leafygreen-ui/palette" "^4.0.7" - "@leafygreen-ui/polymorphic" "^1.3.6" - "@leafygreen-ui/tokens" "^2.1.4" - "@mdx-js/react@^2.1.5": version "2.3.0" resolved "https://registry.yarnpkg.com/@mdx-js/react/-/react-2.3.0.tgz#4208bd6d70f0d0831def28ef28c26149b03180b3" From f334d032ae3d887f04f2c4246296724ec79b491e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 15:21:33 -0400 Subject: [PATCH 09/17] CHORE(NPM) - bump @types/prompts from 2.4.4 to 2.4.5 (#2061) --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3415bce7e7..225d06d7c9 100644 --- a/package.json +++ b/package.json @@ -162,7 +162,7 @@ "@types/new-relic-browser": "0.1212.2", "@types/node": "^16.11.47", "@types/pluralize": "0.0.29", - "@types/prompts": "2.4.4", + "@types/prompts": "2.4.5", "@types/react": "18.2.0", "@types/react-dom": "18.2.0", "@typescript-eslint/eslint-plugin": "5.57.1", diff --git a/yarn.lock b/yarn.lock index 9d419fac50..87496cd87c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6168,10 +6168,10 @@ resolved "https://registry.yarnpkg.com/@types/pretty-hrtime/-/pretty-hrtime-1.0.1.tgz#72a26101dc567b0d68fd956cf42314556e42d601" integrity sha512-VjID5MJb1eGKthz2qUerWT8+R4b9N+CHvGCzg9fn4kWZgaF9AhdYikQio3R7wV8YY1NsQKPaCwKz1Yff+aHNUQ== -"@types/prompts@2.4.4": - version "2.4.4" - resolved "https://registry.yarnpkg.com/@types/prompts/-/prompts-2.4.4.tgz#dd5a1d41cb1bcd0fc4464bf44a0c8354f36ea735" - integrity sha512-p5N9uoTH76lLvSAaYSZtBCdEXzpOOufsRjnhjVSrZGXikVGHX9+cc9ERtHRV4hvBKHyZb1bg4K+56Bd2TqUn4A== +"@types/prompts@2.4.5": + version "2.4.5" + resolved "https://registry.yarnpkg.com/@types/prompts/-/prompts-2.4.5.tgz#9e894d3d644236e88741b75c912c2bb1c7757503" + integrity sha512-TvrzGMCwARi2qqXcD7VmvMvfMP3F7JRQpeEHECK0oufRNZInoBqzd8v/1zksKFE5XW8OOGto/5FsDT8lnpvGRA== dependencies: "@types/node" "*" kleur "^3.0.3" From 87b9d23544e80ba1b96be15c1cc77b407851d0fb Mon Sep 17 00:00:00 2001 From: minnakt <47064971+minnakt@users.noreply.github.com> Date: Tue, 26 Sep 2023 21:56:04 -0400 Subject: [PATCH 10/17] EVG-19947: Support EC2 Fleet on provider settings page (#2050) --- .../distroSettings/provider_section.ts | 79 ++++++++ .../tabs/ProviderTab/ProviderTab.tsx | 21 +- .../tabs/ProviderTab/getFormSchema.ts | 144 +++++++++++++- .../tabs/ProviderTab/schemaFields.ts | 180 +++++++++++++++++- .../tabs/ProviderTab/transformerUtils.ts | 142 ++++++++++++-- .../tabs/ProviderTab/transformers.test.ts | 179 +++++++++++++++-- .../tabs/ProviderTab/transformers.ts | 13 ++ .../distroSettings/tabs/ProviderTab/types.ts | 34 ++++ 8 files changed, 750 insertions(+), 42 deletions(-) diff --git a/cypress/integration/distroSettings/provider_section.ts b/cypress/integration/distroSettings/provider_section.ts index 14a4f8ab82..57552dd990 100644 --- a/cypress/integration/distroSettings/provider_section.ts +++ b/cypress/integration/distroSettings/provider_section.ts @@ -83,4 +83,83 @@ describe("provider section", () => { cy.validateToast("success"); }); }); + + describe("ec2 fleet", () => { + beforeEach(() => { + cy.visit("/distro/ubuntu1804-workstation/settings/provider"); + }); + + it("shows and hides fields correctly", () => { + // Fleet options. + cy.getInputByLabel("Fleet Instance Type").contains("On-demand"); + cy.contains("Capacity optimization").should("not.exist"); + + cy.selectLGOption("Fleet Instance Type", "Spot"); + cy.contains("Capacity optimization").should("exist"); + + // VPC options. + cy.dataCy("use-vpc").should("be.checked"); + cy.contains("Default VPC Subnet ID").should("exist"); + cy.contains("VPC Subnet Prefix").should("exist"); + + cy.dataCy("use-vpc").uncheck({ force: true }); + cy.contains("Default VPC Subnet ID").should("not.exist"); + cy.contains("VPC Subnet Prefix").should("not.exist"); + }); + + it("successfully updates ec2 fleet provider fields", () => { + cy.dataCy("provider-select").contains("EC2 Fleet"); + + // Correct section is displayed. + cy.dataCy("ec2-fleet-provider-settings").should("exist"); + cy.dataCy("region-select").contains("us-east-1"); + + // Change field values. + cy.selectLGOption("Region", "us-west-1"); + cy.getInputByLabel("SSH Key Name").as("keyNameInput"); + cy.get("@keyNameInput").clear(); + cy.get("@keyNameInput").type("my ssh key"); + cy.selectLGOption("Fleet Instance Type", "Spot"); + cy.contains("button", "Add mount point").click(); + cy.getInputByLabel("Device Name").type("device name"); + cy.getInputByLabel("Size").type("200"); + save(); + cy.validateToast("success"); + + // Revert fields to original values. + cy.selectLGOption("Region", "us-east-1"); + cy.get("@keyNameInput").clear(); + cy.get("@keyNameInput").type("mci"); + cy.selectLGOption("Fleet Instance Type", "On-demand"); + cy.dataCy("mount-points").within(() => { + cy.dataCy("delete-item-button").click(); + }); + save(); + cy.validateToast("success"); + }); + + it("can add and delete region settings", () => { + cy.dataCy("ec2-fleet-provider-settings").should("exist"); + + // Add item for new region. + cy.contains("button", "Add region settings").click(); + cy.contains("button", "Add region settings").should("not.exist"); + + // Save new region. + cy.selectLGOption("Region", "us-west-1"); + cy.getInputByLabel("EC2 AMI ID").type("ami-1234"); + cy.getInputByLabel("Instance Type").type("m5.xlarge"); + cy.contains("button", "Add security group").click(); + cy.getInputByLabel("Security Group ID").type("security-group-1234"); + save(); + cy.validateToast("success"); + + // Revert to original state by deleting the new region. + cy.dataCy("delete-item-button").first().click(); + save(); + cy.validateToast("success"); + + cy.contains("button", "Add region settings").should("exist"); + }); + }); }); diff --git a/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx b/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx index d99d743592..ba53b0ef0c 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx +++ b/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx @@ -1,4 +1,7 @@ import { useMemo } from "react"; +import { useQuery } from "@apollo/client"; +import { AwsRegionsQuery, AwsRegionsQueryVariables } from "gql/generated/types"; +import { AWS_REGIONS } from "gql/queries"; import { useSpruceConfig } from "hooks"; import { useDistroSettingsContext } from "pages/distroSettings/Context"; import { omitTypename } from "utils/string"; @@ -24,6 +27,14 @@ export const ProviderTab: React.FC = ({ distro, distroData }) => { initialData: ReturnType>; } = getTab(WritableDistroSettingsTabs.Provider); + const { data: awsData } = useQuery( + AWS_REGIONS + ); + const { awsRegions } = awsData || {}; + const configuredRegions = formData?.ec2FleetProviderSettings?.map( + (p) => p.region + ); + const { containerPools } = useSpruceConfig(); const { pools } = containerPools || {}; @@ -34,8 +45,14 @@ export const ProviderTab: React.FC = ({ distro, distroData }) => { : ""; const formSchema = useMemo( - () => getFormSchema({ pools: pools || [], poolMappingInfo }), - [pools, poolMappingInfo] + () => + getFormSchema({ + awsRegions: awsRegions || [], + configuredRegions: configuredRegions || [], + pools: pools || [], + poolMappingInfo, + }), + [awsRegions, configuredRegions, pools, poolMappingInfo] ); return ( diff --git a/src/pages/distroSettings/tabs/ProviderTab/getFormSchema.ts b/src/pages/distroSettings/tabs/ProviderTab/getFormSchema.ts index b1af6247fe..8efa7f8f4a 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/getFormSchema.ts +++ b/src/pages/distroSettings/tabs/ProviderTab/getFormSchema.ts @@ -1,14 +1,26 @@ import { css } from "@emotion/react"; import { GetFormSchema } from "components/SpruceForm"; -import { CardFieldTemplate } from "components/SpruceForm/FieldTemplates"; +import { + CardFieldTemplate, + AccordionFieldTemplate, +} from "components/SpruceForm/FieldTemplates"; import { STANDARD_FIELD_WIDTH } from "components/SpruceForm/utils"; +import { size } from "constants/tokens"; import { Provider, ContainerPool } from "gql/generated/types"; -import { dockerProviderSettings, staticProviderSettings } from "./schemaFields"; +import { + dockerProviderSettings, + staticProviderSettings, + ec2FleetProviderSettings, +} from "./schemaFields"; export const getFormSchema = ({ + awsRegions, + configuredRegions, poolMappingInfo, pools, }: { + awsRegions: string[]; + configuredRegions: string[]; poolMappingInfo: string; pools: ContainerPool[]; }): ReturnType => ({ @@ -96,13 +108,45 @@ export const getFormSchema = ({ })), }, poolMappingInfo: dockerProviderSettings.poolMappingInfo, - userData: dockerProviderSettings.userData, mergeUserData: dockerProviderSettings.mergeUserData, + userData: dockerProviderSettings.userData, securityGroups: dockerProviderSettings.securityGroups, }, }, }, }, + { + properties: { + provider: { + properties: { + providerName: { + enum: [Provider.Ec2Fleet], + }, + }, + }, + ec2FleetProviderSettings: { + type: "array" as "array", + minItems: 1, + title: "", + items: { + type: "object" as "object", + properties: { + region: { + type: "string" as "string", + title: "Region", + default: "", + oneOf: awsRegions.map((r) => ({ + type: "string" as "string", + title: r, + enum: [r], + })), + }, + ...ec2FleetProviderSettings, + }, + }, + }, + }, + }, ], }, }, @@ -118,6 +162,9 @@ export const getFormSchema = ({ staticProviderSettings: { "ui:data-cy": "static-provider-settings", "ui:ObjectFieldTemplate": CardFieldTemplate, + mergeUserData: { + "ui:elementWrapperCSS": mergeCheckboxCSS, + }, userData: { "ui:widget": "textarea", "ui:elementWrapperCSS": textAreaCSS, @@ -130,6 +177,9 @@ export const getFormSchema = ({ dockerProviderSettings: { "ui:data-cy": "docker-provider-settings", "ui:ObjectFieldTemplate": CardFieldTemplate, + mergeUserData: { + "ui:elementWrapperCSS": mergeCheckboxCSS, + }, userData: { "ui:widget": "textarea", "ui:elementWrapperCSS": textAreaCSS, @@ -159,12 +209,100 @@ export const getFormSchema = ({ "ui:readonly": true, }, }, + ec2FleetProviderSettings: { + "ui:data-cy": "ec2-fleet-provider-settings", + "ui:addable": awsRegions.length !== configuredRegions.length, + "ui:addButtonText": "Add region settings", + "ui:orderable": false, + "ui:useExpandableCard": true, + items: { + "ui:displayTitle": "New AWS Region", + mergeUserData: { + "ui:elementWrapperCSS": mergeCheckboxCSS, + }, + userData: { + "ui:widget": "textarea", + "ui:elementWrapperCSS": textAreaCSS, + }, + securityGroups: { + "ui:addButtonText": "Add security group", + "ui:orderable": false, + }, + region: { + "ui:data-cy": "region-select", + "ui:allowDeselect": false, + "ui:enumDisabled": configuredRegions, + }, + amiId: { + "ui:placeholder": "e.g. ami-1ecba176", + }, + instanceType: { + "ui:description": "EC2 instance type for the AMI. Must be available.", + "ui:placeholder": "e.g. t1.micro", + }, + fleetOptions: { + fleetInstanceType: { + "ui:allowDeselect": false, + }, + useCapacityOptimization: { + "ui:data-cy": "use-capacity-optimization", + "ui:bold": true, + "ui:description": + "Use the capacity-optimized allocation strategy for spot (default: lowest-cost)", + "ui:elementWrapperCSS": capacityCheckboxCSS, + }, + }, + vpcOptions: { + useVpc: { + "ui:data-cy": "use-vpc", + }, + subnetId: { + "ui:placeholder": "e.g. subnet-xxxx", + "ui:elementWrapperCSS": indentCSS, + }, + subnetPrefix: { + "ui:description": + "Looks for subnets like .subnet_1a, .subnet_1b, etc.", + "ui:elementWrapperCSS": indentCSS, + }, + }, + mountPoints: { + "ui:data-cy": "mount-points", + "ui:addButtonText": "Add mount point", + "ui:orderable": false, + "ui:topAlignDelete": true, + items: { + "ui:ObjectFieldTemplate": AccordionFieldTemplate, + "ui:numberedTitle": "Mount Point", + }, + }, + }, + }, }, }); const textAreaCSS = css` box-sizing: border-box; max-width: ${STANDARD_FIELD_WIDTH}px; + textarea { + min-height: 140px; + } +`; + +const mergeCheckboxCSS = css` + max-width: ${STANDARD_FIELD_WIDTH}px; + display: flex; + justify-content: flex-end; + margin-bottom: -20px; +`; + +const capacityCheckboxCSS = css` + max-width: ${STANDARD_FIELD_WIDTH}px; +`; + +const indentCSS = css` + box-sizing: border-box; + padding-left: ${size.m}; `; const poolMappingInfoCss = css` diff --git a/src/pages/distroSettings/tabs/ProviderTab/schemaFields.ts b/src/pages/distroSettings/tabs/ProviderTab/schemaFields.ts index e5eafc59a9..7c266aba37 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/schemaFields.ts +++ b/src/pages/distroSettings/tabs/ProviderTab/schemaFields.ts @@ -1,4 +1,4 @@ -import { BuildType } from "./types"; +import { BuildType, FleetInstanceType } from "./types"; const userData = { type: "string" as "string", @@ -62,9 +62,172 @@ const poolMappingInfo = { title: "Pool Mapping Information", }; +const amiId = { + type: "string" as "string", + title: "EC2 AMI ID", +}; + +const instanceType = { + type: "string" as "string", + title: "Instance Type", +}; + +const sshKeyName = { + type: "string" as "string", + title: "SSH Key Name", +}; + +const fleetInstanceType = { + type: "string" as "string", + title: "Fleet Instance Type", + default: FleetInstanceType.Spot, + oneOf: [ + { + type: "string" as "string", + title: "Spot", + enum: [FleetInstanceType.Spot], + }, + { + type: "string" as "string", + title: "Spot with on-demand fallback", + enum: [FleetInstanceType.SpotWithOnDemandFallback], + }, + { + type: "string" as "string", + title: "On-demand", + enum: [FleetInstanceType.OnDemand], + }, + ], +}; + +const useCapacityOptimization = { + type: "boolean" as "boolean", + title: "Capacity optimization", + default: false, +}; + +const fleetOptions = { + type: "object" as "object", + title: "", + properties: { + fleetInstanceType, + }, + dependencies: { + fleetInstanceType: { + oneOf: [ + { + properties: { + fleetInstanceType: { + enum: [FleetInstanceType.OnDemand], + }, + }, + }, + { + properties: { + fleetInstanceType: { + enum: [ + FleetInstanceType.Spot, + FleetInstanceType.SpotWithOnDemandFallback, + ], + }, + useCapacityOptimization, + }, + }, + ], + }, + }, +}; + +const instanceProfileARN = { + type: "string" as "string", + title: "IAM Instance Profile ARN", +}; + +const useVpc = { + type: "boolean" as "boolean", + title: "Use security groups in an EC2 VPC", + default: false, +}; + +const subnetId = { + type: "string" as "string", + title: "Default VPC Subnet ID", +}; + +const subnetPrefix = { + type: "string" as "string", + title: "VPC Subnet Prefix", +}; + +const vpcOptions = { + type: "object" as "object", + title: "", + properties: { + useVpc, + }, + dependencies: { + useVpc: { + oneOf: [ + { + properties: { + useVpc: { + enum: [true], + }, + subnetId, + subnetPrefix, + }, + }, + { + properties: { + useVpc: { + enum: [false], + }, + }, + }, + ], + }, + }, +}; + +const mountPoints = { + type: "array" as "array", + title: "Mount Points", + items: { + type: "object" as "object", + properties: { + deviceName: { + type: "string" as "string", + title: "Device Name", + default: "", + minLength: 1, + }, + virtualName: { + type: "string" as "string", + title: "Virtual Name", + }, + volumeType: { + type: "string" as "string", + title: "Volume Type", + }, + iops: { + type: "number" as "number", + title: "IOPS", + }, + throughput: { + type: "number" as "number", + title: "Throughput", + }, + size: { + type: "number" as "number", + title: "Size", + }, + }, + }, +}; + export const staticProviderSettings = { - userData, mergeUserData, + userData, securityGroups, }; @@ -74,7 +237,20 @@ export const dockerProviderSettings = { registryUsername, registryPassword, poolMappingInfo, + mergeUserData, userData, + securityGroups, +}; + +export const ec2FleetProviderSettings = { + amiId, + instanceType, + sshKeyName, + fleetOptions, + instanceProfileARN, mergeUserData, + userData, securityGroups, + vpcOptions, + mountPoints, }; diff --git a/src/pages/distroSettings/tabs/ProviderTab/transformerUtils.ts b/src/pages/distroSettings/tabs/ProviderTab/transformerUtils.ts index 5330be9317..8ca278bb90 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/transformerUtils.ts +++ b/src/pages/distroSettings/tabs/ProviderTab/transformerUtils.ts @@ -1,5 +1,9 @@ -import { BuildType, ProviderFormState } from "./types"; +import { Unpacked } from "types/utils"; +import { BuildType, ProviderFormState, FleetInstanceType } from "./types"; +/** + * The provider settings list is untyped in the backend, so we manually define types here. + */ interface ProviderSettingsList { user_data: string; merge_user_data_parts: boolean; @@ -8,8 +12,44 @@ interface ProviderSettingsList { build_type: string; docker_registry_user: string; docker_registry_pw: string; + ami: string; + instance_type: string; + key_name: string; + fleet_options: { + use_on_demand: boolean; + use_capacity_optimized: boolean; + }; + fallback: boolean; + iam_instance_profile_arn: string; + is_vpc: boolean; + subnet_id: string; + vpc_name: string; + mount_points: Array<{ + device_name: string; + virtual_name: string; + volume_type: string; + iops: number; + throughput: number; + size: number; + }>; + region: string; } +const getFleetInstanceType = ( + providerSettings: Partial = {} +) => { + if (providerSettings.fleet_options?.use_on_demand) { + return FleetInstanceType.OnDemand; + } + if ( + !providerSettings.fleet_options?.use_on_demand && + providerSettings.fallback + ) { + return FleetInstanceType.SpotWithOnDemandFallback; + } + return FleetInstanceType.Spot; +}; + export const formProviderSettings = ( providerSettings: Partial = {} ) => ({ @@ -27,26 +67,92 @@ export const formProviderSettings = ( registryUsername: providerSettings.docker_registry_user ?? "", registryPassword: providerSettings.docker_registry_pw ?? "", }, + ec2FleetProviderSettings: { + region: providerSettings.region ?? "", + userData: providerSettings.user_data ?? "", + mergeUserData: providerSettings.merge_user_data_parts ?? false, + securityGroups: providerSettings.security_group_ids ?? [], + amiId: providerSettings.ami ?? "", + instanceType: providerSettings.instance_type ?? "", + sshKeyName: providerSettings.key_name ?? "", + fleetOptions: { + fleetInstanceType: getFleetInstanceType(providerSettings), + useCapacityOptimization: + providerSettings.fleet_options?.use_capacity_optimized ?? false, + }, + instanceProfileARN: providerSettings.iam_instance_profile_arn ?? "", + vpcOptions: { + useVpc: providerSettings.is_vpc ?? false, + subnetId: providerSettings.subnet_id ?? "", + subnetPrefix: providerSettings.vpc_name ?? "", + }, + mountPoints: + providerSettings.mount_points?.map((mp) => ({ + deviceName: mp.device_name, + virtualName: mp.virtual_name, + volumeType: mp.volume_type, + iops: mp.iops, + throughput: mp.throughput, + size: mp.size, + })) ?? [], + }, }); type ProviderSettings = ProviderFormState["staticProviderSettings"] & - ProviderFormState["dockerProviderSettings"]; + ProviderFormState["dockerProviderSettings"] & + Unpacked; export const gqlProviderSettings = ( providerSettings: Partial = {} -) => ({ - staticProviderSettings: { - user_data: providerSettings.userData, - merge_user_data_parts: providerSettings.mergeUserData, - security_group_ids: providerSettings.securityGroups, - }, - dockerProviderSettings: { - user_data: providerSettings.userData, - merge_user_data_parts: providerSettings.mergeUserData, - security_group_ids: providerSettings.securityGroups, - image_url: providerSettings.imageUrl, - build_type: providerSettings.buildType, - docker_registry_user: providerSettings.registryUsername, - docker_registry_pw: providerSettings.registryPassword, - }, -}); +) => { + const { fleetOptions, vpcOptions } = providerSettings; + return { + staticProviderSettings: { + user_data: providerSettings.userData, + merge_user_data_parts: providerSettings.mergeUserData, + security_group_ids: providerSettings.securityGroups, + }, + dockerProviderSettings: { + user_data: providerSettings.userData, + merge_user_data_parts: providerSettings.mergeUserData, + security_group_ids: providerSettings.securityGroups, + image_url: providerSettings.imageUrl, + build_type: providerSettings.buildType, + docker_registry_user: providerSettings.registryUsername, + docker_registry_pw: providerSettings.registryPassword, + }, + ec2FleetProviderSettings: { + region: providerSettings.region, + user_data: providerSettings.userData, + merge_user_data_parts: providerSettings.mergeUserData, + security_group_ids: providerSettings.securityGroups, + ami: providerSettings.amiId, + instance_type: providerSettings.instanceType, + key_name: providerSettings.sshKeyName, + fleet_options: { + use_on_demand: + fleetOptions?.fleetInstanceType === FleetInstanceType.OnDemand, + use_capacity_optimized: + fleetOptions?.fleetInstanceType === FleetInstanceType.OnDemand + ? false + : fleetOptions?.useCapacityOptimization, + }, + fallback: + fleetOptions?.fleetInstanceType === + FleetInstanceType.SpotWithOnDemandFallback, + iam_instance_profile_arn: providerSettings.instanceProfileARN, + is_vpc: vpcOptions?.useVpc, + subnet_id: vpcOptions?.useVpc ? vpcOptions?.subnetId : undefined, + vpc_name: vpcOptions?.useVpc ? vpcOptions?.subnetPrefix : undefined, + mount_points: + providerSettings.mountPoints?.map((mp) => ({ + device_name: mp.deviceName, + virtual_name: mp.virtualName, + volume_type: mp.volumeType, + iops: mp.iops, + throughput: mp.throughput, + size: mp.size, + })) ?? [], + }, + }; +}; diff --git a/src/pages/distroSettings/tabs/ProviderTab/transformers.test.ts b/src/pages/distroSettings/tabs/ProviderTab/transformers.test.ts index 0451185970..c72c1fd45b 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/transformers.test.ts +++ b/src/pages/distroSettings/tabs/ProviderTab/transformers.test.ts @@ -1,7 +1,49 @@ import { DistroInput, Provider } from "gql/generated/types"; import { distroData } from "../testData"; import { formToGql, gqlToForm } from "./transformers"; -import { BuildType, ProviderFormState } from "./types"; +import { BuildType, FleetInstanceType, ProviderFormState } from "./types"; + +const defaultFormState = { + staticProviderSettings: { + userData: "", + mergeUserData: false, + securityGroups: ["1"], + }, + dockerProviderSettings: { + imageUrl: "", + buildType: "" as BuildType, + registryUsername: "", + registryPassword: "", + containerPoolId: "", + poolMappingInfo: "", + userData: "", + mergeUserData: false, + securityGroups: ["1"], + }, + ec2FleetProviderSettings: [ + { + region: "", + displayTitle: "", + amiId: "", + fleetOptions: { + fleetInstanceType: FleetInstanceType.Spot, + useCapacityOptimization: false, + }, + instanceProfileARN: "", + instanceType: "", + mergeUserData: false, + mountPoints: [], + securityGroups: ["1"], + sshKeyName: "", + userData: "", + vpcOptions: { + subnetId: "", + useVpc: false, + subnetPrefix: "", + }, + }, + ], +}; describe("provider tab", () => { describe("static provider", () => { @@ -19,6 +61,7 @@ describe("provider tab", () => { }; const staticForm: ProviderFormState = { + ...defaultFormState, provider: { providerName: Provider.Static, }, @@ -27,17 +70,6 @@ describe("provider tab", () => { mergeUserData: false, securityGroups: ["1"], }, - dockerProviderSettings: { - imageUrl: "", - buildType: "" as BuildType, - registryUsername: "", - registryPassword: "", - containerPoolId: "", - poolMappingInfo: "", - userData: "", - mergeUserData: false, - securityGroups: ["1"], - }, }; const staticGql: DistroInput = { @@ -81,14 +113,10 @@ describe("provider tab", () => { }; const dockerForm: ProviderFormState = { + ...defaultFormState, provider: { providerName: Provider.Docker, }, - staticProviderSettings: { - userData: "", - mergeUserData: false, - securityGroups: ["1"], - }, dockerProviderSettings: { imageUrl: "https://some-url", buildType: BuildType.Import, @@ -127,4 +155,121 @@ describe("provider tab", () => { expect(formToGql(dockerForm, dockerDistroData)).toStrictEqual(dockerGql); }); }); + + describe("ec2 fleet provider", () => { + const ec2FleetDistroData = { + ...distroData, + provider: Provider.Ec2Fleet, + containerPool: "", + providerSettingsList: [ + { + region: "us-east-1", + ami: "ami-east", + instance_type: "m5.xlarge", + key_name: "admin", + fleet_options: { + use_on_demand: false, + use_capacity_optimized: true, + }, + fallback: true, + iam_instance_profile_arn: "profile-east", + is_vpc: true, + subnet_id: "subnet-east", + vpc_name: "vpc-east", + mount_points: [ + { + device_name: "device-east", + size: 200, + }, + ], + user_data: "", + merge_user_data_parts: false, + security_group_ids: ["1"], + }, + ], + }; + + const ec2Form: ProviderFormState = { + ...defaultFormState, + provider: { + providerName: Provider.Ec2Fleet, + }, + ec2FleetProviderSettings: [ + { + region: "us-east-1", + displayTitle: "us-east-1", + amiId: "ami-east", + fleetOptions: { + fleetInstanceType: FleetInstanceType.SpotWithOnDemandFallback, + useCapacityOptimization: true, + }, + instanceProfileARN: "profile-east", + instanceType: "m5.xlarge", + mergeUserData: false, + mountPoints: [ + { + deviceName: "device-east", + virtualName: undefined, + volumeType: undefined, + iops: undefined, + throughput: undefined, + size: 200, + }, + ], + securityGroups: ["1"], + sshKeyName: "admin", + userData: "", + vpcOptions: { + subnetId: "subnet-east", + useVpc: true, + subnetPrefix: "vpc-east", + }, + }, + ], + }; + + const ec2Gql: DistroInput = { + ...distroData, + provider: Provider.Ec2Fleet, + containerPool: "", + providerSettingsList: [ + { + region: "us-east-1", + ami: "ami-east", + instance_type: "m5.xlarge", + key_name: "admin", + fleet_options: { + use_on_demand: false, + use_capacity_optimized: true, + }, + fallback: true, + iam_instance_profile_arn: "profile-east", + is_vpc: true, + subnet_id: "subnet-east", + vpc_name: "vpc-east", + mount_points: [ + { + device_name: "device-east", + iops: undefined, + throughput: undefined, + virtual_name: undefined, + volume_type: undefined, + size: 200, + }, + ], + user_data: "", + merge_user_data_parts: false, + security_group_ids: ["1"], + }, + ], + }; + + it("correctly converts from GQL to a form", () => { + expect(gqlToForm(ec2FleetDistroData)).toStrictEqual(ec2Form); + }); + + it("correctly converts from a form to GQL", () => { + expect(formToGql(ec2Form, ec2FleetDistroData)).toStrictEqual(ec2Gql); + }); + }); }); diff --git a/src/pages/distroSettings/tabs/ProviderTab/transformers.ts b/src/pages/distroSettings/tabs/ProviderTab/transformers.ts index ffba811162..c458f5342c 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/transformers.ts +++ b/src/pages/distroSettings/tabs/ProviderTab/transformers.ts @@ -22,6 +22,10 @@ export const gqlToForm = ((data) => { containerPoolId: containerPool, poolMappingInfo: "", }, + ec2FleetProviderSettings: providerSettingsList.map((p) => ({ + ...formProviderSettings(p).ec2FleetProviderSettings, + displayTitle: p.region ?? "", + })), }; }) satisfies GqlToFormFunction; @@ -55,6 +59,15 @@ export const formToGql = ((data, distro) => { ], containerPool: data.dockerProviderSettings.containerPoolId, }; + case Provider.Ec2Fleet: + return { + ...distro, + provider: Provider.Ec2Fleet, + providerSettingsList: data.ec2FleetProviderSettings.map((p) => ({ + ...gqlProviderSettings(p).ec2FleetProviderSettings, + })), + containerPool: "", + }; default: return distro; } diff --git a/src/pages/distroSettings/tabs/ProviderTab/types.ts b/src/pages/distroSettings/tabs/ProviderTab/types.ts index 15e16b7d74..85d2e13323 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/types.ts +++ b/src/pages/distroSettings/tabs/ProviderTab/types.ts @@ -5,6 +5,12 @@ export enum BuildType { Pull = "pull", } +export enum FleetInstanceType { + Spot = "spot", + OnDemand = "on-demand", + SpotWithOnDemandFallback = "fallback", +} + export type ProviderFormState = { provider: { providerName: Provider; @@ -25,6 +31,34 @@ export type ProviderFormState = { mergeUserData: boolean; securityGroups: string[]; }; + ec2FleetProviderSettings: Array<{ + region: string; + displayTitle: string; + amiId: string; + instanceType: string; + sshKeyName: string; + fleetOptions: { + fleetInstanceType: FleetInstanceType; + useCapacityOptimization: boolean; + }; + instanceProfileARN: string; + vpcOptions: { + useVpc: boolean; + subnetId: string; + subnetPrefix: string; + }; + mountPoints: Array<{ + deviceName: string; + virtualName: string; + volumeType: string; + iops: number; + throughput: number; + size: number; + }>; + userData: string; + mergeUserData: boolean; + securityGroups: string[]; + }>; }; export type TabProps = { From 02e465377423104c0e4e4c7d60f14f5e07be1762 Mon Sep 17 00:00:00 2001 From: SupaJoon Date: Wed, 27 Sep 2023 12:53:38 -0400 Subject: [PATCH 11/17] EVG-20939: Install @leafygreen-ui/button@21.0.6 (#2065) --- package.json | 2 +- yarn.lock | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 225d06d7c9..ecd56b9f6c 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "@emotion/styled": "11.11.0", "@leafygreen-ui/badge": "8.0.2", "@leafygreen-ui/banner": "7.0.4", - "@leafygreen-ui/button": "21.0.0", + "@leafygreen-ui/button": "21.0.6", "@leafygreen-ui/callout": "9.0.13", "@leafygreen-ui/card": "9.0.1", "@leafygreen-ui/checkbox": "12.0.5", diff --git a/yarn.lock b/yarn.lock index 87496cd87c..43d6a3ac79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3287,17 +3287,17 @@ resolved "https://registry.yarnpkg.com/@leafygreen-ui/box/-/box-3.1.8.tgz#33e6dedbe3ee510ce88ffade0a3a9e68a96103a9" integrity sha512-qfjwhrie+mUrS2H+Qp98iQKBPoZtNpFmlGBYgg59sVOzotFvyvqwxlf/JcaNGo+v7nyOhC2XAHui0ywf9cScKw== -"@leafygreen-ui/button@21.0.0": - version "21.0.0" - resolved "https://registry.yarnpkg.com/@leafygreen-ui/button/-/button-21.0.0.tgz#cd3cf92535251fe19952ab202952cc219b1e34fb" - integrity sha512-aI8Ib74pp+bTBy/TX9UR2BqonuR27YHeDWJkPNPKixWTpXxzgubzGHykghKsdKCUXfLP+widX22ajzvzU91mjQ== +"@leafygreen-ui/button@21.0.6": + version "21.0.6" + resolved "https://registry.yarnpkg.com/@leafygreen-ui/button/-/button-21.0.6.tgz#0dd3efc192fa959568c291b21d64d381eb228b56" + integrity sha512-J9QmC29fNQG2GkQdxqR4IXyCBf3Z0A56CDRHQoPkIgrpPkAOLWH6jVbh2pMpcq/mB9LO4P9B4IH1WwdJ1XUn3w== dependencies: - "@leafygreen-ui/box" "^3.1.4" - "@leafygreen-ui/emotion" "^4.0.4" - "@leafygreen-ui/lib" "^10.4.0" - "@leafygreen-ui/palette" "^4.0.4" - "@leafygreen-ui/ripple" "^1.1.9" - "@leafygreen-ui/tokens" "^2.1.1" + "@leafygreen-ui/box" "^3.1.8" + "@leafygreen-ui/emotion" "^4.0.7" + "@leafygreen-ui/lib" "^12.0.0" + "@leafygreen-ui/palette" "^4.0.7" + "@leafygreen-ui/ripple" "^1.1.12" + "@leafygreen-ui/tokens" "^2.1.4" polished "^4.2.2" "@leafygreen-ui/button@^19.0.0", "@leafygreen-ui/button@^19.0.1", "@leafygreen-ui/button@^19.0.4": From fa8254a734134526f9052c58064e3651d67fb2f5 Mon Sep 17 00:00:00 2001 From: SupaJoon Date: Wed, 27 Sep 2023 12:53:49 -0400 Subject: [PATCH 12/17] EVG-20832: Install @leafygreen-ui/card@10.0.5 (#2064) --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index ecd56b9f6c..67eaa118e2 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@leafygreen-ui/banner": "7.0.4", "@leafygreen-ui/button": "21.0.6", "@leafygreen-ui/callout": "9.0.13", - "@leafygreen-ui/card": "9.0.1", + "@leafygreen-ui/card": "10.0.5", "@leafygreen-ui/checkbox": "12.0.5", "@leafygreen-ui/code": "14.0.1", "@leafygreen-ui/combobox": "5.0.7", diff --git a/yarn.lock b/yarn.lock index 43d6a3ac79..95f4dd88ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3364,16 +3364,16 @@ "@leafygreen-ui/tokens" "^2.1.4" "@leafygreen-ui/typography" "^16.5.4" -"@leafygreen-ui/card@9.0.1": - version "9.0.1" - resolved "https://registry.yarnpkg.com/@leafygreen-ui/card/-/card-9.0.1.tgz#c81eb354acfd950d10ef0a5b4ce4c124235505db" - integrity sha512-I07xrEesSmM1tz6IHI4baLb7btudG0EFFPp0MZjd20+yZjrUjBO0DYgL0x7YlN56/DxtIqAmQrWr8kGk1Ythaw== +"@leafygreen-ui/card@10.0.5": + version "10.0.5" + resolved "https://registry.yarnpkg.com/@leafygreen-ui/card/-/card-10.0.5.tgz#890b0b9e9c8d099b2e0200a725738c730752489a" + integrity sha512-RunKpbTg2agE+YXjP0YFtIbUWWLLA3owf5PmyPU7jU+uhOXxSatmcM/ma2zGa82K3oLZSGI7LkKJJL9NMRU8Ig== dependencies: - "@leafygreen-ui/box" "^3.1.1" - "@leafygreen-ui/emotion" "^4.0.3" - "@leafygreen-ui/lib" "^10.0.0" - "@leafygreen-ui/palette" "^3.4.4" - "@leafygreen-ui/tokens" "^1.4.0" + "@leafygreen-ui/box" "^3.1.8" + "@leafygreen-ui/emotion" "^4.0.7" + "@leafygreen-ui/lib" "^12.0.0" + "@leafygreen-ui/palette" "^4.0.7" + "@leafygreen-ui/tokens" "^2.1.4" polished "^4.2.2" "@leafygreen-ui/card@^10.0.4": From cf52d111cf9dd446653afebd241c00e5e87b91f2 Mon Sep 17 00:00:00 2001 From: minnakt <47064971+minnakt@users.noreply.github.com> Date: Wed, 27 Sep 2023 14:27:18 -0400 Subject: [PATCH 13/17] EVG-20880: Add hosts section for static providers (#2058) --- .../distroSettings/provider_section.ts | 5 +- .../distroSettings/task_section.ts | 35 +- src/pages/distroSettings/Tabs.tsx | 5 +- .../tabs/ProviderTab/getFormSchema.ts | 6 +- .../tabs/ProviderTab/schemaFields.ts | 16 + .../tabs/ProviderTab/transformerUtils.ts | 6 + .../tabs/ProviderTab/transformers.test.ts | 4 + .../distroSettings/tabs/ProviderTab/types.ts | 3 + .../distroSettings/tabs/TaskTab/TaskTab.tsx | 10 +- .../tabs/TaskTab/getFormSchema.ts | 351 +++++++++--------- .../distroSettings/tabs/TaskTab/types.ts | 2 + 11 files changed, 257 insertions(+), 186 deletions(-) diff --git a/cypress/integration/distroSettings/provider_section.ts b/cypress/integration/distroSettings/provider_section.ts index 57552dd990..28a11730fa 100644 --- a/cypress/integration/distroSettings/provider_section.ts +++ b/cypress/integration/distroSettings/provider_section.ts @@ -19,6 +19,8 @@ describe("provider section", () => { }); cy.contains("button", "Add security group").click(); cy.getInputByLabel("Security Group ID").type("group-1234"); + cy.contains("button", "Add host").click(); + cy.getInputByLabel("Name").type("host-1234"); save(); cy.validateToast("success"); @@ -27,7 +29,8 @@ describe("provider section", () => { cy.getInputByLabel("Merge with existing user data").uncheck({ force: true, }); - cy.dataCy("delete-item-button").click(); + cy.dataCy("delete-item-button").first().click(); + cy.dataCy("delete-item-button").first().click(); save(); cy.validateToast("success"); }); diff --git a/cypress/integration/distroSettings/task_section.ts b/cypress/integration/distroSettings/task_section.ts index 9fd3138da0..9db2ef9f38 100644 --- a/cypress/integration/distroSettings/task_section.ts +++ b/cypress/integration/distroSettings/task_section.ts @@ -2,14 +2,37 @@ import { save } from "./utils"; describe("task section", () => { beforeEach(() => { - cy.visit("/distro/localhost/settings/task"); + cy.visit("/distro/ubuntu1804-workstation/settings/task"); }); - it("should only show tunable options if planner version is tunable", () => { - cy.getInputByLabel("Task Planner Version").should("contain.text", "Legacy"); - cy.dataCy("tunable-options").should("not.exist"); - cy.selectLGOption("Task Planner Version", "Tunable"); - cy.dataCy("tunable-options").should("be.visible"); + describe("providers", () => { + describe("static provider", () => { + it("should not show tunable options", () => { + cy.visit("/distro/localhost/settings/task"); + cy.selectLGOption("Task Planner Version", "Tunable"); + cy.dataCy("tunable-options").should("not.exist"); + }); + }); + + describe("docker provider", () => { + it("should not show tunable options", () => { + cy.visit("/distro/ubuntu1604-container-test/settings/task"); + cy.selectLGOption("Task Planner Version", "Tunable"); + cy.dataCy("tunable-options").should("not.exist"); + }); + }); + + describe("ec2 provider", () => { + it("should only show tunable options if planner version is tunable", () => { + cy.getInputByLabel("Task Planner Version").should( + "contain.text", + "Legacy" + ); + cy.dataCy("tunable-options").should("not.exist"); + cy.selectLGOption("Task Planner Version", "Tunable"); + cy.dataCy("tunable-options").should("be.visible"); + }); + }); }); it("should surface warnings for invalid number inputs", () => { diff --git a/src/pages/distroSettings/Tabs.tsx b/src/pages/distroSettings/Tabs.tsx index 51f2299a84..4f11d8e1b0 100644 --- a/src/pages/distroSettings/Tabs.tsx +++ b/src/pages/distroSettings/Tabs.tsx @@ -58,7 +58,10 @@ export const DistroSettingsTabs: React.FC = ({ distro }) => { + } /> ; ami: string; instance_type: string; key_name: string; @@ -57,6 +58,7 @@ export const formProviderSettings = ( userData: providerSettings.user_data ?? "", mergeUserData: providerSettings.merge_user_data_parts ?? false, securityGroups: providerSettings.security_group_ids ?? [], + hosts: providerSettings.hosts?.map((h) => ({ name: h.name })) ?? [], }, dockerProviderSettings: { userData: providerSettings.user_data ?? "", @@ -111,6 +113,10 @@ export const gqlProviderSettings = ( user_data: providerSettings.userData, merge_user_data_parts: providerSettings.mergeUserData, security_group_ids: providerSettings.securityGroups, + hosts: + providerSettings.hosts?.map((h) => ({ + name: h.name, + })) ?? [], }, dockerProviderSettings: { user_data: providerSettings.userData, diff --git a/src/pages/distroSettings/tabs/ProviderTab/transformers.test.ts b/src/pages/distroSettings/tabs/ProviderTab/transformers.test.ts index c72c1fd45b..bb281bc2e7 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/transformers.test.ts +++ b/src/pages/distroSettings/tabs/ProviderTab/transformers.test.ts @@ -8,6 +8,7 @@ const defaultFormState = { userData: "", mergeUserData: false, securityGroups: ["1"], + hosts: [], }, dockerProviderSettings: { imageUrl: "", @@ -56,6 +57,7 @@ describe("provider tab", () => { user_data: "", merge_user_data: false, security_group_ids: ["1"], + hosts: [{ name: "localhost-1" }, { name: "localhost-2" }], }, ], }; @@ -69,6 +71,7 @@ describe("provider tab", () => { userData: "", mergeUserData: false, securityGroups: ["1"], + hosts: [{ name: "localhost-1" }, { name: "localhost-2" }], }, }; @@ -81,6 +84,7 @@ describe("provider tab", () => { merge_user_data_parts: false, security_group_ids: ["1"], user_data: "", + hosts: [{ name: "localhost-1" }, { name: "localhost-2" }], }, ], }; diff --git a/src/pages/distroSettings/tabs/ProviderTab/types.ts b/src/pages/distroSettings/tabs/ProviderTab/types.ts index 85d2e13323..5ce0dc04fa 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/types.ts +++ b/src/pages/distroSettings/tabs/ProviderTab/types.ts @@ -19,6 +19,9 @@ export type ProviderFormState = { userData: string; mergeUserData: boolean; securityGroups: string[]; + hosts: Array<{ + name: string; + }>; }; dockerProviderSettings: { imageUrl: string; diff --git a/src/pages/distroSettings/tabs/TaskTab/TaskTab.tsx b/src/pages/distroSettings/tabs/TaskTab/TaskTab.tsx index c382ebe5d3..3fa04319b0 100644 --- a/src/pages/distroSettings/tabs/TaskTab/TaskTab.tsx +++ b/src/pages/distroSettings/tabs/TaskTab/TaskTab.tsx @@ -3,12 +3,8 @@ import { BaseTab } from "../BaseTab"; import { getFormSchema } from "./getFormSchema"; import { TabProps } from "./types"; -export const TaskTab: React.FC = ({ distroData }) => { - const initialFormState = distroData; +export const TaskTab: React.FC = ({ distroData, provider }) => { + const formSchema = useMemo(() => getFormSchema({ provider }), [provider]); - const formSchema = useMemo(() => getFormSchema(), []); - - return ( - - ); + return ; }; diff --git a/src/pages/distroSettings/tabs/TaskTab/getFormSchema.ts b/src/pages/distroSettings/tabs/TaskTab/getFormSchema.ts index 5ea2e1cbeb..78ab84bd8b 100644 --- a/src/pages/distroSettings/tabs/TaskTab/getFormSchema.ts +++ b/src/pages/distroSettings/tabs/TaskTab/getFormSchema.ts @@ -4,194 +4,205 @@ import { FinderVersion, PlannerVersion, DispatcherVersion, + Provider, } from "gql/generated/types"; -export const getFormSchema = (): ReturnType => ({ - fields: {}, - schema: { - type: "object" as "object", - properties: { - finderSettings: { - type: "object" as "object", - title: "Task Finder", - properties: { - version: { - type: "string" as "string", - title: "Task Finder Version", - oneOf: [ - { - type: "string" as "string", - title: "Legacy", - enum: [FinderVersion.Legacy], - }, - { - type: "string" as "string", - title: "Parallel", - enum: [FinderVersion.Parallel], - }, - { - type: "string" as "string", - title: "Pipeline", - enum: [FinderVersion.Pipeline], - }, - { - type: "string" as "string", - title: "Alternate", - enum: [FinderVersion.Alternate], - }, - ], +export const getFormSchema = ({ + provider, +}: { + provider: Provider; +}): ReturnType => { + const hasEC2Provider = + provider !== Provider.Static && provider !== Provider.Docker; + + return { + fields: {}, + schema: { + type: "object" as "object", + properties: { + finderSettings: { + type: "object" as "object", + title: "Task Finder", + properties: { + version: { + type: "string" as "string", + title: "Task Finder Version", + oneOf: [ + { + type: "string" as "string", + title: "Legacy", + enum: [FinderVersion.Legacy], + }, + { + type: "string" as "string", + title: "Parallel", + enum: [FinderVersion.Parallel], + }, + { + type: "string" as "string", + title: "Pipeline", + enum: [FinderVersion.Pipeline], + }, + { + type: "string" as "string", + title: "Alternate", + enum: [FinderVersion.Alternate], + }, + ], + }, }, }, - }, - plannerSettings: { - type: "object" as "object", - title: "Task Planner", - properties: { - version: { - type: "string" as "string", - title: "Task Planner Version", - oneOf: [ - { - type: "string" as "string", - title: "Legacy", - enum: [PlannerVersion.Legacy], - }, - { - type: "string" as "string", - title: "Tunable", - enum: [PlannerVersion.Tunable], - }, - ], + plannerSettings: { + type: "object" as "object", + title: "Task Planner", + properties: { + version: { + type: "string" as "string", + title: "Task Planner Version", + oneOf: [ + { + type: "string" as "string", + title: "Legacy", + enum: [PlannerVersion.Legacy], + }, + { + type: "string" as "string", + title: "Tunable", + enum: [PlannerVersion.Tunable], + }, + ], + }, }, - }, - dependencies: { - version: { - oneOf: [ - { - properties: { - version: { - enum: [PlannerVersion.Legacy], + dependencies: { + version: { + oneOf: [ + { + properties: { + version: { + enum: [PlannerVersion.Legacy], + }, }, }, - }, - { - properties: { - version: { - enum: [PlannerVersion.Tunable], - }, - tunableOptions: { - type: "object" as "object", - title: "", - properties: { - targetTime: { - type: "number" as "number", - title: "Target Time (seconds)", - default: 0, - minimum: 0, - maximum: 1800, - }, - patchFactor: { - type: "number" as "number", - title: "Patch Factor (0 to 100 inclusive)", - default: 0, - minimum: 0, - maximum: 100, - }, - patchTimeInQueueFactor: { - type: "number" as "number", - title: - "Patch Time in Queue Factor (0 to 100 inclusive)", - default: 0, - minimum: 0, - maximum: 100, - }, - mainlineTimeInQueueFactor: { - type: "number" as "number", - title: - "Mainline Time in Queue Factor (0 to 100 inclusive)", - default: 0, - minimum: 0, - maximum: 100, - }, - commitQueueFactor: { - type: "number" as "number", - title: "Commit Queue Factor (0 to 100 inclusive)", - default: 0, - minimum: 0, - maximum: 100, - }, - expectedRuntimeFactor: { - type: "number" as "number", - title: "Expected Runtime Factor (0 to 100 inclusive)", - default: 0, - minimum: 0, - maximum: 100, - }, - generateTaskFactor: { - type: "number" as "number", - title: "Generate Task Factor (0 to 100 inclusive)", - default: 0, - minimum: 0, - maximum: 100, - }, - groupVersions: { - type: "boolean" as "boolean", - title: "Group versions", - default: false, + { + properties: { + version: { + enum: [PlannerVersion.Tunable], + }, + tunableOptions: { + type: "object" as "object", + title: "", + properties: { + targetTime: { + type: "number" as "number", + title: "Target Time (seconds)", + default: 0, + minimum: 0, + maximum: 1800, + }, + patchFactor: { + type: "number" as "number", + title: "Patch Factor (0 to 100 inclusive)", + default: 0, + minimum: 0, + maximum: 100, + }, + patchTimeInQueueFactor: { + type: "number" as "number", + title: + "Patch Time in Queue Factor (0 to 100 inclusive)", + default: 0, + minimum: 0, + maximum: 100, + }, + mainlineTimeInQueueFactor: { + type: "number" as "number", + title: + "Mainline Time in Queue Factor (0 to 100 inclusive)", + default: 0, + minimum: 0, + maximum: 100, + }, + commitQueueFactor: { + type: "number" as "number", + title: "Commit Queue Factor (0 to 100 inclusive)", + default: 0, + minimum: 0, + maximum: 100, + }, + expectedRuntimeFactor: { + type: "number" as "number", + title: "Expected Runtime Factor (0 to 100 inclusive)", + default: 0, + minimum: 0, + maximum: 100, + }, + generateTaskFactor: { + type: "number" as "number", + title: "Generate Task Factor (0 to 100 inclusive)", + default: 0, + minimum: 0, + maximum: 100, + }, + groupVersions: { + type: "boolean" as "boolean", + title: "Group versions", + default: false, + }, }, }, }, }, - }, - ], + ], + }, }, }, - }, - dispatcherSettings: { - type: "object" as "object", - title: "Task Dispatcher", - properties: { - version: { - type: "string" as "string", - title: "Task Dispatcher Version", - oneOf: [ - { - type: "string" as "string", - title: "Revised", - enum: [DispatcherVersion.Revised], - }, - { - type: "string" as "string", - title: "Revised with dependencies", - enum: [DispatcherVersion.RevisedWithDependencies], - }, - ], + dispatcherSettings: { + type: "object" as "object", + title: "Task Dispatcher", + properties: { + version: { + type: "string" as "string", + title: "Task Dispatcher Version", + oneOf: [ + { + type: "string" as "string", + title: "Revised", + enum: [DispatcherVersion.Revised], + }, + { + type: "string" as "string", + title: "Revised with dependencies", + enum: [DispatcherVersion.RevisedWithDependencies], + }, + ], + }, }, }, }, }, - }, - uiSchema: { - finderSettings: { - "ui:ObjectFieldTemplate": CardFieldTemplate, - version: { - "ui:allowDeselect": false, - }, - }, - plannerSettings: { - "ui:ObjectFieldTemplate": CardFieldTemplate, - version: { - "ui:allowDeselect": false, + uiSchema: { + finderSettings: { + "ui:ObjectFieldTemplate": CardFieldTemplate, + version: { + "ui:allowDeselect": false, + }, }, - tunableOptions: { - "ui:field-data-cy": "tunable-options", + plannerSettings: { + "ui:ObjectFieldTemplate": CardFieldTemplate, + version: { + "ui:allowDeselect": false, + }, + tunableOptions: { + "ui:field-data-cy": "tunable-options", + ...(!hasEC2Provider && { "ui:widget": "hidden" }), + }, }, - }, - dispatcherSettings: { - "ui:ObjectFieldTemplate": CardFieldTemplate, - version: { - "ui:allowDeselect": false, + dispatcherSettings: { + "ui:ObjectFieldTemplate": CardFieldTemplate, + version: { + "ui:allowDeselect": false, + }, }, }, - }, -}); + }; +}; diff --git a/src/pages/distroSettings/tabs/TaskTab/types.ts b/src/pages/distroSettings/tabs/TaskTab/types.ts index c47705382f..ef9f1b57fc 100644 --- a/src/pages/distroSettings/tabs/TaskTab/types.ts +++ b/src/pages/distroSettings/tabs/TaskTab/types.ts @@ -2,6 +2,7 @@ import { FinderVersion, PlannerVersion, DispatcherVersion, + Provider, } from "gql/generated/types"; export interface TaskFormState { @@ -28,4 +29,5 @@ export interface TaskFormState { export type TabProps = { distroData: TaskFormState; + provider: Provider; }; From 097591b131841804c508bdcea40b3c205e712123 Mon Sep 17 00:00:00 2001 From: "annie.black" Date: Wed, 27 Sep 2023 14:54:50 -0400 Subject: [PATCH 14/17] v3.0.142 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 67eaa118e2..7e344f1cb3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spruce", - "version": "3.0.141", + "version": "3.0.142", "private": true, "scripts": { "bootstrap-logkeeper": "./scripts/bootstrap-logkeeper.sh", From f26a7a57115d410613bdaf08fed8a29819c3171f Mon Sep 17 00:00:00 2001 From: Mohamed Khelif Date: Wed, 27 Sep 2023 15:30:00 -0400 Subject: [PATCH 15/17] v3.0.143 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7e344f1cb3..5f69e86b18 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spruce", - "version": "3.0.142", + "version": "3.0.143", "private": true, "scripts": { "bootstrap-logkeeper": "./scripts/bootstrap-logkeeper.sh", From ebae367d74655039dfb90eacc3b9e963ea0e35a2 Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Wed, 27 Sep 2023 16:12:10 -0400 Subject: [PATCH 16/17] EVG-19951: Add bootstrap methods to host settings (#2043) --- .../distroSettings/host_section.ts | 62 +- cypress/support/commands.ts | 2 +- cypress/support/e2e.ts | 2 +- src/components/SpruceForm/ElementWrapper.tsx | 1 + .../SpruceForm/Widgets/LeafyGreenWidgets.tsx | 6 +- src/components/SpruceForm/Widgets/types.ts | 1 + .../distroSettings/tabs/HostTab/HostTab.tsx | 45 +- .../distroSettings/tabs/HostTab/constants.ts | 70 ++ .../tabs/HostTab/getFormSchema.tsx | 340 ++++----- .../tabs/HostTab/schemaFields.tsx | 644 ++++++++++++++++++ .../tabs/HostTab/transformers.test.ts | 50 +- .../tabs/HostTab/transformers.ts | 77 ++- .../distroSettings/tabs/HostTab/types.ts | 30 +- 13 files changed, 1047 insertions(+), 283 deletions(-) create mode 100644 src/pages/distroSettings/tabs/HostTab/constants.ts create mode 100644 src/pages/distroSettings/tabs/HostTab/schemaFields.tsx diff --git a/cypress/integration/distroSettings/host_section.ts b/cypress/integration/distroSettings/host_section.ts index cc7958243f..c3aaddd67b 100644 --- a/cypress/integration/distroSettings/host_section.ts +++ b/cypress/integration/distroSettings/host_section.ts @@ -14,14 +14,11 @@ describe("host section", () => { cy.dataCy("future-fraction-input").should("not.exist"); }); - it("errors when selecting an incompatible host communication method", () => { + it("shows an error when selecting an incompatible host communication method", () => { cy.selectLGOption("Host Communication Method", "RPC"); - save(); - cy.validateToast( - "error", - "validating changes for distro 'localhost': 'ERROR: bootstrapping hosts using legacy SSH is incompatible with non-legacy host communication'" + cy.contains( + "Legacy and non-legacy bootstrapping and communication are incompatible." ); - cy.selectLGOption("Host Communication Method", "Legacy SSH"); }); it("updates host fields", () => { @@ -40,7 +37,7 @@ describe("host section", () => { ); save(); - cy.validateToast("success"); + cy.validateToast("success", "Updated distro."); // Reset fields cy.selectLGOption("Agent Architecture", "Linux 64-bit"); @@ -53,6 +50,57 @@ describe("host section", () => { cy.selectLGOption("Host Allocator Feedback Rule", "Default"); cy.selectLGOption("Host Overallocation Rule", "Default"); + save(); + cy.validateToast("success", "Updated distro."); + }); + }); + + describe("using User Data bootstrap method", () => { + beforeEach(() => { + cy.visit("/distro/ubuntu1604-parent/settings/host"); + cy.selectLGOption("Host Bootstrap Method", "User Data"); + cy.selectLGOption("Host Communication Method", "RPC"); + }); + + it("shows Windows-only fields when the architecture is updated", () => { + cy.contains("label", "Root Directory").should("not.exist"); + cy.contains("label", "Service User").should("not.exist"); + + cy.selectLGOption("Agent Architecture", "Windows 64-bit"); + + cy.getInputByLabel("Root Directory").should("exist"); + cy.getInputByLabel("Service User").should("exist"); + }); + + it("hides resource limit fields when the architecture is not Linux", () => { + cy.contains("Resource Limits").should("exist"); + cy.selectLGOption("Agent Architecture", "Windows 64-bit"); + cy.contains("Resource Limits").should("not.exist"); + }); + + it("saves bootstrap settings", () => { + cy.getInputByLabel("Jasper Binary Directory").type("/jasper/binary"); + cy.getInputByLabel("Jasper Credentials Path").type("/jasper/credentials"); + cy.getInputByLabel("Client Directory").type("/client/dir"); + cy.getInputByLabel("Shell Path").type("/shell/path"); + cy.getInputByLabel("Home Volume Format Command").type( + "echo 'Hello World'" + ); + cy.getInputByLabel("Number of Files").type("10"); + cy.getInputByLabel("Number of CGroup Tasks").type("20"); + cy.getInputByLabel("Number of Processes").type("30"); + cy.getInputByLabel("Locked Memory").type("128"); + cy.getInputByLabel("Virtual Memory").type("256"); + + cy.contains("button", "Add variable").click(); + cy.getInputByLabel("Key").type("my-key"); + cy.getInputByLabel("Value").type("my-value"); + + cy.contains("button", "Add script").click(); + cy.getInputByLabel(/^Path$/).type("/path/to/precondition/script"); + cy.getInputByLabel(/^Script$/).type("script contents here"); + + cy.dataCy("save-settings-button").scrollIntoView(); save(); cy.validateToast("success"); }); diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 3fdb8998fe..e18f4e160b 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -48,7 +48,7 @@ Cypress.Commands.add("enterLoginCredentials", () => { }); /* getInputByLabel */ -Cypress.Commands.add("getInputByLabel", (label: string) => { +Cypress.Commands.add("getInputByLabel", (label: string | RegExp) => { // LeafyGreen inputs start out with ids of "undefined". Wait until LeafyGreen components have proper ids. cy.contains("label", label) .should("have.attr", "for") diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 893105b529..e77d5b9f66 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -76,7 +76,7 @@ declare global { * Custom command to enter get an input by its label * @example cy.getInputBylabel("Some Label") */ - getInputByLabel(label: string): Chainable; + getInputByLabel(label: string | RegExp): Chainable; /** * Custom command to select an option from a leafygreen select component by label * @param label The label of the select component diff --git a/src/components/SpruceForm/ElementWrapper.tsx b/src/components/SpruceForm/ElementWrapper.tsx index aa5757e618..c67d38f56c 100644 --- a/src/components/SpruceForm/ElementWrapper.tsx +++ b/src/components/SpruceForm/ElementWrapper.tsx @@ -7,6 +7,7 @@ type ElementWrapperProps = { const ElementWrapper = styled.div` margin-bottom: 20px; + max-width: 800px; ${({ limitMaxWidth }) => limitMaxWidth && `max-width: ${STANDARD_FIELD_WIDTH}px;`} diff --git a/src/components/SpruceForm/Widgets/LeafyGreenWidgets.tsx b/src/components/SpruceForm/Widgets/LeafyGreenWidgets.tsx index 8cfca7afbf..20fbe51099 100644 --- a/src/components/SpruceForm/Widgets/LeafyGreenWidgets.tsx +++ b/src/components/SpruceForm/Widgets/LeafyGreenWidgets.tsx @@ -42,13 +42,13 @@ export const LeafyGreenTextInput: React.FC< "data-cy": dataCy, description, elementWrapperCSS, - emptyValue = "", inputType, optional, warnings, } = options; const { errors, hasError } = processErrors(rawErrors); + const emptyValue = options.emptyValue ?? ""; const inputProps = { ...(!isNullish(schema.maximum) && { max: schema.maximum }), @@ -340,9 +340,11 @@ export const LeafyGreenTextArea: React.FC = ({ }) => { const { "data-cy": dataCy, + description, elementWrapperCSS, emptyValue = "", focusOnMount, + rows, } = options; const { errors, hasError } = processErrors(rawErrors); @@ -366,12 +368,14 @@ export const LeafyGreenTextArea: React.FC = ({ placeholder={placeholder || undefined} data-cy={dataCy} label={label} + description={description} disabled={disabled || readonly} value={value} onChange={({ target }) => target.value === "" ? onChange(emptyValue) : onChange(target.value) } errorMessage={hasError ? errors.join(", ") : null} + rows={rows} state={hasError ? "error" : "none"} /> diff --git a/src/components/SpruceForm/Widgets/types.ts b/src/components/SpruceForm/Widgets/types.ts index b7da591fc3..d5a47cdb1e 100644 --- a/src/components/SpruceForm/Widgets/types.ts +++ b/src/components/SpruceForm/Widgets/types.ts @@ -16,6 +16,7 @@ export interface SpruceWidgetProps extends WidgetProps { errors: string[]; focusOnMount: boolean; inputType: TextInputType; + rows: number; showLabel: boolean; sizeVariant: string; tooltipDescription: string; diff --git a/src/pages/distroSettings/tabs/HostTab/HostTab.tsx b/src/pages/distroSettings/tabs/HostTab/HostTab.tsx index f7df1db7db..9267af8f5e 100644 --- a/src/pages/distroSettings/tabs/HostTab/HostTab.tsx +++ b/src/pages/distroSettings/tabs/HostTab/HostTab.tsx @@ -1,17 +1,54 @@ import { useMemo } from "react"; +import { ValidateProps } from "components/SpruceForm"; +import { DistroSettingsTabRoutes } from "constants/routes"; +import { BootstrapMethod, CommunicationMethod } from "gql/generated/types"; import { useSpruceConfig } from "hooks"; +import { useDistroSettingsContext } from "pages/distroSettings/Context"; import { BaseTab } from "../BaseTab"; import { getFormSchema } from "./getFormSchema"; -import { TabProps } from "./types"; +import { HostFormState, TabProps } from "./types"; export const HostTab: React.FC = ({ distroData, provider }) => { const spruceConfig = useSpruceConfig(); const sshKeys = spruceConfig?.keys; + const { getTab } = useDistroSettingsContext(); + // @ts-expect-error - see TabState for details. + const { formData }: { formData: HostFormState } = getTab( + DistroSettingsTabRoutes.Host + ); + const architecture = formData?.setup?.arch; + const formSchema = useMemo( - () => getFormSchema({ provider, sshKeys }), - [provider, sshKeys] + () => getFormSchema({ architecture, provider, sshKeys }), + [architecture, provider, sshKeys] ); - return ; + return ( + + ); }; + +const validate = ((formData, errors) => { + const { + setup: { bootstrapMethod, communicationMethod }, + } = formData; + + // Ensure either Legacy SSH or non-legacy methods are used for both communication and bootstrapping. + if ( + (bootstrapMethod === BootstrapMethod.LegacySsh && + communicationMethod !== CommunicationMethod.LegacySsh) || + (bootstrapMethod !== BootstrapMethod.LegacySsh && + communicationMethod === CommunicationMethod.LegacySsh) + ) { + errors.setup.communicationMethod.addError( + "Legacy and non-legacy bootstrapping and communication are incompatible." + ); + } + + return errors; +}) satisfies ValidateProps; diff --git a/src/pages/distroSettings/tabs/HostTab/constants.ts b/src/pages/distroSettings/tabs/HostTab/constants.ts new file mode 100644 index 0000000000..322c62a4c9 --- /dev/null +++ b/src/pages/distroSettings/tabs/HostTab/constants.ts @@ -0,0 +1,70 @@ +import { + Arch, + BootstrapMethod, + CommunicationMethod, + FeedbackRule, + HostAllocatorVersion, + OverallocatedRule, + RoundingRule, +} from "gql/generated/types"; + +export const linuxArchitectures = [ + Arch.Linux_64Bit, + Arch.LinuxArm_64Bit, + Arch.LinuxPpc_64Bit, + Arch.LinuxZseries, +]; + +export const nonLinuxArchitectures = Object.values(Arch).filter( + (a) => !linuxArchitectures.includes(a) +); + +export const windowsArchitectures = [Arch.Windows_64Bit]; + +export const nonWindowsArchitectures = Object.values(Arch).filter( + (a) => !windowsArchitectures.includes(a) +); + +export const architectureToCopy = { + [Arch.Linux_64Bit]: "Linux 64-bit", + [Arch.LinuxArm_64Bit]: "Linux ARM 64-bit", + [Arch.LinuxPpc_64Bit]: "Linux PowerPC 64-bit", + [Arch.LinuxZseries]: "Linux zSeries", + [Arch.Osx_64Bit]: "macOS 64-bit", + [Arch.OsxArm_64Bit]: "macOS ARM 64-bit", + [Arch.Windows_64Bit]: "Windows 64-bit", +}; + +export const bootstrapMethodToCopy = { + [BootstrapMethod.LegacySsh]: "Legacy SSH", + [BootstrapMethod.Ssh]: "SSH", + [BootstrapMethod.UserData]: "User Data", +}; + +export const communicationMethodToCopy = { + [CommunicationMethod.LegacySsh]: "Legacy SSH", + [CommunicationMethod.Ssh]: "SSH", + [CommunicationMethod.Rpc]: "RPC", +}; + +export const feedbackRuleToCopy = { + [FeedbackRule.Default]: "Default", + [FeedbackRule.NoFeedback]: "No feedback", + [FeedbackRule.WaitsOverThresh]: "Wait over threshold", +}; + +export const hostAllocatorVersionToCopy = { + [HostAllocatorVersion.Utilization]: "Utilization", +}; + +export const overallocatedRuleToCopy = { + [OverallocatedRule.Default]: "Default", + [OverallocatedRule.Ignore]: "No terminations when overallocated", + [OverallocatedRule.Terminate]: "Terminate hosts when overallocated", +}; + +export const roundingRuleToCopy = { + [RoundingRule.Default]: "Default", + [RoundingRule.Down]: "Round down", + [RoundingRule.Up]: "Round up", +}; diff --git a/src/pages/distroSettings/tabs/HostTab/getFormSchema.tsx b/src/pages/distroSettings/tabs/HostTab/getFormSchema.tsx index d284dc5415..731890413b 100644 --- a/src/pages/distroSettings/tabs/HostTab/getFormSchema.tsx +++ b/src/pages/distroSettings/tabs/HostTab/getFormSchema.tsx @@ -1,24 +1,25 @@ -import { InlineCode } from "@leafygreen-ui/typography"; import { GetFormSchema } from "components/SpruceForm"; -import { CardFieldTemplate } from "components/SpruceForm/FieldTemplates"; +import { Arch, BootstrapMethod, Provider, SshKey } from "gql/generated/types"; +import { nonWindowsArchitectures, windowsArchitectures } from "./constants"; import { - Arch, - BootstrapMethod, - CommunicationMethod, - FeedbackRule, - HostAllocatorVersion, - OverallocatedRule, - Provider, - RoundingRule, - SshKey, -} from "gql/generated/types"; + allocation as allocationProperties, + bootstrap as bootstrapProperties, + setup, + sshConfig as sshConfigProperties, + icecreamConfigPath, + icecreamSchedulerHost, + isVirtualWorkStation, + rootDir, +} from "./schemaFields"; type FormSchemaParams = { + architecture: Arch; provider: Provider; sshKeys: SshKey[]; }; export const getFormSchema = ({ + architecture, provider, sshKeys, }: FormSchemaParams): ReturnType => { @@ -34,237 +35,124 @@ export const getFormSchema = ({ setup: { type: "object" as "object", title: "Host Setup", - properties: { - bootstrapMethod: { - type: "string" as "string", - title: "Host Bootstrap Method", - oneOf: enumSelect(bootstrapMethodToCopy), - }, - communicationMethod: { - type: "string" as "string", - title: "Host Communication Method", - oneOf: enumSelect(communicationMethodToCopy), + properties: setup.schema, + dependencies: { + userSpawnAllowed: { + oneOf: [ + { + properties: { + userSpawnAllowed: { enum: [false] }, + }, + }, + { + properties: { + userSpawnAllowed: { enum: [true] }, + isVirtualWorkStation: isVirtualWorkStation.schema, + }, + dependencies: { + isVirtualWorkStation: { + oneOf: [ + { + properties: { + isVirtualWorkStation: { + enum: [false], + }, + }, + }, + { + properties: { + isVirtualWorkStation: { + enum: [true], + }, + icecreamSchedulerHost: icecreamSchedulerHost.schema, + icecreamConfigPath: icecreamConfigPath.schema, + }, + }, + ], + }, + }, + }, + ], }, arch: { - type: "string" as "string", - title: "Agent Architecture", - oneOf: enumSelect(architectureToCopy), - }, - workDir: { - type: "string" as "string", - title: "Working Directory", - }, - setupScript: { - type: "string" as "string", - title: "Setup Script", - }, - setupAsSudo: { - type: "boolean" as "boolean", - title: "Run script as sudo", + oneOf: [ + { + properties: { + arch: { enum: windowsArchitectures }, + rootDir: rootDir.schema, + }, + }, + { + properties: { + arch: { enum: nonWindowsArchitectures }, + }, + }, + ], }, }, }, - sshConfig: { - type: "object" as "object", - title: "SSH Configuration", - properties: { - user: { - type: "string" as "string", - title: "SSH User", - }, - sshKey: { - type: "string" as "string", - title: "SSH Key", - oneOf: sshKeys.map(({ location, name }) => ({ - type: "string" as "string", - title: `${name} – ${location}`, - enum: [name], - })), - }, - authorizedKeysFile: { - type: "string" as "string", - title: "Authorized Keys File", - }, - sshOptions: { - type: "array" as "array", - title: "SSH Options", - items: { - type: "string" as "string", - title: "SSH Option", - default: "", - minLength: 1, + }, + dependencies: { + setup: { + oneOf: [ + { + properties: { + setup: { + properties: { + bootstrapMethod: { enum: [BootstrapMethod.LegacySsh] }, + }, + }, + sshConfig: sshConfig(sshKeys), + allocation, }, }, - }, - }, - allocation: { - type: "object" as "object", - title: "Host Allocation", - properties: { - version: { - type: "string" as "string", - title: "Host Allocator Version", - oneOf: enumSelect(hostAllocatorVersionToCopy), - }, - roundingRule: { - type: "string" as "string", - title: "Host Allocator Rounding Rule", - oneOf: enumSelect(roundingRuleToCopy), - }, - feedbackRule: { - type: "string" as "string", - title: "Host Allocator Feedback Rule", - oneOf: enumSelect(feedbackRuleToCopy), - }, - hostsOverallocatedRule: { - type: "string" as "string", - title: "Host Overallocation Rule", - oneOf: enumSelect(overallocatedRuleToCopy), - }, - minimumHosts: { - type: "number" as "number", - title: "Minimum Number of Hosts Allowed", - minimum: 0, - }, - maximumHosts: { - type: "number" as "number", - title: "Maxiumum Number of Hosts Allowed", - minimum: 0, - }, - acceptableHostIdleTime: { - type: "number" as "number", - title: "Acceptable Host Idle Time (s)", - }, - futureHostFraction: { - type: "number" as "number", - title: "Future Host Fraction", - minimum: 0, - maximum: 1, + { + properties: { + setup: { + properties: { + bootstrapMethod: { + enum: [BootstrapMethod.Ssh, BootstrapMethod.UserData], + }, + }, + }, + bootstrapSettings, + sshConfig: sshConfig(sshKeys), + allocation, + }, }, - }, + ], }, }, }, uiSchema: { - setup: { - "ui:ObjectFieldTemplate": CardFieldTemplate, - bootstrapMethod: { - "ui:allowDeselect": false, - }, - communicationMethod: { - "ui:allowDeselect": false, - }, - arch: { - "ui:allowDeselect": false, - }, - setupScript: { - "ui:widget": "textarea", - }, - }, - sshConfig: { - "ui:ObjectFieldTemplate": CardFieldTemplate, - sshKey: { - "ui:allowDeselect": false, - }, - authorizedKeysFile: { - "ui:data-cy": "authorized-keys-input", - ...(!hasStaticProvider && { "ui:widget": "hidden" }), - }, - sshOptions: { - "ui:addButtonText": "Add SSH option", - "ui:descriptionNode": ( - <> - Option keywords supported by ssh_config. - - ), - "ui:orderable": false, - items: { - "ui:placeholder": "ConnectTimeout=10", - }, - }, - }, - allocation: { - "ui:ObjectFieldTemplate": CardFieldTemplate, - version: { - "ui:allowDeselect": false, - }, - roundingRule: { - "ui:allowDeselect": false, - }, - feedbackRule: { - "ui:allowDeselect": false, - }, - hostsOverallocatedRule: { - "ui:allowDeselect": false, - }, - minimumHosts: { - "ui:data-cy": "minimum-hosts-input", - ...(!hasEC2Provider && { "ui:widget": "hidden" }), - }, - maximumHosts: { - "ui:data-cy": "maximum-hosts-input", - ...(!hasEC2Provider && { "ui:widget": "hidden" }), - }, - acceptableHostIdleTime: { - "ui:data-cy": "idle-time-input", - ...(!hasEC2Provider && { "ui:widget": "hidden" }), - }, - futureHostFraction: { - "ui:data-cy": "future-fraction-input", - ...(!hasEC2Provider && { "ui:widget": "hidden" }), - }, - }, + setup: setup.uiSchema(architecture, hasStaticProvider), + bootstrapSettings: bootstrapProperties.uiSchema(architecture), + sshConfig: sshConfigProperties.uiSchema(hasStaticProvider), + allocation: allocationProperties.uiSchema(hasEC2Provider), }, }; }; -const enumSelect = (enumObject: Record) => - Object.entries(enumObject).map(([key, title]) => ({ - type: "string" as "string", - title, - enum: [key], - })); - -const architectureToCopy = { - [Arch.Linux_64Bit]: "Linux 64-bit", - [Arch.LinuxArm_64Bit]: "Linux ARM 64-bit", - [Arch.LinuxPpc_64Bit]: "Linux PowerPC 64-bit", - [Arch.LinuxZseries]: "Linux zSeries", - [Arch.Osx_64Bit]: "macOS 64-bit", - [Arch.OsxArm_64Bit]: "macOS ARM 64-bit", - [Arch.Windows_64Bit]: "Windows 64-bit", -}; - -const bootstrapMethodToCopy = { - [BootstrapMethod.LegacySsh]: "Legacy SSH", - [BootstrapMethod.Ssh]: "SSH", - [BootstrapMethod.UserData]: "User Data", -}; - -const communicationMethodToCopy = { - [CommunicationMethod.LegacySsh]: "Legacy SSH", - [CommunicationMethod.Ssh]: "SSH", - [CommunicationMethod.Rpc]: "RPC", -}; - -const hostAllocatorVersionToCopy = { - [HostAllocatorVersion.Utilization]: "Utilization", +const bootstrapSettings = { + type: "object" as "object", + title: "Bootstrap Settings", + properties: bootstrapProperties.schema, }; -const roundingRuleToCopy = { - [RoundingRule.Default]: "Default", - [RoundingRule.Down]: "Round down", - [RoundingRule.Up]: "Round up", -}; - -const feedbackRuleToCopy = { - [FeedbackRule.Default]: "Default", - [FeedbackRule.NoFeedback]: "No feedback", - [FeedbackRule.WaitsOverThresh]: "Wait over threshold", -}; +const sshConfig = (sshKeys: SshKey[]) => ({ + type: "object" as "object", + title: "SSH Configuration", + properties: sshConfigProperties.schema(sshKeys), +}); -const overallocatedRuleToCopy = { - [OverallocatedRule.Default]: "Default", - [OverallocatedRule.Ignore]: "No terminations when overallocated", - [OverallocatedRule.Terminate]: "Terminate hosts when overallocated", +const allocation = { + type: "object" as "object", + title: "Host Allocation", + required: [ + "minimumHosts", + "maximumHosts", + "acceptableHostIdleTime", + "futureHostFraction", + ], + properties: allocationProperties.schema, }; diff --git a/src/pages/distroSettings/tabs/HostTab/schemaFields.tsx b/src/pages/distroSettings/tabs/HostTab/schemaFields.tsx new file mode 100644 index 0000000000..2d05d38002 --- /dev/null +++ b/src/pages/distroSettings/tabs/HostTab/schemaFields.tsx @@ -0,0 +1,644 @@ +import { css } from "@emotion/react"; +import { fontFamilies } from "@leafygreen-ui/tokens"; +import { InlineCode } from "@leafygreen-ui/typography"; +import { + CardFieldTemplate, + AccordionFieldTemplate, + FieldRow, +} from "components/SpruceForm/FieldTemplates"; +import { size } from "constants/tokens"; +import { Arch, SshKey } from "gql/generated/types"; +import { + architectureToCopy, + bootstrapMethodToCopy, + communicationMethodToCopy, + feedbackRuleToCopy, + hostAllocatorVersionToCopy, + linuxArchitectures, + overallocatedRuleToCopy, + roundingRuleToCopy, + windowsArchitectures, +} from "./constants"; + +const indentCSS = css` + margin-left: ${size.m}; +`; + +const enumSelect = (enumObject: Record) => + Object.entries(enumObject).map(([key, title]) => ({ + type: "string" as "string", + title, + enum: [key], + })); + +const bootstrapMethod = { + schema: { + type: "string" as "string", + title: "Host Bootstrap Method", + oneOf: enumSelect(bootstrapMethodToCopy), + }, + uiSchema: { + "ui:allowDeselect": false, + }, +}; + +const communicationMethod = { + schema: { + type: "string" as "string", + title: "Host Communication Method", + oneOf: enumSelect(communicationMethodToCopy), + }, + uiSchema: { + "ui:allowDeselect": false, + }, +}; + +const arch = { + schema: { + type: "string" as "string", + title: "Agent Architecture", + oneOf: enumSelect(architectureToCopy), + }, + uiSchema: { + "ui:allowDeselect": false, + }, +}; + +const workDir = { + schema: { + type: "string" as "string", + title: "Working Directory", + minLength: 1, + }, + uiSchema: { + "ui:description": + "Absolute path in which the agent run tasks on the host machine", + }, +}; + +const setupAsSudo = { + schema: { + type: "boolean" as "boolean", + title: "Run script as sudo", + }, + uiSchema: { + "ui:elementWrapperCSS": css` + display: flex; + justify-content: flex-end; + margin-bottom: -20px; + `, + }, +}; + +const setupScript = { + schema: { + type: "string" as "string", + title: "Setup Script", + }, + uiSchema: { + "ui:elementWrapperCSS": css` + textarea { + font-family: ${fontFamilies.code}; + } + `, + "ui:rows": 8, + "ui:widget": "textarea", + }, +}; + +const userSpawnAllowed = { + schema: { + type: "boolean" as "boolean", + title: "Spawnable", + }, + uiSchema: (hasStaticProvider: boolean) => ({ + ...(hasStaticProvider && { + "ui:disabled": true, + "ui:tooltipDescription": "Static distros are not spawnable.", + }), + "ui:description": "Allow users to spawn these hosts for personal use.", + "ui:bold": true, + }), +}; + +export const isVirtualWorkStation = { + schema: { + type: "boolean" as "boolean", + title: "Virtual Workstations", + }, + uiSchema: (architecture: Arch) => ({ + ...(!linuxArchitectures.includes(architecture) && { + "ui:disabled": true, + "ui:tooltipDescription": + "Only Linux distros may be configured as virtual workstations.", + }), + + "ui:description": + "Allow spawned hosts of this distro to be used as virtual workstations.", + "ui:bold": true, + }), +}; + +export const icecreamSchedulerHost = { + schema: { + type: "string" as "string", + title: "Icecream Scheduler Host", + }, + uiSchema: { + "ui:elementWrapperCSS": indentCSS, + }, +}; + +export const icecreamConfigPath = { + schema: { + type: "string" as "string", + title: "Icecream Config File Path", + }, + uiSchema: { + "ui:elementWrapperCSS": indentCSS, + }, +}; + +export const rootDir = { + schema: { + type: "string" as "string", + title: "Root Directory", + }, + uiSchema: {}, +}; + +const serviceUser = { + schema: { + type: "string" as "string", + title: "Service User", + }, + uiSchema: (architecture: Arch) => ({ + "ui:description": "Username for setting up Evergreen services", + // Only visible for Windows + ...(!windowsArchitectures.includes(architecture) && { + "ui:widget": "hidden", + }), + }), +}; + +const jasperBinaryDir = { + schema: { + type: "string" as "string", + title: "Jasper Binary Directory", + minLength: 1, + }, + uiSchema: { + "ui:description": + "Absolute native path to the directory containing the Jasper binary", + }, +}; + +export const jasperCredentialsPath = { + schema: { + type: "string" as "string", + title: "Jasper Credentials Path", + minLength: 1, + }, + uiSchema: { + "ui:description": + "Absolute native path to the directory containing the Jasper credentials", + }, +}; + +const clientDir = { + schema: { + type: "string" as "string", + title: "Client Directory", + minLength: 1, + }, + uiSchema: { + "ui:description": + "Absolute native path to the directory containing the evergreen binary", + }, +}; + +const shellPath = { + schema: { + type: "string" as "string", + title: "Shell Path", + minLength: 1, + }, + uiSchema: { + "ui:description": "Absolute native path to the shell binary file (bash)", + }, +}; + +const homeVolumeFormatCommand = { + schema: { + type: "string" as "string", + title: "Home Volume Format Command", + }, + uiSchema: {}, +}; + +const numFiles = { + schema: { + type: "number" as "number", + title: "Number of Files", + minimum: -1, + }, + uiSchema: { + "ui:description": "Max number of open file handles. Set -1 for unlimited.", + }, +}; + +const numTasks = { + schema: { + type: "number" as "number", + title: "Number of CGroup Tasks", + minimum: -1, + }, + uiSchema: { + "ui:description": + "Max number of cgroup tasks (threads). Set -1 for unlimited.", + }, +}; + +const numProcesses = { + schema: { + type: "number" as "number", + title: "Number of Processes", + minimum: -1, + }, + uiSchema: { + "ui:description": "Max number of processes. Set -1 for unlimited.", + }, +}; + +const lockedMemoryKb = { + schema: { + type: "number" as "number", + title: "Locked Memory", + minimum: -1, + }, + uiSchema: { + "ui:description": + "Max size (kB) that can be locked into memory. Set -1 for unlimited.", + }, +}; + +const virtualMemoryKb = { + schema: { + type: "number" as "number", + title: "Virtual Memory (kB)", + minimum: -1, + }, + uiSchema: { + "ui:description": + "Max size (kB) of available virtual memory. Set -1 for unlimited.", + }, +}; + +const env = { + schema: { + type: "array" as "array", + title: "Environment Variables", + items: { + type: "object" as "object", + properties: { + key: { + type: "string" as "string", + title: "Key", + default: "", + minLength: 1, + }, + value: { + type: "string" as "string", + title: "Value", + default: "", + minLength: 1, + }, + }, + }, + }, + uiSchema: { + "ui:addButtonText": "Add variable", + "ui:fullWidth": true, + "ui:orderable": false, + items: { + "ui:ObjectFieldTemplate": FieldRow, + }, + }, +}; + +const preconditionScripts = { + schema: { + type: "array" as "array", + title: "Precondition Scripts", + items: { + type: "object" as "object", + properties: { + path: { + type: "string" as "string", + title: "Path", + default: "", + minLength: 1, + }, + script: { + type: "string" as "string", + title: "Script", + default: "", + minLength: 1, + }, + }, + }, + }, + uiSchema: { + "ui:addButtonText": "Add script", + "ui:fullWidth": true, + "ui:orderable": false, + "ui:topAlignDelete": true, + items: { + "ui:ObjectFieldTemplate": AccordionFieldTemplate, + "ui:numberedTitle": "Precondition Script", + path: { + "ui:description": "Absolute path where the script will be placed.", + }, + script: { + "ui:description": + "The precondition script that must run and succeed before Jasper can start.", + "ui:widget": "textarea", + }, + }, + }, +}; + +const user = { + schema: { + type: "string" as "string", + title: "SSH User", + minLength: 1, + }, + uiSchema: { + "ui:description": "Username with which to SSH into host machine", + }, +}; + +const sshKey = { + schema: (sshKeys: SshKey[]) => ({ + type: "string" as "string", + title: "SSH Key", + oneOf: sshKeys.map(({ location, name }) => ({ + type: "string" as "string", + title: `${name} – ${location}`, + enum: [name], + })), + }), + uiSchema: { + "ui:allowDeselect": false, + }, +}; + +const authorizedKeysFile = { + schema: { + type: "string" as "string", + title: "Authorized Keys File", + }, + uiSchema: (hasStaticProvider: boolean) => ({ + "ui:data-cy": "authorized-keys-input", + ...(!hasStaticProvider && { "ui:widget": "hidden" }), + }), +}; + +const sshOptions = { + schema: { + type: "array" as "array", + title: "SSH Options", + items: { + type: "string" as "string", + title: "SSH Option", + default: "", + minLength: 1, + }, + }, + uiSchema: { + "ui:addButtonText": "Add SSH option", + "ui:description": ( + <> + Specify option keywords supported by ssh_config + . + + ), + "ui:orderable": false, + items: { + "ui:placeholder": "ConnectTimeout=10", + }, + }, +}; + +const version = { + schema: { + type: "string" as "string", + title: "Host Allocator Version", + oneOf: enumSelect(hostAllocatorVersionToCopy), + }, + uiSchema: { + "ui:allowDeselect": false, + }, +}; + +const roundingRule = { + schema: { + type: "string" as "string", + title: "Host Allocator Rounding Rule", + oneOf: enumSelect(roundingRuleToCopy), + }, + uiSchema: { + "ui:allowDeselect": false, + }, +}; + +const feedbackRule = { + schema: { + type: "string" as "string", + title: "Host Allocator Feedback Rule", + oneOf: enumSelect(feedbackRuleToCopy), + }, + uiSchema: { + "ui:allowDeselect": false, + }, +}; + +const hostsOverallocatedRule = { + schema: { + type: "string" as "string", + title: "Host Overallocation Rule", + oneOf: enumSelect(overallocatedRuleToCopy), + }, + uiSchema: { + "ui:allowDeselect": false, + }, +}; + +const minimumHosts = { + schema: { + type: "number" as "number", + title: "Minimum Number of Hosts Allowed", + minimum: 0, + }, + uiSchema: (hasEC2Provider: boolean) => ({ + "ui:data-cy": "minimum-hosts-input", + ...(!hasEC2Provider && { "ui:widget": "hidden" }), + }), +}; + +const maximumHosts = { + schema: { + type: "number" as "number", + title: "Maxiumum Number of Hosts Allowed", + minimum: 0, + }, + uiSchema: (hasEC2Provider: boolean) => ({ + "ui:data-cy": "maximum-hosts-input", + ...(!hasEC2Provider && { "ui:widget": "hidden" }), + }), +}; + +const acceptableHostIdleTime = { + schema: { + type: "number" as "number", + title: "Acceptable Host Idle Time (s)", + minimum: 0, + }, + uiSchema: (hasEC2Provider: boolean) => ({ + "ui:data-cy": "idle-time-input", + "ui:description": "Set 0 to use global default.", + ...(!hasEC2Provider && { "ui:widget": "hidden" }), + }), +}; + +const futureHostFraction = { + schema: { + type: "number" as "number", + title: "Future Host Fraction", + minimum: 0, + maximum: 1, + }, + uiSchema: (hasEC2Provider: boolean) => ({ + "ui:data-cy": "future-fraction-input", + "ui:description": "Set 0 to use global default.", + ...(!hasEC2Provider && { "ui:widget": "hidden" }), + }), +}; + +export const setup = { + schema: { + bootstrapMethod: bootstrapMethod.schema, + communicationMethod: communicationMethod.schema, + arch: arch.schema, + workDir: workDir.schema, + setupAsSudo: setupAsSudo.schema, + setupScript: setupScript.schema, + userSpawnAllowed: userSpawnAllowed.schema, + }, + uiSchema: (architecture: Arch, hasStaticProvider: boolean) => ({ + "ui:ObjectFieldTemplate": CardFieldTemplate, + bootstrapMethod: bootstrapMethod.uiSchema, + communicationMethod: communicationMethod.uiSchema, + arch: arch.uiSchema, + setupAsSudo: setupAsSudo.uiSchema, + workDir: workDir.uiSchema, + setupScript: setupScript.uiSchema, + userSpawnAllowed: userSpawnAllowed.uiSchema(hasStaticProvider), + isVirtualWorkStation: isVirtualWorkStation.uiSchema(architecture), + icecreamSchedulerHost: icecreamSchedulerHost.uiSchema, + icecreamConfigPath: icecreamConfigPath.uiSchema, + }), +}; + +export const bootstrap = { + schema: { + jasperBinaryDir: jasperBinaryDir.schema, + jasperCredentialsPath: jasperCredentialsPath.schema, + clientDir: clientDir.schema, + shellPath: shellPath.schema, + homeVolumeFormatCommand: homeVolumeFormatCommand.schema, + serviceUser: serviceUser.schema, + resourceLimits: { + type: "object" as "object", + title: "Resource Limits", + required: [ + "numFiles", + "numTasks", + "numProcesses", + "lockedMemoryKb", + "virtualMemoryKb", + ], + properties: { + numFiles: numFiles.schema, + numTasks: numTasks.schema, + numProcesses: numProcesses.schema, + lockedMemoryKb: lockedMemoryKb.schema, + virtualMemoryKb: virtualMemoryKb.schema, + }, + }, + env: env.schema, + preconditionScripts: preconditionScripts.schema, + }, + uiSchema: (architecture: Arch) => ({ + "ui:ObjectFieldTemplate": CardFieldTemplate, + serviceUser: serviceUser.uiSchema(architecture), + jasperBinaryDir: jasperBinaryDir.uiSchema, + jasperCredentialsPath: jasperCredentialsPath.uiSchema, + clientDir: clientDir.uiSchema, + shellPath: shellPath.uiSchema, + resourceLimits: { + // Only visible for Linux + ...(!linuxArchitectures.includes(architecture) && { + "ui:widget": "hidden", + }), + numFiles: numFiles.uiSchema, + numTasks: numTasks.uiSchema, + numProcesses: numProcesses.uiSchema, + lockedMemoryKb: lockedMemoryKb.uiSchema, + virtualMemoryKb: virtualMemoryKb.uiSchema, + }, + env: env.uiSchema, + preconditionScripts: preconditionScripts.uiSchema, + }), +}; + +export const allocation = { + schema: { + version: version.schema, + roundingRule: roundingRule.schema, + feedbackRule: feedbackRule.schema, + hostsOverallocatedRule: hostsOverallocatedRule.schema, + minimumHosts: minimumHosts.schema, + maximumHosts: maximumHosts.schema, + acceptableHostIdleTime: acceptableHostIdleTime.schema, + futureHostFraction: futureHostFraction.schema, + }, + uiSchema: (hasEC2Provider: boolean) => ({ + "ui:ObjectFieldTemplate": CardFieldTemplate, + version: version.uiSchema, + roundingRule: roundingRule.uiSchema, + feedbackRule: feedbackRule.uiSchema, + hostsOverallocatedRule: hostsOverallocatedRule.uiSchema, + minimumHosts: minimumHosts.uiSchema(hasEC2Provider), + maximumHosts: maximumHosts.uiSchema(hasEC2Provider), + acceptableHostIdleTime: acceptableHostIdleTime.uiSchema(hasEC2Provider), + futureHostFraction: futureHostFraction.uiSchema(hasEC2Provider), + }), +}; + +export const sshConfig = { + schema: (sshKeys: SshKey[]) => ({ + user: user.schema, + sshKey: sshKey.schema(sshKeys), + authorizedKeysFile: authorizedKeysFile.schema, + sshOptions: sshOptions.schema, + }), + uiSchema: (hasStaticProvider: boolean) => ({ + "ui:ObjectFieldTemplate": CardFieldTemplate, + user: user.uiSchema, + sshKey: sshKey.uiSchema, + authorizedKeysFile: authorizedKeysFile.uiSchema(hasStaticProvider), + sshOptions: sshOptions.uiSchema, + }), +}; diff --git a/src/pages/distroSettings/tabs/HostTab/transformers.test.ts b/src/pages/distroSettings/tabs/HostTab/transformers.test.ts index 3f48478ef4..e91705685f 100644 --- a/src/pages/distroSettings/tabs/HostTab/transformers.test.ts +++ b/src/pages/distroSettings/tabs/HostTab/transformers.test.ts @@ -30,6 +30,33 @@ const form: HostFormState = { workDir: "/data/evg", setupScript: "ls -alF", setupAsSudo: true, + userSpawnAllowed: false, + rootDir: "", + isVirtualWorkStation: false, + icecreamSchedulerHost: "", + icecreamConfigPath: "", + }, + bootstrapSettings: { + jasperBinaryDir: "/home/evg/jasper", + jasperCredentialsPath: "/home/evg/jasper/creds.json", + clientDir: "/home/evg/client", + shellPath: "/bin/bash", + serviceUser: "", + homeVolumeFormatCommand: "", + resourceLimits: { + lockedMemoryKb: -1, + numFiles: 64000, + numProcesses: -1, + numTasks: 0, + virtualMemoryKb: -1, + }, + env: [ + { + key: "foo", + value: "bar", + }, + ], + preconditionScripts: [], }, sshConfig: { user: "admin", @@ -49,25 +76,4 @@ const form: HostFormState = { }, }; -const gql: DistroInput = { - ...distroData, - bootstrapSettings: { - clientDir: "", - communication: CommunicationMethod.LegacySsh, - env: [], - jasperBinaryDir: "", - jasperCredentialsPath: "", - method: BootstrapMethod.LegacySsh, - preconditionScripts: [], - resourceLimits: { - lockedMemoryKb: 0, - numFiles: 0, - numProcesses: 0, - numTasks: 0, - virtualMemoryKb: 0, - }, - rootDir: "", - serviceUser: "", - shellPath: "", - }, -}; +const gql: DistroInput = distroData; diff --git a/src/pages/distroSettings/tabs/HostTab/transformers.ts b/src/pages/distroSettings/tabs/HostTab/transformers.ts index 9356046667..e71e286896 100644 --- a/src/pages/distroSettings/tabs/HostTab/transformers.ts +++ b/src/pages/distroSettings/tabs/HostTab/transformers.ts @@ -9,13 +9,29 @@ export const gqlToForm = ((data) => { const { arch, authorizedKeysFile, - bootstrapSettings: { communication, method }, + bootstrapSettings: { + clientDir, + communication, + env, + jasperBinaryDir, + jasperCredentialsPath, + method, + preconditionScripts, + resourceLimits, + rootDir, + serviceUser, + shellPath, + }, + homeVolumeSettings, hostAllocatorSettings, + iceCreamSettings, + isVirtualWorkStation, setup, setupAsSudo, sshKey, sshOptions, user, + userSpawnAllowed, workDir, } = data; @@ -25,8 +41,24 @@ export const gqlToForm = ((data) => { communicationMethod: communication, arch, workDir, - setupScript: setup, setupAsSudo, + setupScript: setup, + rootDir, + userSpawnAllowed, + isVirtualWorkStation, + icecreamSchedulerHost: iceCreamSettings.schedulerHost, + icecreamConfigPath: iceCreamSettings.configPath, + }, + bootstrapSettings: { + jasperBinaryDir, + jasperCredentialsPath, + clientDir, + shellPath, + serviceUser, + homeVolumeFormatCommand: homeVolumeSettings.formatCommand, + resourceLimits, + env, + preconditionScripts, }, sshConfig: { user, @@ -38,35 +70,40 @@ export const gqlToForm = ((data) => { }; }) satisfies GqlToFormFunction; -export const formToGql = (({ allocation, setup, sshConfig }, distro) => ({ +export const formToGql = (( + { allocation, bootstrapSettings, setup, sshConfig }, + distro +) => ({ ...distro, arch: setup.arch, authorizedKeysFile: sshConfig.authorizedKeysFile, bootstrapSettings: { - // TODO: Set fields when they've been added to the form state. - clientDir: "", + clientDir: bootstrapSettings.clientDir, communication: setup.communicationMethod, - env: [], - jasperBinaryDir: "", - jasperCredentialsPath: "", + env: bootstrapSettings.env, + jasperBinaryDir: bootstrapSettings.jasperBinaryDir, + jasperCredentialsPath: bootstrapSettings.jasperCredentialsPath, method: setup.bootstrapMethod, - preconditionScripts: [], - resourceLimits: { - lockedMemoryKb: 0, - numFiles: 0, - numProcesses: 0, - numTasks: 0, - virtualMemoryKb: 0, - }, - rootDir: "", - serviceUser: "", - shellPath: "", + preconditionScripts: bootstrapSettings.preconditionScripts, + resourceLimits: bootstrapSettings.resourceLimits, + rootDir: setup.rootDir, + serviceUser: bootstrapSettings.serviceUser, + shellPath: bootstrapSettings.shellPath, + }, + homeVolumeSettings: { + formatCommand: bootstrapSettings.homeVolumeFormatCommand, }, hostAllocatorSettings: allocation, - setup: setup.setupScript, + iceCreamSettings: { + configPath: setup.icecreamConfigPath, + schedulerHost: setup.icecreamSchedulerHost, + }, + isVirtualWorkStation: setup.isVirtualWorkStation, setupAsSudo: setup.setupAsSudo, + setup: setup.setupScript, sshKey: sshConfig.sshKey, sshOptions: sshConfig.sshOptions, user: sshConfig.user, + userSpawnAllowed: setup.userSpawnAllowed, workDir: setup.workDir, })) satisfies FormToGqlFunction; diff --git a/src/pages/distroSettings/tabs/HostTab/types.ts b/src/pages/distroSettings/tabs/HostTab/types.ts index de4bf53651..c0e4e6473a 100644 --- a/src/pages/distroSettings/tabs/HostTab/types.ts +++ b/src/pages/distroSettings/tabs/HostTab/types.ts @@ -15,8 +15,36 @@ export interface HostFormState { communicationMethod: CommunicationMethod; arch: Arch; workDir: string; - setupScript: string; setupAsSudo: boolean; + setupScript: string; + userSpawnAllowed: boolean; + rootDir: string; + isVirtualWorkStation: boolean; + icecreamSchedulerHost: string; + icecreamConfigPath: string; + }; + bootstrapSettings: { + jasperBinaryDir: string; + jasperCredentialsPath: string; + clientDir: string; + shellPath: string; + serviceUser: string; + homeVolumeFormatCommand: string; + resourceLimits: { + numFiles: number; + numTasks: number; + numProcesses: number; + lockedMemoryKb: number; + virtualMemoryKb: number; + }; + env: Array<{ + key: string; + value: string; + }>; + preconditionScripts: Array<{ + path: string; + script: string; + }>; }; sshConfig: { user: string; From 62a296c4030f744759f47baa897b92b8e928afaa Mon Sep 17 00:00:00 2001 From: SupaJoon Date: Wed, 27 Sep 2023 16:30:51 -0400 Subject: [PATCH 17/17] EVG-20863: Install @leafygreen-ui/side-nav@14.0.3 (#2066) --- package.json | 2 +- yarn.lock | 77 +++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 62 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 5f69e86b18..63a1234deb 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "@leafygreen-ui/search-input": "2.0.8", "@leafygreen-ui/segmented-control": "8.2.6", "@leafygreen-ui/select": "10.2.0", - "@leafygreen-ui/side-nav": "13.0.2", + "@leafygreen-ui/side-nav": "14.0.3", "@leafygreen-ui/skeleton-loader": "1.1.0", "@leafygreen-ui/table": "10.0.1", "@leafygreen-ui/table/new": "npm:@leafygreen-ui/table@12.0.10", diff --git a/yarn.lock b/yarn.lock index 95f4dd88ba..d7bc44c87f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3231,6 +3231,15 @@ "@leafygreen-ui/hooks" "^7.7.3" "@leafygreen-ui/lib" "^10.3.2" +"@leafygreen-ui/a11y@^1.4.10": + version "1.4.10" + resolved "https://registry.yarnpkg.com/@leafygreen-ui/a11y/-/a11y-1.4.10.tgz#f4fd8526282f3e232d687cc7c105403154c66218" + integrity sha512-Mp3ttmutq1yDr27DXGQaqsBe4AuGyIBuBH9yQWIluIF/raTF7GLFceqa0Fa9k228FfoBis+ApASHvmS+57Gctw== + dependencies: + "@leafygreen-ui/emotion" "^4.0.7" + "@leafygreen-ui/hooks" "^8.0.0" + "@leafygreen-ui/lib" "^12.0.0" + "@leafygreen-ui/a11y@^1.4.7": version "1.4.7" resolved "https://registry.yarnpkg.com/@leafygreen-ui/a11y/-/a11y-1.4.7.tgz#cb3975bd4a72408153e13f8a13a3cbf4a4bc2534" @@ -3850,6 +3859,18 @@ "@leafygreen-ui/tokens" "^2.1.4" react-transition-group "^4.4.1" +"@leafygreen-ui/popover@^11.0.18": + version "11.1.0" + resolved "https://registry.yarnpkg.com/@leafygreen-ui/popover/-/popover-11.1.0.tgz#58703d133f013a93f2bc8531d8bd5f8644936130" + integrity sha512-4V7Is/YlE14+tTVYw397v5TSPmj4ZwevyLZ/FyGZ3Z89xUMNq+n1VIUdPoyx4fWgY+QF6Le77AWISPYIjlr7tA== + dependencies: + "@leafygreen-ui/emotion" "^4.0.7" + "@leafygreen-ui/hooks" "^8.0.0" + "@leafygreen-ui/lib" "^12.0.0" + "@leafygreen-ui/portal" "^5.0.2" + "@leafygreen-ui/tokens" "^2.2.0" + react-transition-group "^4.4.5" + "@leafygreen-ui/portal@^4.0.9", "@leafygreen-ui/portal@^4.1.2", "@leafygreen-ui/portal@^4.1.4": version "4.1.4" resolved "https://registry.yarnpkg.com/@leafygreen-ui/portal/-/portal-4.1.4.tgz#31513ce87c8619cdfa514900cac5f4bb882d28e5" @@ -3874,6 +3895,14 @@ "@leafygreen-ui/hooks" "^8.0.0" "@leafygreen-ui/lib" "^11.0.0" +"@leafygreen-ui/portal@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@leafygreen-ui/portal/-/portal-5.0.2.tgz#abf03843deef4aa997bfb97ecdfc22e459207d3c" + integrity sha512-vLLB8wGmEtQHhIJ753KbO3zJDBP3idd9h965CPYWdRHHWP0A2QwIRhPr148SbH0/VxFVO6zXVBcTeqPGHhrXZw== + dependencies: + "@leafygreen-ui/hooks" "^8.0.0" + "@leafygreen-ui/lib" "^12.0.0" + "@leafygreen-ui/radio-box-group@12.0.1": version "12.0.1" resolved "https://registry.yarnpkg.com/@leafygreen-ui/radio-box-group/-/radio-box-group-12.0.1.tgz#64f44ad30d99958ccc18e2303269175c4cad715d" @@ -3984,22 +4013,22 @@ polished "^4.1.3" react-is "^17.0.1" -"@leafygreen-ui/side-nav@13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@leafygreen-ui/side-nav/-/side-nav-13.0.2.tgz#f448f21aebaadcfd34934f84c2120603cd112fc0" - integrity sha512-F0/810zWhVqRI6tNFOPZ3N3RGKgeY31Jn3yvWb6SjhHsXnr9UizTo1WJUss2PP4jAtka7+9GgRI72XBGj1+lZA== +"@leafygreen-ui/side-nav@14.0.3": + version "14.0.3" + resolved "https://registry.yarnpkg.com/@leafygreen-ui/side-nav/-/side-nav-14.0.3.tgz#cf356dc7733e80bef88c4e33a5623c1ea028f748" + integrity sha512-jSgdza1IyyRnm1ysJxgqSu5pMNTyKSDoNYA9hMd8EM/kmhVp4nS5QjZRyCrcn3SzSnsq7xo/8BqLoKfqKJ5JAw== dependencies: - "@leafygreen-ui/a11y" "^1.3.4" - "@leafygreen-ui/box" "^3.1.1" - "@leafygreen-ui/emotion" "^4.0.3" - "@leafygreen-ui/hooks" "^7.3.3" - "@leafygreen-ui/icon" "^11.12.4" - "@leafygreen-ui/lib" "^10.0.0" - "@leafygreen-ui/palette" "^3.4.7" - "@leafygreen-ui/portal" "^4.0.9" - "@leafygreen-ui/tokens" "^2.0.0" - "@leafygreen-ui/tooltip" "^9.1.3" - "@leafygreen-ui/typography" "^16.0.0" + "@leafygreen-ui/a11y" "^1.4.10" + "@leafygreen-ui/box" "^3.1.8" + "@leafygreen-ui/emotion" "^4.0.7" + "@leafygreen-ui/hooks" "^8.0.0" + "@leafygreen-ui/icon" "^11.23.0" + "@leafygreen-ui/lib" "^12.0.0" + "@leafygreen-ui/palette" "^4.0.7" + "@leafygreen-ui/portal" "^5.0.2" + "@leafygreen-ui/tokens" "^2.2.0" + "@leafygreen-ui/tooltip" "^10.0.11" + "@leafygreen-ui/typography" "^17.0.1" polished "^4.2.2" react-transition-group "^4.4.5" @@ -4190,7 +4219,23 @@ lodash "^4.17.21" polished "^4.2.2" -"@leafygreen-ui/tooltip@^9.0.0", "@leafygreen-ui/tooltip@^9.1.3": +"@leafygreen-ui/tooltip@^10.0.11": + version "10.0.11" + resolved "https://registry.yarnpkg.com/@leafygreen-ui/tooltip/-/tooltip-10.0.11.tgz#5fe52c43acd9c2349f05c5d726fc2a18b0cfb8e5" + integrity sha512-8DJrfxLMleqAoyXB+iI2yszUmJj4IZmTMhOVumlVtsohE6TchJH4n9LnCtnwkUznP2+gPU2Rvuec7PjlKo4ykQ== + dependencies: + "@leafygreen-ui/emotion" "^4.0.7" + "@leafygreen-ui/hooks" "^8.0.0" + "@leafygreen-ui/icon" "^11.23.0" + "@leafygreen-ui/lib" "^12.0.0" + "@leafygreen-ui/palette" "^4.0.7" + "@leafygreen-ui/popover" "^11.0.18" + "@leafygreen-ui/tokens" "^2.2.0" + "@leafygreen-ui/typography" "^17.0.1" + lodash "^4.17.21" + polished "^4.2.2" + +"@leafygreen-ui/tooltip@^9.0.0": version "9.1.8" resolved "https://registry.yarnpkg.com/@leafygreen-ui/tooltip/-/tooltip-9.1.8.tgz#9ae8165a3cab099061f92d50080c779557783480" integrity sha512-bqLF0z4L19y253nmRoQSs4U1O7OGSCf46e1N7xBCbenlZVMLN4MSk0EQdpmDmXqMkopLOomVQAy/17guV6YULA==