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

Commit

Permalink
Merge branch 'main' into EVG-19947
Browse files Browse the repository at this point in the history
  • Loading branch information
minnakt committed Sep 21, 2023
2 parents 1f23cfa + 7df69bb commit b0a3238
Show file tree
Hide file tree
Showing 182 changed files with 1,129 additions and 1,401 deletions.
2 changes: 0 additions & 2 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spruce",
"version": "3.0.139",
"version": "3.0.140",
"private": true,
"scripts": {
"bootstrap-logkeeper": "./scripts/bootstrap-logkeeper.sh",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/aprilFools/useAprilFoolsAnalytics.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useAnalyticsRoot } from "analytics/useAnalyticsRoot";

type Action = { name: "Triggered Konami Code" };
type Action = { name: "2024 Boilerplate!" };

export const useAprilFoolsAnalytics = () =>
useAnalyticsRoot<Action>("April Fools");
13 changes: 5 additions & 8 deletions src/analytics/patch/usePatchAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -49,13 +49,10 @@ type Action =
| { name: "Open Schedule Tasks Modal" };

export const usePatchAnalytics = (id: string) => {
const { data: eventData } = useQuery<PatchQuery, PatchQueryVariables>(
GET_PATCH,
{
variables: { id },
fetchPolicy: "cache-first",
}
);
const { data: eventData } = useQuery<PatchQuery, PatchQueryVariables>(PATCH, {
variables: { id },
fetchPolicy: "cache-first",
});
const { status } = eventData?.patch || {};

return useAnalyticsRoot<Action>("Patch", {
Expand Down
6 changes: 3 additions & 3 deletions src/analytics/task/useAnnotationAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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<BuildBaronQuery, BuildBaronQueryVariables>(
GET_BUILD_BARON,
BUILD_BARON,
{
variables: { taskId: id, execution },
fetchPolicy: "cache-first",
Expand Down
13 changes: 5 additions & 8 deletions src/analytics/task/useTaskAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -71,13 +71,10 @@ export const useTaskAnalytics = () => {

const parsed = parseQueryString(location.search);
const execution = Number(parsed[RequiredQueryParams.Execution]);
const { data: eventData } = useQuery<TaskQuery, TaskQueryVariables>(
GET_TASK,
{
variables: { taskId: id, execution },
fetchPolicy: "cache-first",
}
);
const { data: eventData } = useQuery<TaskQuery, TaskQueryVariables>(TASK, {
variables: { taskId: id, execution },
fetchPolicy: "cache-first",
});

const {
failedTestCount,
Expand Down
4 changes: 2 additions & 2 deletions src/analytics/version/useVersionAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -52,7 +52,7 @@ type Action =

export const useVersionAnalytics = (id: string) => {
const { data: eventData } = useQuery<VersionQuery, VersionQueryVariables>(
GET_VERSION,
VERSION,
{
variables: { id },
fetchPolicy: "cache-first",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Banners/GithubUsernameBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -17,7 +17,7 @@ export const GithubUsernameBanner = () => {

// USER SETTINGS QUERY
const { data: userSettingsData } = useQuery<UserSettingsQuery>(
GET_USER_SETTINGS,
USER_SETTINGS,
{ skip: !isPatchesPage }
);
const { userSettings } = userSettingsData || {};
Expand Down
4 changes: 2 additions & 2 deletions src/components/Banners/ProjectBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -15,7 +15,7 @@ export const ProjectBanner: React.FC<ProjectBannerProps> = ({
const { data: projectBannerData } = useQuery<
ProjectBannerQuery,
ProjectBannerQueryVariables
>(GET_PROJECT_BANNER, {
>(PROJECT_BANNER, {
variables: { identifier: projectIdentifier },
skip: !projectIdentifier,
});
Expand Down
5 changes: 2 additions & 3 deletions src/components/Banners/SlackNotificationBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -41,8 +41,7 @@ export const SlackNotificationBanner = () => {
});

// USER SETTINGS QUERY
const { data: userSettingsData } =
useQuery<UserSettingsQuery>(GET_USER_SETTINGS);
const { data: userSettingsData } = useQuery<UserSettingsQuery>(USER_SETTINGS);
const { userSettings } = userSettingsData || {};
const { notifications, slackUsername: defaultSlackUsername } =
userSettings || {};
Expand Down
4 changes: 2 additions & 2 deletions src/components/CodeChanges/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -30,7 +30,7 @@ export const CodeChanges: React.FC<CodeChangesProps> = ({ patchId }) => {
const { data, error, loading } = useQuery<
CodeChangesQuery,
CodeChangesQueryVariables
>(GET_CODE_CHANGES, {
>(CODE_CHANGES, {
variables: { id: patchId },
});
const { moduleCodeChanges } = data?.patch ?? {};
Expand Down
4 changes: 2 additions & 2 deletions src/components/Content/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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<UserQuery, UserQueryVariables>(GET_USER);
const { data } = useQuery<UserQuery, UserQueryVariables>(USER);
localStorage.setItem("userId", data?.user?.userId ?? "");
const { userSettings } = useUserSettings();
const { useSpruceOptions } = userSettings ?? {};
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -25,7 +25,7 @@ export const Navbar: React.FC = () => {
const legacyURL = useLegacyUIURL();
const { sendEvent } = useNavbarAnalytics();

const { data: userData } = useQuery<UserQuery>(GET_USER);
const { data: userData } = useQuery<UserQuery>(USER);
const { user } = userData || {};
const { userId } = user || {};

Expand Down
4 changes: 2 additions & 2 deletions src/components/Header/UserDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<UserQuery>(GET_USER);
const { data } = useQuery<UserQuery>(USER);
const { user } = data || {};
const { displayName, permissions } = user || {};

Expand Down
8 changes: 4 additions & 4 deletions src/components/HistoryTable/hooks/useTestResults.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/components/HistoryTable/hooks/useTestResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Notifications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -65,7 +65,7 @@ export const NotificationModal: React.FC<NotificationModalProps> = ({
// Fetch user Slack and email information.
const { userSettings } = useUserSettings();
const { slackUsername } = userSettings || {};
const { data: userData } = useQuery<UserQuery>(GET_USER);
const { data: userData } = useQuery<UserQuery>(USER);
const { user } = userData || {};
const { emailAddress } = user || {};

Expand Down
6 changes: 3 additions & 3 deletions src/components/PatchActionButtons/ScheduleTasks/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand All @@ -11,7 +11,7 @@ const mocks: ApolloMock<
>[] = [
{
request: {
query: GET_UNSCHEDULED_TASKS,
query: UNSCHEDULED_TASKS,
variables: { versionId: "version" },
},
result: {
Expand Down Expand Up @@ -142,7 +142,7 @@ const mocks: ApolloMock<
},
{
request: {
query: GET_UNSCHEDULED_TASKS,
query: UNSCHEDULED_TASKS,
variables: { versionId: "emptyVersion" },
},
result: {
Expand Down
8 changes: 4 additions & 4 deletions src/components/ProjectSelect/ProjectSelect.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -257,7 +257,7 @@ describe("projectSelect", () => {
const getProjectsMock: [ApolloMock<ProjectsQuery, ProjectsQueryVariables>] = [
{
request: {
query: GET_PROJECTS,
query: PROJECTS,
},
result: {
data: {
Expand Down Expand Up @@ -357,7 +357,7 @@ const getViewableProjectsMock: [
] = [
{
request: {
query: GET_VIEWABLE_PROJECTS,
query: VIEWABLE_PROJECTS,
},
result: {
data: {
Expand Down Expand Up @@ -438,7 +438,7 @@ const noDisabledProjectsMock: [
] = [
{
request: {
query: GET_VIEWABLE_PROJECTS,
query: VIEWABLE_PROJECTS,
},
result: {
data: {
Expand Down
Loading

0 comments on commit b0a3238

Please sign in to comment.