diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 7e4938f400..893105b529 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -129,9 +129,7 @@ beforeEach(() => { cy.setCookie(bannerCookie, "true"); cy.setCookie(CY_DISABLE_COMMITS_WELCOME_MODAL, "true"); cy.setCookie(CY_DISABLE_NEW_USER_WELCOME_MODAL, "true"); - cy.setCookie(konamiCookie, "true"); cy.setCookie(SLACK_NOTIFICATION_BANNER, "true"); }); const bannerCookie = "This is an important notification"; -const konamiCookie = "seen-konami-code"; diff --git a/package.json b/package.json index 3d285d7670..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", @@ -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/src/analytics/aprilFools/useAprilFoolsAnalytics.ts b/src/analytics/aprilFools/useAprilFoolsAnalytics.ts index 0732867c75..74d769fb6f 100644 --- a/src/analytics/aprilFools/useAprilFoolsAnalytics.ts +++ b/src/analytics/aprilFools/useAprilFoolsAnalytics.ts @@ -1,6 +1,6 @@ import { useAnalyticsRoot } from "analytics/useAnalyticsRoot"; -type Action = { name: "Triggered Konami Code" }; +type Action = { name: "2024 Boilerplate!" }; export const useAprilFoolsAnalytics = () => useAnalyticsRoot("April Fools"); 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/constants/externalResources.ts b/src/constants/externalResources.ts index 9bf766f811..a98ef74bd3 100644 --- a/src/constants/externalResources.ts +++ b/src/constants/externalResources.ts @@ -37,9 +37,6 @@ export const getJiraBugUrl = (jiraHost: string) => export const getJiraImprovementUrl = (jiraHost: string) => `https://${jiraHost}/secure/CreateIssueDetails!init.jspa?pid=12787&issuetype=4&priority=4&labels=user-feedback`; -export const konamiSoundTrackUrl = - "https://www.myinstants.com/media/sounds/mvssf-win.mp3"; - export const legacyRoutes = { distros: "/distros", hosts: "/spawn", diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index 8a36ec88cb..d312e9e046 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -5159,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; @@ -5440,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"]; }>; @@ -5718,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: { @@ -5836,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 = { @@ -6925,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; @@ -7816,6 +7927,101 @@ 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"; + email?: string | null; + 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; @@ -7900,7 +8106,7 @@ export type TaskFilesQuery = { __typename?: "Task"; execution: number; id: string; - taskFiles: { + files: { __typename?: "TaskFiles"; fileCount: number; groupedFiles: Array<{ @@ -7949,6 +8155,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"]; }>; @@ -8177,6 +8395,7 @@ export type TaskQuery = { id: string; status: string; }> | null; + files: { __typename?: "TaskFiles"; fileCount: number }; logs: { __typename?: "TaskLogLinks"; agentLogLink?: string | null; @@ -8187,7 +8406,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; @@ -8238,49 +8456,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 }; }; }; @@ -8495,342 +8838,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/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/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/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/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 94% rename from src/gql/queries/get-task-files.graphql rename to src/gql/queries/task-files.graphql index 2ce204002f..39f1dbf0b8 100644 --- a/src/gql/queries/get-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/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 99% rename from src/gql/queries/get-task.graphql rename to src/gql/queries/task.graphql index e56c555288..e8931efb59 100644 --- a/src/gql/queries/get-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/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/useKonamiCode/index.ts b/src/hooks/useKonamiCode/index.ts deleted file mode 100644 index 1d6d56c59a..0000000000 --- a/src/hooks/useKonamiCode/index.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { useState, useEffect } from "react"; -import { useAprilFoolsAnalytics } from "analytics/aprilFools/useAprilFoolsAnalytics"; -import { konamiSoundTrackUrl } from "constants/externalResources"; -import { useToastContext } from "context/toast"; -import { cache } from "gql/GQLWrapper"; -import { PatchStatus } from "types/patch"; -import { TaskStatus } from "types/task"; - -const konamiCode = - "ArrowUpArrowUpArrowDownArrowDownArrowLeftArrowRightArrowLeftArrowRightba"; - -const useKonamiCode = () => { - const [pressedKeys, setPressedKeys] = useState([]); - const dispatchToast = useToastContext(); - const { sendEvent } = useAprilFoolsAnalytics(); - const downHandler = ({ key, target }: KeyboardEvent) => { - // Ignore key presses if the user is typing in an input - if ( - target instanceof HTMLInputElement || - target instanceof HTMLButtonElement || - target instanceof HTMLSelectElement - ) { - return; - } - setPressedKeys((curr) => [...curr, key]); - }; - - const playMusic = () => { - const audio = new Audio(konamiSoundTrackUrl); - audio.play(); - }; - // Listen to all key presses - useEffect(() => { - // Register event listeners - window.addEventListener("keydown", downHandler); - - return () => { - // Unregister event listeners - window.removeEventListener("keydown", downHandler); - }; - }, []); - - useEffect(() => { - // Check if the pressed keys match the konami code - if (pressedKeys.join("").includes(konamiCode)) { - dispatchToast.success("To reset just refresh the page", true, { - title: "Konami Code Activated!", - }); - sendEvent({ name: "Triggered Konami Code" }); - setPressedKeys([]); - const TaskKeys = Object.keys(cache.extract()).filter((key) => - key.includes("Task") - ); - const VersionKeys = Object.keys(cache.extract()).filter((key) => - key.includes("Version") - ); - playMusic(); - - // eslint-disable-next-line no-restricted-syntax - for (const key of TaskKeys) { - cache.modify({ - id: key, - fields: { - status: () => TaskStatus.Succeeded, - }, - broadcast: true, - }); - } - // eslint-disable-next-line no-restricted-syntax - for (const key of VersionKeys) { - cache.modify({ - id: key, - fields: { - status: () => PatchStatus.Success, - taskStatusStats: (stats) => ({ - ...stats, - counts: [ - { - count: 100, - status: TaskStatus.Succeeded, - __typename: "StatusCount", - }, - ], - }), - buildVariantStats: (stats) => { - const newStats = stats.map((stat) => ({ - ...stat, - statusCounts: [ - { - count: 100, - status: TaskStatus.Succeeded, - __typename: "StatusCount", - }, - ], - })); - return newStats; - }, - }, - broadcast: true, - }); - } - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [pressedKeys]); -}; - -export default useKonamiCode; diff --git a/src/hooks/useKonamiCode/useKonamiCode.test.tsx b/src/hooks/useKonamiCode/useKonamiCode.test.tsx deleted file mode 100644 index 0bd09fbcad..0000000000 --- a/src/hooks/useKonamiCode/useKonamiCode.test.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import { MockedProvider } from "@apollo/client/testing"; -import userEvent from "@testing-library/user-event"; -import { RenderFakeToastContext } from "context/toast/__mocks__"; -import { TaskQuery, TaskQueryVariables } from "gql/generated/types"; -import { cache } from "gql/GQLWrapper"; -import { taskQuery } from "gql/mocks/taskData"; -import { GET_TASK } from "gql/queries"; -import { render, screen } from "test_utils"; -import useKonamiCode from "."; - -const KonamiCodeWrapper = ({ gqlCache }) => ( - - - -); - -const HookComponent = () => { - useKonamiCode(); - return ; -}; - -describe("useKonamiCode", () => { - afterEach(() => { - jest.resetAllMocks(); - jest.resetModules(); - }); - it("pressing the correct sequence of keys triggers the Konami code easter", async () => { - const audioPlayMock = jest.fn(); - jest.spyOn(global, "Audio").mockImplementation( - () => - ({ - play: audioPlayMock, - } as any) - ); - window.HTMLMediaElement.prototype.play = audioPlayMock; - - cache.writeQuery({ - query: GET_TASK, - data: { - ...taskQuery, - }, - }); - - const user = userEvent.setup(); - const { Component, dispatchToast } = RenderFakeToastContext( - - ); - render(); - - await user.keyboard( - "{ArrowUp}{ArrowUp}{ArrowDown}{ArrowDown}{ArrowLeft}{ArrowRight}{ArrowLeft}{ArrowRight}{b}{a}" - ); - expect(audioPlayMock).toHaveBeenCalledTimes(1); - expect(dispatchToast.success).toHaveBeenCalledWith( - "To reset just refresh the page", - true, - { title: "Konami Code Activated!" } - ); - expect( - cache.extract()[ - cache.identify({ - __typename: "Task", - id: taskQuery.task.id, - execution: taskQuery.task.execution, - }) - ].status - ).toBe("success"); - }); - it("should not trigger the Konami code if the sequence is incorrect", async () => { - const audioPlayMock = jest.fn(); - jest.spyOn(global, "Audio").mockImplementation( - () => - ({ - play: audioPlayMock, - } as any) - ); - window.HTMLMediaElement.prototype.play = audioPlayMock; - - cache.writeQuery({ - query: GET_TASK, - data: { - ...taskQuery, - }, - }); - - const user = userEvent.setup(); - const { Component, dispatchToast } = RenderFakeToastContext( - - ); - render(); - - await user.keyboard( - "{ArrowUp}{ArrowUp}{ArrowDown}{ArrowDown}{ArrowLeft}{ArrowRight}{ArrowLeft}{ArrowRight}{b}{b}" - ); - expect(audioPlayMock).toHaveBeenCalledTimes(0); - expect(dispatchToast.success).not.toHaveBeenCalled(); - expect( - cache.extract()[ - cache.identify({ - __typename: "Task", - id: taskQuery.task.id, - execution: taskQuery.task.execution, - }) - ].status - ).toBe("pending"); - }); - it("should not trigger the Konami code if it is inputted into a text field", async () => { - const audioPlayMock = jest.fn(); - jest.spyOn(global, "Audio").mockImplementation( - () => - ({ - play: audioPlayMock, - } as any) - ); - window.HTMLMediaElement.prototype.play = audioPlayMock; - - cache.writeQuery({ - query: GET_TASK, - data: { - ...taskQuery, - }, - }); - - const user = userEvent.setup(); - const { Component, dispatchToast } = RenderFakeToastContext( - - ); - render(); - - await user.type( - screen.getByRole("textbox"), - "{ArrowUp}{ArrowUp}{ArrowDown}{ArrowDown}{ArrowLeft}{ArrowRight}{ArrowLeft}{ArrowRight}{b}{a}" - ); - expect(screen.getByRole("textbox")).toHaveValue("ba"); - expect(audioPlayMock).toHaveBeenCalledTimes(0); - expect(dispatchToast.success).not.toHaveBeenCalled(); - expect( - cache.extract()[ - cache.identify({ - __typename: "Task", - id: taskQuery.task.id, - execution: taskQuery.task.execution, - }) - ].status - ).toBe("pending"); - }); -}); 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/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": 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/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/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..91adfc2d95 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, @@ -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"] >; 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) => { 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==