From 0436da12d7602f0544f57ad7e2d98d3d92a7d4f7 Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Tue, 5 Sep 2023 11:38:31 -0400 Subject: [PATCH 1/6] Add save modal to provider page --- src/pages/distroSettings/HeaderButtons.tsx | 108 ++------------ src/pages/distroSettings/SaveModal.tsx | 134 ++++++++++++++++++ src/pages/distroSettings/Tabs.tsx | 1 + .../tabs/ProviderTab/ProviderTab.tsx | 18 ++- .../tabs/ProviderTab/UnsavedModal.tsx | 33 +++++ .../distroSettings/tabs/ProviderTab/types.ts | 3 +- 6 files changed, 193 insertions(+), 104 deletions(-) create mode 100644 src/pages/distroSettings/SaveModal.tsx create mode 100644 src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx diff --git a/src/pages/distroSettings/HeaderButtons.tsx b/src/pages/distroSettings/HeaderButtons.tsx index 2d8137b8b3..5baab914cd 100644 --- a/src/pages/distroSettings/HeaderButtons.tsx +++ b/src/pages/distroSettings/HeaderButtons.tsx @@ -1,23 +1,8 @@ import { useState } from "react"; -import { useMutation } from "@apollo/client"; -import styled from "@emotion/styled"; import Button from "@leafygreen-ui/button"; -import { Radio, RadioGroup } from "@leafygreen-ui/radio-group"; -import { Body, BodyProps } from "@leafygreen-ui/typography"; -import pluralize from "pluralize"; -import { useDistroSettingsAnalytics } from "analytics"; -import { ConfirmationModal } from "components/ConfirmationModal"; -import { size } from "constants/tokens"; -import { useToastContext } from "context/toast"; -import { - DistroOnSaveOperation, - DistroQuery, - SaveDistroMutation, - SaveDistroMutationVariables, -} from "gql/generated/types"; -import { SAVE_DISTRO } from "gql/mutations"; +import { DistroQuery } from "gql/generated/types"; import { useDistroSettingsContext } from "./Context"; -import { formToGqlMap } from "./tabs/transformers"; +import { SaveModal } from "./SaveModal"; import { WritableDistroSettingsType } from "./tabs/types"; interface Props { @@ -26,56 +11,10 @@ interface Props { } export const HeaderButtons: React.FC = ({ distro, tab }) => { - const { sendEvent } = useDistroSettingsAnalytics(); - const dispatchToast = useToastContext(); - - const { getTab, saveTab } = useDistroSettingsContext(); - const { formData, hasChanges, hasError } = getTab(tab); + const { getTab } = useDistroSettingsContext(); + const { hasChanges, hasError } = getTab(tab); const [modalOpen, setModalOpen] = useState(false); - const [onSaveOperation, setOnSaveOperation] = useState( - DistroOnSaveOperation.None - ); - - const [saveDistro] = useMutation< - SaveDistroMutation, - SaveDistroMutationVariables - >(SAVE_DISTRO, { - onCompleted({ saveDistro: { hostCount } }) { - saveTab(tab); - dispatchToast.success( - `Updated distro${ - onSaveOperation !== DistroOnSaveOperation.None - ? ` and scheduled ${hostCount} ${pluralize( - "host", - hostCount - )} to update` - : "" - }.` - ); - }, - onError(err) { - dispatchToast.error(err.message); - }, - refetchQueries: ["Distro"], - }); - - const handleSave = () => { - // Only perform the save operation is the tab is valid. - // eslint-disable-next-line no-prototype-builtins - if (formToGqlMap.hasOwnProperty(tab)) { - const formToGql = formToGqlMap[tab]; - const changes = formToGql(formData, distro); - saveDistro({ - variables: { - distro: changes, - onSave: onSaveOperation, - }, - }); - setModalOpen(false); - sendEvent({ name: "Save distro", section: tab }); - } - }; return ( <> @@ -87,41 +26,12 @@ export const HeaderButtons: React.FC = ({ distro, tab }) => { > Save changes on page - setModalOpen(false)} - onConfirm={handleSave} - title="Save page" - > - - Evergreen can perform one of the following actions on save: - - - setOnSaveOperation(e.target.value as DistroOnSaveOperation) - } - value={onSaveOperation} - > - - Nothing, only new hosts will have updated distro settings applied - - - Decommission hosts of this distro - - - Restart Jasper service on running hosts of this distro - - - Reprovision running hosts of this distro - - - + setOpen={setModalOpen} + tab={tab} + /> ); }; - -const StyledBody = styled(Body)` - margin-bottom: ${size.xs}; -`; diff --git a/src/pages/distroSettings/SaveModal.tsx b/src/pages/distroSettings/SaveModal.tsx new file mode 100644 index 0000000000..fc328a0751 --- /dev/null +++ b/src/pages/distroSettings/SaveModal.tsx @@ -0,0 +1,134 @@ +import { useState } from "react"; +import { useMutation } from "@apollo/client"; +import styled from "@emotion/styled"; +import { Radio, RadioGroup } from "@leafygreen-ui/radio-group"; +import { Body, BodyProps } from "@leafygreen-ui/typography"; +import pluralize from "pluralize"; +import { useDistroSettingsAnalytics } from "analytics"; +import { ConfirmationModal } from "components/ConfirmationModal"; +import { size } from "constants/tokens"; +import { useToastContext } from "context/toast"; +import { + DistroOnSaveOperation, + DistroQuery, + SaveDistroMutation, + SaveDistroMutationVariables, +} from "gql/generated/types"; +import { SAVE_DISTRO } from "gql/mutations"; +import { useDistroSettingsContext } from "./Context"; +import { formToGqlMap } from "./tabs/transformers"; +import { WritableDistroSettingsType } from "./tabs/types"; + +type SaveModalProps = { + additionalText?: string; + distro: DistroQuery["distro"]; + onCancel?: () => void; + onConfirm?: () => void; + open: boolean; + setOpen: React.Dispatch>; + tab: WritableDistroSettingsType; +}; + +export const SaveModal: React.FC = ({ + additionalText, + distro, + onCancel, + onConfirm, + open, + setOpen, + tab, +}) => { + const { sendEvent } = useDistroSettingsAnalytics(); + const dispatchToast = useToastContext(); + + const { getTab, saveTab } = useDistroSettingsContext(); + const { formData } = getTab(tab); + const [onSaveOperation, setOnSaveOperation] = useState( + DistroOnSaveOperation.None + ); + + const [saveDistro] = useMutation< + SaveDistroMutation, + SaveDistroMutationVariables + >(SAVE_DISTRO, { + onCompleted({ saveDistro: { hostCount } }) { + saveTab(tab); + dispatchToast.success( + `Updated distro${ + onSaveOperation !== DistroOnSaveOperation.None + ? ` and scheduled ${hostCount} ${pluralize( + "host", + hostCount + )} to update` + : "" + }.` + ); + }, + onError(err) { + dispatchToast.error(err.message); + }, + refetchQueries: ["Distro"], + }); + + const handleSave = () => { + // Only perform the save operation is the tab is valid. + // eslint-disable-next-line no-prototype-builtins + if (formToGqlMap.hasOwnProperty(tab)) { + const formToGql = formToGqlMap[tab]; + const changes = formToGql(formData, distro); + saveDistro({ + variables: { + distro: changes, + onSave: onSaveOperation, + }, + }); + setOpen(false); + sendEvent({ name: "Save distro", section: tab }); + } + }; + + return ( + { + onCancel?.(); + setOpen(false); + }} + onConfirm={() => { + onConfirm?.(); + handleSave(); + }} + title="Save page" + > + {additionalText && {additionalText}} + + Evergreen can perform one of the following actions on save: + + + setOnSaveOperation(e.target.value as DistroOnSaveOperation) + } + value={onSaveOperation} + > + + Nothing, only new hosts will have updated distro settings applied + + + Decommission hosts of this distro + + + Restart Jasper service on running hosts of this distro + + + Reprovision running hosts of this distro + + + + ); +}; + +const StyledBody = styled(Body)` + margin-bottom: ${size.xs}; +`; diff --git a/src/pages/distroSettings/Tabs.tsx b/src/pages/distroSettings/Tabs.tsx index 5393a0f00d..da4046df96 100644 --- a/src/pages/distroSettings/Tabs.tsx +++ b/src/pages/distroSettings/Tabs.tsx @@ -49,6 +49,7 @@ export const DistroSettingsTabs: React.FC = ({ distro }) => { path={DistroSettingsTabRoutes.Provider} element={ } diff --git a/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx b/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx index f6c1b1fcd2..a6ba86af23 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx +++ b/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx @@ -1,14 +1,24 @@ import { useMemo } from "react"; +import { useDistroSettingsContext } from "../../Context"; import { BaseTab } from "../BaseTab"; +import { WritableDistroSettingsTabs } from "../types"; import { getFormSchema } from "./getFormSchema"; import { TabProps } from "./types"; +import { UnsavedModal } from "./UnsavedModal"; -export const ProviderTab: React.FC = ({ distroData }) => { - const initialFormState = distroData; - +export const ProviderTab: React.FC = ({ distro, distroData }) => { const formSchema = useMemo(() => getFormSchema(), []); + const { getTab } = useDistroSettingsContext(); + const { formData, initialData } = getTab(WritableDistroSettingsTabs.Provider); + return ( - + <> + + + ); }; diff --git a/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx b/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx new file mode 100644 index 0000000000..e74fa18907 --- /dev/null +++ b/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx @@ -0,0 +1,33 @@ +import { + unstable_BlockerFunction as BlockerFunction, + unstable_useBlocker as useBlocker, +} from "react-router-dom"; +import { DistroQuery } from "gql/generated/types"; +import { SaveModal } from "../../SaveModal"; +import { WritableDistroSettingsTabs } from "../types"; + +type UnsavedModalProps = { + distro: DistroQuery["distro"]; + shouldBlock: boolean | BlockerFunction; +}; + +export const UnsavedModal: React.FC = ({ + distro, + shouldBlock, +}) => { + const blocker = useBlocker(shouldBlock); + + return ( + blocker.state === "blocked" && ( + blocker.reset?.()} + onConfirm={() => blocker.proceed?.()} + setOpen={() => {}} + tab={WritableDistroSettingsTabs.Provider} + /> + ) + ); +}; diff --git a/src/pages/distroSettings/tabs/ProviderTab/types.ts b/src/pages/distroSettings/tabs/ProviderTab/types.ts index c100aead99..c13a4e68f2 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/types.ts +++ b/src/pages/distroSettings/tabs/ProviderTab/types.ts @@ -1,4 +1,4 @@ -import { Provider } from "gql/generated/types"; +import { DistroQuery, Provider } from "gql/generated/types"; interface StaticProviderFormState { provider: { @@ -15,5 +15,6 @@ interface StaticProviderFormState { export type ProviderFormState = StaticProviderFormState; export type TabProps = { + distro: DistroQuery["distro"]; distroData: ProviderFormState; }; From e78b4ff8c3a2cd3edf65abbef2f83ae0eb04d532 Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Wed, 6 Sep 2023 10:45:40 -0400 Subject: [PATCH 2/6] Use banner for save message --- src/pages/distroSettings/HeaderButtons.tsx | 3 ++- src/pages/distroSettings/SaveModal.tsx | 10 +++------- .../tabs/ProviderTab/UnsavedModal.tsx | 15 +++++++++++++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/pages/distroSettings/HeaderButtons.tsx b/src/pages/distroSettings/HeaderButtons.tsx index 5baab914cd..2a0b63c960 100644 --- a/src/pages/distroSettings/HeaderButtons.tsx +++ b/src/pages/distroSettings/HeaderButtons.tsx @@ -29,7 +29,8 @@ export const HeaderButtons: React.FC = ({ distro, tab }) => { setModalOpen(false)} + onCancel={() => setModalOpen(false)} tab={tab} /> diff --git a/src/pages/distroSettings/SaveModal.tsx b/src/pages/distroSettings/SaveModal.tsx index fc328a0751..945e31a4d9 100644 --- a/src/pages/distroSettings/SaveModal.tsx +++ b/src/pages/distroSettings/SaveModal.tsx @@ -20,22 +20,20 @@ import { formToGqlMap } from "./tabs/transformers"; import { WritableDistroSettingsType } from "./tabs/types"; type SaveModalProps = { - additionalText?: string; + banner?: React.ReactNode; distro: DistroQuery["distro"]; onCancel?: () => void; onConfirm?: () => void; open: boolean; - setOpen: React.Dispatch>; tab: WritableDistroSettingsType; }; export const SaveModal: React.FC = ({ - additionalText, + banner, distro, onCancel, onConfirm, open, - setOpen, tab, }) => { const { sendEvent } = useDistroSettingsAnalytics(); @@ -82,7 +80,6 @@ export const SaveModal: React.FC = ({ onSave: onSaveOperation, }, }); - setOpen(false); sendEvent({ name: "Save distro", section: tab }); } }; @@ -94,7 +91,6 @@ export const SaveModal: React.FC = ({ open={open} onCancel={() => { onCancel?.(); - setOpen(false); }} onConfirm={() => { onConfirm?.(); @@ -102,7 +98,7 @@ export const SaveModal: React.FC = ({ }} title="Save page" > - {additionalText && {additionalText}} + {banner} Evergreen can perform one of the following actions on save: diff --git a/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx b/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx index e74fa18907..b24151cb8c 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx +++ b/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx @@ -1,7 +1,10 @@ +import styled from "@emotion/styled"; +import Banner from "@leafygreen-ui/banner"; import { unstable_BlockerFunction as BlockerFunction, unstable_useBlocker as useBlocker, } from "react-router-dom"; +import { size } from "constants/tokens"; import { DistroQuery } from "gql/generated/types"; import { SaveModal } from "../../SaveModal"; import { WritableDistroSettingsTabs } from "../types"; @@ -20,14 +23,22 @@ export const UnsavedModal: React.FC = ({ return ( blocker.state === "blocked" && ( + Because you have modified the distro provider, your changes must be + saved before navigating to a new page. + + } distro={distro} open onCancel={() => blocker.reset?.()} onConfirm={() => blocker.proceed?.()} - setOpen={() => {}} tab={WritableDistroSettingsTabs.Provider} /> ) ); }; + +const StyledBanner = styled(Banner)` + margin-bottom: ${size.xs}; +`; From 8b9256e1bf3e089c16fd2a751629aa6888c8d590 Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Fri, 8 Sep 2023 12:28:06 -0400 Subject: [PATCH 3/6] Add tests --- .../integration/distroSettings/navigation.ts | 44 +++++++++++++++++++ .../tabs/ProviderTab/ProviderTab.tsx | 8 ++-- .../tabs/ProviderTab/UnsavedModal.tsx | 2 +- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/cypress/integration/distroSettings/navigation.ts b/cypress/integration/distroSettings/navigation.ts index a8b5a7ec3d..e0e5274080 100644 --- a/cypress/integration/distroSettings/navigation.ts +++ b/cypress/integration/distroSettings/navigation.ts @@ -12,4 +12,48 @@ describe("using the distro dropdown", () => { cy.location("pathname").should("not.contain", "localhost"); cy.location("pathname").should("contain", "rhel71-power8-large"); }); + + it("warns when navigating away from distro settings with unsaved changes and allows returning to distro settings", () => { + cy.getInputByLabel("Notes").type("my note"); + cy.dataCy("save-settings-button").should( + "not.have.attr", + "aria-disabled", + "true" + ); + cy.dataCy("project-health-link").click(); + cy.dataCy("navigation-warning-modal").should("be.visible"); + cy.contains("button", "Cancel").click(); + cy.dataCy("navigation-warning-modal").should("not.exist"); + cy.location("pathname").should("eq", "/distro/localhost/settings/general"); + }); + + describe("modifying the distro provider", () => { + beforeEach(() => { + cy.visit("/distro/localhost/settings/provider"); + }); + + it("warns when navigating to another distro settings tab after the provider has changed and allows save", () => { + cy.selectLGOption("Provider", "Docker"); + cy.dataCy("save-settings-button").should( + "not.have.attr", + "aria-disabled", + "true" + ); + cy.contains("a", "Task Settings").click(); + cy.dataCy("save-modal").should("be.visible"); + cy.dataCy("provider-warning-banner").should("be.visible"); + }); + + it("shows the standard save warning modal when non-provider fields have changed", () => { + cy.getInputByLabel("User Data").type("test user data"); + cy.dataCy("save-settings-button").should( + "not.have.attr", + "aria-disabled", + "true" + ); + cy.dataCy("project-health-link").click(); + cy.dataCy("navigation-warning-modal").should("be.visible"); + cy.dataCy("provider-warning-banner").should("not.exist"); + }); + }); }); diff --git a/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx b/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx index a6ba86af23..0ffcbff084 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx +++ b/src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx @@ -14,10 +14,10 @@ export const ProviderTab: React.FC = ({ distro, distroData }) => { return ( <> - + {/* Use conditional rendering instead of the shouldBlock prop so that modifying fields other than the provider triggers the standard navigation warning modal */} + {initialData?.provider !== formData?.provider?.providerName && ( + + )} ); diff --git a/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx b/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx index b24151cb8c..f2ddcf71ba 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx +++ b/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx @@ -24,7 +24,7 @@ export const UnsavedModal: React.FC = ({ blocker.state === "blocked" && ( + Because you have modified the distro provider, your changes must be saved before navigating to a new page. From c7d9322559a35de144761b27d263d14a305b3bed Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Fri, 15 Sep 2023 11:14:15 -0400 Subject: [PATCH 4/6] Address CR comments --- .../integration/distroSettings/navigation.ts | 73 ++++++++++--------- src/pages/distroSettings/SaveModal.tsx | 5 +- .../tabs/ProviderTab/UnsavedModal.tsx | 4 +- 3 files changed, 43 insertions(+), 39 deletions(-) diff --git a/cypress/integration/distroSettings/navigation.ts b/cypress/integration/distroSettings/navigation.ts index e0e5274080..5b0cf7e368 100644 --- a/cypress/integration/distroSettings/navigation.ts +++ b/cypress/integration/distroSettings/navigation.ts @@ -13,39 +13,9 @@ describe("using the distro dropdown", () => { cy.location("pathname").should("contain", "rhel71-power8-large"); }); - it("warns when navigating away from distro settings with unsaved changes and allows returning to distro settings", () => { - cy.getInputByLabel("Notes").type("my note"); - cy.dataCy("save-settings-button").should( - "not.have.attr", - "aria-disabled", - "true" - ); - cy.dataCy("project-health-link").click(); - cy.dataCy("navigation-warning-modal").should("be.visible"); - cy.contains("button", "Cancel").click(); - cy.dataCy("navigation-warning-modal").should("not.exist"); - cy.location("pathname").should("eq", "/distro/localhost/settings/general"); - }); - - describe("modifying the distro provider", () => { - beforeEach(() => { - cy.visit("/distro/localhost/settings/provider"); - }); - - it("warns when navigating to another distro settings tab after the provider has changed and allows save", () => { - cy.selectLGOption("Provider", "Docker"); - cy.dataCy("save-settings-button").should( - "not.have.attr", - "aria-disabled", - "true" - ); - cy.contains("a", "Task Settings").click(); - cy.dataCy("save-modal").should("be.visible"); - cy.dataCy("provider-warning-banner").should("be.visible"); - }); - - it("shows the standard save warning modal when non-provider fields have changed", () => { - cy.getInputByLabel("User Data").type("test user data"); + describe("warning modal", () => { + it("warns when navigating away from distro settings with unsaved changes and allows returning to distro settings", () => { + cy.getInputByLabel("Notes").type("my note"); cy.dataCy("save-settings-button").should( "not.have.attr", "aria-disabled", @@ -53,7 +23,42 @@ describe("using the distro dropdown", () => { ); cy.dataCy("project-health-link").click(); cy.dataCy("navigation-warning-modal").should("be.visible"); - cy.dataCy("provider-warning-banner").should("not.exist"); + cy.contains("button", "Cancel").click(); + cy.dataCy("navigation-warning-modal").should("not.exist"); + cy.location("pathname").should( + "eq", + "/distro/localhost/settings/general" + ); + }); + + describe("modifying the distro provider", () => { + beforeEach(() => { + cy.visit("/distro/localhost/settings/provider"); + }); + + it("warns when navigating to another distro settings tab after the provider has changed and allows save", () => { + cy.selectLGOption("Provider", "Docker"); + cy.dataCy("save-settings-button").should( + "not.have.attr", + "aria-disabled", + "true" + ); + cy.contains("a", "Task Settings").click(); + cy.dataCy("save-modal").should("be.visible"); + cy.dataCy("provider-warning-banner").should("be.visible"); + }); + + it("shows the standard save warning modal when non-provider fields have changed", () => { + cy.getInputByLabel("User Data").type("test user data"); + cy.dataCy("save-settings-button").should( + "not.have.attr", + "aria-disabled", + "true" + ); + cy.dataCy("project-health-link").click(); + cy.dataCy("navigation-warning-modal").should("be.visible"); + cy.dataCy("provider-warning-banner").should("not.exist"); + }); }); }); }); diff --git a/src/pages/distroSettings/SaveModal.tsx b/src/pages/distroSettings/SaveModal.tsx index ad93ba7a0c..0f7f8fe0c9 100644 --- a/src/pages/distroSettings/SaveModal.tsx +++ b/src/pages/distroSettings/SaveModal.tsx @@ -69,9 +69,8 @@ export const SaveModal: React.FC = ({ }); const handleSave = () => { - // Only perform the save operation is the tab is valid. - // eslint-disable-next-line no-prototype-builtins - if (formToGqlMap.hasOwnProperty(tab)) { + // Only perform the save operation if the tab is valid. + if (Object.prototype.hasOwnProperty.call(formToGqlMap, tab)) { const formToGql: FormToGqlFunction = formToGqlMap[tab]; const changes = formToGql(formData, distro); saveDistro({ diff --git a/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx b/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx index f2ddcf71ba..9116939822 100644 --- a/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx +++ b/src/pages/distroSettings/tabs/ProviderTab/UnsavedModal.tsx @@ -25,8 +25,8 @@ export const UnsavedModal: React.FC = ({ - Because you have modified the distro provider, your changes must be - saved before navigating to a new page. + Your distro provider changes must be saved or reverted before + navigating to a new page. } distro={distro} From cbddd28dc140a3b32266f8143d50edcb72c9c954 Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Fri, 15 Sep 2023 11:26:05 -0400 Subject: [PATCH 5/6] Don't use Object.prototype --- src/pages/distroSettings/SaveModal.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/distroSettings/SaveModal.tsx b/src/pages/distroSettings/SaveModal.tsx index 0f7f8fe0c9..661abf4f21 100644 --- a/src/pages/distroSettings/SaveModal.tsx +++ b/src/pages/distroSettings/SaveModal.tsx @@ -70,7 +70,8 @@ export const SaveModal: React.FC = ({ const handleSave = () => { // Only perform the save operation if the tab is valid. - if (Object.prototype.hasOwnProperty.call(formToGqlMap, tab)) { + // eslint-disable-next-line no-prototype-builtins + if (formToGqlMap.hasOwnProperty(tab)) { const formToGql: FormToGqlFunction = formToGqlMap[tab]; const changes = formToGql(formData, distro); saveDistro({ From 57686df0dd9b57cdc949153e0abb33702cfc509c Mon Sep 17 00:00:00 2001 From: Sophie Stadler Date: Fri, 15 Sep 2023 11:50:54 -0400 Subject: [PATCH 6/6] codegen --- src/gql/generated/types.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index 59f47f7dd8..a518e5d843 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -258,6 +258,19 @@ export enum CommunicationMethod { Ssh = "SSH", } +export type ContainerPool = { + __typename?: "ContainerPool"; + distro: Scalars["String"]["output"]; + id: Scalars["String"]["output"]; + maxContainers: Scalars["Int"]["output"]; + port: Scalars["Int"]["output"]; +}; + +export type ContainerPoolsConfig = { + __typename?: "ContainerPoolsConfig"; + pools: Array; +}; + export type ContainerResources = { __typename?: "ContainerResources"; cpu: Scalars["Int"]["output"]; @@ -2330,6 +2343,7 @@ export type SpruceConfig = { __typename?: "SpruceConfig"; banner?: Maybe; bannerTheme?: Maybe; + containerPools?: Maybe; githubOrgs: Array; jira?: Maybe; keys: Array;